Inspiration: https://www.most-useful.com/kde-plasma-on-wsl.html
- Update WSL
- In windows command prompt run:
wsl --update
- In windows command prompt run:
- Add systemd to ubuntu
- In ubuntu prompt run:
sudo nano /etc/wsl.conf
- Add the following to the file:
[boot] systemd=true
- Save and exit by pressing ctrl + o and then ctrl + x
- Shutdown WSL by running the following in the windows command prompt:
wsl --shutdown
- Restart WSL by opening a new terminal session for Ubuntu
- In ubuntu prompt run:
sudo apt update
sudo apt install kubuntu-desktop
Select SDDM as display manager during setup
sudo apt install lightdm
During installation, select lightdm as default display manager using arrow keys
Edit the lightdm configuration as follows:
sudo nano /etc/lightdm/lightdm.conf
Add the following text
[Seat:*]
user-session=plasma
[LightDM]
start-default-seat=false
[XDMCPServer]
enabled=true
port=177
Save and exit by pressing ctrl + o and then ctrl + x
Download and install this software for windows:
https://sourceforge.net/projects/vcxsrv/
- From windows open the XLaunch program
- Select the
One window without titlebar
option and clickNext
- Selct
Open session via XDMCP
and click next - In your ubuntu terminal you need to get the ip address of the wsl2 instance:
- Run:
sudo apt install net-tools
- Run:
ifconfig eth0 | grep inet
- The ip address will be listed after the
inet
item and usually looks like 172.xxx.xxx.xxx
- Run:
- Copy the ip address above and paste into the text box next to
Connect to host
in the XLaunch window and clicknext
- Modify the default settings to uncheck
Native opengl
and checkDisable access control
- Click
Next
- Click
Save configuration
and save the file to your desktop and name the file whatever you want - VITALLY IMPORTANT: When you first run VcXSrv (or XLaunch) you’ll get a Windows Firewall popup. You will need to allow it to accept connections on both the PRIVATE and PUBLIC networks. If you don’t allow PUBLIC networks you will not get a connection as the WSL Virtual Network is considered to be PUBLIC
- Click
Finish
- From the KDE desktop, click the start menu, go to
Computer
then clickSystem Settings
- Underneath
Hardware
in the left panel, clickDisplay and Monitor
- Select
Compositor
from the left panel - Change the
rendering backend
toXRender
- Check
Enable compositor on startup
- Click
Apply
It pops up for me but it's just a black screen that flickers every minute or so? What custom rule should I add? And if I get it to work and need to shut down my PC for any reason, can I just launch kex like normal or is there another process for starting it up?
EDIT:
I found that I got errors when launching kex and I figured out the solution.
Go back to /etc/wsl.conf and set it to
false
Go into cmd/powershell and shutdown wsl, type:
wsl --shutdown
Launch the distro again, for me I hit Windows start menu and clicked "Kali".
When bash loads, set the x-session manager to KDE by typing:
$ sudo update-alternatives --config x-session-manager
You should see something similar to:
There are 3 choices for the alternative x-session-manager (providing /usr/bin/x-session-manager).
Selection Path Priority Status
---------------------------------------------------------
* 0 /usr/bin/startxfce4 50 auto mode
1 /usr/bin/startplasma-x11 40 manual mode
2 /usr/bin/startxfce4 50 manual mode
3 /usr/bin/xfce4-session 40 manual mode
Press < enter > to keep the current choice[*], or type selection number:
Type the corresponding number in bash, for me it was 1.
Shutdown wsl from cmd again. Launch your distro, kali for me. And lastly, launch kex from bash.
It loaded for me and I even have a lock screen too :D