While Linux has a reputation for being stable, able to keep chugging along for years, there are times when the desktop will just freeze and stop responding to input. One of the most common solutions to fix a frozen desktop is to restart the PC. An easier way is to just restart the desktop.
Let’s see how to do this on three of the most popular desktop environments: Gnome, KDE, and XFCE. We will be using Ubuntu (Kubuntu/Xubuntu) for this illustration.
Restart Gnome in Ubuntu
If your desktop can still respond to your keyboard, press Alt + F2, type the single letter r on the pop-up window, and press Enter.
This will restart your desktop environment without much fuss. If your desktop doesn’t respond to your input, though, you will have to take more drastic measures.
Press Ctrl + Alt + F3 to access the first terminal outside of your desktop environment.
Enter the following command to restart the Gnome desktop environment:
gnome-shell --replace
Press Ctrl + Alt + F2 to move back to the desktop and, if everything goes according to the plan, a refreshed version of your desktop will be waiting for you.
If that doesn’t work, you can try restarting the display manager. Since the display manager is the “base” on which the desktop environment runs, by restarting it, you also end up reloading the desktop environment. To do that, go back to the terminal and enter the following:
sudo systemctl restart gdm
Note that this fully reloads the desktop environment, so you will have to log in again from scratch.
Restart KDE in Kubuntu
Restarting the KDE desktop environment follows the same approach as Gnome, but there are small differences in the individual steps you will have to take.
For starters, and at least in Kubuntu, the first available terminal outside your desktop environment is tty2, so you will have to use the Ctrl + Alt + F2 combination to get there.
In the latest versions of KDE, the proper way to restart the desktop from the terminal is:
kquitapp5 plasmashell && kstart5 plasmashell
If that doesn’t work, you can also try:
pkill -ABRT plasmashell
If that fails as well, it’s worth trying to restart the display manager itself as a last option before rebooting your whole PC. Try it out with:
pkill -ABRT kwin_x11
Note, though, that this forced-restart of the desktop environment may also lead to the appearance of some error messages.
Restart XFCE in Xubuntu
With XFCE being a much simpler desktop environment than Gnome and KDE, restarting it is also easier.
The primary desktop element of XFCE – and the most probable to freeze – is its panel. To restart it, if your desktop is still somewhat responsive, fire up a terminal by using the Ctrl + Alt + T combination and type:
killall xfce4-panel
This command will “kill” the panel. To reload it, enter:
xfce4-panel & disown
To restart the whole window manager, move to the first available terminal outside your desktop. (On the Xubuntu installation, it was the first one, accessible with the Ctrl + Alt + F1 combination.) There, try the official approach:
xfwm4 --replace
If that doesn’t work, try the more forceful approach:
killall xfwm4 & xfwm4 & disown
Hopefully, your desktop will be back up and running, waiting for you.
The above methods should help you get out of a frozen desktop situation very easily. Do also check out the keyboard shortcut for GNOME to better navigate the desktop.
Our latest tutorials delivered straight to your inbox