How to fix a frozen Gnome desktop session

Many people are using the Gnome Shell desktop these days. Since many Linux projects They are adopting the desktop environment as their default user interface. In general, this is a good decision, since Gnome is reliable, easy to use and faster and faster. However, even the best desks like this one have problems often.

Perhaps, the most common, irritating and biggest problem that this environment suffers, even with quick patches that improve it with each release. It freezes. No matter what, sometimes, Gnome is destined to freeze and block. Therefore, we will show you what you should do when this problem occurs.

First method: X11 restart fix for Gnome desktop

First, Gnome has a built-in reset function, which users can execute to restart the environment. This when frozen and while in use. You can do this restart quickly. The only drawback is that it does not work with the new Wayland visualization protocol, so you must use the “Gnome or Xorg” session for this to work.

Now, to restart the Gnome Shell session while everything is frozen, start by pressing the ALT + F2 keys. Similarly, when executing this keyboard sequence, a window will appear in the center of the screen. In which you can enter commands.

Also, in the command box, you must type "r". This command will completely restart the session, restart Gnome Shell. And even, it will solve any window manager problem you may have. Although mainly, just restart the session without closing it.

Now, press Enter to execute the command. In addition, you may feel free to rerun this command more than once, if a single restart does not solve the problem. Usually, executing the reset command a few times in a row corrects things.

Second method: Wayland reset correction

First, Wayland is the new modern visualization protocol for Linux. And this environment adopted him from the beginning. If you use Intel open source or other compatible GPU drivers. While you are using Gnome, then you are most likely using Wayland.

The Wayland session has tons of performance improvements, but still, blockages can occur. Unfortunately, the restart function does not work in this session. So, if you have encountered your frozen Gnome environment, you must do something else to regain control of your PC.

So, to restart a Wayland Gnome session, you will not be able to work with the environment itself. Instead, you will need to access the TTY console and force the restart of the desktop manager that manages Gnome. Forcing the restart of your session. Now, press CTRL + ALT + F2 or also, CRTL + ALT + F3, to access the TTY console.

Now, once inside the TTY console window, you must log in. Type your username in lowercase and press Enter. After the username, enter your password. By entering your password successfully, you will get access to the Linux command line in TTY mode.

Follow the instructions to restart your Gnome Shell session

1.- With the systemctl stop command, you can stop the execution of the Gnome screen manager. Doing this will automatically end your environment session and cause it to close.

sudo systemctl stop gdm

Similarly, if you use LightDM with Gnome, run this command instead: sudo systemctl stop lightdm

2.- When executing the stop command, Gnome or the LightDM administrator will stop executing. From here, execute the start command and start the login manager again.

sudo systemctl start gdm

The same for LightDM; you just have to execute this command.

sudo systemctl start lightdm

Now, assuming the command is successful, your Linux computer should show you the Gnome login screen. You can also use it to log in to the Gnome desktop. And all without a session that freezes or blocks.

Third method: the Gnome desktop replacement

Also, if you have tried the Xorg and Wayland corrections; and you have discovered that they have not worked according to your needs. There is a third way to restart the session in this environment while it is frozen. You just have to use Shell's "replacement" feature.

Also, if you have tried the Xorg and Wayland corrections; and you have discovered that they have not worked according to your needs. There is a third way to restart the session in this environment while it is frozen. You just have to use Shell's "replacement" feature.

Now, within the TTY on your Linux computer, type your username and password to access the command line interface. Then, follow the step-by-step instructions so you can learn how to reset your Gnome session with this method.

Steps to recover the environment

1.- Create a file called “gnome-restart” using the “touch” command.

touch gnome-restart

2.- Similarly, using the echo command, add the reset code to the gnome-restart file.

echo ‘#! / bin / bash’> gnome-restart

echo ‘DISPLAY =: 0 gnome-shell –replace &’ >> gnome-restart

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

sudo chmod + x gnome-restart

4.- Move the “gnome-restart” file to / usr / bin / so that the system can call it as a program.

sudo mv gnome-restart / usr / bin /

5.- From the TTY terminal, type gnome-restart to restart your Gnome Shell session. As an added note, you should know that the gnome-restart command can also be executed directly from the Gnome desktop. To do this, you must press ALT + F2, to open the command window on the desktop and execute the command within that window.

gnome-restart

Finally, when executing the command successfully from TTY, return to your Gnome desktop. Pressing CTRL + ALT + F2 or CTRL + ALT + F3. After you do, your session should be fully operational.