Read Chapters 11, 12, 13, and 15 in LAH. Read 4, 5, and 6 in WS2k8.
Example dmesg outputs:
Linux version 2.4.21-37.EL (centos@sillage.bis.pasteur.fr) (gcc version 3.2.3 20030502 (Red Hat Linux 3.2.3-52)) #1 Wed Sep 28 14:14:23 EDT 2005 BIOS-provided physical RAM map: BIOS-e820: 0000000000000000 - 00000000000a0000 (usable) BIOS-e820: 00000000000f0000 - 0000000000100000 (reserved) BIOS-e820: 0000000000100000 - 000000001f771000 (usable) BIOS-e820: 000000001f771000 - 000000001f773000 (ACPI NVS)
BIOS-e820: 000000001f773000 - 000000001f794000 (ACPI data) BIOS-e820: 000000001f794000 - 000000001f800000 (reserved) BIOS-e820: 00000000fec00000 - 00000000fec10000 (reserved) BIOS-e820: 00000000fee00000 - 00000000fee10000 (reserved) BIOS-e820: 00000000ffb00000 - 0000000100000000 (reserved) 0MB HIGHMEM available. 503MB LOWMEM available. [ ... ] Kernel command line: ro root=LABEL=/ Initializing CPU#0
Detected 2399.594 MHz processor. Console: colour VGA+ 80x25 Calibrating delay loop... 4784.12 BogoMIPS [ ... ] Memory: 500836k/515524k available (1545k kernel code, 12128k reserved, 1073k data, 164k init, 0k highmem) [ ... ] CPU: Trace cache: 12K uops, L1 D cache: 8K CPU: L2 cache: 512K
Intel machine check architecture supported. Intel machine check reporting enabled on CPU#0. CPU: After generic, caps: bfebfbff 00000000 00000000 00000000 CPU: Common caps: bfebfbff 00000000 00000000 00000000 CPU: Intel(R) Pentium(R) 4 CPU 2.40GHz stepping 07 [ ... ] Linux NET4.0 for Linux 2.4 [ ... ]
hda: WDC WD800BB-75CAA0, ATA DISK drive blk: queue c041c900, I/O limit 4095Mb (mask 0xffffffff) hdc: LG CD-ROM CRN-8245B, ATAPI CD/DVD-ROM drive ide0 at 0x1f0-0x1f7,0x3f6 on irq 14 ide1 at 0x170-0x177,0x376 on irq 15 hda: attached ide-disk driver. hda: host protected area => 1 hda: setmax LBA 156301488, native 156250000
hda: 156250000 sectors (80000 MB) w/2048KiB Cache, CHS=9726/255/63, UDMA(100) ide-floppy driver 0.99.newide Partition check: hda: hda1 hda2 hda3 ide-floppy driver 0.99.newide
[ ... ] EXT3-fs: mounted filesystem with ordered data mode. Freeing unused kernel memory: 164k freed [ ... ] EXT3 FS 2.4-0.9.19, 19 August 2002 on ide0(3,2), internal journal Adding Swap: 1044216k swap-space (priority -1)
kjournald starting. Commit interval 5 seconds EXT3 FS 2.4-0.9.19, 19 August 2002 on ide0(3,1), internal journal EXT3-fs: mounted filesystem with ordered data mode. [ ... ]
[ 0.000000] Initializing cgroup subsys cpuset [ 0.000000] Initializing cgroup subsys cpu [ 0.000000] Linux version 2.6.40.4-5.fc15.x86_64 (mockbuild@x86-10.phx2.fedoraproject.org) (gcc version 4.6.0 20110603 (Red Hat 4.6.0-10) (GCC) ) #1 SMP Tue Aug 30 14:38:32 UTC 2011 [ 0.000000] Command line: ro root=UUID=a34a9b1e-82f6-4d91-a407-f5a769ed09b8 rd_NO_LUKS rd_NO_LVM rd_NO_MD rd_NO_DM LANG=en_US.UTF-8 SYSFONT=latarcyrheb-sun16 KEYTABLE=us rhgb quiet [ 0.000000] BIOS-provided physical RAM map: [ 0.000000] BIOS-e820: 0000000000000000 - 000000000009f000 (usable) [ 0.000000] BIOS-e820: 000000000009f000 - 00000000000a0000 (reserved) [ 0.000000] BIOS-e820: 00000000000f0000 - 0000000000100000 (reserved) [ 0.000000] BIOS-e820: 0000000000100000 - 000000007fed0000 (usable) [ 0.000000] BIOS-e820: 000000007fed0000 - 000000007fed3000 (ACPI NVS) [ 0.000000] BIOS-e820: 000000007fed3000 - 000000007fee0000 (ACPI data) [ 0.000000] BIOS-e820: 000000007fee0000 - 000000007ff00000 (reserved) [ 0.000000] BIOS-e820: 00000000f0000000 - 00000000f4000000 (reserved) [ 0.000000] BIOS-e820: 00000000fec00000 - 0000000100000000 (reserved) [ 0.000000] NX (Execute Disable) protection: active [ 0.000000] DMI 2.4 present. [ 0.000000] DMI: Dell Inc OptiPlex 740/0TT708, BIOS 1.1.8 06/08/2007
[ 0.000000] Memory: 2037512k/2095936k available (4680k kernel code, 452k absent, 57972k reserved, 6905k data, 936k init) [ 0.000000] SLUB: Genslabs=15, HWalign=64, Order=0-3, MinObjects=0, CPUs=2, Nodes=1 [ 0.000000] Hierarchical RCU implementation. [ 0.000000] RCU dyntick-idle grace-period acceleration is enabled. [ 0.000000] NR_IRQS:16640 nr_irqs:512 16 [ 0.000000] spurious 8259A interrupt: IRQ7. [ 0.000000] Console: colour VGA+ 80x25 [ 0.000000] console [tty0] enabled [ 0.000000] allocated 16777216 bytes of page_cgroup [ 0.000000] please try 'cgroup_disable=memory' option if you don't want memory cgroups [ 0.000000] hpet clockevent registered [ 0.000000] Fast TSC calibration using PIT [ 0.000000] Detected 2605.321 MHz processor. [ 0.000000] Marking TSC unstable due to TSCs unsynchronized [ 0.001007] Calibrating delay loop (skipped), value calculated using timer frequency.. 5210.64 BogoMIPS (lpj=2605321) [ 0.001012] pid_max: default: 32768 minimum: 301 [ 0.001043] Security Framework initialized [ 0.001062] SELinux: Initializing. [ 0.001071] SELinux: Starting in permissive mode
[ 0.001383] Dentry cache hash table entries: 262144 (order: 9, 2097152 bytes) [ 0.002806] Inode-cache hash table entries: 131072 (order: 8, 1048576 bytes) [ 0.003288] Mount-cache hash table entries: 256 [ 0.003474] Initializing cgroup subsys cpuacct [ 0.003480] Initializing cgroup subsys memory [ 0.003498] Initializing cgroup subsys devices [ 0.003501] Initializing cgroup subsys freezer [ 0.003503] Initializing cgroup subsys net_cls [ 0.003506] Initializing cgroup subsys blkio [ 0.003516] Initializing cgroup subsys perf_event [ 0.003552] tseg: 007ff00000 [ 0.003555] CPU: Physical Processor ID: 0 [ 0.003557] CPU: Processor Core ID: 0 [ 0.003559] mce: CPU supports 5 MCE banks [ 0.003573] using AMD E400 aware idle routine [ 0.003913] ACPI: Core revision 20110413 [ 0.008011] ftrace: allocating 24446 entries in 96 pages [ 0.009647] ..TIMER: vector=0x30 apic1=0 pin1=2 apic2=-1 pin2=-1 [ 0.019888] CPU0: AMD Athlon(tm) 64 X2 Dual Core Processor 5000+ stepping 02 [ 0.019998] Performance Events: AMD PMU driver. [ 0.019998] ... version: 0 [ 0.019998] ... bit width: 48 [ 0.019998] ... generic registers: 4 [ 0.019998] ... value mask: 0000ffffffffffff [ 0.019998] ... max period: 00007fffffffffff [ 0.019998] ... fixed-purpose events: 0 [ 0.019998] ... event mask: 000000000000000f
[ 0.251377] Trying to unpack rootfs image as initramfs... [ 0.602091] Freeing initrd memory: 14776k freed [ 0.611303] Simple Boot Flag at 0x3a set to 0x80 [ 0.611741] Intel AES-NI instructions are not detected. [ 0.611954] audit: initializing netlink socket (disabled) [ 0.611970] type=2000 audit(1315925247.610:1): initialized [ 0.639163] HugeTLB registered 2 MB page size, pre-allocated 0 pages [ 0.655096] VFS: Disk quotas dquot_6.5.2 [ 0.655152] Dquot-cache hash table entries: 512 (order 0, 4096 bytes) [ 0.655753] msgmni has been set to 4008 [ 0.655828] SELinux: Registering netfilter hooks [ 0.656341] alg: No test for stdrng (krng) [ 0.656352] NET: Registered protocol family 38 [ 0.656415] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 253)
[ 1.023889] device-mapper: uevent: version 1.0.3 [ 1.023976] device-mapper: ioctl: 4.20.0-ioctl (2011-02-02) initialised: dm-devel@redhat.com [ 1.024056] cpuidle: using governor ladder [ 1.024059] cpuidle: using governor menu [ 1.024497] EFI Variables Facility v0.08 2004-May-17 [ 1.024683] usbcore: registered new interface driver usbhid [ 1.024685] usbhid: USB HID core driver [ 1.024770] ip_tables: (C) 2000-2006 Netfilter Core Team [ 1.024786] TCP cubic registered [ 1.024788] Initializing XFRM netlink socket [ 1.024800] NET: Registered protocol family 17 [ 1.024820] Registering the dns_resolver key type [ 1.024940] PM: Hibernation image not present or could not be loaded. [ 1.024959] registered taskstats version 1 [ 1.031818] IMA: No TPM chip found, activating TPM-bypass! [ 1.032171] Magic number: 11:714:788 [ 1.032273] rtc_cmos 00:04: setting system clock to 2011-09-13 14:47:28 UTC (1315925248) [ 1.032316] Initializing network drop monitor service [ 1.034569] Freeing unused kernel memory: 936k freed [ 1.035030] Write protecting the kernel read-only data: 10240k [ 1.041589] Freeing unused kernel memory: 1444k freed [ 1.049947] Freeing unused kernel memory: 1688k freed
[ 1.090909] dracut: dracut-009-12.fc15 [ 1.100001] dracut: rd.luks=0: removing cryptoluks activation [ 1.102866] dracut: rd.lvm=0: removing LVM activation [ 1.109223] udev[128]: starting version 167 [ 1.144994] [drm] Initialized drm 1.1.0 20060810 [ 1.163906] [drm] radeon defaulting to kernel modesetting. [ 1.163910] [drm] radeon kernel modesetting enabled. [ 1.165250] ACPI: PCI Interrupt Link [APC5] enabled at IRQ 16 [ 1.165277] radeon 0000:03:00.0: PCI INT A -> Link[APC5] -> GSI 16 (level, low) -> IRQ 16 [ 1.165283] radeon 0000:03:00.0: setting latency timer to 64 [ 1.165543] [drm] initializing kernel modesetting (RV515 0x1002:0x7183 0x1028:0x0D02). [ 1.165564] [drm] register mmio base: 0xFDDF0000 [ 1.165566] [drm] register mmio size: 65536 [ 1.167721] ATOM BIOS: RV516 [ 1.167744] [drm] Generation 2 PCI interface, using max accessible memory [ 1.167750] radeon 0000:03:00.0: VRAM: 256M 0x0000000000000000 - 0x000000000FFFFFFF (256M used) [ 1.167753] radeon 0000:03:00.0: GTT: 512M 0x0000000010000000 - 0x000000002FFFFFFF
Linux provides a flexible multi-operating system boot loader named grub (GRand Unified Bootloader) that can be used to boot different operating systems. Like Windows bootloaders, it can also sit on the Master Boot Record (MBR) of the boot device and transfer control to specific operating system kernels depending on either a user type-in or a default. Grub's behavior is controlled by /boot/grub/grub.conf.
Previously, there was lilo, which is still seen occasionally, and even older, the loadlin program which used DOS to boot Linux.
Here's a grub configuration file on a Fedora 11 machine with a choice of three different kernels:
# grub.conf generated by anaconda # # Note that you do not have to rerun grub after making changes to this file # NOTICE: You have a /boot partition. This means that # all kernel and initrd paths are relative to /boot/, eg. # root (hd0,0) # kernel /vmlinuz-version ro root=/dev/mapper/luks-67331215-2e69-4e48-85b6-f9600f5aaa7c # initrd /initrd-version.img #boot=/dev/sda default=0 timeout=0 splashimage=(hd0,0)/grub/splash.xpm.gz hiddenmenu # title Fedora (2.6.30.5-43.fc11.x86_64) root (hd0,0) kernel /vmlinuz-2.6.30.5-43.fc11.x86_64 ro root=/dev/mapper/luks-67331215-2e69-4e48-85b6-f9600f5aaa7c rhgb quiet initrd /initrd-2.6.30.5-43.fc11.x86_64.img # title Fedora (2.6.29.6-217.2.16.fc11.x86_64) root (hd0,0) kernel /vmlinuz-2.6.29.6-217.2.16.fc11.x86_64 ro root=/dev/mapper/luks-67331215-2e69-4e48-85b6-f9600f5aaa7c rhgb quiet initrd /initrd-2.6.29.6-217.2.16.fc11.x86_64.img # title Fedora (2.6.29.6-217.2.8.fc11.x86_64) root (hd0,0) kernel /vmlinuz-2.6.29.6-217.2.8.fc11.x86_64 ro root=/dev/mapper/luks-67331215-2e69-4e48-85b6-f9600f5aaa7c rhgb quiet initrd /initrd-2.6.29.6-217.2.8.fc11.x86_64.img
Here's a grub configuration file from a Debian Squeeze machine with two boot-up choices:
# # DO NOT EDIT THIS FILE # # It is automatically generated by grub-mkconfig using templates # from /etc/grub.d and settings from /etc/default/grub # ### BEGIN /etc/grub.d/00_header ### if [ -s $prefix/grubenv ]; then load_env fi set default="0" if [ "${prev_saved_entry}" ]; then set saved_entry="${prev_saved_entry}" save_env saved_entry set prev_saved_entry= save_env prev_saved_entry set boot_once=true fi function savedefault { if [ -z "${boot_once}" ]; then saved_entry="${chosen}" save_env saved_entry fi } function load_video { insmod vbe insmod vga insmod video_bochs insmod video_cirrus } insmod part_msdos insmod ext2 set root='(hd0,msdos1)' search --no-floppy --fs-uuid --set bb37e57f-0535-4a67-8f1d-f11cdd6098f3 if loadfont /usr/share/grub/unicode.pf2 ; then set gfxmode=640x480 load_video insmod gfxterm fi terminal_output gfxterm insmod part_msdos insmod ext2 set root='(hd0,msdos1)' search --no-floppy --fs-uuid --set bb37e57f-0535-4a67-8f1d-f11cdd6098f3 set locale_dir=($root)/boot/grub/locale set lang=en insmod gettext set timeout=5 ### END /etc/grub.d/00_header ### ### BEGIN /etc/grub.d/05_debian_theme ### set menu_color_normal=cyan/blue set menu_color_highlight=white/blue ### END /etc/grub.d/05_debian_theme ### ### BEGIN /etc/grub.d/10_linux ### menuentry 'Debian GNU/Linux, with Linux 2.6.32-5-amd64' --class debian --class gnu-linux --class gnu --class os { insmod part_msdos insmod ext2 set root='(hd0,msdos1)' search --no-floppy --fs-uuid --set bb37e57f-0535-4a67-8f1d-f11cdd6098f3 echo 'Loading Linux 2.6.32-5-amd64 ...' linux /boot/vmlinuz-2.6.32-5-amd64 root=UUID=bb37e57f-0535-4a67-8f1d-f11cdd6098f3 ro quiet echo 'Loading initial ramdisk ...' initrd /boot/initrd.img-2.6.32-5-amd64 } menuentry 'Debian GNU/Linux, with Linux 2.6.32-5-amd64 (recovery mode)' --class debian --class gnu-linux --class gnu --class os { insmod part_msdos insmod ext2 set root='(hd0,msdos1)' search --no-floppy --fs-uuid --set bb37e57f-0535-4a67-8f1d-f11cdd6098f3 echo 'Loading Linux 2.6.32-5-amd64 ...' linux /boot/vmlinuz-2.6.32-5-amd64 root=UUID=bb37e57f-0535-4a67-8f1d-f11cdd6098f3 ro single echo 'Loading initial ramdisk ...' initrd /boot/initrd.img-2.6.32-5-amd64 } ### END /etc/grub.d/10_linux ### ### BEGIN /etc/grub.d/20_linux_xen ### ### END /etc/grub.d/20_linux_xen ### ### BEGIN /etc/grub.d/30_os-prober ### ### END /etc/grub.d/30_os-prober ### ### BEGIN /etc/grub.d/40_custom ### # This file provides an easy way to add custom menu entries. Simply type the # menu entries you want to add after this comment. Be careful not to change # the 'exec tail' line above. ### END /etc/grub.d/40_custom ### ### BEGIN /etc/grub.d/41_custom ### if [ -f $prefix/custom.cfg ]; then source $prefix/custom.cfg; fi ### END /etc/grub.d/41_custom ###
# inittab is no longer used when using systemd. # # ADDING CONFIGURATION HERE WILL HAVE NO EFFECT ON YOUR SYSTEM. # # Ctrl-Alt-Delete is handled by /etc/systemd/system/ctrl-alt-del.target # # systemd uses 'targets' instead of runlevels. By default, there are two main targets: # # multi-user.target: analogous to runlevel 3 # graphical.target: analogous to runlevel 5 # # To set a default target, run: # # ln -s /lib/systemd/system/.target /etc/systemd/system/default.target #
The idea for init is that soft-links that start with a capital ``S'' are executed at startup; soft-links with a leading capital ``K'' are executed at shutdown (you can see this behavior in /sbin/rc2 on Solaris and /etc/rc.d/rc on RedHat).
The Linux init package usually includes a utility named runlevel that you can run to determine the current machine's run level.
CentOS 3.6 Linux /etc/inittab
# # inittab This file describes how the INIT process # should set up # the system in a certain run-level. # # Author: Miquel van Smoorenburg, ## Modified for RHS Linux by Marc Ewing and # Donnie Barnes # # Default runlevel. The runlevels used by RHS are: # 0 - halt (Do NOT set initdefault to this) # 1 - Single user mode # 2 - Multiuser, without NFS (The same as 3, if you do not have networking) # 3 - Full multiuser mode # 4 - unused # 5 - X11 # 6 - reboot (Do NOT set initdefault to this) # id:5:initdefault: # System initialization. si::sysinit:/etc/rc.d/rc.sysinit l0:0:wait:/etc/rc.d/rc 0 l1:1:wait:/etc/rc.d/rc 1 l2:2:wait:/etc/rc.d/rc 2 l3:3:wait:/etc/rc.d/rc 3 l4:4:wait:/etc/rc.d/rc 4 l5:5:wait:/etc/rc.d/rc 5 l6:6:wait:/etc/rc.d/rc 6 # Trap CTRL-ALT-DELETE ca::ctrlaltdel:/sbin/shutdown -t3 -r now # When our UPS tells us power has failed, assume we have a few minutes # of power left. Schedule a shutdown for 2 minutes from now. # This does, of course, assume you have powerd installed and your # UPS connected and working correctly. pf::powerfail:/sbin/shutdown -f -h +2 "Power Failure; System Shutting Down" # If power was restored before the shutdown kicked in, cancel it. pr:12345:powerokwait:/sbin/shutdown -c "Power Restored; Shutdown Cancelled" # Run gettys in standard runlevels 1:2345:respawn:/sbin/mingetty tty1 2:2345:respawn:/sbin/mingetty tty2 3:2345:respawn:/sbin/mingetty tty3 4:2345:respawn:/sbin/mingetty tty4 5:2345:respawn:/sbin/mingetty tty5 6:2345:respawn:/sbin/mingetty tty6 # Run xdm in runlevel 5 x:5:respawn:/etc/X11/prefdm -nodaemon
Solaris 9 /etc/inittab
ap::sysinit:/sbin/autopush -f /etc/iu.ap ap::sysinit:/sbin/soconfig -f /etc/sock2path fs::sysinit:/sbin/rcS sysinit >/dev/msglog 2<>/dev/msglog /dev/msglog 2<>/dev/msglog sS:s:wait:/sbin/rcS >/dev/msglog 2<>/dev/msglog /dev/msglog 2<>/dev/msglog /dev/msglog 2<>/dev/msglog /dev/msglog 2<>/dev/msglog /dev/msglog 2<>/dev/msglog /dev/msglog 2<>/dev/msglog /dev/msglog 2<>/dev/msglog /dev/msglog 2<>/dev/msglog /dev/msglog 2<>/dev/msglog /dev/msglog 2<>/dev/msglog
Notice the location of the actual init shell scripts can vary (/etc, /etc/rc.d, etc.), even between different versions of UNIX. For instance, Solaris: /etc/rc?.d (/etc/rc2.d is typical), CentOS Linux: /etc/rc.d
On some systems, you can use chkconfig to control the maze of links.
# chkconfig --list # show what is on and what is off for runlevels anacron 0:off 1:off 2:on 3:on 4:on 5:on 6:off atd 0:off 1:off 2:off 3:on 4:on 5:on 6:off atieventsd 0:off 1:off 2:off 3:off 4:off 5:on 6:off auditd 0:off 1:off 2:on 3:on 4:on 5:on 6:off autofs 0:off 1:off 2:off 3:on 4:on 5:on 6:off # chkconfig --level 2345 sendmail on # have sendmail start 2345 # chkconfig --del sendmail # remove sendmail from chkconfig management # chkconfig --add sendmail # add sendmail to chkconfig management
Beware that many versions of UNIX/Linux choose to use symbolic links between a common script directory and the particular runlevel directory. Treat any modifications to the startup shell scripts as you would any other program -- edit, test (reboot), document, debug until it works.
In a major site, you may find that weekly reboots at an off time (such as early on Sunday morning) are automatically done to discover any bad interactions among boot modifications that might have been made recently.
[boot loader] timeout=30 default=multi(0)disk(0)rdisk(0)partition(1)\WINDOWS [operating systems] multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows .NET Standard Server" /fastdetect
Notice the ``boot loader'' stanza used to specify the loader behavior and give the default operating system while the ``operating systems'' stanza gives the choices for operating system. To boot Win2K3 or XP, for example, you could use:
[boot loader] timeout=30 default=multi(0)disk(0)rdisk(0)partition(1)\WINDOWS [operating systems] multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows .NET Standard Server" /fastdetect multi(0)disk(1)rdisk(0)partition(2)\WINDOWS="Microsoft Windows XP Professional" /sos
You can place many options such as /sos in the boot.ini file (sos means display device driver names as they load).
Here is a quick list of the ones for 2003 (from http://support.microsoft.com/kb/833721)
In Windows 2008, Microsoft eliminated the boot.ini file. Now only ``magic'' commands will let you modify boot parameters. Microsoft's bcdedit.exe or EasyBCD will let you do things such as set up multi-boot.
Look at for a short summary of the boot sequence for W2k8, Vista, and Windows 7.
What is the BCD store?
The Boot Configuration Data (BCD) store contains boot configuration parameters and controls how the operating system is started in Microsoft® Windows Vista® and Microsoft® Windows Server® 2008 operating systems. These parameters were previously in the Boot.ini file (in BIOS-based operating systems) or in the nonvolatile RAM (NVRAM) entries (in Extensible Firmware Interface–based operating systems). You can use the Bcdedit.exe command-line tool to affect the Windows® code which runs in the pre-operating system environment by adding, deleting, editing, and appending entries in the BCD store. Bcdedit.exe is located in the WindowsSystem32 directory of the Windows Vista partition.
[From http://technet.microsoft.com/en-us/library/cc721886.aspx]
Since the boot loading process is reasonably common to various platforms, many boot loaders can handle different operating systems. You can, for instance, use grub to boot up Linux, Win2K, WinXP (and occasionally Vista, though by default Vista is not going to like a non-Windows MBR), and so forth; you can also use some third-party software, such as Neosmart EasyBCD. (The last works particularly well with Vista and Linux dual-booting.)
None of these are perfect. So far, Neosmart EasyBCD seems to be a good choice, but who knows what will break next!?