Jun 9 at 21:56
This is an older version of the article. Click here to see the current one.

KDE Wayland in Fedora 39

KDE Plasma Wayland in Fedora 39 with nvidia

Time to try this again, two years after my last post on Fedora 35. I’m seeing some exciting search results already, e.g. “Wayland is now usable for me”.

I’m now on Fedora 39 after just upgrading from 37. KDE and nvidia drivers already installed. For reference, KDE is installed with sudo dnf groupinstall "KDE Plasma Workspaces". To see the current nvidia driver version (and apps using it), run nvidia-smi.

To try wayland in KDE Plasma, look to the bottom left of the login screen (sddm, the default KDE greeter) for a combo box. It should have an option “Plasma Wayland”.

Black screen, only a mouse and task switcher

What follows is a linear story of troubles before I realised I had a stale config issue. Feel free to skip this section.

Unfortunately I’m met with only a black screen and a giant (low resolution) mouse cursor. I was also seeing some blurry mouse trails and slight flickering from stale swapchain contents. If I move the mouse to the top left I can open the task switcher, which says there are no windows.

I’m also unable to switch back to X11 - choosing that option now gives me a black screen.

Maybe it’s a config issue…

mv ~/.kde ~/.kde.bak1

Still can’t login. The last time I tried wayland I needed to pass modeset=1 to the nvidia_drm kernel module before Wayland would work. Maybe this isn’t needed anymore, but I’ll try it anyway. Rather than reboot, I switched to another virtual terminal, unloaded the nvidia kernel modules and tried again. An alternative is to pass it on the grub command line.

# Ctrl-Alt-F3 and login, then stop all apps that are using nvidia kernel modules (graphics/display)
# These may not all be needed - they’re just what I found from running pstree
sudo service sddm stop
killall kwin
pkill kwin_wayland_wr
pkill ksystemstats
pkill xdg-desktop
sudo pkill xwaylandvideobr

# Remove the kernel modules
# If it says any cannot be unloaded, go back to stopping more apps like the above
# Or just reboot into runlevel 3
sudo rmmod nvidia_drm nvidia_modeset nvidia_uvm nvidia

# Manually add the kernel module with the modeset argument
sudo modprobe nvidia_drm modeset=1  # For Wayland

# This typically breaks X11. To return, redo the above to unload the module and add it without
sudo modprobe nvidia_drm            # For X11

# Start the greeter again, now that the kernel module has been reloaded
sudo service sddm start

Some people are saying we don’t need to manually set the modeset=1 kernel argument anymore. Maybe it’s trying to apply modeset=1 automatically in the background and breaking X11 in the process. It may be possible to rmmod and reload the kernel module manually. Indeed, reloading kernel modules as above but without modeset=1 gets me back, but I still don’t have wayland running.

After logging in I now have a much smaller mouse (native resolution), but still a black screen. Something is still broken. There is some discussion of trailing mouse artefacts but nothing jumping out. Maybe some user configuration is causing a conflict. A few other disucssions of issues…

  • https://www.reddit.com/r/Fedora/comments/163qd3r/fedora_39_kde_plasma_wayland_lags_and_window/
  • https://discussion.fedoraproject.org/t/problems-with-wayland-after-updating-to-fedora-39/95501/2
  • https://discussion.fedoraproject.org/t/f39-kde-wayland-logged-out-shortly-after-login-heads-up/95498
  • https://www.reddit.com/r/kde/comments/17efpz8/did_something_change_with_wayland_kde_and_nvidia/

Maybe an nvidia driver update would help…

nvidia-driver.x86_64                                                    3:545.23.08-1.fc37                                @cuda-fedora37-x86_64

Damn. No fedora 39 repo exists yet, so I just uninstalled this and downloaded the .run file drivers from the nvidia webpage directly.

sudo dnf remove nvidia-driver
sudo dnf install dkms  # because the above command removed it as an unused dependency
chmod u+x ~/Downloads/NVIDIA-Linux-x86_64-535.146.02.run
sudo ~/Downloads/NVIDIA-Linux-x86_64-535.146.02.run

Mouse trails still there. Reading nvidia_drm with modeset=1 gave me a small/native resolution but very laggy mouse, still with a black screen.

Success

Finally I noticed the kde config directory is not ~/.kde and there’s a few ~/config/kde*.

Ls -Flatr ~/config/kde*
mv ~/.config/kdedefaults{,.bak}
mv ~/.config/kde.org{,.bak}

Then I ran with nvidia_drm modeset=1 and I got a loading screen and am typing this post in plasma wayland now.

Animation generally feels snappier on my 144hz 4k monitor, but incredible laggy when changing window focus or moving windows to the top of the screen and getting a maximize preview. Some rendering bugs after resizing, e.g. from google chrome which does its own window decorations.

To see what config option might have broke things I had a quick look with meld ~/.config/kde.org.bak ~/.config/kde.org. There didn’t seem to be much happening there except the following:

Theme=org.fedoraproject.fedora.desktop
Theme=org.kde.breezetwilight.desktop

Finally I tried adjusting the display scaling for my 4k monitors (as it had reverted to 100%). After changing to 200% and then back to 150% the mouse started lagging badly — down to ~1fps — at which point I just gave up.

Plasma Wayland is still not ready for me yet :(