Kwin_wayland segfault with proprietary NVIDIA drivers

With the services.xserver.videoDrivers line in configuration.nix commented-out, I am able to launch Plasma Wayland, and use glxgears to confirm that the nouveau drivers work. But after uncommenting it (as per the manual; my chipset is Pascal so it needs the nvidia drivers), rebuilding, and rebooting, attempting to log in only drops me back to SDDM after a while. Attached is what I believe to be the relevant part of the system journal. The only Issue that seems similar is #145576, caused by an environment variable which doesn’t seem to be set on my system. This is a fresh install. I shy away from low-level stuff like this so I’d appreciate any help at all.

configuration.nix
{ config, pkgs, lib, ... }:
{
	imports = [
		./hardware-configuration.nix
	];
	boot.loader = {
		efi.canTouchEfiVariables = true;
		grub = {
			enable = true;
			efiSupport = true;
			device = "nodev";
			extraEntries = ''
				menuentry "Manjaro" {
					search --set=manjaro --fs-uuid bccab72c-b110-4016-995e-5a98bb5711d9
					configfile "($manjaro)/@/boot/grub/grub.cfg"
				}
				menuentry "Reboot" {
					reboot
				}
				menuentry "Halt" {
					halt
				}
			'';
		};
	};
	networking.hostName = "yoshi-elite";
	time.timeZone = "Australia/Brisbane";
	networking.useDHCP = false;
	networking.interfaces.eno1.useDHCP = true;
	networking.interfaces.enp0s26u1u1.useDHCP = true;
	hardware.opengl.driSupport = true;
	services.xserver = {
		enable = true;
		videoDrivers = [ "nvidia" ]; # <--- this one
		displayManager = {
			sddm.enable = true;
			sessionPackages = [
				(pkgs.plasma-workspace.overrideAttrs (old: { passthru.providedSessions = [ "plasmawayland" ]; }))
			];
			defaultSession = "plasmawayland";
		};
		desktopManager.plasma5.enable = true;
	};
	services.printing.enable = true;
	sound.enable = true;
	services.pipewire.enable = true;
	users = {
		mutableUsers = false;
		groups = {
			yoshi = { gid = 1000; };
		};
		users = {
			root = {
				initialPassword = "asdfasdf";
				password = "asdfasdf";
			};
			yoshi = {
				uid = 1000;
				isNormalUser = true;
				initialPassword = "asdfasdf";
				password = "asdfasdf";
				description = "Yoshi";
				extraGroups = [ "wheel" "networkmanager" ];
			};
		};
	};
	nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
		"nvidia-settings" "nvidia-x11"
	];
	environment.systemPackages = [
		pkgs.firefox
	];
	services.openssh.enable = true;
	systemd.services.NetworkManager-wait-online.enable = false;
	systemd.services.numLockOnTTY = {
		wantedBy = [ "multi-user.target" ];
		serviceConfig = {
			ExecStart = lib.mkForce (pkgs.writeShellScript "numlock-on-tty" ''
				for i in 1 2 3 4 5 6; do
					/run/current-system/sw/bin/setleds -D +num </dev/tty$i
				done
			'');
		};
	};
	system.stateVersion = "21.11"; # don't bump when updating to new release
}
journal
Apr 03 17:58:30 yoshi-elite sddm[966]: Session started
Apr 03 17:58:30 yoshi-elite dbus-daemon[801]: [system] Activating via systemd: service name='org.freedesktop.locale1' unit='dbus-org.freedesktop.locale1.service' requested by ':1.59' (uid=1000 pid=1682 comm="/nix/store/3yy3w8q8b5jzdm8qayp41wbzsaiqk253-plasma" label="kernel")
Apr 03 17:58:30 yoshi-elite systemd[1]: Starting Locale Service...
Apr 03 17:58:30 yoshi-elite sddm-helper[1644]: [PAM] Closing session
Apr 03 17:58:30 yoshi-elite sddm-helper[1644]: [PAM] Ended.
Apr 03 17:58:30 yoshi-elite sddm[966]: Auth: sddm-helper exited successfully
Apr 03 17:58:30 yoshi-elite sddm[966]: Greeter stopped.
Apr 03 17:58:30 yoshi-elite systemd[1]: session-c3.scope: Deactivated successfully.
Apr 03 17:58:30 yoshi-elite systemd[1]: session-c3.scope: Consumed 1.756s CPU time, no IP traffic.
Apr 03 17:58:30 yoshi-elite systemd-logind[840]: Session c3 logged out. Waiting for processes to exit.
Apr 03 17:58:30 yoshi-elite systemd-logind[840]: Removed session c3.
Apr 03 17:58:30 yoshi-elite dbus-daemon[801]: [system] Successfully activated service 'org.freedesktop.locale1'
Apr 03 17:58:30 yoshi-elite systemd[1]: Started Locale Service.
Apr 03 17:58:30 yoshi-elite kernel: show_signal_msg: 1 callbacks suppressed
Apr 03 17:58:30 yoshi-elite kernel: .kwin_wayland-w[1686]: segfault at 7f244d1b0c60 ip 00007f245f6a8043 sp 00007ffea2ff0ab0 error 4 in libQt5Core.so.5.15.3[7f245f476000+314000]
Apr 03 17:58:30 yoshi-elite kernel: Code: 8b 7e 08 48 85 ff 0f 84 9b 00 00 00 48 8b 47 08 48 8b 50 38 49 8b 46 38 48 39 c2 0f 85 ba 52 de ff 48 8b 07 48 89 ea 48 89 de <ff> 50 30 84 c0 75 58 4d 8b 46 30 49 8b 50 20 8b 7a 0c 8b 4a 08 89
Apr 03 17:58:30 yoshi-elite systemd[1]: Started Process Core Dump (PID 1688/UID 0).
Apr 03 17:58:30 yoshi-elite systemd[1]: systemd-coredump@22-1688-0.service: Deactivated successfully.
Apr 03 17:58:30 yoshi-elite kernel: .kwin_wayland-w[1695]: segfault at 7f04acf18c60 ip 00007f04bf410043 sp 00007ffcb1fec540 error 4 in libQt5Core.so.5.15.3[7f04bf1de000+314000]
Apr 03 17:58:30 yoshi-elite kernel: Code: 8b 7e 08 48 85 ff 0f 84 9b 00 00 00 48 8b 47 08 48 8b 50 38 49 8b 46 38 48 39 c2 0f 85 ba 52 de ff 48 8b 07 48 89 ea 48 89 de <ff> 50 30 84 c0 75 58 4d 8b 46 30 49 8b 50 20 8b 7a 0c 8b 4a 08 89
Apr 03 17:58:30 yoshi-elite systemd[1]: Started Process Core Dump (PID 1697/UID 0).
Apr 03 17:58:31 yoshi-elite systemd[1]: systemd-coredump@23-1697-0.service: Deactivated successfully.
Apr 03 17:58:31 yoshi-elite kernel: .kwin_wayland-w[1702]: segfault at 7f3d0333cc60 ip 00007f3d15834043 sp 00007ffe5a006e10 error 4 in libQt5Core.so.5.15.3[7f3d15602000+314000]
Apr 03 17:58:31 yoshi-elite kernel: Code: 8b 7e 08 48 85 ff 0f 84 9b 00 00 00 48 8b 47 08 48 8b 50 38 49 8b 46 38 48 39 c2 0f 85 ba 52 de ff 48 8b 07 48 89 ea 48 89 de <ff> 50 30 84 c0 75 58 4d 8b 46 30 49 8b 50 20 8b 7a 0c 8b 4a 08 89
Apr 03 17:58:31 yoshi-elite systemd[1]: Started Process Core Dump (PID 1706/UID 0).
Apr 03 17:58:31 yoshi-elite systemd[1]: systemd-coredump@24-1706-0.service: Deactivated successfully.
Apr 03 17:58:31 yoshi-elite kernel: .kwin_wayland-w[1711]: segfault at 7f6b2b17cc60 ip 00007f6b3d674043 sp 00007ffc3e0e3bc0 error 4 in libQt5Core.so.5.15.3[7f6b3d442000+314000]
Apr 03 17:58:31 yoshi-elite kernel: Code: 8b 7e 08 48 85 ff 0f 84 9b 00 00 00 48 8b 47 08 48 8b 50 38 49 8b 46 38 48 39 c2 0f 85 ba 52 de ff 48 8b 07 48 89 ea 48 89 de <ff> 50 30 84 c0 75 58 4d 8b 46 30 49 8b 50 20 8b 7a 0c 8b 4a 08 89
Apr 03 17:58:31 yoshi-elite systemd[1]: Started Process Core Dump (PID 1715/UID 0).
Apr 03 17:58:31 yoshi-elite systemd[1]: systemd-coredump@25-1715-0.service: Deactivated successfully.
Apr 03 17:58:31 yoshi-elite kernel: .kwin_wayland-w[1722]: segfault at 7f329e0e7c60 ip 00007f32b05df043 sp 00007fff0981ff60 error 4 in libQt5Core.so.5.15.3[7f32b03ad000+314000]
Apr 03 17:58:31 yoshi-elite kernel: Code: 8b 7e 08 48 85 ff 0f 84 9b 00 00 00 48 8b 47 08 48 8b 50 38 49 8b 46 38 48 39 c2 0f 85 ba 52 de ff 48 8b 07 48 89 ea 48 89 de <ff> 50 30 84 c0 75 58 4d 8b 46 30 49 8b 50 20 8b 7a 0c 8b 4a 08 89
Apr 03 17:58:31 yoshi-elite systemd[1]: Started Process Core Dump (PID 1724/UID 0).
Apr 03 17:58:32 yoshi-elite systemd[1]: systemd-coredump@26-1724-0.service: Deactivated successfully.
Apr 03 17:58:32 yoshi-elite kernel: .kwin_wayland-w[1731]: segfault at 7f3c8da8bc60 ip 00007f3c9ff83043 sp 00007ffce0773860 error 4 in libQt5Core.so.5.15.3[7f3c9fd51000+314000]
Apr 03 17:58:32 yoshi-elite kernel: Code: 8b 7e 08 48 85 ff 0f 84 9b 00 00 00 48 8b 47 08 48 8b 50 38 49 8b 46 38 48 39 c2 0f 85 ba 52 de ff 48 8b 07 48 89 ea 48 89 de <ff> 50 30 84 c0 75 58 4d 8b 46 30 49 8b 50 20 8b 7a 0c 8b 4a 08 89
Apr 03 17:58:32 yoshi-elite systemd[1]: Started Process Core Dump (PID 1733/UID 0).
Apr 03 17:58:32 yoshi-elite systemd[1]: systemd-coredump@27-1733-0.service: Deactivated successfully.
Apr 03 17:58:32 yoshi-elite kernel: .kwin_wayland-w[1738]: segfault at 7fc3120edc60 ip 00007fc3245e5043 sp 00007ffd76707e30 error 4 in libQt5Core.so.5.15.3[7fc3243b3000+314000]
Apr 03 17:58:32 yoshi-elite kernel: Code: 8b 7e 08 48 85 ff 0f 84 9b 00 00 00 48 8b 47 08 48 8b 50 38 49 8b 46 38 48 39 c2 0f 85 ba 52 de ff 48 8b 07 48 89 ea 48 89 de <ff> 50 30 84 c0 75 58 4d 8b 46 30 49 8b 50 20 8b 7a 0c 8b 4a 08 89
Apr 03 17:58:32 yoshi-elite systemd[1]: Started Process Core Dump (PID 1742/UID 0).
Apr 03 17:58:32 yoshi-elite systemd[1]: systemd-coredump@28-1742-0.service: Deactivated successfully.
Apr 03 17:58:32 yoshi-elite kernel: .kwin_wayland-w[1749]: segfault at 7f6a9825bc60 ip 00007f6aaa753043 sp 00007ffdaf004eb0 error 4 in libQt5Core.so.5.15.3[7f6aaa521000+314000]
Apr 03 17:58:32 yoshi-elite kernel: Code: 8b 7e 08 48 85 ff 0f 84 9b 00 00 00 48 8b 47 08 48 8b 50 38 49 8b 46 38 48 39 c2 0f 85 ba 52 de ff 48 8b 07 48 89 ea 48 89 de <ff> 50 30 84 c0 75 58 4d 8b 46 30 49 8b 50 20 8b 7a 0c 8b 4a 08 89
Apr 03 17:58:32 yoshi-elite systemd[1]: Started Process Core Dump (PID 1751/UID 0).
Apr 03 17:58:32 yoshi-elite systemd[1]: systemd-coredump@29-1751-0.service: Deactivated successfully.
Apr 03 17:58:33 yoshi-elite kernel: .kwin_wayland-w[1756]: segfault at 7ffb84c66c60 ip 00007ffb9715e043 sp 00007ffeff72d9d0 error 4 in libQt5Core.so.5.15.3[7ffb96f2c000+314000]
Apr 03 17:58:33 yoshi-elite kernel: Code: 8b 7e 08 48 85 ff 0f 84 9b 00 00 00 48 8b 47 08 48 8b 50 38 49 8b 46 38 48 39 c2 0f 85 ba 52 de ff 48 8b 07 48 89 ea 48 89 de <ff> 50 30 84 c0 75 58 4d 8b 46 30 49 8b 50 20 8b 7a 0c 8b 4a 08 89
Apr 03 17:58:33 yoshi-elite systemd[1]: Started Process Core Dump (PID 1760/UID 0).
Apr 03 17:58:33 yoshi-elite systemd[1]: systemd-coredump@30-1760-0.service: Deactivated successfully.
Apr 03 17:58:33 yoshi-elite kernel: .kwin_wayland-w[1767]: segfault at 7f2bf734cc60 ip 00007f2c09844043 sp 00007ffd69107cb0 error 4 in libQt5Core.so.5.15.3[7f2c09612000+314000]
Apr 03 17:58:33 yoshi-elite kernel: Code: 8b 7e 08 48 85 ff 0f 84 9b 00 00 00 48 8b 47 08 48 8b 50 38 49 8b 46 38 48 39 c2 0f 85 ba 52 de ff 48 8b 07 48 89 ea 48 89 de <ff> 50 30 84 c0 75 58 4d 8b 46 30 49 8b 50 20 8b 7a 0c 8b 4a 08 89
Apr 03 17:58:33 yoshi-elite systemd[1]: Started Process Core Dump (PID 1769/UID 0).
Apr 03 17:58:33 yoshi-elite systemd[1]: systemd-coredump@31-1769-0.service: Deactivated successfully.
Apr 03 17:58:33 yoshi-elite systemd[1]: Started Process Core Dump (PID 1778/UID 0).
Apr 03 17:58:33 yoshi-elite systemd[1]: systemd-coredump@32-1778-0.service: Deactivated successfully.
Apr 03 17:58:33 yoshi-elite sddm-helper[1677]: [PAM] Closing session
Apr 03 17:58:33 yoshi-elite sddm-helper[1677]: pam_unix(sddm:session): session closed for user yoshi
Apr 03 17:58:33 yoshi-elite sddm-helper[1677]: pam_kwallet5(sddm:session): pam_kwallet5: pam_sm_close_session
Apr 03 17:58:33 yoshi-elite sddm-helper[1677]: pam_kwallet5(sddm:setcred): pam_kwallet5: pam_sm_setcred
Apr 03 17:58:33 yoshi-elite sddm-helper[1677]: [PAM] Ended.
Apr 03 17:58:33 yoshi-elite sddm[966]: Auth: sddm-helper exited successfully
Apr 03 17:58:33 yoshi-elite sddm[966]: Socket server stopping...
Apr 03 17:58:33 yoshi-elite sddm[966]: Socket server stopped.
Apr 03 17:58:33 yoshi-elite sddm[966]: Display server stopping...
Apr 03 17:58:33 yoshi-elite systemd-logind[840]: Session 7 logged out. Waiting for processes to exit.
1 Like

I think I am seeing something similar – plasma-wayland immediately dies. I get the following stacktrace in the journal:

                                            Stack trace of thread 12931:
                                                 #0  0x00007fc1d5c1ab6b _ZN23QCoreApplicationPrivate34sendThroughApplicationEventFiltersEP7QObjectP6QEvent (libQt5Core.so.5 + 0x2c9b6b)
                                                 #1  0x00007fc1d6816708 _ZN19QApplicationPrivate13notify_helperEP7QObjectP6QEvent (libQt5Widgets.so.5 + 0x171708)
                                                 #2  0x00007fc1d5c1af5a _ZN16QCoreApplication15notifyInternal2EP7QObjectP6QEvent (libQt5Core.so.5 + 0x2c9f5a)
                                                 #3  0x00007fc1d5c4f887 _ZN14QObjectPrivate16setParent_helperEP7QObject (libQt5Core.so.5 + 0x2fe887)
                                                 #4  0x00007fc1d5c4fd98 _ZN7QObjectD2Ev (libQt5Core.so.5 + 0x2fed98)
                                                 #5  0x00007fc1c2bca889 _ZN4KWin10DrmBackendD0Ev (KWinWaylandDrmBackend.so + 0x18889)
                                                 #6  0x00007fc1d5c107c8 n/a (libQt5Core.so.5 + 0x2bf7c8)
                                                 #7  0x00007fc1d5c14b8d n/a (libQt5Core.so.5 + 0x2c3b8d)
                                                 #8  0x00007fc1d5c12029 n/a (libQt5Core.so.5 + 0x2c1029)
                                                 #9  0x00007fc1d50de737 __cxa_finalize (libc.so.6 + 0x3f737)
                                                 #10 0x00007fc1d5a0a477 n/a (libQt5Core.so.5 + 0xb9477)
                                                 #11 0x00007fc1d8d06d2e _dl_fini (ld-linux-x86-64.so.2 + 0x3d2e)
                                                 #12 0x00007fc1d50de205 __run_exit_handlers (libc.so.6 + 0x3f205)
                                                 #13 0x00007fc1d50de38a exit (libc.so.6 + 0x3f38a)
                                                 #14 0x000000000044f52e _ZN4KWin18ApplicationWayland14performStartupEv (.kwin_wayland-wrapped + 0x4f52e)
                                                 #15 0x000000000044c45e main (.kwin_wayland-wrapped + 0x4c45e)
                                                 #16 0x00007fc1d50c8237 __libc_start_call_main (libc.so.6 + 0x29237)
                                                 #17 0x00007fc1d50c82f5 __libc_start_main@@GLIBC_2.34 (libc.so.6 + 0x292f5)
                                                 #18 0x000000000044e131 _start (.kwin_wayland-wrapped + 0x4e131)

No idea of what’s going on here or how to debug further.

Nvidia’s drivers, despite having been partially open sourced as of a few weeks ago, are still a broken mess when it comes to Wayland. This is entirely on nvidia, they’ve been dragging their feet on getting support for half a decade at least, and lots of Wayland projects deliberately avoid supporting nvidia for this reason. You may want to reconsider switching to wayland with an nvidia GPU, I believe some important features are still missing.

That said, things are getting a bit better, and you should at least be able to run wayland.

KDE has a list of things you need to do to get this to work: Plasma/Wayland/Nvidia - KDE Community Wiki

I think this means you’re missing:

But I’m not sure off the top of my head whether the egl lib is separate on NixOS]. Edit: Looks like it’s not: nvidia: fix egl-wayland loading by colemickens · Pull Request #139354 · NixOS/nixpkgs · GitHub.

Thank you! Modeset was what I was missing, along with switching to the 22.05 channel which I was going to do anyway.