2. Extracting Information about the
Boot Process
● To view information logged by the Linux kernel
and modules stored in the kernel ring buffer.
● dmesg
● dmesg | less
● dmesg > boot.messages
● cat /var/log/dmesg
● system logger ( syslogd )
3. Locating & Interpreting Boot
Messages
● Use less and Its search functions
● Look for Hardware type names (SCSI/USB etc)
● Look for Hardware Chipset names
● Study the output from a working System
4. The Boot Process
Going to the nitty gritty details of the boot process is complex.
Below is a high-level view of the boot process.
● Power the machine & CPU runs the firmware.
●
The firmware performs some tasks.
●
Boot-loader takes over from the firmware & loads a kernel.
●
Linux kernel takes over,initializing devices, mounting the root
partition & executes /sbin/init
●
The initial program gets the process ID (PID) of 1. Commonly,
/sbin/init reads the /etc/inittab
http://www.linuxdevcenter.com/pub/a/linux/excerpts/linux_kernel/ho
w_computer_boots.html
5. Dealing with Runlevels and the
Initialization Process
● Linux relies on runlevels (0-6) to determine what features are available.
● 0 - A transitional runlevel, on/off (shuts down).
● 1,s, or S - Single-user mode. Used for low-level system maintenance
● 2 - On Debian and its derivatives, a full multi-user mode with X.
Undefined in others.
● 3 – In most distributions, a full multi-user mode with a console.
● 4 - Usually undefined by default and therefore available for
customization.
● 5 – In most distributions, the same behavior as runlevel 3 with the
addition of having X.
● 6 - Also a transitional runlevel. Used to reboot the system.
6. Identifying the Services in a Runlevel
● There are two main ways to affect what
programs run when you enter a new SysV
runlevel.
1) add or delete entries in your /etc/inittab file
2) the SysV Startup Scripts
Distributions based on Upstart and systemd often
provide startup scripts that are named and work
much like on SysV-based computers; however, whe
the computer boots, it may use other startup
methods, as described later, in “Using Alternative
Boot Systems.”
8. Checking Your Runlevel
1) Checking and changingyour default runlevel.
# grep :initdefault: /etc/inittab
Edit the initdefault line in /etc/inittab & change
the runlevel field to the value you want.
2) Determining Your Current Runlevel : # runlevel
The fi rst character is the previous runlevel.
When the character is N , this means the
system hasn’t switched runlevels since booting.
9. Changing Runlevels on a Running
System
● Changing Runlevels with init or telinit
The init process is the fi rst process run by the
Linux kernel, but you can also use it to have the
system reread the /etc/inittab fi le and
implement changes it fi nds there or to
changeto a new runlevel.
● # init 1 - reserved for single-user mode
● # init 6 - reboot the system
10. A variant of init is telinit
● This program can take a runlevel number just like init to
change to that runlevel.
● It can also take the Q or q option to have the tool reread
/etc/inittab and implement any changes it finds there.
● Thus, if you’ve made a change to the runlevel in
/etc/inittab, you can immediately implement that change by
typing telinit q .
● The Upstart and systemd tools provide init and telinit
commands that work much as they do on SysV-based
computers.
11. Changing Runlevels with shutdown
● shutdown is invoked with a time:
# shutdown now
● The now parameter causes the change to occur
immediately. Other possible time formats include hh:mm ,
for a time in 24-hour format.
● -r reboots, -H halts, -P powers it off
● shutdown -r +10 to reboot the system in 10 min
● shutdown -h +15 “system going down for maintenance”
● shutdown -c “never mind” -c option to cancel it.
12. halt, reboot, and powerof
Three additional shortcut commands are halt ,
reboot , and poweroff .
In reality, reboot and poweroff are usually symbolic
links to halt . This command behaves differently
depending on the name with which it’s called.
As you might expect, these commands halt the
system (shut it down without powering it off), reboot
it, or shut it down and (on hardware that supports
this feature) turn off the power, respectively.