Fix a 60-second hang on suspend that ends with the machine waking back up
The mechanism and the env var are real: systemd's ENVIRONMENT.md documents SYSTEMD_SLEEP_FREEZE_USER_SESSIONS as "Takes a boolean. When true (the default), user.slice will be frozen during sleep. When false it will not be." The four unit names and drop-in paths are correct, and systemctl thaw user.slice is a real command. What is missing is the caveat that ships with that same documentation: systemd upstream explicitly recommends against setting it, because disabling the freeze causes undesired behaviour with home-directory encryption and with systemd-suspend-then-hibernate.service, which the suspend-then-hibernate record in this same set tells users to enable. Handing someone a copy-paste loop that silently degrades s2h and homed without saying so is an incomplete fix.
The Arch wiki notes this drop-in can itself prevent some systems from entering sleep at all (an AMD graphics bug). If suspend stops working entirely afterwards, delete the drop-in files and daemon-reload.
Symptom
Suspend takes about a minute and then the machine wakes itself back up, or it resumes but I can no longer open a new session. The journal shows Failed to freeze unit 'user.slice' before sleep, and login attempts fail with: pam_systemd(login:session): Failed to create session: Job 9876 for unit 'session-6.scope' failed with 'frozen'
Cause
Since systemd v256, systemd-sleep freezes user.slice before entering sleep. On some kernels this fails, notably when KVM is in use, leaving cgroups stuck in the frozen state.
Fix
Confirm this is actually your failure before changing anything. You want to see the freeze failure in the journal, not just a slow suspend:
journalctl -b -1 -u systemd-suspend.service | grep -i 'freeze\|user.slice'
Unstick a currently frozen session without rebooting:
sudo systemctl thaw user.slice
If KVM/libvirt is involved, try stopping the guests before suspend first. That avoids the workaround entirely.
Only then apply the override. Read this first: systemd upstream advises against this setting. With it disabled you can get incorrect behaviour with encrypted home directories (systemd-homed) and with systemd-suspend-then-hibernate. If you use suspend-then-hibernate, apply the drop-in to the suspend unit only rather than all four:
for u in systemd-suspend systemd-hibernate systemd-hybrid-sleep systemd-suspend-then-hibernate; do
sudo mkdir -p "/etc/systemd/system/$u.service.d"
printf '[Service]\nEnvironment=SYSTEMD_SLEEP_FREEZE_USER_SESSIONS=false\n' \
| sudo tee "/etc/systemd/system/$u.service.d/nofreeze.conf" >/dev/null
done
sudo systemctl daemon-reload
Treat it as a temporary workaround and re-test after kernel/systemd updates. Remove the drop-ins with sudo rm -r /etc/systemd/system/systemd-{suspend,hibernate,hybrid-sleep,suspend-then-hibernate}.service.d/nofreeze.conf and daemon-reload.
Verify
systemctl suspend enters sleep within a couple of seconds. journalctl -b | grep -i freeze shows no Failed to freeze unit lines, and systemctl show user.slice -p FreezerState reports FreezerState=running.