NVIDIA: Difference between revisions
Explain that iGPU Xorg driver is needed for offloading, see https://discourse.nixos.org/t/how-to-use-nvidia-prime-offload-to-run-the-x-server-on-the-integrated-board/9091/31 and https://github.com/NixOS/nixpkgs/pull/412648 |
Add shortcut to Docker NVIDIA section |
||
| (7 intermediate revisions by 6 users not shown) | |||
| Line 206: | Line 206: | ||
This allows you to pin the specific driver version being used in your NixOS installation. | This allows you to pin the specific driver version being used in your NixOS installation. | ||
You might want to do this if you are running the newest kernel, as the packaged drivers may fail to build otherwise<ref>https://github.com/NixOS/nixpkgs/issues/429624#issuecomment-3189861599</ref>. | |||
== Troubleshooting == | == Troubleshooting == | ||
| Line 236: | Line 237: | ||
=== Graphical corruption and system crashes on suspend/resume === | === Graphical corruption and system crashes on suspend/resume === | ||
<code>powerManagement.enable = true</code> can sometimes fix this, but is itself unstable and is known to cause suspend issues. | <code>powerManagement.enable = true</code> can sometimes fix this, but is itself unstable and is known to cause suspend issues. | ||
<code>hardware.nvidia.powerManagement.enable = true</code> can also sometimes fix this issue; it is <code>false</code> by default. | |||
{{Note|When the <code>hardware.nvidia.powerManagement.enable</code> option is enabled, the driver saves video memory to <code>/tmp</code> by default. If <code>/tmp</code> is backed by tmpfs (RAM) and the GPU VRAM usage exceeds the available space, the system will not resume and you will see a blank screen instead. | |||
To resolve this, redirect the temporary file to a storage location with sufficient capacity (e.g., <code>/var/tmp</code>) using kernel parameters: | |||
{{file|configuration.nix|nix|<nowiki> | |||
boot.kernelParams = [ "nvidia.NVreg_TemporaryFilePath=/var/tmp" ]; | |||
</nowiki>}} | |||
}} | |||
If you have a modern NVIDIA GPU (Turing [https://en.wikipedia.org/wiki/Turing_(microarchitecture)#Products_using_Turing] or later), you may also want to investigate the <code>hardware.nvidia.powerManagement.finegrained</code> option: [https://download.nvidia.com/XFree86/Linux-x86_64/460.73.01/README/dynamicpowermanagement.html] | If you have a modern NVIDIA GPU (Turing [https://en.wikipedia.org/wiki/Turing_(microarchitecture)#Products_using_Turing] or later), you may also want to investigate the <code>hardware.nvidia.powerManagement.finegrained</code> option: [https://download.nvidia.com/XFree86/Linux-x86_64/460.73.01/README/dynamicpowermanagement.html] | ||
[https://discourse.nixos.org/t/suspend-resume-cycling-on-system-resume/32322/12 A potential fix] that Interrupts the gnome-shell in time so it’s not trying to access the graphics hardware. <ref>https://discourse.nixos.org/t/suspend-resume-cycling-on-system-resume/32322/12</ref> The entire purpose is to manually "pause" the GNOME Shell process just before the system sleeps and "un-pause" it just after the system wakes up. | |||
<hr> | |||
If you have graphical corruption upon waking from suspend, and the above causes the system to go back to sleep ~20-30 seconds after wakeup, the following may solve both issues: | |||
{{File|3={ | |||
# https://discourse.nixos.org/t/black-screen-after-suspend-hibernate-with-nvidia/54341/6 | |||
# https://discourse.nixos.org/t/suspend-problem/54033/28 | |||
systemd = { | |||
# Uncertain if this is still required or not. | |||
services.systemd-suspend.environment.SYSTEMD_SLEEP_FREEZE_USER_SESSIONS = "false"; | |||
services."gnome-suspend" = { | |||
description = "suspend gnome shell"; | |||
before = [ | |||
"systemd-suspend.service" | |||
"systemd-hibernate.service" | |||
"nvidia-suspend.service" | |||
"nvidia-hibernate.service" | |||
]; | |||
wantedBy = [ | |||
"systemd-suspend.service" | |||
"systemd-hibernate.service" | |||
]; | |||
serviceConfig = { | |||
Type = "oneshot"; | |||
ExecStart = ''${pkgs.procps}/bin/pkill -f -STOP ${pkgs.gnome-shell}/bin/gnome-shell''; | |||
}; | |||
}; | |||
services."gnome-resume" = { | |||
description = "resume gnome shell"; | |||
after = [ | |||
"systemd-suspend.service" | |||
"systemd-hibernate.service" | |||
"nvidia-resume.service" | |||
]; | |||
wantedBy = [ | |||
"systemd-suspend.service" | |||
"systemd-hibernate.service" | |||
]; | |||
serviceConfig = { | |||
Type = "oneshot"; | |||
ExecStart = ''${pkgs.procps}/bin/pkill -f -CONT ${pkgs.gnome-shell}/bin/gnome-shell''; | |||
}; | |||
}; | |||
}; | |||
# https://discourse.nixos.org/t/black-screen-after-suspend-hibernate-with-nvidia/54341/23 | |||
hardware.nvidia.powerManagement.enable = true; | |||
}|name=configuration.nix|lang=nix}} | |||
=== Black screen or 'nothing works' on laptops === | === Black screen or 'nothing works' on laptops === | ||
| Line 248: | Line 311: | ||
boot.kernelParams = [ "module_blacklist=amdgpu" ]; | boot.kernelParams = [ "module_blacklist=amdgpu" ]; | ||
</syntaxHighlight> | </syntaxHighlight> | ||
=== NVIDIA Docker Containers === | |||
See: [[Docker#NVIDIA Docker Containers]] | |||
== Disabling == | == Disabling == | ||