5 Things to do when your Linux system GUI freezes

Got a frozen Linux desktop? Several factors cause your Linux system to become non-responsive. Here are the five things you can do before hitting that Power reset button.

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.

Arun Kumar
Arun did his bachelor in computer engineering and loves enjoying his spare time writing for FOSS Linux. He uses Fedora as the daily driver and loves tinkering with interesting distros on VirtualBox. He works during the day and reads anything tech at night. Apart from blogging, he loves swimming and playing tennis.

1 COMMENT

  1. “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.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

STAY CONNECTED

23,283FansLike
386FollowersFollow
16SubscribersSubscribe

LATEST ARTICLES

MUST READ

Buyers who wish to go for a machine that is based on Linux often show interest in Chromebooks due to the form factor and extended battery life capabilities. Although ChromeOS power these machines, users can still miss out on a more genuine Linux experience. For those who happen to agree, the new Lemur Pro by System76 might get some heads turning.
Linux is growing faster than ever. As per the latest report, there is a drop in the Windows 10 market share for the first time, and Linux's market share has improved to 2.87% this month. Most of the features in the list were rolled out in the Pop OS 20.04. Let's a detailed look into the new features, how to upgrade, and a ride through video.

7 Best Ways to Kill Unresponsive Programs in Linux

For dealing with a frozen app or desktop, you can't use the CTRL+ALT+DEL in Linux system. Instead, there are powerful alternatives that come in handy in frustrating situations. We pick the best methods available for you.

The 10 Best Linux Games [2020 Edition]

Not too long ago, people had to use Wine or run virtual machines like VMware to play Windows Games on their Linux PCs. Not only was this inefficient, but it also consumed a lot of extra resources and resulted in a sub-optimal gaming experience. But standing in 2020, gaming on Linux is like a long-time dream come true.

Linux Vs. Windows: 10 Key Differences to Know

Merely going by statistics, it is most likely that you are a Windows user.  After all, around  87.70% of all PCs around the world run on Windows with Linux, only accounting for 2.32%.

Top 10 Reasons to use Xfce as your Desktop Environment

There are many choices for desktop environments for Linux based operating systems. Mainly, you can install any DE of your choice on most of the Linux based distributions, even if they are not offered as a package officially. In our recent articles, we discussed the best of KDE and Cinnamon. In this article, we wish to present to you the top reasons why you should consider Xfce as your desktop environment.