- What to do when a Linux desktop freezes?
- 9 Answers 9
- What to do when your computer running ubuntu (or any Linux distro) freezes?
- A single program stops responding Link to heading
- Using xkill Link to heading
- Using “kill” Link to heading
- Using pkill Link to heading
- But, what to do when even the mouse is not working? Link to heading
- Restart the desktop environment Link to heading
- When the whole system is locked up, and nothing works? Link to heading
What to do when a Linux desktop freezes?
I’m a Windows guy, dual booted recently, and now I’m using Linux Mint 12 When a Windows desktop freezes I refresh , or if I am using a program I use alt + F4 to exit the program or I can use ctrl + alt + delete and this command will allow me to fix the Windows desktop by seeing what program is not responding and so on. Mint freezes fewer times than my XP, but when it does, I don’t know what to do, I just shut down the pc and restart it. So is there a command to fix Linux when it freezes?
9 Answers 9
If all else fails, you Raise The Elephant. Essentially, there are special Magic SysRq key sequences ( Alt + SysRq + ? ) that the Linux kernel handles specially.
If your Linux box freezes and simply won’t yield to any other key-commands, you should definitely try one particular key sequence before a hard reboot.
The key sequence is popularly remembered with the mnemonic:
Raising Elephants Is So Utterly Boring
- Alt + SysRq + R switch keyboard to ‘raw’ mode
- Alt + SysRq + E send SIGTERM (termination) signal to all processes except mother init
- Alt + SysRq + I send SIGKILL signal to all processes, a little more aggressive
- Alt + SysRq + S sync all filesystems to prevent data loss
- Alt + SysRq + U remount filesystems as read-only
- Alt + SysRq + B forcefully reboot
For the full list of possible commands and additional tips on how to type these commands see the Wikipedia page.
Problem: some modern keyboards do not have a SysRq key. (the one I’m typing from right now doesn’t, for instance — although it does have «print screen», «scroll lock» and «pause/break»)
You can try Ctrl + Alt + * to kill the front process (Screen locking programs on Xorg 1.11) or Ctrl + Alt + F1 to open a terminal, launch a command like ps , top , or htop to see running processes and launch kill on not responding process.
Note: if not installed, install htop with sudo apt-get install htop .
Also, once done in your Ctrl + Alt + F1 virtual console, return to the desktop with Ctrl + Alt + F7 .
For a windows guy and a beginner in Linux, I would recommend installing htop instead of top as it is easier to operate.
Wasn’t the kill foreground process under pointer key combination Ctrl + Alt + Esc, or did that change? (And why do my key buttons not show correct formatting?)
Which asterisk should in use for Ctrl+Alt+*? The one on the numeric keypad or in the alpha block? In the latter case, what would I press on non-US keyboards?
Only the asterisk on numeric keypad should work, @user149408. The linked thread in oss-sec mailing list suggest that.
In most distros pressing Ctrl + Alt + Backspace kills the X11 (graphic) interface and restarts it. Unfortunately some recent, supposedly «user friendly» distros deactivated this very useful shortcut for some unfathomable reason. I don’t know if Mint is so «user friendly» but you have nothing to lose trying it 🙂
Make sure this is enabled in Mint by searching for ‘Startup Applications’ in the menu, and then making sure ‘Ctrl Alt Backspace’ is checked.
AFAIRK,the newer fancy xorg evdev input drivers disable the ‘zapping’ by default. However, there is a way to reenable them on startup in /etc/xorg.conf or /etc/xorg.conf.d/XX-somefile or set it in a per-user xorg startup script (maybe put setxkbmap -option «terminate:ctrl_alt_bksp» into ~/.xinitrc) by adding the line Option «XKbOptions» «terminate:ctrl_alt_bksp» into a corresponding Section «InputClass» , or by setting another switch in your OS that relays to do that.
In Fedora [install,] open gnome-tweaks and check ‘key sequence to kill Xserver’ in the mouse/keyboard section
Besides what was already mentioned, I also use those tricks:
- If by any chance the unresponsive program was started in a terminal, I would try a Ctrl + D or Ctrl + C . If nothing happens I’d try a Ctrl + Z followed by a ruthless kill .
- If I knew the responsible program, I would open a terminal and use killall . (E.g., killall firefox )
- Alternatively, under Gnome, I would launch run command and invoke xkill , which allows you to kill a program by simply clicking on a window it owns.
- Finally, just in case my keyboard melts, I have a System Monitor applet (also under Gnome) which will pop up the gnome-system-monitor when clicked. From there, I can kill any process I own using only my mouse.
Adding one more possible solution to the mix, and (apart from the accepted answer) one of the least destructive of the answers so far.
- Use keyboard/mouse to A) Run the Ctrl + Alt + * option above, B) Navigate to a utility that can be used to terminate the offending program, C) Launch a terminal to initiate a pkill (or similar, as detailed above)
- Switch to another virtual console ( Ctrl + Alt +any one of F1-6 ), to initiate a pkill (or similar, as detailed above)
. then assuming MagicSysRq support is compiled into the kernel (From http://en.wikipedia.org/wiki/Magic_keys), on a QWERTY keyboard (alternatives for the below f are provided in the aforementioned article), one can try:
Alt + SysRq (Note caveats on http://en.wikipedia.org/wiki/Magic_keys#Commands)+ f to
«Call oom_kill, which kills a process to alleviate an O ut O f M emory condition», which (at least for me) often kills the program that is causing the issue, as it is the largest RAM consuming process running at the time.
On laptops you might need to press Ctrl Fn F1 to open terminal, what I do is type reboot now to restart from terminal.
To go back to the GUI from terminal on my laptop (HP G56) I have to Ctrl Fn F8 (apparently it could also be Ctrl Fn F7 ) and you should be back to graphical interface.
- shutdown -h now – Shutdown the system now and do not reboot
- halt – Stop all processes — same as above
- shutdown -r 5 – Shutdown the system in 5 minutes and reboot
- shutdown -r now – Shutdown the system now and reboot
- reboot – Stop all processes and then reboot — same as above
- startx – Start the X system
Another suggestion if you are using Gnome3 (I think the default Mint installation uses something similar), you can use CTRL + F2 then press R and hit return. I use this often and it works. It basically restarts the GUI. Even if you don’t see anything on the screen (e.g., it is frozen) you should do that and it will restart the GUI.
maybe isn’t works in the Mint GUI, since the default Mint GUI isn’t exactly Gnome, but on Gnome 3 it works for sure.
This changed in GNOME3. Pressing Alt+F2 will open a run box where you can type the command r . This is restarting gnome-shell, which in GNOME 3.x has had many memory leaks which lead to it becoming slower and slower over time. Performing this restart released much of this RAM.
On my laptop when it completely freezes (unresponsive mouse or keyboard) on mint 17.3, I’m able to do control + alt + fn + f7, then control + alt + fn+ f2. This gets to the shell, then I login with my username and password. To go back to the desktop I do chvt 8 this gets me back to my current desktop. To find out the active tty’s type w then chvt to the current one.
That way you can resume your work without rebooting or losing anything.
Not yet mentioned but might work in some cases — try CTRL + ALT + RIGHTARROW or LEFTARROW . This did switch workspaces, and doing so somehow unhitched whatever was blocking mouse and keyboard actions. I could then switch back to the first workspace, kill Chromium, which I had by then figured had crashed and was hogging all keyboard and mouse events. Now everything’s back to normal, no reboot or loss of anything involved.
In my case, just minutes ago, everything was hung except the mouse moved the cursor, but the mouse did no more. The PrtScn made a popup saying I could drag a rectangle (but not) or hit ESC (works). Nothing else worked. Not even moving the cursor onto another window, when I have focus-follows-mouse, changes the window frame highlighting. But Ctrl + Alt + F3 did switch to a text term, Ctrl + Alt + F1 brought back the X windows session.
The culprit was Chromium. I was reading, switched tabs in one browser window, and upon clicking the tab everything froze but for the few things just described. Switching workspaces
What to do when your computer running ubuntu (or any Linux distro) freezes?
Note: This is almost 10 years old post, but the steps are still the same. Even though the post is for “Ubuntu”, it should work for anything, like Linux Mint, PopOS! etc.
I often mention to use Ctrl+Alt+T to bring up the terminal, it may or may not work based on the Linux distro you are using. So, if it does not work, look for your distro specific keyboard shortcut to bring up a terminal window
This is what you can do when your Ubuntu freezes
There are different types of freezing, from a single program stops responding, to the entire system lock up. I will try to address them one by one.
A single program stops responding Link to heading
This is the most common one. This happens very often. And this can be dealt easily.
Using xkill Link to heading
Note: xkill is for X Window systems. If you are using a distro that is using Wayland, this may not work.
When a single window stops responding, you can simply click the close button in the window and chances are it will give you an option to force close it.
But, sometimes it does not. In that case, press Alt+F2 and type xkill and press enter.
The mouse pointer will turn into an X . Now, if you left click on any window, that window will be killed, no questions asked. If you click the right button, the mouse pointer will get back to its normal form.
Using “kill” Link to heading
If that doesn’t work, you can open up a terminal window (by pressing Ctrl+Alt+T . ).
(If you are not able to open up a terminal window, press Ctrl+Alt+F1 and login to the tty. You can press Ctrl+Alt+F7 to go back to GUI) and find the process id of the process that is offending.
For example, if vlc player is the one that is giving me headache, I will issue the following command to find the process id of vlc.
Make note of the process id, and kill it with the following command.
kill -9 # Example: kill -9 2343
Using pkill Link to heading
You can also use the pkill command which combines pgrep and kill into a single command.
This will kill all processes with “vlc” in it. It is equivalent to pgrep vlc and then kill
The process should be gone for good.
But, what to do when even the mouse is not working? Link to heading
In that case, You need to open a terminal. You could try Ctrl+Alt+T , if that does not work, type Alt+F2 and then type in gnome-terminal and press enter.
Sometimes, it won’t work either. If that’s the case, you need to type Ctrl+Alt+F1 to get into the tty.
Restart the desktop environment Link to heading
The service you need to restart varies based on whether you are using Gnome, KDE or something else.
sudo systemctl restart gdm
kquitapp5 plasmashell && kstart5 plasmashell
xfce4-panel -r && xfwm4 --replace
This should bring you back to the login screen.
When the whole system is locked up, and nothing works? Link to heading
Note: This is a pretty old and I am not sure if it will work for the modern systems Try it anyway, might as well just reboot the whole thing
This does not happen usually, but if it happens, you can do the following to get the system back on.
Press and hold the Alt key along with SysReq (Print Screen) key. Now, type in the following keys, R E I S U B ( give a second or two of interval between each key stroke). If you have a hard time remembering the keys, try this:
Reboot; Even; If; System; Utterly; Broken.
If you need to know what just happened, this is what happened.
E: Send Terminate signal to all processes except for init
I: Send Kill signal to all processes except for init
S: Sync all mounted file-systems
U: Remount file-systems as read-only
None of the above methods were helpful? Well, then you know what to do. That’s right, the restart button. If there’s none, hold down the power button for a few seconds, and then, you know the drill. Probably, that’s what most of us do when things get ugly.