KDE on Ubuntu on Windows!!! submitted by
That's right, you heard me correctly, and the proof lies right here before your very eyes, absolutely no GIMPing necessary! All those who wish to pay for Windows just so they can bypass it and run free Linux distributions and apps non-natively, rejoice!
I have KDE (from the kubuntu-desktop package) working pretty much 100% just like on a native setup! No need for fancy custom Linux kernels, no flashy custom WSL distributions, just good old Ubuntu from the Windows store and a bunch of free downloads to supplement it. Obviously it doesn't have direct bluetooth access and whatnot, but I think I've got just about everything I could need for now and everything WSL 2 currently permits. As you can see, I've got high resolution graphical output with VcXsrv and working audio with Pulseaudio, the microphone works too (many setup guides recommend disabling the Pulseaudio microphone capability, but it appears that some recent Windows update fixed this issue).
There's no software rendering warning in the KDE system tray because I disabled the Windows native OpenGL rendering option and allow WSL 2 to perform its own direct hardware rendering, also the authentication system in KDE works properly and allows me to change system settings or install apps and updates because I'm using Genie
to run a fake SystemD environment (without this you would have to run it as root). With SystemD running, you need to set up NetPlan to manage your internet connection, there's all sorts of fantastic tips on this and other WSL issues found here
To get Muon Package Manager running and authenticating properly without undesirable workarounds, I had to edit the file org.kubuntu.qaptworker3.policy in the PolicyKit actions folder and add in "allow_any" flags for all the actions, because it appears that WSL doesn't log you in as an active or inactive user (try the "w" or "who" commands, I get empty output), but apparently you do get counted under the "any" category. I might possibly need to do a similar fix for other apps, but I haven't noticed any similar such issues yet.
If you follow the high DPI graphics tips in the second link I posted, I recommend adding GDK_SCALE=2 to your /etc/environment file to compensate. You could set it in your own .bashrc, but then it won't be picked up by programs that run in their own environments. Edit: Upon further testing, it’s actually best to set it in both files. Add “GDK_SCALE=2” to etc/environment and “export GDK_SCALE=2” to your .bashrc.
There's also a GDK_DPI_SCALE variable you can set, but I didn't personally find any need or benefit to doing so in my case. If you find the KDE system tray icons to be ridiculously tiny because of the high DPI settings, you can fix that by first resizing and re-docking the associated panel, then editing the appropriate config file as detailed here
This more or less covers my basic setup, there might be a tweak or two I'm forgetting. A last couple of tips, if you find Pulseaudio refusing to start up again after shutting it down, go to your Windows user home directory, enter the .pulse directory and the daughter directory beneath it, then delete the little pid file you see there (it's normally supposed to be deleted by Pulseaudio on exit, but won't be if you shut it down by closing its command window). You can avoid this issue altogether by shutting down pulseaudio.exe with the ctrl+C key combo. Also make sure to run VcXsrv in one of the single window modes when running the Plasma desktop, if that's what you choose for graphics output as I did. Conversely, run in multi-window mode outside the Plasma environment. You could start two X-servers on channels 0 and 1 and have a WSL session running with each one to get the best of both worlds.
Special thanks to Arkane Systems
for making Genie, Steve Brown
for his amazingly useful tips, and all the countless others who took the time and effort to put important info out there on the web for stoners like myself to muck around with.
Edit: Also my apologies, if possible could the mods please edit my post title to read "Fully Working KDE on Bash on Ubuntu 20.04 on Windows 10!!!"
Edit 2: Another big tip: to run KDE apps outside Plasma that require authentication without running as root, you will need a graphical authentication agent such as polkit-kde-agent-1 to be loaded in the background. Plasma does this automatically when you start it up, but outside that environment you must do it manually. I can’t speak for other authenticators, but the one provided by KDE requires SystemD to be running, which I accomplish as mentioned above using Genie. I believe you will also need to run it with genie -s to start a fake SystemD login, but I haven’t fully tested the effects of genie -c.
Edit 3: I personally recommend installing the mesa-utils package if you don't already have it. This will provide you with the llvmpipe graphics driver, which has some limited capabilities within WSL for leveraging your graphics card to speed things up (Correction! It's entirely CPU based). Once installed, and with your X-server loaded and set to allow direct OpenGL rendering as opposed to indirect rendering through Windows, run the graphical program "glxgears" and verify that the gears are turning smoothly. It appears that WSL doesn't currently have much if any support for hardware acceleration with OpenGL, so you should set your KDE Plasma window compositor to run on the Xrender backend rather than OpenGL 2 or 3.1.
You'll miss out a few OpenGL desktop window transition effects, but the MASSIVE boost in performance should be well worth it. Sadly using indirect rendering via Windows isn't an option here because X11 forwarding only supports OpenGL 1.4 and lower; if you try to go for that option with Plasma's windows compositor set to run on OpenGL, you'll most likely just cause your X-server to crash and shut down. I'm about to start experimenting with X2Go as a substitute for X11 forwarding and see what kind of OpenGL support and other capabilities it provides, if anyone else has tips or suggestions on how to get optimal hardware acceleration, please don't hesitate to let me know!
Update: Steve Brown has posted another excellent guide which covers many of the steps I've recommended in this post, you can find it here
, covering instructions for getting Plasma running beautifully on a Surface Pro 3 and of course Windows 10 devices in general. I personally recommend further security precautions when setting up your firewall rather than opening it up to all public networks, and if you want any advice on this matter then please feel free to contact me or look for the many existing guides on setting up a secure firewall with WSL.