Thursday, December 30, 2010

Setting runlevel at boot

Changing runlevel on a live system is fairly simple - as root simply type init 3 (or whatever runlevel you want).
However, what if you need to specify a runlevel at boot time? Imagine there is something wrong with your X configuration that is stopping you from being able to log in, how do you force the system to only boot into console mode?
  1. At boot time the system will tell you to hit any key to enter the menu, pressing a key will allow you to see the GRUB boot menu
  2. Find the appropriate boot line and press e to edit the boot options
  3. The second line looks something like kernel /vmlinuz-2.6.32-71.el6......., select it and press e to edit it
    1. At the end of the line, enter the number of the runlevel you wish to boot into and hit enter
  4. Press b to start booting
Thats all there is too it, the system will boot into the appropriate runlevel for this cycle. Rebooting will continue to operate the same as before.

NOTE: This can be very useful if you forget the root password. Simply boot into runlevel 1 and you are logged in as root without being prompted for a password.
Some people may see this as a security hole, but if you have physical access to any other system you can do the same. This process may have made it a little easier, but its not much harder under Windows

No comments: