Help getting the nvidia driver to work on a Dell Precision 5530

I’m using NixOS 24.05, and I’ve tried various things from GitHub - NixOS/nixos-hardware: A collection of NixOS modules covering hardware quirks. and blog posts I’ve found. The result I always get is a black screen with a non-blinking cursor in the top left corner:

Here are the relevant parts of my config which I think should work, but doesn’t:

  boot = {
    initrd = {
      availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ];
    };
    kernelModules = [ "kvm-intel" ];
    blacklistedKernelModules = ["nouveau"];
    kernelParams = ["i915.modeset=1"]; # Have also tried adding "nouveau.modeset=0", but got the same result
  };
  hardware.opengl = {
    enable = true;
    driSupport = true;
    driSupport32Bit = true;
  };
  hardware.nvidia = {
    # I'll note that https://www.nvidia.com/en-us/drivers/details/232672/ says that the version 550 supports the Quadro P1000 card that I have, and "production" below refers to that, ref https://github.com/NixOS/nixpkgs/blob/nixos-24.05/pkgs/os-specific/linux/nvidia-x11/default.nix#L36
    # I've also tried the packages beta (same result), latest (same result), legacy_390 (doesn't build as it's marked as broken)
    package = config.boot.kernelPackages.nvidiaPackages.production;
    nvidiaSettings = true; # Also tried false here, as it was suggested somewhere, but got the same result
    modesetting.enable = true;
    open = false;
    prime = {
      intelBusId = "PCI:0:2:0";
      nvidiaBusId = "PCI:1:0:0";
    };
  };
  services.thermald.enable = true;
  hardware.enableRedistributableFirmware = true;
  services.xserver = {
    enable = true;
    xkb = {
      layout = "no";
    };
    windowManager.i3 = {
      enable = true;
      package = pkgs.i3-gaps;
    };
    videoDrivers = [ "nvidia" ];
  };
  services.displayManager = {
    defaultSession = "none+i3";
  };

I’m able to get to a terminal by doing ctrl+alt+f1, and from there I gathered some information:

# $ journalctl -b | grep -i nvidia
# sep. 21 14:18:55 stian-dell-nixos kernel: Command line: initrd=\EFI\nixos\sk1v02v1jr1c3l40gmgn29gsyv9i4m1q-initrd-linux-6.6.51-initrd.efi init=/nix/store/8bb5wididn70yjm7s2hj44n1alpvkaws-nixos-system-stian-dell-nixos-24.05.20240916.c9f3343/init i915.modeset=1 loglevel=4 nvidia-drm.modeset=1
# sep. 21 14:18:55 stian-dell-nixos kernel: Kernel command line: initrd=\EFI\nixos\sk1v02v1jr1c3l40gmgn29gsyv9i4m1q-initrd-linux-6.6.51-initrd.efi init=/nix/store/8bb5wididn70yjm7s2hj44n1alpvkaws-nixos-system-stian-dell-nixos-24.05.20240916.c9f3343/init i915.modeset=1 loglevel=4 nvidia-drm.modeset=1
# sep. 21 14:18:55 stian-dell-nixos kernel: nvidia: loading out-of-tree module taints kernel.
# sep. 21 14:18:55 stian-dell-nixos kernel: nvidia: module license 'NVIDIA' taints kernel.
# sep. 21 14:18:55 stian-dell-nixos kernel: nvidia: module license taints kernel.
# sep. 21 14:18:56 stian-dell-nixos kernel: nvidia-nvlink: Nvlink Core is being initialized, major device number 240
# sep. 21 14:18:56 stian-dell-nixos kernel: nvidia 0000:01:00.0: enabling device (0006 -> 0007)
# sep. 21 14:18:56 stian-dell-nixos kernel: NVRM: loading NVIDIA UNIX x86_64 Kernel Module  550.78  Sun Apr 14 06:35:45 UTC 2024
# sep. 21 14:18:57 stian-dell-nixos kernel: nvidia_uvm: module uses symbols nvUvmInterfaceDisableAccessCntr from proprietary module nvidia, inheriting taint.
# sep. 21 14:18:57 stian-dell-nixos kernel: nvidia-uvm: Loaded the UVM driver, major device number 235.
# sep. 21 14:18:57 stian-dell-nixos systemd-modules-load[874]: Inserted module 'nvidia'
# sep. 21 14:18:57 stian-dell-nixos kernel: nvidia-modeset: Loading NVIDIA Kernel Mode Setting Driver for UNIX platforms  550.78  Sun Apr 14 06:23:31 UTC 2024
# sep. 21 14:18:57 stian-dell-nixos systemd-modules-load[874]: Inserted module 'nvidia_modeset'
# sep. 21 14:18:57 stian-dell-nixos (udev-worker)[1031]: nvidia: Process '/nix/store/1xhds5s320nfp2022yjah1h7dpv8qqns-bash-5.2p32/bin/bash -c 'mknod -m 666 /dev/nvidiactl c 195 255'' failed with exit code 1.
# sep. 21 14:18:57 stian-dell-nixos kernel: [drm] [nvidia-drm] [GPU ID 0x00000100] Loading driver
# sep. 21 14:18:57 stian-dell-nixos (udev-worker)[1031]: nvidia: Process '/nix/store/1xhds5s320nfp2022yjah1h7dpv8qqns-bash-5.2p32/bin/bash -c 'for i in $(cat /proc/driver/nvidia/gpus/*/information | grep Minor | cut -d \  -f 4); do mknod -m 666 /dev/nvidia${i} c 195 ${i}; done'' failed with exit code 1.
# sep. 21 14:18:58 stian-dell-nixos systemd-modules-load[874]: Inserted module 'nvidia_drm'
# sep. 21 14:18:58 stian-dell-nixos kernel: [drm] Initialized nvidia-drm 0.0.0 20160202 for 0000:01:00.0 on minor 1

# $ dmesg | grep -i nvidia
# [    0.000000] Command line: initrd=\EFI\nixos\sk1v02v1jr1c3l40gmgn29gsyv9i4m1q-initrd-linux-6.6.51-initrd.efi init=/nix/store/8bb5wididn70yjm7s2hj44n1alpvkaws-nixos-system-stian-dell-nixos-24.05.20240916.c9f3343/init i915.modeset=1 loglevel=4 nvidia-drm.modeset=1
# [    0.046769] Kernel command line: initrd=\EFI\nixos\sk1v02v1jr1c3l40gmgn29gsyv9i4m1q-initrd-linux-6.6.51-initrd.efi init=/nix/store/8bb5wididn70yjm7s2hj44n1alpvkaws-nixos-system-stian-dell-nixos-24.05.20240916.c9f3343/init i915.modeset=1 loglevel=4 nvidia-drm.modeset=1
# [   18.903079] nvidia: loading out-of-tree module taints kernel.
# [   18.903086] nvidia: module license 'NVIDIA' taints kernel.
# [   18.903090] nvidia: module license taints kernel.
# [   19.366253] nvidia-nvlink: Nvlink Core is being initialized, major device number 240
# [   19.370131] nvidia 0000:01:00.0: enabling device (0006 -> 0007)
# [   19.576702] NVRM: loading NVIDIA UNIX x86_64 Kernel Module  550.78  Sun Apr 14 06:35:45 UTC 2024
# [   20.129106] nvidia_uvm: module uses symbols nvUvmInterfaceDisableAccessCntr from proprietary module nvidia, inheriting taint.
# [   20.364669] nvidia-uvm: Loaded the UVM driver, major device number 235.
# [   20.400174] nvidia-modeset: Loading NVIDIA Kernel Mode Setting Driver for UNIX platforms  550.78  Sun Apr 14 06:23:31 UTC 2024
# [   20.430256] [drm] [nvidia-drm] [GPU ID 0x00000100] Loading driver
# [   21.671136] [drm] Initialized nvidia-drm 0.0.0 20160202 for 0000:01:00.0 on minor 1

# $ lsmod | grep nvidia
# nvidia_drm            122880  2
# nvidia_modeset       1605632  2 nvidia_drm
# nvidia_uvm           6635520  0
# video                  77824  4 dell_wmi,dell_laptop,i915,nvidia_modeset
# backlight              28672  4 video,dell_laptop,i915,nvidia_modeset
# nvidia              60497920  22 nvidia_uvm,nvidia_modeset
# firmware_class         57344  15 btrtl,snd_hda_intel,xhci_pci_renesas,btmtk,snd_sof,drm_display_helper,nvidia,btintel,btbcm,iwlwifi,btusb,snd_soc_skl,i915,r8152,cfg80211

# $ nvidia-smi
# Sat Sep 21 14:36:46 2024
# +-----------------------------------------------------------------------------------------+
# | NVIDIA-SMI 550.78                 Driver Version: 550.78         CUDA Version: 12.4     |
# |-----------------------------------------+------------------------+----------------------+
# | GPU  Name                 Persistence-M | Bus-Id          Disp.A | Volatile Uncorr. ECC |
# | Fan  Temp   Perf          Pwr:Usage/Cap |           Memory-Usage | GPU-Util  Compute M. |
# |                                         |                        |               MIG M. |
# |=========================================+========================+======================|
# |   0  Quadro P1000                   Off |   00000000:01:00.0 Off |                  N/A |
# | N/A   38C    P8             N/A / ERR!  |      10MiB /   4096MiB |      0%      Default |
# |                                         |                        |                  N/A |
# +-----------------------------------------+------------------------+----------------------+
# 
# +-----------------------------------------------------------------------------------------+
# | Processes:                                                                              |
# |  GPU   GI   CI        PID   Type   Process name                              GPU Memory |
# |        ID   ID                                                               Usage      |
# |=========================================================================================|
# |    0   N/A  N/A      1906      G   ...lcysj159v-xorg-server-21.1.13/bin/X          8MiB |
# +-----------------------------------------------------------------------------------------+

What else can I try? What other debug information can I dig out? Any pointers would be appreciated :slightly_smiling_face:

Have you tried seeing if it works with Gnome (or KDE) rather than i3? I wonder if this is an issue with a missing display manager. You can try turning on sddm and see: NixOS Search

Thanks for responding! I tried this now, but I unfortunately get the same result. I removed all traces of i3 (and also of home-manager), and tried adding that line to enable sddm.

I’ll add that when booting back to my normal configuration, I do see the same screen (blank screen with non-blinking cursor) for a split second before I see the normal login window. So maybe x is having problems starting? How can I debug that?

You can usually debug that by going into an alternative console like you did above via Ctrl + Alt + F3, logging in with your user and checking the logs for issues with gdm and/or x

Thanks for the tip. I’m not sure which files to look at, but:

  • the file /var/log/X.0.log doesn’t have anything of note
  • there are no files in /var/log/gdm (but the folder is there)
  • there’s also the file /var/log/lightdm/x-0.log, but there’s nothing of note there
  • from journalctl I did notice an error related to sddm: ssdm-greeter[number]: file:///nix/store/.../qml/SddmComponents/ComboBox.qml:58: TypeError: Cannot read property name of undefined

What else should I be looking at?