Previous Section  < Day Day Up >  Next Section

Recipe 7.4. Starting and Stopping X

7.4.1 Problem

You don't like the idea of changing runlevels just to kill an X session. After all, it means restarting all services, and it will mess up any users who are logged in. What's a better way to stop an X session?

7.4.2 Solution

There are several choices. The best way is to configure one runlevel to boot to a text console. Then start X when you want it with the startx command:

$ startx

Then you can exit X simply by logging out of the X session. You won't be logged out of Linux, just X.

On most distributions, runlevel 3 boots to a text console. On Red Hat, Fedora, Mandrake, and SuSE, runlevel 5 is a graphical login manager. On Slackware, this is runlevel 4.

Debian users may have to take some extra steps, as Debian's default 2-5 runlevels are all the same. See Recipe Recipe 7.6 to learn how to customize Debian's runlevels.

7.4.3 Discussion

There are other ways to stop an X session. These are better suited for when X locks up.

Any user can use "xkill", by typing Ctrl-Alt-Backspace.

If you're running a graphical login manager (xdm, kdm, or gdm), root can stop the login manager. This also logs out users:

# /etc/init.d/gdm stop

7.4.4 See Also

    Previous Section  < Day Day Up >  Next Section