How to Restart a Frozen Desktop in Linux

Restart Linux Desktop 00 Featured Image

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 fixes for 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 five of the most popular desktop environments in Linux: Gnome, KDE, XFCE, LXQt and MATE. We are using Ubuntu (Kubuntu/Xubuntu/Lubuntu/Ubuntu MATE) 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.

Restart Linux Desktop 01 Gnome Reload

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.

Restart Linux Desktop 02 Loading Gnome

Press Ctrl + Alt + F3 to access the first terminal outside of your desktop environment.

Restart Linux Desktop 03 Tty Screen

Enter the following command to restart the Gnome desktop environment:

gnome-shell --replace
Restart Linux Desktop 04 Gnome Tty Restart

Press Ctrl + Alt + F2 to move back to the desktop and, if everything goes according to plan, a refreshed version of your desktop will be waiting for you.

Restart Linux Desktop 05 New Gnome Session

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
Restart Linux Desktop 06 Login Screen

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 have to take.

In Kubuntu, the first available terminal outside your desktop environment is TTY3, so you will have to use the Ctrl + Alt + F3 combination to get there.

Restart Linux Desktop 07 Tty Kde Screen

In the latest versions of KDE, the proper way to restart the desktop from the terminal is:

kquitapp5 plasmashell && kstart5 plasmashell
Restart Linux Desktop 08 Kde Reload

If that doesn’t work, you can also try:

pkill -ABRT plasmashell

If that fails as well, it will be worth a try to restart the display manager itself as a last option before rebooting your whole PC. Try it 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 Linux Desktop 09 New Kde Session

Restart XFCE in Xubuntu

With XFCE being a much simpler desktop environment than Gnome and KDE, restarting it is also easier.

Restart Linux Desktop 10 Xfce Session

The primary desktop element of XFCE – and the most probable to freeze – is its panel. If your desktop is still somewhat responsive, restart it by firing up a terminal with the Ctrl + Alt + T combination and typing:

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 of your desktop. On the Xubuntu installation, it was the first one, accessible with the Ctrl + Alt + F2 combination. There, try the official approach:

xfwm4 --replace
Restart Linux Desktop 11 Xfce Restart Command

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.

Restart LXQt in Lubuntu

LXQt is a simple desktop environment that aims to work with small, lightweight machines. Similar to XFCE, reloading this desktop environment mostly consists of restarting its panel.

Restart Linux Desktop 12 Lxqt Session

To start, access a terminal emulator inside the environment. Create a .desktop file that can launch a terminal emulator by pressing right-click on the Desktop and selecting “Create Launcher.”

Restart Linux Desktop 13 Lxqt Create Launcher

This will display a prompt where you can provide the details for your shortcut. To create a Terminal launcher, write /bin/bash in the “Command” field and toggle the “Terminal” option.

Restart Linux Desktop 14 Terminal Shortcut

Click this shortcut to open a new Terminal, then run the following commands to restart the LXQt panel:

qdbus org.lxqt.session /LXQtSession stopModule lxqt-panel.desktop
qdbus org.lxqt.session /LXQtSession startModule lxqt-panel.desktop

On the other hand, it is also possible to reload the entire LXQt desktop. This is handy if you cannot access any of the environment’s features through the graphical interface.

Press Ctrl + Alt + F3 to drop to a TTY shell, then run the following command to fully restart LXQt:

sudo systemctl restart sddm
Restart Linux Desktop 15 Lxqt Restart Sddm

Restart MATE in Ubuntu MATE

MATE is a flexible desktop environment that aims to continue the GNOME2 design language. To restart this environment, open a Terminal window by pressing Ctrl + Alt + T.

Restart Linux Desktop 16 Xfce Terminal

Run the following commands to fully reload MATE:

mate-settings-daemon --replace
mate-panel --replace
marco --no-composite --replace

It can be useful to fully reset the MATE desktop in instances where you want to undo a system configuration that can potentially break your system.

Similar to other desktop environments, do this by dropping to a TTY, then run the following command:

mate-panel --reset
Restart Linux Desktop 17 Mate Reload

Restart the Xorg Server

Restarting the entire Xorg server instead of your specific desktop environment is useful if you want to restart your display and are either running without a display manager or using a window manager such as bspwm.

To restart Xorg, you need to drop to your TTY. Press Ctrl + Alt + F3.

Restart Linux Desktop 18 Xorg Tty Screen

Send a SIGTERM signal to the main Xorg process by running the following command:

pkill X

Xorg will immediately stop and restart itself in your machine. Go back to your graphical interface by pressing Ctrl + Alt + F1.

Frequently Asked Questions

Does a desktop restart corrupt any files that I am working on?

Luckily, no. The standard Linux filesystem works in a way that it can tolerate abrupt system changes, as most files in your machine can preserve some data about their state before the restart. While data corruption is less likely in Linux, it is still possible to lose data that only exists in your machine’s memory. You need to make sure that you have saved everything you’re currently doing to disk before attempting any desktop restart.

Is it possible to use a different TTY to restart a desktop?

Yes! By default, the Linux kernel supports up to six virtual terminal sessions at the same time, which is useful if you want to run a process while trying to restart your GUI environment. To access these extra TTYs, press Ctrl + Alt followed by any key between F2 and F8.

Is it still possible to restart a frozen system if you cannot use the TTY?

Yes! One option is to use Linux’s Magic SysRq Keycodes. These are hidden key combinations that allow you to access some of the kernel’s debugging tools. To restart your system by force, press Alt + SysRq + R, then Alt + SysRq + B. Doing this will switch your kernel’s keyboard driver to “Raw,” then trigger a “Force Reboot” instruction.

Image credit: Simone Pellegrini via Unsplash. All screenshots by Ramces Red.

Ramces Red
Ramces Red

Ramces is a technology writer that lived with computers all his life. A prolific reader and a student of Anthropology, he is an eccentric character that writes articles about Linux and anything *nix.

Subscribe to our newsletter!

Our latest tutorials delivered straight to your inbox