Disclaimer: We may earn a commission when you purchase products linked throughout our site.

DigitalOcean โ€” Cloud hosting for developers
Restart X and Reset Your Desktop Session on Ubuntu Without Rebooting

Restart X and Reset Your Desktop Session on Ubuntu Without Rebooting

Multiple methods to restart the X server, reset a frozen desktop session, and recover from display manager crashes on Ubuntu 24.04 without a full reboot.

When your Ubuntu desktop freezes โ€” the mouse moves but nothing responds, or worse, the screen goes completely black with only a blinking cursor โ€” your first instinct is to hold the power button and force a reboot. But there are faster, cleaner recovery paths that preserve your unsaved work in terminal applications, keep background processes running, and get you back to a working desktop in seconds. This guide covers every method for restarting the display server, resetting a stuck desktop session, and recovering from display manager failures on Ubuntu 24.04, across both Wayland and Xorg sessions. Having rescued hundreds of frozen desktops over the years (including many of our own during GPU driver testing), these techniques are well-tested under pressure.

Method 1: Kill the Compositor (Wayland Session)

If you are running GNOME on Wayland (the Ubuntu 24.04 default), the compositor is GNOME Shell itself. Killing it restarts the entire graphical session โ€” you will be dropped to the GDM login screen, and all graphical applications in that session will close.

Switch to a TTY: Ctrl+Alt+F3

Log in with your username and password, then:

sudo systemctl restart gdm3

This restarts GDM, which kills the Wayland compositor and respawns the login screen. Log back in and you have a fresh session.

What survives: Any process running in a tmux or screen session on a TTY. SSH connections. Background services managed by systemd.

What dies: All graphical applications โ€” unsaved work in GUI apps is lost. Terminal emulators within the desktop session are also killed.

Method 2: Restart Just the Display Manager

If the login screen itself is broken (GDM shows a black screen or crashes repeatedly), you can cycle the display manager:

sudo systemctl stop gdm3
sleep 2
sudo systemctl start gdm3

This is gentler than a full restart and sometimes resolves GDM issues caused by a stale session lock or a GPU driver hiccup.

For LightDM (used by Xubuntu, Lubuntu):

sudo systemctl restart lightdm

For SDDM (Kubuntu):

sudo systemctl restart sddm

Method 3: The SysRq REISUB Sequence (Last Resort Before Power Button)

If the system is so frozen that you cannot switch to a TTY (keyboard appears unresponsive to Ctrl+Alt+F3), the Magic SysRq keys can perform a graceful shutdown:

Hold Alt+SysRq (the Print Screen key on most keyboards), then slowly type:

R โ€“ switch keyboard from raw mode E โ€“ send SIGTERM to all processes I โ€“ send SIGKILL to remaining processes S โ€“ sync all filesystems U โ€“ remount all filesystems read-only B โ€“ reboot

Wait 2โ€“3 seconds between each key. The mnemonic: “Reboot Even If System Utterly Broken.”

This is a controlled reboot, not a hard power-off. It flushes disk caches and unmounts filesystems cleanly, significantly reducing the risk of data corruption.

Enabling SysRq

On Ubuntu 24.04, SysRq may be partially disabled by default. To enable all functions:

echo 1 | sudo tee /proc/sys/kernel/sysrq

To make it permanent:

echo 'kernel.sysrq=1' | sudo tee /etc/sysctl.d/99-sysrq.conf

Method 4: Ctrl+Alt+Backspace (If Enabled)

The classic X11 kill shortcut, Ctrl+Alt+Backspace, is disabled by default on modern Ubuntu. If you enable it (see our dedicated guide), pressing this key combination kills the X server immediately โ€” you are dropped to the display manager login screen.

This only works on Xorg sessions. On Wayland, the key combination does nothing because there is no X server to kill.

Method 5: SSH In from Another Device

If you have SSH enabled on the frozen machine, connect from your phone (using Termius or JuiceSSH) or another computer:

ssh user@machine-ip

From there, you can:

  • Kill a specific frozen application: killall firefox
  • Restart the display manager: sudo systemctl restart gdm3
  • Check system logs: journalctl -b -p 3 (shows critical errors from current boot)
  • Check GPU state: nvidia-smi (for Nvidia) or cat /sys/kernel/debug/dri/0/amdgpu_pm_info (for AMD)

This is the most surgical approach โ€” you can identify and kill the offending process without disrupting the entire session.

Diagnosing Why the Desktop Froze

After recovering, investigate the cause so it does not recur.

Check System Logs

journalctl -b -1 -p 3

The -b -1 flag shows logs from the previous boot (if you rebooted), and -p 3 filters for error-level messages.

Common Causes

SymptomLikely causeFix
Mouse moves, nothing clickableGNOME Shell/Mutter crashedRestart GDM
Complete black screen, cursor blinksGPU driver crashReinstall GPU driver, check kernel logs
Screen frozen, no mouseKernel panic or OOMCheck dmesg, add swap, check RAM
Login loop after crashCorrupted .XauthorityDelete ~/.Xauthority
Desktop starts then crashesExtension or theme conflictBoot with extensions disabled: gnome-shell --disable-extensions

OOM Killer

If the system ran out of memory, the kernel’s OOM (Out of Memory) killer may have terminated your desktop compositor:

dmesg | grep -i "oom\|out of memory"

If this is recurring, you either need more RAM, more swap, or to identify the memory-hungry culprit (often a browser with too many tabs).

Preventing Future Freezes

  1. Enable swap: Even on systems with 32 GB RAM, a 4โ€“8 GB swap partition or swapfile prevents OOM kills during memory spikes.
  2. Keep GPU drivers updated: Most desktop freezes on Nvidia hardware trace back to driver bugs. Use the driver version Ubuntu recommends via ubuntu-drivers.
  3. Monitor with htop: Run htop in a tmux session on a TTY. If the desktop freezes, switch to that TTY to see what is consuming resources.
  4. Limit browser memory: Chrome’s Memory Saver mode and Firefox’s about:memory page help control the biggest RAM consumer on most desktops.