Save 10%Pay yearly on any plan. 6% half-yearly, 3% quarterly. Help centreWhatsAppTelegram TeamsOpen a ticket

Why Ubuntu Freezes and How to Fix It Fast

Ubuntu frozen? Close the stuck app, recover from a text console, restart safely with the SysRq keys, then find the cause in the logs and stop it coming back.

4 min readBy Daniel

Reviewed by the AmazingRDP technical team

Fixing a frozen Ubuntu system

A server that keeps running out of memory needs more of it. See Linux VPS plans with the memory your workload needs. See Linux VPS from $6.99

When Ubuntu stops responding, the power button is the last thing to reach for. Most freezes leave part of the system working, and you can get back in without losing work. Find out which kind of freeze you have, then use the matching fix.

Which kind of freeze?

What you seeWhat it isGo to
One window is stuck, the rest worksA frozen programStep 1
The whole desktop is stuck, the mouse may still moveThe desktop has hung; the system is still runningStep 2
Nothing reacts at allA full freezeStep 3

1. Close a frozen program

Ubuntu usually offers a "Force Quit" window after a few seconds. If it does not, open a terminal with Ctrl + Alt + T and use one of these:

xkill

The pointer becomes a cross; click the stuck window to close it. (On newer Ubuntu versions with Wayland this works only for older programs.)

pkill firefox
pkill -9 firefox

The first line asks the program to close; the second forces it. Replace firefox with the program's name. For a list with a "kill" button, run gnome-system-monitor.

2. Recover a frozen desktop from a text console

  1. Press Ctrl + Alt + F3. A black screen with a login prompt appears (try F4 to F6 if not).
  2. Sign in with your user name and password.
  3. Run top and look at the first lines: the program using nearly all of the processor or memory is the likely cause. Note its number in the PID column and press q.
  4. Stop it:
kill 12345
kill -9 12345

Use the second line only if the first has no effect. Go back to the desktop with Ctrl + Alt + F2 (or F1). If the desktop itself is the problem, restart it. This closes your open programs but is cleaner than the power button:

sudo systemctl restart gdm3

3. A full freeze: restart safely with SysRq

The Linux kernel listens for a special key combination even when everything else is stuck. Hold Alt and SysRq (the Print Screen key; on some laptops with Fn), and press these keys slowly, a second or two apart:

KeyWhat it does
RTakes the keyboard back from the desktop
EAsks all programs to end
IForces the remaining programs to end
SWrites unsaved data to the disk
USets the disks to read-only
BRestarts the computer

The sequence is known as REISUB. On a standard Ubuntu installation only the last three (S, U, B) are switched on, and those are the ones that protect your files. To allow all of them, now and after every restart:

echo 1 | sudo tee /proc/sys/kernel/sysrq
echo "kernel.sysrq = 1" | sudo tee /etc/sysctl.d/90-sysrq.conf

Only if this fails too: hold the power button for about ten seconds. The system checks its disks at the next start.

4. Find the cause

After the restart, read what the system logged before it froze:

journalctl -b -1 -p err
journalctl -k -b -1 | grep -iE 'out of memory|oom|i/o error'

The first command shows errors from the previous start; the second looks for the two most common causes in the kernel's messages. For a known time, add --since "2026-11-19 10:00" --until "2026-11-19 11:00".

5. The usual causes and their fixes

  • Memory is full. The most common cause by far: the system starts using the disk as memory and everything crawls. Check with free -h. Close heavy browser tabs, add memory or swap, and install earlyoom (sudo apt install earlyoom), which ends the greediest program before the system locks up.
  • The disk is full. Check with df -h. A full root partition makes logins and updates fail in odd ways.
  • The graphics driver. Freezes during video, games or when waking from sleep point here. Install the recommended driver with sudo ubuntu-drivers install, or try the other session type (the gear icon on the login screen switches between Wayland and Xorg). See how to check GPU information in Linux.
  • Outdated software. Run sudo apt update && sudo apt full-upgrade and restart.
  • A failing disk or memory module. "I/O error" in the log points to the disk; check it with sudo smartctl -a /dev/sda (package smartmontools). Random freezes with no log entry can be bad memory: run the memory test from the start menu of an Ubuntu USB stick.
  • Heat. A laptop that freezes under load may be overheating. sensors (package lm-sensors) shows the temperatures.

When a server "freezes"

An Ubuntu server has no desktop. When SSH stops answering, the cause is nearly always memory or disk. Restart it from your provider's control panel, then run the commands from steps 4 and 5. If the log shows "Out of memory" again and again, the workload needs more memory than the server has: add swap as a stopgap, or move to a larger Linux VPS. Related guides: fix "sudo: command not found" in Linux and copy and paste in Ubuntu Server.

Questions

Why does Ubuntu freeze randomly?

Most often the memory is full. Other causes are a full disk, the graphics driver, overheating, or failing hardware. The log from the previous start usually shows which.

How do I unfreeze Ubuntu without restarting?

Press Ctrl + Alt + F3, sign in on the text console, find the stuck program with top and end it with kill.

What is REISUB?

A key sequence, pressed while holding Alt and SysRq, that tells the Linux kernel to end programs, save data and restart safely.

Is holding the power button safe?

It is the last resort. Unsaved work is lost, and files being written at that moment can be damaged.