Every operating system hangs and Linux distributions are no exception. I’ve used Fedora as my primary Operating System for a long time and now I’m using Ubuntu in dual-boot with Windows 8.1.
In Fedora 20, I used the default music app for playing and maintaining my music library and as the number of files in the library increased, the app started hanging up now and then. I installed Clementine as an alternative but to no avail. Also my whole screen used to freeze many times for no reason and only solution was to restart computer.
Ubuntu also freezes many times. Momentary freezing of Software Center is most common, many times it also freezes while mounting my Windows Phone. Ubuntu freezes while restarting Unity.
There are various solutions available at different forums. Some of them worked for me. I’ll list here the best solutions to the problem. Please note that none of the following prevents freezing but helps if the system is hanged.
An Application is not responding
If the case is with a single application not responding properly, the solution would be
xkill command. What this command does is changes your mouse cursor to a cross sign and the application you click on will get closed with no further prompt.
- Press Alt + F2. You may need to press Fn as well if former is not working.
- Enter command
xkilland press Enter.
- Click on the window you want to close with the cursor.
Got it? Good.
Nothing is responding on the screen
Many times it may happen that nothing on the screen seems to be working. Clock is also stuck. Cursor may or may not move. In this case you’ll need to restart gdm or lightdm whichever your distribution is running.
However, it may also happen momentarily so first, you should wait and see if the issue gets resolved on its own. If it persists, do the following:
- Press Ctrl + Alt + F1.
- Sign in with your credentials.
- Restart GNOME Display Manager using following command if your Linux is using LightDM (e.g. Ubuntu)
sudo service lightdm restartor
sudo service gdm restartfor GDM as in GNOME Desktop Environments.
All running programs will be closed and you’ll be back to GUI log-in screen.
GDM is NOT restarting
Restarting GDM works for me on my Ubuntu desktop however, it did not work on Fedora for me. If you are still not able to work anything out, here is the last resort.
Magic SysRq key is a key combination used for forcibly killing any processes, recovering system state, disaster recovery and safely rebooting computer without corrupting your file system in Linux machines. It consists of various commands given holding Alt with Prt Sc (Print Screen) key or Sys Rq key in older keyboards.
Commands are shortened for REISUB or Reboot Even If System Utterly Broken. What you’ve to do is:
- Hold Alt and Prt Scr / SysRq and press following keys one by one.
- R : Switch back from X Windows mode.
- E : Allowing processes to terminate by sending Terminate Signal (SIGTERM).
- I : Forcibly killing processes by sending Kill Signal (SIGKILL).
- S : Syncs file-systems to disk
- U : U is short for Unmount. This command remounts all file systems on the disk but read only.
- B : Rebooting the system. Hence your machine will get restarted.
In case you find it hard to remember, REISUB when read backward is BUSIER.
Killing particular processes in Command line
If you’re running some processes in command line and it is not working you can stop it using Ctrl + C
If the issue is not as big as the solutions I’ve given above and you just want to terminate a process irritating, process can be killed using any of the following command. In UNIX based systems every processes is given a Process ID. To view all the processes and respective process IDs running on your system, use command
top. Hit Ctrl + C to stop the command. However a more powerful command with more options would be
ps aux | grep query. Here query is to search among the running processes. For example, if you are running an installation in Software Center and it is stuck, you can search for
ps aux | grep aptto get the process ID of the running process and kill it with either of the following commands.
- Kill a process using kill command. This command sends TERM signal to terminate the process with given PROCESS ID.
- If the process is still running, run kill command with
-KILLflag. SIGKILL i.e. kill signal causes the process to stop immediately and unlike TERM, no clean-up is performed. However if it’s taking time reason is that the kernel may take its time to deliver them.
kill -9 PROCESS_ID
All signals for
kill can be found using
A process can also be killed using its name. For instance,
These measures are the most useful for any Linux system freezing. For most of the times, to kill a process
kill -9 is most useful. However if your system is freezing very often you should also consider looking for any drivers or any particular program creating nuisance.