Fixing Boot Problems Using Runlevels

We discussed runlevels earlier in this chapter, and if you have a corrupt system, or a runaway process that is loaded in the init process, one way to fix this is to force the system into a specific runlevel to stop that process from running. This is achieved by passing the runlevel number to the boot loader at boot time. Both LILO and GRUB are capable of passing parameters to the kernel before it is loaded, which is a feature that every Linux user should know how to use.

The kernel is able to take parameters in the same way that a normal application or program can once Linux is loaded. To do this, the kernel must know this information before it is loaded and executed so that it can make changes based on what you need to do. The kernel itself does not deal with what runlevel the system boots up in. This is determined by the init process, as defined in the /etc/inittab file by default, but it can be overridden from the boot manager. Any parameter you pass to the kernel that it does not understand will be passed on to the first program that the kernel calls after it has finished initializing. In the case of Linux, this is the i nit process. If you remember, you change a runlevel by using the i nit process with the runlevel as a parameter. If you add the runlevel number to the kernel command line before booting, this number is sent to the init process, which therefore boots the system into the specified runlevel.

To pass an i nit parameter to LILO, you can specify linux 1 on the LILO prompt to load up the boot profile called Linux.

In GRUB, you do this by selecting the profile you would like to edit and entering the number of the runlevel into which you want to enter at boot-up in the Boot Options field (see Figure 4-5).

Was this article helpful?

0 0

Post a comment