My general stuff. This will generally include computer related information, but may also contain general rantings on my part.

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?

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

Find the appropriate boot line and press e to edit the boot options

The second line looks something like kernel /vmlinuz-2.6.32-71.el6......., select it and press e to edit it

At the end of the line, enter the number of the runlevel you wish to boot into and hit enter

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