Suspend/resume cycling on system resume

After upgrading to nixpkgs ~18324978d632ffc55ef1d928e81630c620f4f447 (when I first noticed the issue), my system is unable to effectively resume from sleep. When I resume the system, it will forcibly re-suspend itself… until it doesn’t. It usually takes between 3-10 attempts for system to stay awake, with anywhere from 5-30 seconds between resumes and re-suspends.

In the journalctl logs below, you’ll see:

Aug 29 10:47:59 nixos systemd-sleep[137498]: System returned from sleep state.
...
Aug 29 10:48:23 nixos systemd-logind[1156]: The system will suspend now!

Not sure where to start with debugging, since the journal doesn’t (to me) show any obvious kernel/login errors.


Relevant details from neofetch:

OS: NixOS 23.11.20230827.a999c1c (Tapir) x86_64
Kernel: 6.1.47
DE: GNOME 44.3
WM: Mutter
CPU: AMD Ryzen 7 2700X (16) @ 3.700GHz
GPU: NVIDIA GeForce RTX 3060 Ti


Here’s the bits of my configuration.nix relating to graphics & DE config:

{
  boot.kernelModules = [
    "nvidia"
  ];

  hardware.nvidia = {
    modesetting.enable = true;
    powerManagement.enable = true;
  };

  hardware.opengl = {
    enable = true;

    driSupport = true;
    driSupport32Bit = true;

    extraPackages = with pkgs; [
      nvidia-vaapi-driver
    ];
  };

  services.xserver = {
    enable = true;

    videoDrivers = [ "nvidia" ];

    desktopManager.gnome.enable = true;
    displayManager.gdm.enable = true;
  };
}

Here’s my full journalctl, starting from the suspend last night, resume this morning, and subsequent 8-ish suspend/resume cycles: https://fars.ee/fH2w

Did you ever find a solution to this problem? I think I have the same issue… I also have a NVIDIA GPU, and I could be wrong, but I don’t remember having this problem prior to adding NVIDIA into my configuration. I had a look in my journalctl, but I couldn’t see any information to track down the root cause.

OS: NixOS 23.11.20231201.5de0b32 (Tapir) x86_64 
Host: ASRock Z370M-ITX/ac 
Kernel: 6.1.64 
Uptime: 4 hours, 13 mins 
Packages: 952 (nix-system), 405 (nix-user) 
Shell: fish 3.6.1 
Resolution: 2560x1440, 2560x1440 
DE: GNOME 45.1 (Wayland) 
WM: Mutter 
WM Theme: Adwaita 
Theme: Adwaita [GTK2/3] 
Icons: Adwaita [GTK2/3] 
Terminal: kgx 
CPU: Intel i5-8600K (6) @ 4.300GHz 
GPU: NVIDIA GeForce GTX 1060 6GB 
Memory: 3465MiB / 15937MiB

I have slowly narrowed the issue down, and have lodged an issue with the GNOME team. Please see the linked issue for additional information and to help narrow down whether we have the same problem. For me, it looks to be an issue with the power plugin of the gnome-settings-daemon.

I’ve also experienced this periodically. I’ve just discovered Suspend in multiseat not working correctly: One seat causes the entire installation to go into suspend mode (#611) · Issues · GNOME / gnome-settings-daemon · GitLab and wonder if this could be the cause. I have multiple systems and the bug does not manifest on all of them, but I’ve noticed it manifests on a system with multiple users logged in, so I’m wondering if that could be a missing piece of the puzzle. Do you have multiple users logged in also, perhaps?

I have the same issue, but for me powerManagement.enable = true; seems to be the culprit. When I set it to false I no longer have suspend/resume cycles.

1 Like

Confirming hardware.nvidia.powerManagement.enable = false; fixes the suspend/resume cycles — but I forgot I’d turned that on in the first place to fix app crashes on resume :frowning:

https://wiki.archlinux.org/title/NVIDIA/Tips_and_tricks#Preserve_video_memory_after_suspend

Having to restart an app or two is better than rendering the entire computer unusable, I suppose?

I wonder if it is a NixOS specific thing or a NVIDIA thing.

It was also discontinued on amd graphics as well. And, even if I reboot, it stops.