Why is my new NixOS install suspending?

I’ve just installed NixOS 22.05 from scratch on a server, and it keeps suspending (and crashing badly when resuming from suspend):

$ journalctl --boot=-1 --unit=systemd-suspend.service
Jun 03 23:04:04 lib systemd[1]: Starting System Suspend...
Jun 03 23:04:04 lib systemd-sleep[1632]: Entering sleep state 'suspend'...

It’s a server, so it should never suspend. I’ve disabled automatic suspend in the GNOME power settings, and the only suspension-related configuration I have is services.logind.extraConfig = "HandlePowerKey=suspend";. What else should I look for before reaching for the hack of just explicitly disabling the service? Also, is there some way to tell what activated the service?

1 Like

I’ve had similar problems with my server that has GNOME installed on it. Here’s some configuration I have on it:

  services.xserver.displayManager.gdm.autoSuspend = false;
  security.polkit.extraConfig = ''
    polkit.addRule(function(action, subject) {
        if (action.id == "org.freedesktop.login1.suspend" ||
            action.id == "org.freedesktop.login1.suspend-multiple-sessions" ||
            action.id == "org.freedesktop.login1.hibernate" ||
            action.id == "org.freedesktop.login1.hibernate-multiple-sessions")
            return polkit.Result.NO;

You can look at Disabling gdm.autoSuspend still auto suspends · Issue #100390 · NixOS/nixpkgs · GitHub for some more details about this issue.


Thank you very much! I’ll give that a try. But why is that issue marked as resolved? Also, why would this only affect one of my several machines with NixOS 22.05?

That issue is specifically about

services.xserver.displayManager.gdm.autoSuspend = false;

which we could basically only resolve by improving the documentation, which we did.

It seems like it would be nice for there to be some general auto suspend option that turns everything else off though!