System is frozen after resume from suspend, when a virtual machine is running

Problem

In certain cases, when a virtual machine (VM) is running during system suspend (laptop lid closed, system idle, etc), the system appears completely frozen after resume. Just a black screen and no reaction to any input.

So far this has been demonstrated with systems with a libvirt-based virtual machines (i.e. virt-manager, gnome-boxes), when the VM is running in a user session (the default approach for gnome-boxes, but not for virt-manager). It doesn’t happen when the VM is running in a system session.

Additionally, another symptom of this bug is that the suspend process takes a full minute instead of just a few seconds.

You can discuss this topic here.

Cause

There’s a bug probably in systemd, which tries to freeze the user session during suspend, but fails if a user-session VM is currently running. Systemd then gets stuck in the freezing state, and never thaws the user session, after the system is resumed.

Related Issues

Bugzilla report: #2321268

Workarounds

Workarounds are no longer necessary, because a proper fix is now available (see below). If you installed a workaround in the past, please revert it this way:

sudo systemctl revert systemd-suspend.service systemd-hibernate.service systemd-suspend-then-hibernate.service
sudo systemctl daemon-reload

Solution

1 Like

This is fixed in systemd-256.8-1.fc41 (it disables user session freezing by default). Update your system as usual, reboot, and you should no longer be affected by it.

If you performed any workarounds before the fix was released, please don’t forget to revert them.

2 Likes