If your Ubuntu system freezes, becomes unresponsive, or shows a black screen, the quickest way out is often a forced reboot with the Magic SysRq key sequence or a hard reset. For less severe freezes, you can try switching to a text console, restarting the display server, or using a recovery mode. This guide covers the most effective methods, from the gentlest to the most drastic, so you can recover your system and your data.
Before You Panic: Assess the Severity
Not all crashes are the same. The right recovery method depends on how unresponsive your system is. First, try moving your mouse and pressing a few keys. If the cursor moves, the kernel is likely alive, and you may be able to recover gracefully. If the screen is completely frozen but the keyboard LEDs respond to Caps Lock, the system is in a deeper freeze. If even the keyboard is dead, you are dealing with a hard lockup. Matching the fix to the severity saves time and reduces the risk of data loss.
Method 1: The Magic SysRq Key (The Gentle Reboot)
The Magic SysRq key is a Linux kernel feature that lets you send low-level commands even when the system appears frozen. It works by pressing a specific key combination, usually Alt + SysRq (the Print Screen key) followed by a command letter. The most famous sequence is REISUB, which safely reboots the system:
- R – Switch the keyboard from raw mode to XLATE mode (restores keyboard control).
- E – Send SIGTERM to all processes except init (asks programs to exit gracefully).
- I – Send SIGKILL to all processes except init (force-kills anything still running).
- S – Sync all mounted filesystems (writes cached data to disk).
- U – Remount all filesystems as read-only (prevents further writes).
- B – Immediately reboot the system.
To use it, press and hold Alt and SysRq, then press each letter one at a time, pausing a second or two between each. Wait for the system to reboot. This method is far safer than a hard power-off because it gives processes a chance to flush data and reduces the chance of filesystem corruption. On some laptops, you may need to use Alt + Fn + SysRq if the Print Screen key is shared.
Method 2: Switch to a Text Console (Ctrl+Alt+F1–F6)
If the graphical interface (Xorg or Wayland) has crashed but the kernel is still running, you can often switch to a text-based virtual console. Press Ctrl + Alt + F1 (or F2 through F6) to leave the graphical session and get a login prompt. Log in with your username and password. From here you can:
- Run
sudo systemctl restart gdm3(orlightdmif you use that display manager) to restart the graphical login screen. - Run
sudo systemctl restart display-managerto restart whatever display manager is active. - Use
toporhtopto find a runaway process and kill it withkill <PID>. - Check system logs with
journalctl -xeto see what went wrong.
After restarting the display manager, you should return to the login screen. If this doesn’t work, you can also try sudo reboot from the text console, which is cleaner than a hard reset.
Method 3: Use a Recovery Mode (When You Can’t Boot)
If the system crashes during boot or you cannot get to a login prompt, Ubuntu’s recovery mode is your next best option. At the GRUB boot menu, select “Advanced options for Ubuntu” and then choose the entry ending in “(recovery mode)”. This gives you a menu with several useful options:
- clean – Frees up disk space by removing temporary files.
- dpkg – Repairs broken software packages.
- fsck – Checks and repairs filesystem errors.
- root – Drops you to a root shell for manual troubleshooting.
If you choose root, you can then inspect logs, fix configuration files, or reinstall a problematic package. After making changes, type exit to return to the recovery menu and select resume to continue booting normally. This method is invaluable when the system is stuck in a boot loop or fails to start the desktop.
Method 4: Hard Reset (The Last Resort)
When every other method fails—the keyboard is unresponsive, the screen is black, and even the Magic SysRq keys do nothing—you may have to perform a hard reset. Press and hold the power button for 5–10 seconds until the machine powers off, then press it again to turn it back on. This is the least safe method because it cuts power abruptly, which can cause filesystem corruption or data loss. Only use it if you have no other choice. After rebooting, Ubuntu will typically run a filesystem check automatically if it detects an unclean shutdown.
Common Causes and Prevention
Understanding what causes crashes can help you avoid them. Common culprits include:
- Graphics driver issues – Proprietary NVIDIA or AMD drivers sometimes conflict with kernel updates. Sticking to the open-source drivers or using the ‘additional drivers’ tool can help.
- Memory leaks – A single application (like a browser) consuming all RAM can cause the system to swap heavily and become unresponsive. Monitor memory with
free -hand close apps that balloon. - Overheating – Dust-clogged fans or failing thermal paste can cause random freezes. Check temperatures with
sensorsand clean the hardware if needed. - Kernel panics – These are rare but can happen after a bad update. Booting an older kernel from the GRUB menu often restores stability.
To reduce the risk of data loss, enable automatic updates, keep your system backed up (using tools like rsync or Deja Dup), and consider using a journaling filesystem like ext4, which is the default and helps recover from crashes.
Frequently Asked Questions
Q: What is the difference between a freeze and a crash?
A freeze usually means the system is unresponsive but still powered on, while a crash often results in a shutdown or reboot. A freeze can sometimes be recovered with the methods above; a crash may require a reboot. Both can be caused by hardware or software issues.
Q: Will I lose my unsaved work if I do a hard reset?
Yes, any unsaved data in open applications will be lost. The Magic SysRq sequence (REISUB) is safer because it attempts to sync filesystems and gracefully terminate processes, but unsaved work in applications that don’t handle SIGTERM may still be lost. Regular saving and autosave features are your best defense.
Q: Can I use Ctrl+Alt+Delete to reboot Ubuntu?
Yes, pressing Ctrl+Alt+Delete in Ubuntu typically initiates a graceful reboot, similar to the REISUB sequence but without the manual steps. It may not work if the system is completely frozen, but it’s worth trying before a hard reset.
Q: Why does my system freeze only when playing video or games?
This is often related to graphics drivers or hardware acceleration. Try switching to a different video driver, disabling hardware acceleration in the application, or checking for overheating. Updating your system and drivers to the latest versions can also resolve such issues.
Q: What should I do if the system freezes immediately after login?
Boot into recovery mode and check the logs for errors. A common fix is to reset the GNOME configuration with dconf reset -f /org/gnome/ or to reinstall the desktop environment. If the issue started after a recent update, try reverting to an older kernel from the GRUB menu.
Q: Is there a way to prevent crashes altogether?
No operating system is crash-proof, but you can minimize the risk by keeping the system updated, using stable software, monitoring system health, and avoiding overclocking. Regular backups ensure that even if a crash occurs, your data is safe.
Related
General steps for current mainstream versions; menus can differ by device and version. See the disclaimer or report an error.
More in this bed
- Fix Unfortunately App Has Stopped: Step-by-Step
- Restart a Frozen Samsung Galaxy A12
- HomePod Stereo Pair with AirPlay 2 from iPhone
- Fix 0x8e5e0247 Error on Windows
- Pixel & Pixel XL No Sound: Solved?
- How to Edit Playlists on iPhone