All nividia drivers crash or do not work

I have followed the wiki page Nvidia - NixOS Wiki while trying to install Nivida drivers onto my system

KDE Plasma Version: 6.0.5
KDE Frameworks Version: 6.2.0
Qt Version: 6.7.1
Kernel Version: 6.6.34 (64-bit)
Graphics Platform: Wayland
Processors: 16 × AMD Ryzen 7 3700X 8-Core Processor
Memory: 15.6 GiB of RAM
Graphics Processor: llvmpipe

i have an rtx 2060 and i have tried all of the driver versions listed in the wiki aswell as a few forum posts a saw after doing anything may things happen like my performance tanks discord dosent launch minecraft flashes rapidly with a red screen and more

these are the config settings im trying to use

  # nixpkgs.config.nvidia.acceptLicense = true;
  # hardware.nvidia.package = config.boot.kernelPackages.nvidiaPackages.stable; #dosent work
  # hardware.nvidia.package = config.boot.kernelPackages.nvidiaPackages.beta;  #dosent work
  # hardware.nvidia.package = config.boot.kernelPackages.nvidiaPackages.production; #dosent work
  # hardware.nvidia.package = config.boot.kernelPackages.nvidiaPackages.vulkan_beta; #dosent work
  # DO NOT USE # hardware.nvidia.package = config.boot.kernelPackages.nvidiaPackages.legacy_470; # DOES NOT WORK KILLS PC PERFORAMNCE
  # services.xserver.videoDrivers = [ "nvidia" ]; #even using this by itself or along side open gl it dosent work as intended
  # hardware.opengl.enable = true;
  # hardware.opengl.driSupport32Bit = true; #seemingly does nothing
  # hardware.nvidia.modesetting.enable = true;
  # hardware.nvidia.powerManagement.enable = true;
  # hardware.nvidia.open = false; #changes nothing weither open source or not when rebuilding and then rebooting
  # hardware.nvidia.nvidiaSettings = true;

each time i changed a value i use nixos-reboot switch and then also rebooted my pc

if you require any more information let me know i would really like to get this fixed

UPDATE

i tried the fix for the 4070 super Nvidia - NixOS Wiki and it has fixed minecraft not loading 1/2 issues that im having now my discord opens atleast i just need to stop it from being a black screen :slight_smile:

1 Like

Yeah, that’s just wayland problems currently, sadly, at least without explicit sync, which KDE has AIUI, but only with the very latest nvidia driver.

You’ll have to be a bit more clear about what other problems you’re encountering. The most recent nvidia driver helps even without explicit sync on sway in my case (2070) - are your channels up to date? What nvidia driver is actually installed? Check nvidia-settings for that.

2 Likes

im on KDE.
i have fixed the minecraft issue via the 4070 fix. now the only issue that i am running into is discord opens but is just black there is no ui it seems to be a driver issue as it wasnt present before i tried installing drivers
the driver that is installed now is 535.154.05. im not sure what the NVML Version means but if its importat its 12.535.154.05

For discord, can try that Discord renders a black window on Wayland · Issue #159267 · NixOS/nixpkgs · GitHub ?

when you say “try that” do you mean try Baughn’s work around or disable hardware acceleration?

the ones that work best are to run it with --disable-gpu, or (preferrably) --use-gl=desktop

So try to launch discord from terminal with either --disable-gpu or --use-gl=desktop.
Then if ok, apply as he suggested for configuration.nix:
https://github.com/NixOS/nixpkgs/issues/159267#issuecomment-1037372237

1 Like

That driver is affected by some pretty serious recent CVEs, if you’re going to stick to a manual definition make sure to update whenever nvidia release new drivers (and also right now): Security Bulletin: NVIDIA GPU Display Driver - June 2024 | NVIDIA

Phoronix’ nvidia section is a good RSS feed to follow if you want to know when there are new driver versions.

Don’t use https://nixos.wiki, it’s outdated, poorly maintained and often wrong to begin with - we have an official wiki nowadays: NixOS Wiki - NixOS Wiki. The configuration you copied likely just incidentally also switched to a driver unaffected by whatever bug causes this rather than being a real “fix”.

Give this config a shot:

hardware.nvidia = {
  package = config.boot.kernelPackages.nvidiaPackages.mkDriver {
    # This is the latest driver with the CVE patches + explicit sync
    version = "555.52.04";
    sha256_64bit = "sha256-nVOubb7zKulXhux9AruUTVBQwccFFuYGWrU1ZiakRAI=";
    sha256_aarch64 = "sha256-Kt60kTTO3mli66De2d1CAoE3wr0yUbBe7eqCIrYHcWk=";
    openSha256 = "sha256-wDimW8/rJlmwr1zQz8+b1uvxxxbOf3Bpk060lfLKuy0=";
    settingsSha256 = "sha256-PMh5efbSEq7iqEMBr2+VGQYkBG73TGUh6FuDHZhmwHk=";
    persistencedSha256 = "sha256-KAYIvPjUVilQQcD04h163MHmKcQrn2a8oaXujL2Bxro=";
  };

  # Modesetting is required for various things, you should almost never
  # run non-modesetting drivers these days
  modesetting.enable = true;
  # Power management is required to get nvidia GPUs to behave on
  # suspend, due to firmware bugs. Aren't nvidia great?
  powerManagement.enable = true;
  # powerManagement.finegrained only makes sense if you have a multi-gpu setup
  # nvidiaSettings is enabled by default anyway
  # The open driver is recommended even by nvidia these days
  open = true;
};

# Without this you won't be using nvidia's semi-proprietary driver,
# but the very slow nouveau
services.xserver.videoDrivers = ["nvidia"];

Can you also run sudo nix-channel --update as well as give us the output of sudo nix-channel --list? If your nixpkgs is outdated, that will explain a lot of these issues.

4 Likes

im trying out the config right now just running rebuild (ill let you know how that goes :D) but this was the output of --list.
nixos nixos-24.05 release nixos-24.05.1695.dd457de7e08c
i hope its up to date i just installed the os today

1 Like

Yep, that looks good! Make sure to reboot when changing graphics drivers, too.

1 Like

Minecraft working nice! discord now just crashing when i run it this is what i get as the output Paste.ee - discord crash i will most likely just have to try out jims fix as the --use-gl=desktop seemed to work

tbh, I’d recommend running discord in a browser until they fix their electron settings. It just doesn’t support wayland at the moment.

oooo yea i completly forgot about doing that…! ill stick to that then
thank you so much for your help!
one last noobie question if you dont mind do packages listed in the config file auto update or is there a command i need to run to update everything?

To update your system, you need to:

sudo nix-channel --update
nixos-rebuild switch --use-remote-sudo

Whenever there is a new NixOS release (the next one will be in November/December) you’ll have to do some extra stuff too, check back then.

Again, your nvidia driver will not automatically update since you define the package manually. This is fine, I do that too because the NixOS package is anyway outdated most of the time. But that does mean that you’ll need to keep track of nvidia driver releases manually.

Note the sudo on sudo nix-channel --update is important - your user has a separate set of channels that are not used for system updates, so it’s easy to accidentally update your user channels and forget about the root channels.

1 Like

amazing! thank you so much for your help!

Not my fix :rofl:

Note that some apps may not work on wayland or not work as expected and depending on support, there may not always be some workaround - specially with nvidia drivers.
I’m currently switching between x11 and wayland for different use cases.

2 Likes

The fix you found that is helpful :slight_smile: <3
that is also helpful information about swapping between them ill have to keep an eye out for that thank you!

1 Like

I have some questions about this:

  • How are the SHA256 sums generated?
  • Where does the 555.52.04 driver come from? The latest I see at Unix Drivers | NVIDIA is 555.42.02.

If you keep the strings empty nix will tell you the correct hashes and you can then plug those in.

Alternatively, download the files yourself, ensure they aren’t corrupt somehow, and calculate them with sha256sum. I’m too lazy to do that. Sadly nvidia don’t provide checksums.

I get them from phoronix posts: https://www.phoronix.com/news/NVIDIA-555.52.04-Linux-Beta

They always include a link. I’m sure there’s some nvidia RSS feed for the beta drivers or something, but I’ve never found it.

I’ve been sticking to beta since switching to wayland because the stable driver has been very broken 99% of the time anyway, so there’s not much benefit to using it.

open = true;

While NixOS wiki still recommends false

# Currently alpha-quality/buggy, so false is currently the recommended setting. open = false;

Not sure if my settings got wrong or some programs conflicted with that but it seems that’s it’s required when installing either unstable branch drivers or manually declare them (as shown in your solution), otherwise kernel will fail to build when running nixos-rebuild.

I’ve tried different kernels from 6.6 (stable from 24.05) to 6.9.6 (latest), all failed to build.

Using the open = true; option fixed that up.

Well, the unofficial wiki is:

The official wiki lists it as “beta”, which is Nvidia’s current statement. Still, even with the official wiki updatedness will drift, there’s just not enough people keeping stuff up-to-date, so it’s best to go straight to the source (this comment, too, will be outdated in a few weeks/months)…

Nvidia themselves elaborate on exactly what that means here (permalink, find your driver version instead): Chapter 44. Open Linux Kernel Modules

The tl;dr is, if you’re not using gsync or older GPUs (older than Turing) it should be pretty much the same, in fact the open module now supports several features the closed module doesn’t.

2 Likes