Plasma 5 works with NVIDIA, but SDDM fails

Hi everybody,

I spent several hours searching for all issues related to NVIDIA on NixOS and I can’t find a solution

Starting with the simple configuration:

{
  services.xserver.videoDrivers = ["nvidia"];
  hardware.nvidia.modesetting.enable = true;
  hardware.nvidia.prime = {
    offload = {
      enable = true;
      enableOffloadCmd = true;
    };

    intelBusId = "PCI:2:0:0";
    nvidiaBusId = "PCI:1:0:0";

  };

	...

    desktopManager.plasma5.enable = true;
    displayManager.defaultSession = "plasmawayland";
}

I can login via terminal and run:

dbus-launch startplasma-wayland
# or
dbus-run-session startplasma-wayland

and Plasma works just fine. The reason I login via terminal is that I don’t get SDDM screen after and the reason for that is:

journalctl --boot -u display-manager.service
Jun 26 14:01:27 nixos xserver-wrapper[2182]: (EE)
Jun 26 14:01:27 nixos xserver-wrapper[2182]: (EE) Server terminated with error (1). Closing log file.
Jun 26 14:01:27 nixos sddm[1701]: Failed to read display number from pipe
Jun 26 14:01:27 nixos sddm[1701]: Attempt 2 starting the Display server on vt 7 failed
Jun 26 14:01:29 nixos sddm[1701]: Display server starting...
Jun 26 14:01:29 nixos sddm[1701]: Adding cookie to "/var/run/sddm/{c8c792fb-423a-4f9b-9818-8a3929387631}"
Jun 26 14:01:29 nixos sddm[1701]: Running: /nix/store/27irrirl842b8aj9af7rni18ggzxlnxr-xserver-wrapper -nolisten tcp -auth /var/run/sddm/{c8c792fb-423a-4f9b-9818-8a3929387631} -background none -noreset -displayfd 17 -seat seat0 vt7
Jun 26 14:01:29 nixos xserver-wrapper[2186]: X.Org X Server 1.21.1.8
Jun 26 14:01:29 nixos xserver-wrapper[2186]: X Protocol Version 11, Revision 0
Jun 26 14:01:29 nixos xserver-wrapper[2186]: Current Operating System: Linux nixos 6.1.35 #1-NixOS SMP PREEMPT_DYNAMIC Wed Jun 21 14:01:03 UTC 2023 x86_64
Jun 26 14:01:29 nixos xserver-wrapper[2186]: Kernel command line: BOOT_IMAGE=(hd1,gpt2)/mydisk//kernels/2npm8s7p2f9nrsbgdy3rgkrbm5m6k5y1-linux-6.1.35-bzImage init=/nix/store/f7kgv6dh21wcwbyrz7m1cr47a3bl5sdv-nixos-system-n0-23.11.20230625.1c9db97/init console=ttyS0,115200n8 console=tty systemd.show_status=1 quiet video=hyperv_fb:1152x864 elevator=noop nohibernate loglevel=4 nvidia-drm.modeset=1 nvidia.NVreg_OpenRmEnableUnsupportedGpus=1
Jun 26 14:01:29 nixos xserver-wrapper[2186]:
Jun 26 14:01:29 nixos xserver-wrapper[2186]: Current version of pixman: 0.42.2
Jun 26 14:01:29 nixos xserver-wrapper[2186]:         Before reporting problems, check http://wiki.x.org
Jun 26 14:01:29 nixos xserver-wrapper[2186]:         to make sure that you have the latest version.
Jun 26 14:01:29 nixos xserver-wrapper[2186]: Markers: (--) probed, (**) from config file, (==) default setting,
Jun 26 14:01:29 nixos xserver-wrapper[2186]:         (++) from command line, (!!) notice, (II) informational,
Jun 26 14:01:29 nixos xserver-wrapper[2186]:         (WW) warning, (EE) error, (NI) not implemented, (??) unknown.
Jun 26 14:01:29 nixos xserver-wrapper[2186]: (++) Log file: "/dev/null", Time: Mon Jun 26 14:01:29 2023
Jun 26 14:01:29 nixos xserver-wrapper[2186]: (++) Using config file: "/nix/store/8b1985k9w3yk0h4jk7hiqn787z6d8d5c-xserver.conf"
Jun 26 14:01:29 nixos xserver-wrapper[2186]: (==) Using config directory: "/etc/X11/xorg.conf.d"
Jun 26 14:01:29 nixos xserver-wrapper[2186]: (==) Using system config directory "/nix/store/spq0gggyq6j0vqqfsk53np01sl6l3gs2-xorg-server-21.1.8/share/X11/xorg.conf.d"
Jun 26 14:01:29 nixos xserver-wrapper[2186]: (==) ServerLayout "Layout[all]"
Jun 26 14:01:29 nixos xserver-wrapper[2186]: (**) |-->Screen "Screen-modesetting[0]" (0)
Jun 26 14:01:29 nixos xserver-wrapper[2186]: (**) |   |-->Monitor "<default monitor>"
Jun 26 14:01:29 nixos xserver-wrapper[2186]: (**) |   |-->Device "Device-modesetting[0]"
Jun 26 14:01:29 nixos xserver-wrapper[2186]: (**) |   |-->GPUDevice "Device-nvidia[0]"
Jun 26 14:01:29 nixos xserver-wrapper[2186]: (==) No monitor specified for screen "Screen-modesetting[0]".
Jun 26 14:01:29 nixos xserver-wrapper[2186]:         Using a default monitor configuration.
Jun 26 14:01:29 nixos xserver-wrapper[2186]: (**) Option "DontZap" "on"
Jun 26 14:01:29 nixos xserver-wrapper[2186]: (**) Option "AllowMouseOpenFail" "on"
Jun 26 14:01:29 nixos xserver-wrapper[2186]: (==) Automatically adding devices
Jun 26 14:01:29 nixos xserver-wrapper[2186]: (==) Automatically enabling devices
Jun 26 14:01:29 nixos xserver-wrapper[2186]: (==) Automatically adding GPU devices
Jun 26 14:01:29 nixos xserver-wrapper[2186]: (==) Automatically binding GPU devices
Jun 26 14:01:29 nixos xserver-wrapper[2186]: (==) Max clients allowed: 256, resource mask: 0x1fffff
Jun 26 14:01:29 nixos xserver-wrapper[2186]: (**) FontPath set to:
Jun 26 14:01:29 nixos xserver-wrapper[2186]:         /nix/store/nj5499cyq7icn98f2671gkhg2z66pasc-font-cursor-misc-1.0.3/lib/X11/fonts/misc,
Jun 26 14:01:29 nixos xserver-wrapper[2186]:         /nix/store/islq30qyvv88zi909133jalmll0pih0c-font-misc-misc-1.1.2/lib/X11/fonts/misc,
Jun 26 14:01:29 nixos xserver-wrapper[2186]:         /nix/store/lksx35qcs0f5998l3z556gzshgjl14j7-unifont-15.0.04/share/fonts,
Jun 26 14:01:29 nixos xserver-wrapper[2186]:         /nix/store/0039j6r28ccvhvj15pxxi6q8wv7bs80l-font-adobe-100dpi-1.0.3/lib/X11/fonts/100dpi,
Jun 26 14:01:29 nixos xserver-wrapper[2186]:         /nix/store/v0hy4njhx8r21p8czzrfqz5z6rby7ar3-font-adobe-75dpi-1.0.3/lib/X11/fonts/75dpi
Jun 26 14:01:29 nixos xserver-wrapper[2186]: (**) ModulePath set to "/nix/store/awzm3f2ls0m4izmckvyy12xwvbh7ybcw-xf86-input-libinput-1.2.0/lib/xorg/modules/input,/nix/store/k0cbhylnwd4lfmaad5pwnjdffm13an7i-nvidia-x11-535.54.03-6.1.35-bin/lib/xorg/modules/drivers,/nix/store/k0cbhylnwd4lfmaad5pwnjdffm13an7i-nvidia-x11-535.54.03-6.1.35-bin/lib/xorg/modules/extensions,/nix/store/r0hkwjfnlplw22l2nr1mlzhzscgskkc2-xf86-input-evdev-2.10.6/lib/xorg/modules/input,/nix/store/spq0gggyq6j0vqqfsk53np01sl6l3gs2-xorg-server-21.1.8/lib/xorg/modules,/nix/store/spq0gggyq6j0vqqfsk53np01sl6l3gs2-xorg-server-21.1.8/lib/xorg/modules/drivers,/nix/store/spq0gggyq6j0vqqfsk53np01sl6l3gs2-xorg-server-21.1.8/lib/xorg/modules/extensions,/nix/store/spq0gggyq6j0vqqfsk53np01sl6l3gs2-xorg-server-21.1.8/lib/xorg/modules/input"
Jun 26 14:01:29 nixos xserver-wrapper[2186]: (II) The server relies on udev to provide the list of input devices.
Jun 26 14:01:29 nixos xserver-wrapper[2186]:         If no devices become available, reconfigure udev or disable AutoAddDevices.
Jun 26 14:01:29 nixos xserver-wrapper[2186]: (II) Loader magic: 0x640e20
Jun 26 14:01:29 nixos xserver-wrapper[2186]: (II) Module ABI versions:
Jun 26 14:01:29 nixos xserver-wrapper[2186]:         X.Org ANSI C Emulation: 0.4
Jun 26 14:01:29 nixos xserver-wrapper[2186]:         X.Org Video Driver: 25.2
Jun 26 14:01:29 nixos xserver-wrapper[2186]:         X.Org XInput driver : 24.4
Jun 26 14:01:29 nixos xserver-wrapper[2186]:         X.Org Server Extension : 10.0
Jun 26 14:01:29 nixos xserver-wrapper[2186]: (++) using VT number 7
Jun 26 14:01:29 nixos xserver-wrapper[2186]: (II) systemd-logind: logind integration requires -keeptty and -keeptty was not provided, disabling logind integration
Jun 26 14:01:29 nixos xserver-wrapper[2186]: (II) xfree86: Adding drm device (/dev/dri/card1)
Jun 26 14:01:29 nixos xserver-wrapper[2186]: (II) Platform probe for /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/drm/card1
Jun 26 14:01:29 nixos xserver-wrapper[2186]: (II) xfree86: Adding drm device (/dev/dri/card0)
Jun 26 14:01:29 nixos xserver-wrapper[2186]: (II) Platform probe for /sys/devices/pci0000:00/0000:00:02.0/drm/card0
Jun 26 14:01:29 nixos xserver-wrapper[2186]: (--) PCI:*(0@0:2:0) 8086:a788:1558:d502 rev 4, Mem @ 0x83000000/16777216, 0x90000000/268435456, I/O @ 0x00001000/64, BIOS @ 0x????????/131072
Jun 26 14:01:29 nixos xserver-wrapper[2186]: (--) PCI: (1@0:0:0) 10de:2860:1558:d502 rev 161, Mem @ 0x81000000/16777216, 0x1200000000/8589934592, 0x1400000000/33554432, I/O @ 0x0000a000/128, BIOS @ 0x????????/524288
Jun 26 14:01:29 nixos xserver-wrapper[2186]: (II) Open ACPI successful (/var/run/acpid.socket)
Jun 26 14:01:29 nixos xserver-wrapper[2186]: (II) "glx" will be loaded by default.
Jun 26 14:01:29 nixos xserver-wrapper[2186]: (II) LoadModule: "glx"
Jun 26 14:01:29 nixos xserver-wrapper[2186]: (II) Loading /nix/store/spq0gggyq6j0vqqfsk53np01sl6l3gs2-xorg-server-21.1.8/lib/xorg/modules/extensions/libglx.so
Jun 26 14:01:29 nixos xserver-wrapper[2186]: (II) Module glx: vendor="X.Org Foundation"
Jun 26 14:01:29 nixos xserver-wrapper[2186]:         compiled for 1.21.1.8, module version = 1.0.0
Jun 26 14:01:29 nixos xserver-wrapper[2186]:         ABI class: X.Org Server Extension, version 10.0
Jun 26 14:01:29 nixos xserver-wrapper[2186]: (II) LoadModule: "modesetting"
Jun 26 14:01:29 nixos xserver-wrapper[2186]: (II) Loading /nix/store/spq0gggyq6j0vqqfsk53np01sl6l3gs2-xorg-server-21.1.8/lib/xorg/modules/drivers/modesetting_drv.so
Jun 26 14:01:29 nixos xserver-wrapper[2186]: (II) Module modesetting: vendor="X.Org Foundation"
Jun 26 14:01:29 nixos xserver-wrapper[2186]:         compiled for 1.21.1.8, module version = 1.21.1
Jun 26 14:01:29 nixos xserver-wrapper[2186]:         Module class: X.Org Video Driver
Jun 26 14:01:29 nixos xserver-wrapper[2186]:         ABI class: X.Org Video Driver, version 25.2
Jun 26 14:01:29 nixos xserver-wrapper[2186]: (II) LoadModule: "nvidia"
Jun 26 14:01:29 nixos xserver-wrapper[2186]: (II) Loading /nix/store/k0cbhylnwd4lfmaad5pwnjdffm13an7i-nvidia-x11-535.54.03-6.1.35-bin/lib/xorg/modules/drivers/nvidia_drv.so
Jun 26 14:01:29 nixos xserver-wrapper[2186]: (II) Module nvidia: vendor="NVIDIA Corporation"
Jun 26 14:01:29 nixos xserver-wrapper[2186]:         compiled for 1.6.99.901, module version = 1.0.0
Jun 26 14:01:29 nixos xserver-wrapper[2186]:         Module class: X.Org Video Driver
Jun 26 14:01:29 nixos xserver-wrapper[2186]: (II) modesetting: Driver for Modesetting Kernel Drivers: kms
Jun 26 14:01:29 nixos xserver-wrapper[2186]: (II) NVIDIA dlloader X Driver  535.54.03  Tue Jun  6 22:23:02 UTC 2023
Jun 26 14:01:29 nixos xserver-wrapper[2186]: (II) NVIDIA Unified Driver for all Supported NVIDIA GPUs
Jun 26 14:01:29 nixos xserver-wrapper[2186]: (WW) Falling back to old probe method for modesetting
Jun 26 14:01:29 nixos xserver-wrapper[2186]: (II) modeset(0): using default device
Jun 26 14:01:29 nixos xserver-wrapper[2186]: (II) Loading sub module "fb"
Jun 26 14:01:29 nixos xserver-wrapper[2186]: (II) LoadModule: "fb"
Jun 26 14:01:29 nixos xserver-wrapper[2186]: (II) Module "fb" already built-in
Jun 26 14:01:29 nixos xserver-wrapper[2186]: (II) Loading sub module "wfb"
Jun 26 14:01:29 nixos xserver-wrapper[2186]: (II) LoadModule: "wfb"
Jun 26 14:01:29 nixos xserver-wrapper[2186]: (II) Loading /nix/store/spq0gggyq6j0vqqfsk53np01sl6l3gs2-xorg-server-21.1.8/lib/xorg/modules/libwfb.so
Jun 26 14:01:29 nixos xserver-wrapper[2186]: (II) Module wfb: vendor="X.Org Foundation"
Jun 26 14:01:29 nixos xserver-wrapper[2186]:         compiled for 1.21.1.8, module version = 1.0.0
Jun 26 14:01:29 nixos xserver-wrapper[2186]:         ABI class: X.Org ANSI C Emulation, version 0.4
Jun 26 14:01:29 nixos xserver-wrapper[2186]: (II) modeset(G1): using drv /dev/dri/card0
Jun 26 14:01:29 nixos xserver-wrapper[2186]: (EE)
Jun 26 14:01:29 nixos xserver-wrapper[2186]: Fatal server error:
Jun 26 14:01:29 nixos xserver-wrapper[2186]: (EE) Cannot run in framebuffer mode. Please specify busIDs        for all framebuffer devices
Jun 26 14:01:29 nixos xserver-wrapper[2186]: (EE)
Jun 26 14:01:29 nixos xserver-wrapper[2186]: (EE)
Jun 26 14:01:29 nixos xserver-wrapper[2186]: Please consult the The X.Org Foundation support
Jun 26 14:01:29 nixos xserver-wrapper[2186]:          at http://wiki.x.org
Jun 26 14:01:29 nixos xserver-wrapper[2186]:  for help.
Jun 26 14:01:29 nixos xserver-wrapper[2186]: (EE) Please also check the log file at "/dev/null" for additional information.
Jun 26 14:01:29 nixos xserver-wrapper[2186]: (EE)
Jun 26 14:01:29 nixos xserver-wrapper[2186]: (EE) Server terminated with error (1). Closing log file.
Jun 26 14:01:29 nixos sddm[1701]: Failed to read display number from pipe
Jun 26 14:01:29 nixos sddm[1701]: Attempt 3 starting the Display server on vt 7

I tried:

  • systemctl restart display-manager.service
  • hardware.nvidia.open = true;
  • Disabling / enabling hardware.nvidia.modesetting.enable
  • Disabling / enabling hardware.opengl.driSupport32Bit
  • Using lightdm / not using SDDM (commenting out displayManager.sddm.enable)
  • powerManagement.enable = lib.mkForce false;
  • boot.blacklistedKernelModules = [ "nouveau" ];

and probably a few other options but the result is always the same.

Btw. when I use Plasma via dbus-launch startplasma-wayland (as non-root user) it works just fine. I tested the nvidia-offload script with glxgears / glxinfo and they work as expected.

I’m on a new System76 Serval WS laptop with i9-13900HX with NVIDIA GeForce RTX 4070 and nixpkgs-unstable NixOS 23.11.

Could you please help?

Btw. meanwhile I’ll be just using dbus-launch startplasma-wayland since it works just fine ;-).

Thank you.

Is this your actual configuration? If so this must be wrong.

No, it’s not. I corrected the first post. Thank you.

Huuuuups, you solved it @Stzx . I actually had an issue. My Intel should be 0:2:0 and not 2:0:0.

Thank you very much.

Sorry about this pointless post. Fat fingers and 3 hours of debugging. :wink:

I apologize for re-opening this but that didn’t solve the problem. I was too confused from too many config changes…

The current situation is that when I use the configuration from the initial post (PCI numbers are PCI:0:2:0 for Intel and PCI:1:0:0 for NVIDIA triple checked) everything is fine when external display is connected.

I boot up with external display connected, see SDDM, login to Plasma and if I want use NVIDIA card I can do that using the nvidia-offload script and nvidia-smi -l 1 shows me that the process is hitting NVIDIA. All cool.

Or I can boot up with external display connected, see SDDM, disconnect Thunderbolt dock with external display and login to Plasma - all cool.

But If I reboot without external display connected via Thunderbolt dock - after systemd messages everything freezes and I can’t even Ctrl+ALT+F1. If I then reboot with display again connected and check last boot messages I get again Failed to read display number from pipe and display-manager.service not working.

I had more time for tests, I realized I have kernel 6.1.35 due ZFS preventing more current kernel. I disabled ZFS to test 6.4.0 and still the same issue. I can’t boot up without external display connected.

Any tips highly appreciated. Thank you.

Trying early loading?

I don’t have an Intel graphics card, I think it’s this module?

boot.initrd.kernelModules = [ "i915" ];

Thank you.

I somehow managed to fix it by doing multiple things - now I just need to figure out which one is the one.

I had a large update (running unstable).

I added kernel param i915.enable_psr=0

Enabled hardware.enableAllFirmware

And something else I don’t remember…

Once I figure out what caused the issue, I’ll report back.

Thank you.

Hi @marcus. I’m trying to configure nixos on my oryx pro, also with a 4070 and running into the same issue as you did. Do you mind sharing your config to see if I can get nixos working on my system?

Hi @menixator ,

To be honest, I’m not sure how I fixed the problem, I think I had just wrong values somewhere in the configuration. The configuration is the same as I mentioned in the first post except bus IDs and I switched back to X11.

{
  services.xserver.videoDrivers = ["nvidia"];
  hardware.nvidia.modesetting.enable = true;
  hardware.nvidia.prime = {
    offload = {
      enable = true;
      enableOffloadCmd = true;
    };

    intelBusId = "PCI:0:2:0";
    nvidiaBusId = "PCI:1:0:0";

  };

	...

    desktopManager.plasma5.enable = true;
    displayManager.defaultSession = "plasma";
}

Hey @marcus. Thank you for the reply.

I got it working once I enabled Primse Sync. So for users who are having a similar issue, try enabling one of the Optimus PRIME modes discussed in the wiki.

https://nixos.wiki/wiki/Nvidia