Home Featured 5 Things to do when your Linux system GUI freezes

5 Things to do when your Linux system GUI freezes

by Arun Kumar
Frozen GUI Linux

All operating systems freeze at some point and, Linux distributions are no exceptions. In this post, we are going to look at five methods you can apply to your frozen system before thinking of plugging out the power cable or holding down the power button to power off the PC.

Frozen GUI is mostly characterized by:

  • A single program stops responding and can’t close the window.
  • Nothing responds to mouse clicks or keyboard keys presses.
  • The mouse can’t move completely.

Major causes of a Frozen GUI

Some of the common causes that cause freezing/hanging in Linux are either software or hardware related issues. They include; system resources exhaustion, application compatibility issues, under-performing hardware, slow networks, device/application configurations, and long-running un-interruptable computations.

However, the main issue is mostly resource exhaustion, which often leads to a Deadlock. With that mind, let’s look at five things to do when your Linux system GUI freezes.

Things to do when your Linux desktop GUI freezes

1. Close Frozen Applications Using the X-Window

It is one of the easiest ways to kill freezing applications. There are several ways to open the X-Window. One is executing the command xkill in the terminal, as shown below.

xkill
Execute command xkill from Terminal

Execute command xkill from terminal

Your cursor will change from an arrow sign to an X sign, as shown in the image below. Click on the stubborn application window you wish to close anywhere but preferably on the exit button.

ubuntu-freeze-xkill cursor sign

ubuntu-freeze-xkill cursor sign

Alternatively, if you are unable to launch the terminal, you can use the following key combinations. Alt + F2 will open a dialog box where you will type the command xkill and hit Enter/Return key.

Using Alt + F2 command to open dialog box

Using Alt + F2 command to open the dialog box

This method is applicable in situations where your GUI has frozen, but you still have power over the mouse, and you can apply mouse clicks. Unfortunately, there are situations where even the mouse is frozen, and you cannot move the cursor. Here, you will need to apply the second method below.

2. Use the Linux Terminal

If it were a program running on the terminal, the easiest way would press Ctrl + C to stop it. This combination sends a SIGINT signal that interrupts/stops the program. In other systems, the ‘Delete‘ or ‘Break‘ can perform the same action.

Stop a program from Terminal using Ctrl + C

Stop a program from the terminal using Ctrl + C

Alternatively, if the process wasn’t running in the terminal, you can launch the terminal to stop it by their (Process Identification Number) PID’s. Press the combination Alt + F2 to open the dialog box. Type the command, gnome-terminal, and hit the Return/Enter key to start the terminal. 

From this point, we will use several utilities to see running processes in the system. One of the standard programs is TOP that comes preinstalled in most Linux systems. You can still use other services like HTOP if installed in your system. Launch the program and close the process that seems to consume much of the system memory.

Use TOP program to Close programs

Use the TOP program to Close programs

For example, in the image above, we will stop Firefox using the PID, which is 4240. Execute the command below.

sudo kill -9 4240

3. Use the Console (Virtual Terminal) to Kill Processes

If all of the above, including the terminal, doesn’t work, you will need to revert to Console mode. To enter Console mode, use press the combination Ctrl + Alt + F3. Your GUI interface will disappear and, you will drop into the Virtual Terminal, as shown below. You might be required to sign in with your username and password.

Press Ctrl + Alt + F3 to drop to Console mode

Press Ctrl + Alt + F3 to drop to Console mode

To come out of the console and return to the Graphical User Interface (GUI), press Ctrl + Alt + F2.

Just like in the Terminal, here, we can also use several commands and utilities to stop the running process. Since I have installed HTOP in my system, I will execute it and kill the processes using their PID’s.

Use HTOP to kill running programs in the console

Use HTOP to kill running programs in the console

Fortunately, with HTOP, unlike TOP, you don’t have to execute the KILL command. Select the process that you wish to stop and press the F9 (kill) key.

4. Use Putty to Login Remotely via SSH

Other than performing the above tasks on your native machine, you can access it remotely via putty and execute the same commands. Here, you will need to have an SSH server running and configured correctly on your target system. In this post, we will use putty to stop troubleshoot and stop the process on a remote Ubuntu server.

To install putty, execute the command below.

  •  Ubuntu/Debian
sudo apt-get install putty
  • CentOS, Red Hat and, Fedora
sudo dnf install putty
or
sudo yum install putty
Launch Putty

Launch Putty

Launch putty and enter the Ip-address of the target machine in the highlighted section, as shown in the image above. Click “Open”. You can get the Ip-address of any Linux system by running the command ifconfig.

Note, if the target PC is on a private network (i.e., is assigned a private address), you will need to be on the same network to get remote access on the system.

You will have to log in with your username and password, as shown in the image below.

Connect to Frozen system remotely using putty

Connect to Frozen system remotely using putty

Once you have an active session, you can now start troubleshooting for issues on the system. One of the common ways is using process utilities to check for all running processes in the system. In this example, we will launch TOP by executing the top command.

Launch TOP in Putty

Launch TOP in Putty

You can check some of the processes that are consuming the most memory and kill them using their PID’s. Some of the common kill commands include; pkill, kill, kill -9, killall. See the examples below.

pkill gedit
kill [Process_PID]
kill -9 [Process_PID]
killall -u [username]

You can check more options to use with the various commands using the –help option. For example, pkill –help will give you a list of all options you can use with the pkill utility.

5. Use Alt + SysRq + [Option-Keys] in the Console

The SysRq (System Request) is a specific combination of keys used to communicate directly with the Kernel regardless of the system state. It gives users the ability to send low-level commands to the Linux Kernel.

The SysRq key is commonly on the same key as Prnt-Scrn or the Home button. However, this might differ from one PC brand to another.

SysRq Ket on the keyboard

SysRq Ket on the keyboard

To use the SysRq, we will first need to go into console mode, as shown in the previous method. Press the combination Ctrl + Alt + F3. To revert to GUI, press Ctrl +Alt + F2. In case you cannot drop to console, follow the steps below.

Step 1) Press Alt+SysRq+R. It is a combination used to get the keyboard.
Step 2) If you were not able to drop to console previously, now run the Ctrl + Alt + F2 combination again.
Step 3) Press Alt+SysRq+ E. It terms all the processes running on the system.
Step 4) Press Alt+SysRq+ I. It Kills all running and stalled processes.
Step 5) Press Alt+SysRq+ S. It’s a combination to sync all your disks connected to the system preventing data loss.
Step 6) Wait for the OK message on the console. You can also check your HDD lights to see if the sync was successful.
Step 7) Press Alt+SysRq+ U. It re-mounts all disks connected to the system as read-only.
Step 8) Wait for the OK message. However, if it doesn’t appear, wait for 30 seconds and assume it finished then proceed.
Step 9) Press Alt + SysRq + B. Its a combination to forcefully reboot your PC.

All the letters used here follow the order R-E-I-S-U-B. They must be executed in the same order for this method to work on your system. Some of the common mnemonics used for these letters are ‘Reboot Even If System Utterly Broken’ or ‘Raising Elephants Is So Utterly Boring.’

There are more SysRq combinations that you can use on your frozen GUI other than the REISUB. You can find them in the Linux Kernel sources, SysRq Documentation.

Conclusion

Those are methods you can use to recover your system from a frozen state. They are here to save you from using the last resort that would be performing a physical reset or power on/off, which might lead to data loss. If you have another method that works for you, feel free to share it with our readers in the comment section.

You may also like

20 comments

PaulB May 14, 2020 - 9:08 AM

“The SysRq key is commonly on the same key as Prnt-Scrn or the Home button. However, this might differ from one PC brand to another.”

The majority of keyboards available on residential and small business PCs in the U.S. today are devoid of a label for the SysRq function. It would be more useful to reword the quoted section above state that if this is the case with your keyboard, use the PrtScr (Print Screen) as its substitute, in case the keyboard manufacturer has still met the standard convention. Newbies here might take your advice too literally, and not try the PrtScr key without a designated key on their keyboard.

Reply
MaJed anon October 26, 2020 - 4:55 PM

How can I Access to terminal in this cave
The system will be Explored

Reply
MaJed anon October 26, 2020 - 5:01 PM

Yeas This fk by Firefox curse

Reply
Michael January 21, 2021 - 9:33 PM

I always do a Ctrl+Print Scrn REISUB
(type the R E I S U B).

Reply
ariyan February 1, 2021 - 9:49 AM

none of them works

Reply
cactusbush May 24, 2021 - 5:47 PM

Kewl stuff to know for future reference perhaps; but none of the these solutions worked for me either (didn’t try step #4). Solution #5 (with the Alt+SysRq keys) was enlightening, however just punching a simple “reset” button would have been a quicker solution. If I had one. It seems that they stopped making computer cases with reset buttons – back with the introduction of Windows XP. An unfortunate decision. If I had lots of time & energy, I’d yank this motherboard out of its case and look for the two reset terminals; then hot-wire in a reset button/ kill switch taken from an old case. ( in an ATX case, those 2 terminals might be in the little 9-pin “System Panel Header”).

Reply
Conrad March 20, 2021 - 10:43 AM

To return to the GUI on Linux Mint you use Ctrl + Alt + F7 !!!
Using Ctrl + Alt + F2 will only get you another console (the consoles are F1 through F6)

Reply
Dale April 9, 2021 - 7:12 AM

Wow, I used the print screen key with alt. I didn’t think anything was happening then I got to B and the laptop rebooted.

Thanks for this, I can unmount when I crash.

Just FYI, I had nothing appear on the screen

Reply
Franklin Edward Archer Rinpoche June 14, 2021 - 7:37 AM

But what if the entire computer freezes, nothing moves, the image on the screen halts, no sound is emitted, all response ceases, even the lights on the lock lights on the keyboard won’t light up? Everything abruptly halts all at once with no warning at all? What the hell causes that?

Reply
Rahul July 22, 2021 - 4:23 AM

Same is happening me..in my case I’m using Ubuntu 20.04.2.0 LTS..

Reply
Jason Tiscione July 25, 2021 - 6:07 PM

Me too, same version, I come back and everything’s frozen. Usually happens when writing large files to disk.

Reply
Mohammed Naguib August 21, 2021 - 12:54 PM

I have the same problem,I think it might have to do with the fact that my laptop is 10th Generation ,but I am not sure

Reply
Glen D. February 13, 2022 - 11:13 PM

I am running Linux 20.3 Cinnamon 5.2.7 Linux Kernel 5.4.0-99 Generic on a Dell Inspiron 750, and when it freezes absolutely not one thing on the keyboard or mouse does a thing. The ONLY THING that works is the power switch!!!!!!! I am getting fed up with no real answers, so I think I will just go back to Linux 19 and if that doesn’t solve the problem, I will be FORCED to go back to Windows!!!! I am tired of reprogramming this computer over and over!!

Reply
Glen D. February 16, 2022 - 10:34 PM

I am using a Logitech wireless keyboard & mouse and the remote is plugged into a USB hub with an indicator light. When the computer freezes, the indicator light is NOT on!!! I have moved it around to every USP port on the computer and it still will not indicate a connection nor will the (print/scan button), nor the (Home) button work!!!

Reply
Philip B March 20, 2022 - 7:43 AM

Dell Optiplex 7070 with Debian 11.2. Every few days becomes unresponsive to mouse or keyboard. The lights on keyboard do not change. Unplug the mouse, its light goes off of course. Plug it back in, no light. Same with keyboard. Also stops responding to ssh. kdump does not get triggered.

Reply
newbie June 3, 2022 - 8:50 AM

“To use the SysRq, we will first need to go into console mode, as shown in the previous method. Press the combination Ctrl + Alt + F3. To revert to GUI, press Ctrl +Alt + F2. In case you cannot drop to console, follow the steps below.”
in this text to revert gui you need to press ctrl+Alt+F5.

Reply
Srihari Vernekar July 17, 2022 - 8:54 AM

Hello, my keyboard and mouse nothing works when it freezes what should I do?
Please reply

Reply
Srihari Vernekar July 17, 2022 - 8:56 AM

My PC also freezes when there is no additional programs running

Reply
timmy July 29, 2022 - 9:27 AM

None of these worked when Kubuntu 20.04 freezes.

Just a waste of time. Better accept the fact that you lost some things when this happened.

Reply
Boris (NOT Bore Us) Birch January 10, 2024 - 6:45 PM

This alt+F2 didn’t work on my manjaro or fyodora. I suppose I could switch to YOUR distro, but you didn’t clarify which one it works on and it might be hard to guess.

Reply

Leave a Reply to MaJed anon Cancel Reply

fl_logo_v3_footer

ENHANCE YOUR LINUX EXPERIENCE.



FOSS Linux is a leading resource for Linux enthusiasts and professionals alike. With a focus on providing the best Linux tutorials, open-source apps, news, and reviews written by team of expert authors. FOSS Linux is the go-to source for all things Linux.

Whether you’re a beginner or an experienced user, FOSS Linux has something for everyone.

Follow Us

Subscribe

©2016-2023 FOSS LINUX

A PART OF VIBRANT LEAF MEDIA COMPANY.

ALL RIGHTS RESERVED.

“Linux” is the registered trademark by Linus Torvalds in the U.S. and other countries.