I am having problems with suspend on NixOS 24.05.
I have a NVIDIA 970. I know bad hardware choice yada yada… But I have to live with my decisions from 10+ years ago.
I read the Nvidia NixOS Wiki here: Nvidia - NixOS Wiki
But no matter how I configure it some problems persist.
hardware.nvidia = {
...
# If this on -> suspend fails: wakes up 1 sec after suspend
# If this off -> graphical glitches after wakeup
powerManagement.enable = true;
# Changing this to beta, production, ... does not help
package = config.boot.kernelPackages.nvidiaPackages.stable;
};
Am I missing something?
What can I change?
(Suspend was working fine on Fedora 40, so probably no hardware failure.)
The difference from Fedora could be explained by kernel and driver versions. I’d consider bumping the kernel version to the latest for testing, too. Using nouveau would also change things, and I’m pretty sure that’s the default over there.
If updating the driver doesn’t help, and the nvidia docs don’t seem applicable, get dmesg, journalctl --boot and journalctl --boot -1 logs for both settings and see if you can infer something from those. Make sure to do a full reboot after changing the setting (and updating drivers/kernels).
You can use journalctl --boot -1 to share logs from the previous boot.
That said, yeah, looks very much like an nvidia bug. Not much that can be done about it, unless you find out what the difference between the fedora and NixOS kernels is, and apply the same patches to yours.
The suspend now is very inconsistent, sometimes it suspends and wakes up again immediately, sometimes it fails to suspend altogether, sometimes suspend even worked.
Here is another example of journalctl --boot -1 - maybe not as helpful as not all messages are not saved because of the force shutdown:
Okt 10 11:30:19 nixos systemd-logind[776]: The system will suspend now!
Okt 10 11:30:19 nixos sudo[3320]: pam_unix(sudo:session): session closed for user root
Okt 10 11:30:19 nixos systemd[1]: Starting NVIDIA system suspend actions...
Okt 10 11:30:19 nixos systemd[1]: Starting Pre-Sleep Actions...
Okt 10 11:30:19 nixos systemd[1]: pre-sleep.service: Deactivated successfully.
Okt 10 11:30:19 nixos systemd[1]: Finished Pre-Sleep Actions.
Okt 10 11:30:19 nixos systemd[1]: Reached target Sleep.
Okt 10 11:30:20 nixos .cosmic-comp-wrapped[1198]: Failed to submit rendering: Failed to submit result for display
Caused by:
0: The underlying drm surface encountered an error: DRM access error: Page flip commit failed on device `Some("/dev/dri/card0")` (Permission denied (os error 13))
1: DRM access error: Page flip commit failed on device `Some("/dev/dri/card0")` (Permission denied (os error 13))
2: Permission denied (os error 13)
Okt 10 11:30:20 nixos systemd[1]: nvidia-suspend.service: Deactivated successfully.
Okt 10 11:30:20 nixos systemd[1]: Finished NVIDIA system suspend actions.
Okt 10 11:30:20 nixos systemd[1]: nvidia-suspend.service: Consumed 509ms CPU time, 453.2M memory peak.
Okt 10 11:30:20 nixos systemd[1]: Starting System Suspend...
I think I am not technical enough to compare kernel patches.
So probably my NixOS journey stops here.
Sad to see it! I loved the declarative approach, so much easier than traditional distros.
Thank you for your help again!
If anyone still finds something I am very happy to try it though!
It lists this bug as having been fixed, maybe this is what you’re looking for? To be clear, this would mean you needpowerManagement.enable, but that’s kind of how this is supposed to work anyway.
Yeaaah, you still get guarantees of subsequent evaluations being the same, though, i.e., ssh server cert style (aka TOFU).
Nix unfortunately does use an unorthodox method (and character sets) for hashing, so sadly the hashes published upstream can’t be converted. This is the best you get in the nix world.
Hey Tlater, thanks for the @.
I had enough of it TBH and bought myself an Intel A310 off ebay.
After years of glitches on suspend across all distros I was just amazed at how everything now ‘just works’ since the drivers are in the kernel.
Even things like gnome remote desktop are perfect now which I could never get to work with the two pascal cards I have here.
Thanks again for your help.