NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.15k stars 13.42k forks source link

hardware.nvidia.powerManagement.enable causing system suspend not to work #254614

Open LDprg opened 11 months ago

LDprg commented 11 months ago

Describe the bug

When I am setting hardware.nvidia.powerManagement.enable = true my nvidia gpu wont boot after suspend or hibarnation.

Steps To Reproduce

  1. Set hardware.nvidia.powerManagement.enable = true
  2. Apply config and reboot
  3. Suspend Laptop
  4. Try to start from suspend

Expected behavior

Well my displaymanager to start after suspend and my laptop not to crash

Additional context

I have a Asus TUF Gaming Laptop with an Ryzen 7 and Nvidia RTX 3060.

Notify maintainers

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 6.1.51, NixOS, 23.11 (Tapir), 23.11.20230908.db9208a`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.17.0`
 - channels(root): `"nixos"`
 - nixpkgs: `/nix/store/9incrwprw2s90minyy0gpmwbxmrkcx1v-source`

Neofetch

[user@system:~]$  neofetch
          ▗▄▄▄       ▗▄▄▄▄    ▄▄▄▖            ld@LD-Laptop 
          ▜███▙       ▜███▙  ▟███▛            ------------ 
           ▜███▙       ▜███▙▟███▛             OS: NixOS 23.11.20230908.db9208a (Tapir) x86_64 
            ▜███▙       ▜██████▛              Host: ASUSTeK COMPUTER INC. FA506QM 
     ▟█████████████████▙ ▜████▛     ▟▙        Kernel: 6.1.51 
    ▟███████████████████▙ ▜███▙    ▟██▙       Uptime: 10 mins 
           ▄▄▄▄▖           ▜███▙  ▟███▛       Packages: 2007 (nix-system), 940 (nix-user), 18 (flatpak) 
          ▟███▛             ▜██▛ ▟███▛        Shell: fish 3.6.1 
         ▟███▛               ▜▛ ▟███▛         Resolution: 1920x1080 
▟███████████▛                  ▟██████████▙   DE: Plasma 5.27.7 
▜██████████▛                  ▟███████████▛   WM: KWin 
      ▟███▛ ▟▙               ▟███▛            Icons: Nordic-darker [GTK2/3] 
     ▟███▛ ▟██▙             ▟███▛             Terminal: kitty 
    ▟███▛  ▜███▙           ▝▀▀▀▀              Terminal Font: monospace 10.0 
    ▜██▛    ▜███▙ ▜██████████████████▛        CPU: AMD Ryzen 7 5800H with Radeon Graphics (16) @ 4.463GHz 
     ▜▛     ▟████▙ ▜████████████████▛         GPU: NVIDIA GeForce RTX 3060 Mobile / Max-Q 
           ▟██████▙       ▜███▙               GPU: AMD ATI Radeon Vega Series / Radeon Vega Mobile Series 
          ▟███▛▜███▙       ▜███▙              Memory: 3618MiB / 31507MiB 
         ▟███▛  ▜███▙       ▜███▙
         ▝▀▀▀    ▀▀▀▀▘       ▀▀▀▘                                     
LDprg commented 11 months ago

Hybernation is also not working with powerManagment enabled!

FrankelJb commented 11 months ago

I'm experiencing the same problem. meta output below. Happy to share any other outputs that can help to troubleshoot

› nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 6.1.51, NixOS, 23.11 (Tapir), 23.11.20230908.db9208a`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.17.0`
 - nixpkgs: `/nix/store/9incrwprw2s90minyy0gpmwbxmrkcx1v-source`
pluiedev commented 10 months ago

I have the same issue, and it's keeping me from switching to Wayland permanently — I can confirm that suspend, sleep and hibernate work perfectly when I switch to X11 within the same user session, so it looks like it's definitely a Wayland + Nvidia issue. (Tested on a RTX 3060 Mobile)

profiluefter commented 8 months ago

Same issue, am having it for a few months already (so it's not recent). If it's enabled my GPU also doesn't start at all and wayland stays blank on KDE Plasma. However if I disable it it just results in corrupted graphics after suspending which isn't much better. (Also I can screenshot it so I'm pretty sure it's not my faulty GPU)

Edit: GPUs I had this issue with: GTX 1080 Ti, GTX 1050 Ti

edmundmiller commented 8 months ago

We should probably start including GPUs in these comments 🫠

Personally: 2070 SUPER 545.29.02

benoitdr commented 7 months ago

Same here, but only when 2nd monitor (hdmi) is connected

nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 6.1.69, NixOS, 23.11 (Tapir), 23.11.2413.32f63574c85f`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.18.1`
 - channels(root): `"home-manager-23.11.tar.gz, nixos-23.11"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`

with NVIDIA RTX A4000 Laptop GPU

LDprg commented 4 months ago

I made a new discovery! The problem only occurs when using the open kernel module for NVIDIA, which make kind of sense.

Maybe there should be a check that open and powerManagement.enable are not enabled at the same time.

Edit: Hibernation working too

programotuojes commented 4 months ago

The problem only occurs when using the open kernel module for NVIDIA

Thanks to you, I also made a discovery. Despite not using the open kernel module, I experienced the same symptoms. Turns out it was due to me using an older driver version - 535.129.03 (referenced through config.boot.kernelPackages.nvidiaPackages.production). The newer one (545.29.02) works fine. I made this change, because on the newer version screen brightness control does not work. I guess I'll just have to choose the lesser of the two devils.

Maybe there should be a check that open and powerManagement.enable are not enabled at the same time.

This bug occurs when using Plasma with Wayland. A check would be overkill IMO, though it would be nice to have it at least mentioned in the option's description. But even that's probably not worth it, as per https://github.com/NVIDIA/open-gpu-kernel-modules/issues/472#issuecomment-1918464628, the fix is being actively worked on. Hopefully it's fixed in the near future.

LDprg commented 4 months ago

@programotuojes are you using kde plasma 5 or 6? I got no problems using kde 6 and latest drivers.

pwaller commented 1 month ago

@LDprg

I made a new discovery! The problem only occurs when using the open kernel module for NVIDIA, which make kind of sense.

Unfortuantely on my GeForce 1080, I have nix eval .#nixosConfigurations.machinename.config.hardware.nvidia.open set to false;

With hardware.nvidia.powerManagement.enable = true:

With hardware.nvidia.powerManagement.enable = false:

LDprg commented 1 month ago

@pwaller Try with and without the open nvidia kernel drivers. They should have fixed the open ones (afaik) with the 555 driver.

pwaller commented 1 month ago

I think my hardware is too old for the open drivers, it's a 10xx series where the open driver started at the ~20xx~ (edit: 16xx) series.