Fixing GNOME Terminal Freezes on Wayland

Heavy background jobs on a 4K laptop display

Why GNOME Terminal can freeze on a 4K Wayland display

When you fire up a heavy background job—think dd, fio, or a long‑running rsync—the terminal can suddenly stop answering. On a 4K laptop running Wayland the culprit is usually the compositor trying to keep the terminal’s output fresh while the CPU is busy elsewhere. The rendering loop stalls, and the window looks frozen even though the shell is still alive. The cure is to separate the terminal’s repainting from the job’s I/O, or to give the compositor a lighter load.

Below is a step‑by‑step walk‑through that covers the most common causes, practical workarounds, and a few permanent fixes that work on Fedora, Ubuntu, Arch, and other mainstream distros.


1. Re‑enable the “background” rendering mode

GNOME Terminal has a background mode that tells the compositor to skip repainting the terminal when it’s not in focus. Wayland disables it by default because it can cause visual glitches, but re‑enabling it cuts GPU usage and keeps the terminal responsive.

gsettings set org.gnome.Terminal.Legacy.Settings enable-background true

Restart GNOME Terminal and verify:

gsettings get org.gnome.Terminal.Legacy.Settings enable-background
# → true

Trade‑off: Some users notice that scrollback looks a bit choppier, but for heavy jobs the benefit usually outweighs the minor visual change.


2. Use a “plain” terminal that doesn’t depend on Wayland

If the problem sticks around, the simplest workaround is to run a terminal that renders directly to the framebuffer or uses a different backend.

Terminal Backend Why it helps
xterm X11 Bypasses Wayland’s compositor for the terminal window.
alacritty OpenGL Uses its own GPU rendering; less affected by Wayland’s scheduling.

2.1 Install and use xterm

sudo apt install xterm   # Debian/Ubuntu
sudo dnf install xterm   # Fedora
sudo pacman -S xterm     # Arch

Launch it:

xterm -hold -e bash

The -hold flag keeps the window open after the command finishes, handy for debugging.

2.2 Install and use alacritty

sudo pacman -S alacritty   # Arch
sudo dnf install alacritty # Fedora

Create a minimal config in ~/.config/alacritty/alacritty.yml:

font:
  size: 12
  normal:
    family: "DejaVu Sans Mono"

Run:

alacritty

It’s lightweight and performs beautifully on high‑resolution displays.


3. Reduce the terminal’s scrollback size

A huge scrollback buffer forces the terminal to keep a massive amount of text in memory, which can slow down rendering when the buffer is full. Trim it to a sane value.

gsettings set org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:<PROFILE_ID>/ scrollback-unlimited false
gsettings set org.gnome.Terminal.Legacy.Profile:/org/gnome/terminal/legacy/profiles:/:<PROFILE_ID>/ scrollback-lines 1000

Get <PROFILE_ID> with:

gsettings get org.gnome.Terminal.ProfilesList default

4. Offload heavy jobs to a separate TTY

The most bulletproof solution is to run the job in a virtual console instead of inside the terminal. Wayland doesn’t touch TTYs, so the job can use all CPU resources without affecting the GUI.

  1. Switch to a free TTY:

    Ctrl+Alt+F3
    
  2. Log in with your user credentials.

  3. Run the heavy job directly:

    dd if=/dev/zero of=/tmp/hugefile bs=1M count=1000 status=progress
    
  4. Return to the GUI:

    Ctrl+Alt+F2   # or F1 on some systems
    

Tip: A quick script can launch the job in a TTY and log output:

#!/usr/bin/env bash
tty=$(tty)
echo "Running on $tty"
dd if=/dev/zero of=/tmp/hugefile bs=1M count=1000 status=progress

Make it executable:

chmod +x ~/run_job.sh

5. Use nice or cpulimit to throttle CPU usage

If the job is CPU‑bound, throttling it keeps the terminal responsive.

nice -n 10 dd if=/dev/zero of=/tmp/hugefile bs=1M count=1000 status=progress

Or with cpulimit:

sudo apt install cpulimit   # Debian/Ubuntu
sudo dnf install cpulimit   # Fedora
sudo pacman -S cpulimit     # Arch

cpulimit -l 50 -e dd -- dd if=/dev/zero of=/tmp/hugefile bs=1M count=1000 status=progress

cpulimit caps the process at 50 % of a single CPU core, freeing the rest for the compositor.


6. Disable Wayland’s “GPU compositing” for the terminal

Wayland can be told to use a different compositor for specific windows via the GDK_BACKEND environment variable. Setting it to x11 forces the terminal to use the X11 backend, which is less demanding on a 4K display.

GDK_BACKEND=x11 gnome-terminal

Add this to ~/.bashrc if you want every new terminal to use X11:

export GDK_BACKEND=x11

Caveat: This disables Wayland for the terminal only; the rest of the desktop stays on Wayland.


7. Upgrade the compositor

If you’re on an older kernel or Mesa, the compositor may not be optimized for 4K. Updating the kernel and graphics stack often fixes the issue.

# Debian/Ubuntu
sudo apt update && sudo apt full-upgrade

# Fedora
sudo dnf upgrade

# Arch
sudo pacman -Syu

Check the kernel version:

uname -r

A recent kernel (≥ 6.5) and Mesa (≥ 23.2) provide better Wayland support for high‑resolution displays. For reference, see the kernel’s release notes on https://kernel.org.


8. Monitor compositor performance

Use top or htop to see if the compositor (mutter on GNOME) is eating a lot of CPU when the job runs.

htop

Look for mutter or wayland. If they spike to 100 % during heavy jobs, the compositor is the bottleneck.


9. Adjust GNOME’s “animation” settings

Animations add extra GPU work. Disabling them can reduce the load.

gsettings set org.gnome.desktop.interface enable-animations false

Re‑enable when you’re done:

gsettings set org.gnome.desktop.interface enable-animations true

10. Use screen or tmux to detach jobs

Detaching a job from the terminal keeps the terminal responsive and lets you reattach later.

# Start screen
screen -S heavy_job
dd if=/dev/zero of=/tmp/hugefile bs=1M count=1000 status=progress
# Detach with Ctrl+A D

Re‑attach:

screen -r heavy_job

tmux works similarly and is often preferred for its scripting capabilities.


11. Practical example: copying a large ISO

Suppose you’re copying a 4 GB ISO to a USB stick and the terminal freezes.

# Using dd with a separate TTY
Ctrl+Alt+F3
sudo dd if=ubuntu-22.04.iso of=/dev/sdb bs=4M status=progress

If you prefer to keep the GUI, use nice:

nice -n 10 dd if=ubuntu-22.04.iso of=/dev/sdb bs=4M status=progress

Or run it in screen:

screen -S iso_copy
dd if=ubuntu-22.04.iso of=/dev/sdb bs=4M status=progress

Detach with Ctrl+A D and reattach later.


12. Troubleshooting checklist

Symptom Likely cause Fix
Terminal freezes after a few seconds of output Compositor busy repainting 4K buffer Re‑enable background mode, reduce scrollback, or use xterm
Terminal lags but doesn’t freeze CPU bound job Use nice or cpulimit
Terminal remains responsive but output is delayed Wayland compositor throttles I/O Switch to GDK_BACKEND=x11 or run job in TTY
Terminal crashes after a long run Out‑of‑memory due to huge scrollback Reduce scrollback lines
Compositor spikes to 100 % Old kernel/Mesa Upgrade kernel and graphics stack

13. Security note

Running heavy jobs in a TTY or with nice doesn’t expose new security risks. However, if you’re copying files to external media, always verify the integrity of the data with checksums:

sha256sum ubuntu-22.04.iso

Store the checksum on a trusted device before writing to the USB stick.


14. Summary of best practices

  1. Enable terminal background mode (gsettings set org.gnome.Terminal.Legacy.Settings enable-background true).
  2. Reduce scrollback to 1 000 lines.
  3. Throttle CPU with nice or cpulimit.
  4. Run the heaviest jobs in a separate TTY.
  5. Consider a lightweight terminal (xterm, alacritty).
  6. Keep the system up‑to‑date (kernel ≥ 6.5, Mesa ≥ 23.2).
  7. Disable animations while the job runs.

Follow these steps and GNOME Terminal stays responsive on a 4K laptop running Wayland, letting you focus on the task instead of chasing a frozen window.

See also