Friday, June 5, 2009

Restart X Windows in Linux

In Linux,there are a number of different graphical environments (GNOME, KDE, Xfce, Fluxbox), but all of these run on top of the X Windows System, also known as X and X11. One of the great things about running Linux is that it is very stable, making reboots rarely necessary. Individual applications and services can be killed or restarted as necessary for configuration changes or if there is a problem.

Much like any other service, the X Window System is capable of freezing. This is annoying. However, forcing a hard reboot of the system is rarely necessary. Most Linux distros include a convenient keyboard shortcut for restarting X when this happens...or if you have to restart X for another reason. On your keyboard simply press:
This will immediately kill the graphical window environment and you will likely see some next on the screen. Give it a few seconds, as X restarts, and you will be presented with the standard graphical login screen. Now just log back in and go back to what you were doing.

In the latest version of Ubuntu, Jaunty Jackalope, this shortcut is disabled by default. This should also work for other distributions where is shortcut is not enabled. To enable it, first make a backup copy of your X config file:
sudo cp /etc/X11/xorg.conf /etc/X11/xorg.conf.orig
Now open that file with a text editor, keep in mind that you will need administrator privlidges to do so. I usually do it like this:
sudo gedit /etc/X11/xorg.conf &
In my Jaunty installation, I had to add this next section:
Section "ServerFlags"
Option "DontZap" "false"
If the section is absent for you, add it. If yours is present but instead says "yes" rather than "false" then change it. You will need to restart X before this change takes effect. The easiest way to do this is to log out and back in. Or you could reboot.

No comments:

Post a Comment