1. Home
  2. Linux

How to fix a frozen Gnome desktop session

Lots of people are using Gnome Shell these days, as many mainstream Linux projects are adopting the desktop environment as their default user interface. Overall, this is a good move, as Gnome is reliable, easy to use, and getting faster with every release. However, even great desktops like Gnome have issues.

Perhaps the most glaring and debilitating issue that Gnome suffers from (even with rapid patches improving the desktop with every release) is freezing. No matter what, sometimes, Gnome is destined to freeze and lock up. So, in this guide, we’ll show you what to do when you have a frozen Gnome desktop session. Let’s get started!

Method 1 – X11 restart fix

Gnome Shell has a built-in restart function that users can execute to restart a frozen desktop while in use quickly. The only catch is it doesn’t work with the new Wayland display protocol, so you need to be using the “Gnome on Xorg” session for this to work.

To restart the Gnome Shell session while everything is frozen, start by pressing Alt + F2 on the keyboard. Executing this keyboard combo will bring up a window in the center of the screen in which you’ll be able to enter commands.

In the command box, type in ‘r.’ This command will fully restart the session, re-launch the Gnome Shell, and even fix any window manager issues you may be having (though it mainly just restarts the session without logging you out).

r

Press enter to execute the command. Feel free to re-run this command more than once if a single restart doesn’t solve the problem. Usually, running the re-launch command a couple of times in a row fixes things.

Method 2 – Wayland restart fix

Wayland is the new modern display protocol for Linux, and Gnome Shell embraced it early. If you’re using Intel open-source, or other supported GPU drivers, while running Gnome, you’re most likely using Wayland.

The Wayland session for Gnome has tons of performance improvements, but crashes can still happen. Unfortunately, the restart feature doesn’t work in this session. So, if you’ve run into a frozen Gnome desktop session, you need to do something else to regain control of your computer.

To restart a Wayland Gnome session, you won’t be working within the Gnome desktop environment. Instead, you’ll need to access the TTY console and force the desktop manager that handles Gnome to restart, forcing your session to reboot. Press Ctrl + Alt + F2  or Ctrl + Alt + F3 to gain access to the TTY console.

Once inside of the TTY console window, you must log in. Write out your username in all lower-case letters and press Enter. Following the username, write in your password. Upon entering your password successfully, you’ll gain access to the Linux command-line in TTY mode.

From here, follow the step-by-step instructions to restart your Gnome Shell session.

Step 1: Using the systemctl stop command, stop the Gnome display manager from running. Doing this will automatically end your Gnome Shell session and cause it to close.

sudo systemctl stop gdm

Or, if you use LightDM with Gnome, run this command instead.

sudo systemctl stop lightdm

Step 2: By running the stop command, the Gnome (or LightDM manager) will stop running. From here, run the start command and re-launch the login manager.

sudo systemctl start gdm

Or, for LightDM, run this command instead.

sudo systemctl start lightdm

Assuming the command is successful, your Linux PC should show you the Gnome login screen, and you’ll be able to use it to log into Gnome Shell again, without a frozen session!

Method 3 – Display replace fix

If you’ve tried the Xorg and Wayland fixes and found they haven’t worked to your needs, there’s a third way to restart the Gnome Shell session while it’s frozen, using the Shell’s built-in “replace” function.

The “replace” command works similar to the Gnome Wayland fix, in that it must be launched in the TTY window. So, press Ctrl + Alt + F2  or Ctrl + Alt + F3 to access it.

Note: this fix works with all versions of Gnome Shell, including Wayland.

Inside of the TTY area on your Linux PC, write in your username and password to gain access to the command-line interface. Then, follow the step-by-step instructions below to learn how to reset your Gnome session with this method.

Step 1: Create a file called “gnome-restart” using touch.

touch gnome-restart

Step 2: Using the echo command, add the restart code to the gnome-restart file.

echo '#!/bin/bash' > gnome-restart
echo 'DISPLAY=:0 gnome-shell --replace &' >> gnome-restart

Step 3: Update the permissions to the “gnome-restart” file so that it can be executed as a program from the terminal using the chmod command.

sudo chmod +x gnome-restart

Step 4: Move the “gnome-restart” file into /usr/bin/ so that the system can call it like a program.

sudo mv gnome-restart /usr/bin/

Step 5: From the TTY terminal, write gnome-restart to restart your Gnome Shell session.

Note: the gnome-restart command can also be run directly from the Gnome desktop. To do it, press Alt + F2 to open the command window on the desktop, and run the command inside of it.

gnome-restart

Upon running the command successfully from TTY, return to your Gnome desktop by pressing Ctrl + Alt + F2  or Ctrl + Alt + F3. Your session should be usable again!

Leave a comment