ZDNET’s key takeaways
- If your Linux desktop freezes, don’t panic; there are ways to fix it.
- You can use keyboard shortcuts, virtual consoles, SSH, and other tricks.
- These tips can help avoid a hard reboot.
I started using Linux in 1997, and since then, it’s been a rare occasion that my desktop causes me any issues.
Notice I said “rare.” That doesn’t mean I’ve gone all these years without an issue. In fact, I have had my desktop freeze up on me enough that I’ve had to lean on some tricks to reclaim it.
Now, before I continue, I want to make one thing clear: when a Linux desktop freezes, 99.99999% of the time, it’s not the kernel’s fault. Typically, what causes the issue is a single app that, out of nowhere, consumes a majority of the system resources, causing the desktop to lock up. That app could be a web browser, a virtual machine manager, an image editor — anything that uses memory. When that app goes on a memory-gobbling spree, it will either cause your desktop to react very slowly or not at all. I’ve had situations where the cursor still moves but cannot interact with the apps.
What do you do?
Also: Ready to ditch Windows for Linux? This is the ideal distro for you
There are ways to get yourself out of this jam without having to shut down the system by holding the power button for a few seconds until you see the screen go black.
1. Ctrl+Q
This is the first thing you should try. Most apps in Linux have the Ctrl+Q keyboard combination mapped to close a window. If you still have control of your cursor, click on a suspect app, and then hit the Ctrl+Q keyboard combination to see if it’ll close the app. If the app closes and you regain your desktop, you’re done. If not, you can try to close other apps until you find the offender. If this doesn’t work at all, move on to the next method.
2. Virtual console
Linux has had a really cool trick up its sleeve for decades: virtual consoles. Essentially, this switches you out of the desktop and into a console that includes a bash prompt where you can log in with your username and password, and then run the necessary commands to troubleshoot. For example, you could issue the top command to find out what app has taken over your system resources and then kill the offending app with either the kill or killall command.
Also: 8 ways I quickly leveled up my Linux skills – and you can too
Linux gives you several virtual consoles (each functions in the same way), and you can access them with the Ctrl+Alt+F1/7 key combination. Do note that F1/7 means F1 through F7 (your function keys).
3. SSH
This is the trick I use most. When my desktop freezes, I use Secure Shell to remote into my desktop and fix the problem. Because SSH uses so few system resources, it never fails me. Once I’ve logged in, I can use whatever command is necessary to solve my problem. Here’s one other thing you could do: because GNOME is sometimes the problem (or the problem isn’t revealing itself), I created a script that I can run to restart the GNOME desktop (which always solves the problem).
Also: 5 Linux terminal apps better than your default – and they’re all free
The content of that script is just two lines:
#!/bin/bash
killall -3 gnome-shell
Save that file, give it executable permissions (such as chmod u+x restart_gnome.sh), and all you have to do is run it from the command line when necessary. Problem solved.
4. REISUB
If your desktop has frozen, and the above two tricks don’t work, there’s always a soft reboot (a normal reboot, as opposed to holding down the power key, which isn’t the best method of shutting down a system). REISUB restarts your computer without you having to access the desktop menu. Of course, you could always use either a virtual terminal or SSH and then issue the sudo reboot command (I’ve done that several times).
But if you’re not comfortable with either method — or they are, for some reason, not working — you can use the REISUB method. This is done by holding down Alt+SysRq (the Print Screen key) while slowly typing REISUB (with a slight pause between each). Once you’ve done that, your system will safely reboot.
5. Ctrl+Alt+Del / Ctrl+Alt+Backspace
Some desktop environments still make use of the old Ctrl+Alt+Del key combination, which immediately reboots your machine. Not all desktop environments (such as GNOME) honor this key combination. Some Linux desktops also still honor the old Ctrl+Alt+Backspace combination, which automatically kills the desktop and sends you back to the login screen.
Also: The 5 most customizable Linux desktop environments – when you want it your way
Back in the early days of Linux, every distribution honored these key combinations. As desktops evolved, some dropped support for that functionality in favor of mapping the shortcuts to other actions. If your desktop freezes, you can always try one of these two shortcuts to see if it works before trying something else.
Open Source
<!–>
–>