Gnome session frozen, some options to restart it

about fix a frozen gnome desktop session

In the next article we are going to take a look at what can we do if we find ourselves facing a frozen Gnome session. Nowadays, many people are using Gnome Shell as it is reliable, easy to use and faster and faster. However, even the best desks have problems.

Perhaps the most striking and debilitating problem that Gnome suffers from is that many users freeze their session. In the following lines we are going to see what to do when we have a frozen Gnome desktop session.

How to restart a frozen Gnome session

Method 1: restart X11

Gnome Shell has a built-in restart function. Users can run it to restart a frozen desktop. The only downside is that this doesn't work with wayland, so we have to use "Xorg" for it to work.

To restart the Gnome Shell session while everything is frozen, we will start pressing the key combination Alt + F2. This will bring up a window in which we can write commands.

In this window we will only have to to write 'r'. This command mainly restarts the session without closing it.

execute an order from desktop

r

We will be able to do this as many times as we want, in case a single restart does not solve the problem.

Method 2: restarting Wayland

If you are using Wayland for Gnome you will notice a good performance, but even in spite of this there may be session crashes. Unfortunately, here the reset function does not work. More will need to be done to regain control of the team.

To restart a session, in this case we will not be able to work in the Gnome desktop environment. Instead We will have to use the TTY console and force a restart of the desktop administrator that Gnome handles and thus be able to restart the session. To open the console, we can use the key combinations Ctrl + Alt + F2 o Ctrl + Alt + F3.

Once inside the TTY console window, we will have to log in. If everything is correct, we will get access to the command line in TTY mode. From here, we will have to follow the step-by-step instructions to restart our session:

Step 1: With the systemctl stop command, we will stop the execution of the Gnome screen manager. Do this will automatically log out of the Gnome Shell:

sudo systemctl stop gdm

If you use LightDM with Gnome, instead of the command you will have to use:

sudo systemctl stop lightdm

Step 2: When executing the stop command, gdm or lightdm will stop running. From here we will start it again using start command:

sudo systemctl start gdm

For LightDM the command to execute would be:

sudo systemctl start lightdm

If the commands are executed correctly, we should see the Gnome login screen. From there we can log in again.

Method 3: using gnome-shell –replace

If you have tried the above methods of Xorg and Wayland and still have not managed to solve the problems, there is still a third way to restart the Gnome Shell session while frozen. The argument "replace“It works in a similar way to what we did with Wayland, since must be started at the TTY terminal. We will access it with the key combinations Ctrl + Alt + F2 or Ctrl + Alt + F3.

As I have read out there, this solution works with all versions of Gnome Shell, including Wayland.

Inside the TTY terminal, we are going to log in with our user and follow the following instructions:

First we are going to create a file called "gnome-restart" using the touch command:

touch gnome-restart

The following will be use echo command. With which we are going to add the reset code to the file gnome-restart, writing in the terminal first the line:

echo '#!/bin/bash' > gnome-restart

And then this other line:

echo 'DISPLAY=:0 gnome-shell --replace &' >> gnome-restart

We will update the file permissions'gnome-restart' that we just created so that we can run it as a program from the terminal:

sudo chmod +x gnome-restart

The following will be move file 'gnome-restart' to / usr / bin /. With this we will achieve that the system can call it as a program:

gnome-restart

sudo mv gnome-restart /usr/bin/

From the TTY terminal, we will have to write gnome-restart to restart our Gnome Shell session frozen. We can also execute this command directly from the Gnome desktop by pressing Alt + F2 to open the command window in which we will write:

gnome-restart

Upon successful execution of the command, our session should be functional again.

Method 4: using Killall

Kill for Ubuntu
Related article:
Kill: everything you need to know about this command for Unix

After all that said, when a Gnome session crashes, I think this is the easiest way to restart it. We will only have to write on the TTY:

killall -3 gnome-shell

The above command we can also use it as an alias in the ~ / .bashrc file as follows:

aka add gnome killall

alias kgnome=’killall -3 gnome-shell’

Once the file is saved, when a desktop session is frozen, from the TTY we will only have to write:

kgnome

With this command we will force the closure of the locked session.


Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.