The X server on Linux provides your graphical desktop. If it crashes, you’ll lose all unsaved work in graphical programs, but you can recover from the crash and restart the X server without restarting your computer.
X server crashes can be caused by bugs with graphics drivers — the proprietary AMD or NVIDIA graphics drivers, for example — hardware problems, or other software bugs.
Image Credit: Francois Schnell on Flickr
The Ctrl+Alt+Backspace keyboard shortcut traditionally restarted the X server on Linux. However, after complaints — particularly from new Linux users that accidentally hit this key combination and lost all their work — this shortcut was disabled by default. To enable it on Ubuntu, Fedora, or any other distribution using a GNOME-based desktop, you can use the Keyboard Layout utility.
Click the Options button and enable the Control + Alt + Backspace check box under Key sequence to kill the X server.
After it’s enabled, you can press Ctrl+Alt+Backspace to immediately restart your X server. However, this shortcut is implemented by the X server and may not work if X hangs in some ways.
Switch Virtual Consoles
You can use the Ctrl+Alt+F1 keyboard shortcut (and other F-key keyboard shortcuts) to switch to a different virtual console from your X server. (Ctrl+Alt+F7 usually takes you back to X — the exact F key depends on your Linux distribution.)
Once you have, you can log into the virtual console and run the appropriate command to restart your X server. The command you’ll need depends on the display manager you’re using. On Ubuntu, which uses the LightDM display manager, you’d use the following command:
sudo service lightdm restart
SSH Into Computer
If you can’t kill the X server locally, you can kill it over the network. Assuming you have an SSH server set up and running on your Linux system, you can log in from another computer and run the appropriate command to restart the X server. Just sign in via SSH to access a remote console and use the appropriate command to restart your display manager — on Ubuntu, it’s the sudo service lightdm restart command above.
Use the Magic SysRq Key
We’ve covered using the magic SysRq key in the past — the SysRq is is generally the same as the Print Screen key. Assuming you want to kill the X server locally — not over the network — your system may not be responding to key presses, including the Ctrl+Alt+F1 keyboard shortcut. This can occur because the X server has taken control of the keyboard. To take control away from the X server, use the following key combination:
After you have, you can try pressing Ctrl+Alt+F1 to access a virtual console. You can also use the Alt+SysRq+k combination, which kills all programs on your current virtual console, including your X server.
If you want to restart your computer, you can also use the magic SysRq key to cleanly restart your system — see our full post on the magic SysRq key for more information.
- › Use These Tools To Change Settings Removed From Ubuntu and GNOME
- › Remembering VRML: The Metaverse of 1995
- › 6 Tips for Making Microsoft Excel Charts That Stand Out
- › How to Clean Your iPhone’s Charging Port
- › What Does “BB” Mean, and How Do I Use It?
- › Stop Shutting Down Your Windows PC
- › How to Add More Ethernet Ports to Your Router