SDDM fails to start X11 session for non-root user in KDE Plasma using NVIDIA after upgrading to 22.11

After upgrading to 22.11 (without any changes to the configuration other than updating the system flake nixpkgs input to point to the 22.11 branch), the X11 session for my default user stopped loading and I was faced with a black screen.
I am running an Optimus setup with the following integrated and discrete GPUs:

iGPU: Intel 4th Gen Core Processor
dGPU: NVIDIA GeForce GTX 850M

Here is the related part in my configuration:

...
  boot.blacklistedKernelModules = [ "nouveau" ];
  services.xserver.videoDrivers = [ "nvidia" ];
  services.xserver.logFile = "/var/log/Xorg.0.log";
  hardware.nvidia.package = config.boot.kernelPackages.nvidiaPackages.stable;
  hardware.nvidia.modesetting.enable = true;
  hardware.nvidia.powerManagement.enable = true;
  hardware.nvidia.prime = {
    offload.enable = true;
    intelBusId = "PCI:0:2:0";
    nvidiaBusId = "PCI:1:0:0";
  };
  xdg.portal.extraPortals = [ pkgs.xdg-desktop-portal-gtk ];
  services.xserver.enable = true;
  services.xserver.desktopManager.plasma5.enable = true;
  services.xserver.displayManager.sddm.enable = true;
  services.xserver.displayManager.autoLogin.enable = true;
  services.xserver.displayManager.autoLogin.user = "arashsm79";
  services.xserver.layout = "us";
...

I couldn’t find any errors in the Xorg log file and after comparing it to the logfile of the previous working configuration, everything seems to be fine.
Xorg log file since boot after failing to start an X11 session:

pastebin

And here is the result of

journalctl --boot -u display-manager.service

without the lines related to xserver (those are included in the logfile of xorg, pasted above)

Dec 20 11:40:57 nixbox systemd[1]: Starting X11 Server...
Dec 20 11:40:57 nixbox systemd[1]: Started X11 Server.
Dec 20 11:40:58 nixbox sddm[1340]: Initializing...
Dec 20 11:40:58 nixbox sddm[1340]: Starting...
Dec 20 11:40:58 nixbox sddm[1340]: Logind interface found
Dec 20 11:40:58 nixbox sddm[1340]: Adding new display on vt 7 ...
Dec 20 11:40:58 nixbox sddm[1340]: Loading theme configuration from ""
Dec 20 11:40:58 nixbox sddm[1340]: Display server starting...
Dec 20 11:40:58 nixbox sddm[1340]: Adding cookie to "/var/run/sddm/{945d96c1-c005-4236-8486-b1d4e4ca2fec}"
Dec 20 11:41:00 nixbox sddm[1340]: Setting default cursor
Dec 20 11:41:00 nixbox sddm[1340]: Could not setup default cursor
Dec 20 11:41:00 nixbox sddm[1340]: Running display setup script  "/nix/store/3r18hc8hv6wjhp68gg33myfciq0bfyqm-Xsetup"
Dec 20 11:41:00 nixbox sddm[1340]: Display server started.
Dec 20 11:41:00 nixbox sddm[1340]: Reading from "/nix/store/adylm76z3363zlw2xsw7c21w3xj69cfz-desktops/share/xsessions/plasma.desktop"
Dec 20 11:41:00 nixbox sddm[1340]: Reading from "/nix/store/adylm76z3363zlw2xsw7c21w3xj69cfz-desktops/share/xsessions/plasma.desktop"
Dec 20 11:41:00 nixbox sddm[1340]: Session "/nix/store/adylm76z3363zlw2xsw7c21w3xj69cfz-desktops/share/xsessions/plasma.desktop" selected, command: "/nix/store/sj29n4l8i1nyy6ycwvyajb2qd3sr5vrr-plasma-workspace-5.26.4.1/bin/startplasma-x11"
Dec 20 11:41:00 nixbox sddm-helper[1649]: [PAM] Starting...
Dec 20 11:41:00 nixbox sddm-helper[1649]: [PAM] Authenticating...
Dec 20 11:41:00 nixbox sddm-helper[1649]: [PAM] returning.
Dec 20 11:41:00 nixbox sddm[1340]: Authenticated successfully
Dec 20 11:41:00 nixbox sddm-helper[1649]: pam_unix(sddm-autologin:session): session opened for user arashsm79(uid=1000) by (uid=0)
Dec 20 11:41:01 nixbox sddm-helper[1649]: pam_kwallet5(sddm-autologin:session): pam_kwallet5: pam_sm_open_session
Dec 20 11:41:01 nixbox sddm-helper[1649]: pam_kwallet5(sddm-autologin:session): pam_kwallet5: open_session called without kwallet5_key
Dec 20 11:41:01 nixbox sddm-helper[1649]: Starting: "/nix/store/nfx6n1gl8v63cmwyai48a4qrpbfhy54z-xsession-wrapper \"/nix/store/sj29n4l8i1nyy6ycwvyajb2qd3sr5vrr-plasma-workspace-5.26.4.1/bin/startplasma-x11\""
Dec 20 11:41:01 nixbox sddm[1340]: Session started

If I disable autologin I am faced with the SDDM greeter and am prompted to type in the password for my user. After doing so, the screen gets stuck on the greeter (without going into the X11 session) and the cursor changes to a black X while being movable.
The logs in this scenario show some errors related to xdg-portal. They resemble this issue Failing to start xdg-desktop-portal-gnome after logging on Gnome #206630.

pastebin

Disabling xdg-portal (using mkForce) and flatpak doesn’t change the problem and after typing in the password again the greeter gets stuck and the cursor turns to a black X. The logs however slightly change. Now they are complaining about qt platform plugins and Kirigami not being available.

Dec 19 12:32:42 nixbox systemd[1997]: Started D-Bus User Message Bus.
Dec 19 12:32:42 nixbox sddm-greeter[2006]: Reading from "/nix/store/adylm76z3363zlw2xsw7c21w3xj69cfz-desktops/share/wayland-sessions/plasmawayland.desktop"
Dec 19 12:32:42 nixbox sddm-greeter[2006]: Reading from "/nix/store/adylm76z3363zlw2xsw7c21w3xj69cfz-desktops/share/xsessions/plasma.desktop"
Dec 19 12:32:42 nixbox sddm-greeter[2006]: Loading theme configuration from "/run/current-system/sw/share/sddm/themes/breeze/theme.conf"
Dec 19 12:32:42 nixbox sddm-greeter[2006]: Connected to the daemon.
Dec 19 12:32:42 nixbox sddm-greeter[2006]: QFont::fromString: Invalid description '(empty)'
Dec 19 12:32:42 nixbox sddm[1951]: Message received from greeter: Connect
Dec 19 12:32:42 nixbox sddm-greeter[2006]: Loading file:///run/current-system/sw/share/sddm/themes/breeze/Main.qml...
Dec 19 12:32:42 nixbox sddm-greeter[2006]: QObject: Cannot create children for a parent that is in a different thread.
                                           (Parent is QGuiApplication(0x7ffec865caa0), parent's thread is QThread(0x1370800), current thread is QThread(0x14321e0)
Dec 19 12:32:42 nixbox sddm-greeter[2006]: QObject: Cannot create children for a parent that is in a different thread.
                                           (Parent is QGuiApplication(0x7ffec865caa0), parent's thread is QThread(0x1370800), current thread is QThread(0x14321e0)
Dec 19 12:32:42 nixbox sddm-greeter[2006]: QObject: Cannot create children for a parent that is in a different thread.
                                           (Parent is QGuiApplication(0x7ffec865caa0), parent's thread is QThread(0x1370800), current thread is QThread(0x14321e0)
Dec 19 12:32:42 nixbox sddm-greeter[2006]: QObject: Cannot create children for a parent that is in a different thread.
                                           (Parent is QGuiApplication(0x7ffec865caa0), parent's thread is QThread(0x1370800), current thread is QThread(0x14321e0)
Dec 19 12:32:42 nixbox sddm-greeter[2006]: QObject: Cannot create children for a parent that is in a different thread.
                                           (Parent is QGuiApplication(0x7ffec865caa0), parent's thread is QThread(0x1370800), current thread is QThread(0x14321e0)
Dec 19 12:32:42 nixbox sddm-greeter[2006]: QObject: Cannot create children for a parent that is in a different thread.
                                           (Parent is QGuiApplication(0x7ffec865caa0), parent's thread is QThread(0x1370800), current thread is QThread(0x14321e0)
Dec 19 12:32:42 nixbox sddm-greeter[2006]: QObject: Cannot create children for a parent that is in a different thread.
                                           (Parent is QGuiApplication(0x7ffec865caa0), parent's thread is QThread(0x1370800), current thread is QThread(0x14321e0)
Dec 19 12:32:42 nixbox sddm-greeter[2006]: QObject::installEventFilter(): Cannot filter events for objects in a different thread.
Dec 19 12:32:42 nixbox sddm-greeter[2006]: Could not find any platform plugin
Dec 19 12:32:43 nixbox sddm-greeter[2006]: Failed to find a Kirigami platform plugin
Dec 19 12:32:43 nixbox sddm-greeter[2006]: Adding view for "eDP-1" QRect(0,0 1920x1080)
Dec 19 12:32:43 nixbox sddm-greeter[2006]: Qt Quick Layouts: Polish loop detected. Aborting after two iterations.
Dec 19 12:32:43 nixbox sddm-greeter[2006]: Message received from daemon: Capabilities
Dec 19 12:32:43 nixbox sddm-greeter[2006]: Message received from daemon: HostName
Dec 19 12:32:51 nixbox sddm-greeter[2006]: Reading from "/nix/store/adylm76z3363zlw2xsw7c21w3xj69cfz-desktops/share/wayland-sessions/plasmawayland.desktop"
Dec 19 12:32:51 nixbox sddm[1951]: Message received from greeter: Login
Dec 19 12:32:51 nixbox sddm[1951]: Reading from "/nix/store/adylm76z3363zlw2xsw7c21w3xj69cfz-desktops/share/wayland-sessions/plasmawayland.desktop"
Dec 19 12:32:51 nixbox sddm[1951]: Reading from "/nix/store/adylm76z3363zlw2xsw7c21w3xj69cfz-desktops/share/wayland-sessions/plasmawayland.desktop"
Dec 19 12:32:51 nixbox sddm[1951]: Session "/nix/store/adylm76z3363zlw2xsw7c21w3xj69cfz-desktops/share/wayland-sessions/plasmawayland.desktop" selected, command: "/nix/store/sj29n4l8i1nyy6ycwvyajb2qd3sr5vrr-plasma-workspace-5.26.4.1/libexe>
Dec 19 12:32:51 nixbox sddm-helper[2022]: [PAM] Starting...
Dec 19 12:32:51 nixbox sddm-helper[2022]: [PAM] Authenticating...

I am able to successfully login to a desktop using the the Wayland session as a user or the X11 session as root. I don’t think the problem is with the NVIDIA driver, because it works fine as root. Even when logging in as a user through tty after X11 session fails, nvidia-smi shows that the driver correctly detects the GPU and an Xorg process is attached to the GPU. I have also tried both stable and latest versions of the NVIDIA driver and the Linux kernel (6.1).

I have completely cleaned the home directory of my user from any KDE related configuration. I have also removed all caches in my home directory and the sddm qml cache described in Black Screen on SDDM start since Plasma 5.12 #35013.

Since the X11 root session works fine, I think this problem might be related to: QT related environment variables not being set correctly for user sessions or changes in how SDDM handles X11 sessions. I’m not sure if this is related to Xorg segfaulting on login (after greeter) with nvidia drivers #206663 since the Xorg logs show no sign of segfaults.

It shouldn’t be related. That issue would only present as a segfault, and the segfault would show both in the Xorg log and journalctl.

Have you tried creating a throwaway user and seeing if the newly created user can log in? It would help differentiate between if it’s something to do with root vs non-root, or if it’s something to do with your user’s config/state.

1 Like

I use fish as an interactive shell and had

exec fish

in my .bashrc as described in the Arch Wiki.

Removing that line solved the issue with SDDM. I had that line since forever; something in the new Plasma desktop version must be causing this issue.

1 Like