|< Day Day Up >|
Recipe 7.2. Changing Runlevels After Bootup
Somewhere during the installation of your Linux system, you selected either "boot to text mode" or "boot to graphical mode." Maybe you didn't quite understand what these options meant—or maybe you did, but now you want a nice graphical interface instead of a boring text-only console. Or you're having problems with the graphical interface, and want to drop to a runlevel with minimal services for troubleshooting.
Use init. First, check what runlevel you are in:
# /sbin/runlevel N 5
The N means you have not previously booted to a different runlevel. If you had, the number of the runlevel would be displayed. You must be root to change the runlevel:
# /sbin/init 3
This will stop all runlevel 5 services, then start up the runlevel 3 services. It's like doing a partial reboot. All users will be logged out.
Sometimes you need to change to runlevel 1 to get out of trouble:
# /sbin/init 1
This stops X and drops you to a root shell, with limited services and no X. On Red Hat, you don't need to supply the root password after dropping to runlevel 1, so don't give any sudo users init access.
In Red Hat, Fedora, Mandrake, and Slackware, changing runlevels is one way to kill an X session, because runlevel 3 boots to a text console. However, it's rather drastic, as it stops and restarts all services and boots out all logged-in users.
Bad reasons include:
There are other, better ways to manage switching between X sessions and console sessions, as you'll see in Recipe 7.4, Recipe 7.4.
$ ls -al /sbin/telinit lrwxrwxrwx 1 root root 4 Oct 31 07:51 /sbin/telinit -> init
7.2.4 See Also
|< Day Day Up >|