A Full Desktop in WSL with no SystemD-Genie needed – much easier install than previous tutorials
Artix With KDE Is Very Fast
January 11th, 2022
Why would you want to look at Artix on WSL? I’ve been investigating it because it’s built from the ground up not using SystemD. And SystemD is the biggest annoying factor of using a full desktop experience on WSL2. And in actually setting up Artix on WSL I’ve really enjoyed this Linux distro to the point where I might have to have a bit more of a play.
Incidentally, if you want a bit of a beginner friendly distribution (which Artix isn’t) then you can look at Devuan Linux which is a non-SystemD fork of Debian. I tried this installation initially but found that the KDE Plasma Desktop that came with Devuan for WSL was just way too old for my liking.
In my ramblings around this recently I’ve also found a MUCH better solution for running the Linux GUI applications in the form of GWSL. So this guide will talk about that too.
GWSL is available on the Microsoft Store for free, but the Store version has some limitations that are a bit of a pain on my nice shiny new HP Envy x360. So I ended up putting the downloadable full version on.
Prepare Windows for WSL2
Before you can do anything with WSL you’re going to need to prepare your Windows 10 installation for working with it. I’m not going to go into the details of how to do that because Microsoft are the authority there and I’ll defer to their far superior knowledge.
At the moment it’s quite likely you’ll have to read the Manual Installation Steps unless you’re part of the Windows Insider Program. In which case you’ll probably know how to install WSL2 already 🙂
Download and Install Artix
So, with Ubuntu and Kali – and even to some extent the Fedora Spin for WSL, it’s fairly straight forward to install these distributions into WSL. But for other distributions it’s a little more awkward. Fortunately though, there’s plenty of people on GitHub who’ve created WSL instances of different distributions and created some rudimentary installers for them.
For Artix, go to https://github.com/hdk5/ArtixWSL and download the latest release. Follow the instructions for installing it and creating a WSL installation. Once you’ve finished you might need to convert it to a WSL 2 instance instead of a WSL1 instance.
To check open up a Powershell prompt and type
wsl -l -v
If your Artix installation is installed and registered it’ll tell you which version it is. If it’s Version 1 it’s best to convert it to WSL2 using the command;
wsl --set-version Artix 2
Once it’s converted you should be able to enter the Artix WSL by typing simply;
wsl -d Artix
from the Powershell prompt.
If you don’t yet have it, I’d highly recommend getting a copy of Windows Terminal from the Microsoft Store. It’s far superior to the standard Powershell or CMD console.
You should end up with something that’s similar to the prompt below;
Update Pacman and The PGP Keyrings
This distribution comes with almost nothing installed by default. That’s the way Artix (and Arch Linux) users like it. I’m no Arch or Artix expert, although I have been using Linux since around 1993 so if I get something wrong and you’re an Arch or Artix purist I apologise. Please let me know in the comments!
Nevertheless, before you can do anything else you’re going to need to set up Pacman which is the Arch Linux Package Manager. The first thing we need to do is setup the PGP keys that Pacman uses to determine that packages are indeed what they say they are. To do that issue the following commands;
Then, once that’s done we have the PGP keys setup, we need to update the repository databases and install a few things such as sudo (which we need because we don’t want to be doing everything as root) and Plasma Desktop.
This may not be the best way to do this – if you have opinions I’d like to hear them in the comments. This is how I’ve done it for my WSL install but I’m acutely aware that I haven’t done anything this low level for a very long time and it simply may not be best practice any more.
But, in order to not have to login to the WSL distribution as root, we need to allow the sudo command to be operated by anyone who we deem acceptable to use it. Shortly we’re going to create one such user and we’re going to place them in the ‘wheel’ group. But all that will be for naught if we don’t first allow the ‘wheel’ group access to the sudo command. So, issue the following command;
Then look for the lines that look like the following;
## Uncomment to allow members of group wheel to execute any command
# %wheel ALL=(ALL) ALL
It’ll be somewhere around Line 82-83. Remove the # from the front of the command and save the file. That’s all you need to do with sudo for now.
Create a Non Root User
We don’t want to access everything on our WSL instance as root (the superuser, or the user who can do everything including break stuff). So we’re going to create a normal user – but one who is allowed to use sudo to become the super user if they choose.
In the commands below replace [username] with whatever you want your user to be called. In my case I used ‘steve’ (without quotes of course).
The commands above add a new user, then add them to the wheel group. Then we set a password for that new user (because you can’t use sudo if you don’t have a password). We then create a home directory for the user, and we make sure the user owns their own home directory.
Finally we’re going to set WSL up to automatically log us in as that user when we open a new WSL terminal prompt. To do that we need to edit /etc/wsl.conf and add the following lines.
Obviously replace the [username] with the username you chose above.
Download And Install GWSL
Don’t use the store version if you use a strange DPI and don’t want blurry screen. In my case on my HP Envy X360 my display scaling is set to 125% since the screen is a 1920 x 1080 resolution which is quite a high resolution on a laptop display. 100% is just a bit too small so I prefer (with my old eyes) the scaling set to the 125%. But with the scaling set to that, GWSL looks all blurry.
So, if you’re in the same position you’ll need to download the non-store, or full installation, version from the Github repository at https://opticos.github.io/gwsl/ – follow the links and choose the Traditional Windows Installer. Don’t choose the recommended Store version.
Install GWSL and then adjust the DPI settings if necessary by right clicking on the Start Menu item, choosing More and Open File Location. This will open Windows File Explorer and GWSL shortcut will be shown. Right click over that shortcut and choose Properties. Then choose Compatibility tab and put the tick in the Override High DPI Behaviour and make sure Application is set in the drop down box.
This will then make your Plasma Desktop responsible for the scaling, not GWSL. The result will be a nice sharp output.
For me, I setup my own GWSL profile and added -nodecoration to command line to get a nice full screen window with no title bar and with my windows taskbar still visible and usable. This means ultimately that you will be able to open Windows programs from the very bottom most taskbar and Plasma graphical apps from the task bar above it.
You may well also want to select the Auto-export DISPLAY option in GWSL. This will add some lines of code to your login scripts to automatically connect to your GWSL display server without you needing to know any intricacies. If you get an error you may need to install the ‘which’ package.
sudo pacman -S which
Set up DBUS
You will need a little Dbus tweaking. Primarily, you’ll need to set your WSL instance unique DBus machine-id.
To do this you’ll need to be root. For some reason sudo didn’t work properly for me trying to do this so I had to issue the following command first;
And then as root
dbus-uuidgen > /etc/machine-id
Additional D-Bus Stuff To Make Discover Work
So, if you’re wanting to use the Plasma package manager (instead of say, Octopi) then you’ll need to do a bit more to get D-Bus working properly. The above commands don’t actually make D-Bus run, they just seem to give most applications enough information to not complain.
Nevertheless, if you want any actual D-Bus traffic to flow it does seem that you need to do a bit more. Interestingly, even on a standard VM system I found that I couldn’t get Discover to work properly, so I wonder if Artix doesn’t properly start D-Bus even then? I doubt that – perhaps someone with more Artix knowledge could help me with that one?
Anyway. If you’re using GWSL you can create a shortcut to start Plasma on Artix which I’ll go into further down in the article – but to get it to work properly you will need to tell GWSL to start D-Bus. It’s a matter of ticking a box for GWSL, but behind the scenes you’re going to need to know that GWSL calls /etc/init.d/dbus as a script and expects that script to return as soon as D-Bus is started.
On Artix for WSL that script doesn’t exist. You can create it quite easily though.
Copy the run script from /etc/runit/sv/dbus to /etc/init.d and call it dbus (instead of run).
Then you need to edit the file, using something like;
Remove the command line parameter ‘–nofork’ from the line that starts with exec
This will tell dbus to start in the background and return immediately. Runit doesn’t like things running this way, but we’re not actually using runit we’ve just borrowed one of its startup scripts.
Start Plasma for X11
There are missing applications from within KDE Plasma because Artix is a minimal install system, leaving you the option of installing only what you need. But you’ll probably want the following options – although at the time of writing I cannot get Discover to work properly as the packagekit-qt5 package cannot connect to PackageKit. I’ll come back and let you know when I fix it 🙂 See above for information about D-Bus for getting Discover to work.
Dolphin is the KDE File Manager. You’ll almost certainly want that one. You may also want the firefox package. And perhaps others too but that’s beyond the scope of this post – you can look up which packages you want. They’re all installed with pacman commands similar to above.
If you like things like the Bing wallpaper of the day, you’ll need to add the KDEPlasma-Addons package available on pacman.
pacman -S kdeplasma-addons
Now you should be able to start Plasma. Make sure you have GWSL running already and that you can see the GWSL window. Open up a Windows terminal. You should see a prompt similar to the one pictured at the beginning of this post. The prompt should say something like;
You should see a whole bunch of error messages which are largely irrelevant – then in your GWSL window you should see something like the screenshot below;
Note how you can see the Windows taskbar at the bottom, and then above that is the KDE task bar.
I’ll leave it as an exercise for the reader on customizing the desktop that you have.
But note, there is no SystemD-Genie installed – because on Artix we don’t need to emulate SystemD because SystemD is not present on Artix at all. KDE Plasma in this case is just another X-Windows program which runs as the user.
Artix Not For The Faint Of Heart Perhaps?
But what is interesting, I think at least, is that I found this at least as easy to setup as Ubuntu GUI on WSL because there’s no need for SystemD emulation, no need to setup LightDM or XDMCP and GWSL makes setting up the GUI pre-requisites really easy.
Now I’ve just got to figure out how to get KDE Discover working properly or stick with Pacman.
If you have any comments, feedback or questions please drop me a line in the comments! Thanks for reading and I hope you enjoy your new Artix on WSL installation.
P.S. I find Artix to be extremely fast on my HP Envy x360 with Ryzen 7 processor. Your mileage may vary of course, but it’s definitely quicker than Ubuntu was on the same machine. And uses a LOT less virtual memory. It’s a nifty little minimal install with all the features you might need just at the execution of a pacman command. Highly recommended.