Linux On Windows - WSL With Desktop Environment Via RDP - DEV Community ? - ?? - ?
Linux On Windows - WSL With Desktop Environment Via RDP - DEV Community ? - ?? - ?
Linux On Windows - WSL With Desktop Environment Via RDP - DEV Community ? - ?? - ?
WSL (Windows Subsystem for Linux) is very common these days especially with the new
that Windows will ship a Linux kernel with WSL 2.0!
Installing a Linux distro as WSL is easy via the Microsoft App Store and there are plenty of
tutorials out there for it.
Most of the resources cover the access via Shell, Terminal, Hyperterminal or other console
based tools to the WSL.
Running GUI software is possible and there are resources describing how to archieve this
via VcXsrv (see chapter in this post of mine).
For Kali:
EDIT: 08/2022
As Elvis Van mentioned in the comments, there is a package for Kali linux now targeting
specifically this case: kali-win-kex. It takes care of the full setup of all Kali components and
configurations to give you the Kali Desktop experience under WSL2.
Installing Xrdp
Xrdp is an open source remote desktop solution and also very lightweight and easy to
configure. This command will install the package and setup the default configuration with
port 3389.
Configuring Xrdp
Copy the config file as backup before the changes, change the port from 3389 to 3390
and for quality reasons increase the bpp from 24 to 128. You can play with those settings
but since this is a local connection, the speed should not be worse with those settings.
And finally restarting the xrdp service to apply the changes.
Now you can connect via localhost:3390 and the credentials of your WSL account via
RDP! 💪
Why the port change from 3389 to 3390?
Two reasons: security and sometimes port 3389 is used by a process on wsl and you get
the message
Your computer could not connect to another console session on the remote computer
because you already have a console session in progress.
However it is okay if I double click a text file a gedit GUI would run without problem. I have
tried export DISPLAY=:0.0 but no luck. Any ideals?
You need to find out the display which the X server assigned.
Maybe you have luck with:
Hello, I followed the instructions for other debian based distros because I am using Ubuntu
18.04 on WSL 2. I am able to get to the Xrdp login in page; however, as soon as I type in my
WSL credentials it closes out back to the RDP window.
In Ubuntu WSL:
sudo apt-get purge xrdp
then
configure :
sudo cp /etc/xrdp/xrdp.ini /etc/xrdp/xrdp.ini.bak
sudo sed -i 's/3389/3390/g' /etc/xrdp/xrdp.ini
sudo sed -i 's/max_bpp=32/#max_bpp=32\nmax_bpp=128/g' /etc/xrdp/xrdp.ini
sudo sed -i 's/xserverbpp=24/#xserverbpp=24\nxserverbpp=128/g' /etc/xrdp/xrdp.ini
echo xfce4-session > ~/.xsession
sudo nano /etc/xrdp/startwm.sh
comment these lines to:
#test -x /etc/X11/Xsession && exec /etc/X11/Xsession
#exec /bin/sh /etc/X11/Xsession
Hi,
First I followed original instructions, but after connecting over RDP and entering login
credentials, it was closing the RDP session immediately.
Then I run all commands from Ridwan's post, and now it works well!
Thank you Robin and Ridwan!
PS: I have Ubuntu 20.04 installed in WSL 2.
It seems like newer versions of wsl are having this behavior, good that Ridwan shared
his solution and you got it working with it 😊
I have run Ubuntu with xfce on WSL1 using VcXsrv, but can't use the browser. I tried to
update Windows to be able to try WSL2, it turns out that xfce could not run due to
display problems. Finally here I found the solution by Ridwan, of courser Robin also
who made the tutorial thread, as well as other commentators. Thanks.
Superb, thanks! Editing the startwm.sh file solves the problem of closing the rdp session
after entering the login credentials.
FYI: It only works on Ubuntu 20.04, Ubuntu 18 wouldn't work for me
I just change the port to 3400 i hope it dont effect the server but this error is coming up.
Any recommendations?
which error?
Can you open a wsl command line end check the logs right after this happens?
I'd check at least those logs:
tail -n 100 /var/log/syslog
tail -n 100 /var/log/xrdp-sesman.log
tail -n 100 var/log/sesman.log
Section "ServerLayout"
Identifier "X11 Server"
Screen "Screen (xrdpdev)"
InputDevice "xrdpMouse" "CorePointer"
InputDevice "xrdpKeyboard" "CoreKeyboard"
EndSection
Section "ServerFlags"
Option "DontVTSwitch" "on"
Option "AutoAddDevices" "off"
EndSection
Section "Module"
Load "dbe"
Load "ddc"
Load "extmod"
Load "glx"
Load "int10"
Load "record"
Load "vbe"
Load "xorgxrdp"
Load "fb"
EndSection
Section "InputDevice"
Identifier "xrdpKeyboard"
Driver "xrdpkeyb"
EndSection
Section "InputDevice"
Identifier "xrdpMouse"
Driver "xrdpmouse"
EndSection
Section "Monitor"
Identifier "Monitor"
Option "DPMS"
HorizSync 30-80
VertRefresh 60-75
ModeLine "1920x1080" 138.500 1920 1968 2000 2080 1080 1083 1088 1111 +hsync -vsyn
ModeLine "1280x720" 74.25 1280 1720 1760 1980 720 725 730 750 +HSync +VSync
Modeline "1368x768" 72.25 1368 1416 1448 1528 768 771 781 790 +hsync -vsync
Modeline "1600x900" 119.00 1600 1696 1864 2128 900 901 904 932 -hsync +vsync
EndSection
Section "Device"
Identifier "Video Card (xrdpdev)"
Driver "xrdpdev"
EndSection
Section "Screen"
Identifier "Screen (xrdpdev)"
Device "Video Card (xrdpdev)"
Monitor "Monitor"
DefaultDepth 24
SubSection "Display"
Depth 24
Modes "640x480" "800x600" "1024x768" "1280x720" "1280x1024" "1600x900" "1920x
EndSubSection
EndSection
You could start analyzing it by checking the logs. Open your wsdl env in powershell and
check logs located at /var/log for clues.
update on 8/2022, there's a new kali-specific package for this called kali-win-kex, it's been
pretty smooth and a lot more easy to setup than this
Connection Log
connecting to sesman ip 127.0.0.1 port 3350
sesman connect ok
sending login info to session manager, please wait...
login failed for display 0
login failed means, you can't login to xorg session, try reset your account password in
ubuntu wsl.
passwd username or sudo passwd username.
This error is because Windows 10 home edition doesn't all RDP. I'm going to wait until the
MS GUI release which should be in March 2021
No it doesn't make a difference whether you're on Home or Professional; you can still
connect to RDP, even on Android. The xrdp server is running on WSL, not the main
Windows, so it isn't affected. I have Kubuntu Desktop running perfectly on Windows 10
Home Edition. For me, that message comes up when I put in the wrong password.
Proof:
I have the same issue that the RDP window is closed as soon as I type in my credentials in
Xrdp login page. It's already resolved by:
This worked
Hi. I'm absolutely new in this and followed your instructions step by step.
The last line of the process shows:
Hey neuquenfr, the port 3390 is the port for RDP (Remote Desktop Protocol) connection
so you should use remote desktop to connect to your desktop environment within the
WSL.
One way would be to search for mstsc in Cortana or the start menu and connect with this.
It works, now.
Great help!
Brett Morgan • Aug 15 '20
Awesome article, thanks! Helped clarify a few things after dismissing WSL2 a while back,
updates dont seem to work as well if I'm connected through my VPN service, any idea why
that is? It doesn't get all the repo packages but after i disconnect from the VPN it upgrades
fine, kind of weird!
This sounds strange. My first guess would be your VPN provider blocks some of the
needed DNS records from resolving or anything else that changes during your VPN
connection.
I just really wanted to thank you. Your post was tremendously helpful because it solved a
WSL problem that I've been working on for two days. I was getting very strange errors from
xfce4 and xrdp (no DISPLAY, no console, etc.), and read through hours' worth of posts, and
nothing solved my problem. I reinstalled WSL2 about 7 times, with different attempts, the
problem remained. The changes to the xrdp.ini script that you mentioned both solved the
issue AND allows me to use localhost to RDP into WSL2 (I certainly was tired of changing
the RDP IP almost daily). Can't get better than that. I owe you cofee!!
I'm really happy to read that my article was able to help you solve the problem, I know the
feeling of being stuck with such things and searching for days too well :)
Buy me a coffee
Is there a way to modify this procedure to use GNOME instead of xfce? I've tried putting
gnome-session in ~/.xsession instead of startxfce4 , as well as anything else I can think of,
but it's not working.
hussainisaiduabubakar • Jan 25 '21
I have followed all the above instruction and it works till when I log in my credentials then
after that it output 'unable to contact settings server, failed to execute child process "dbus-
launch" (no such file or directory)' pls I need it been trying to fix it for months now,
thank u
This reddit thread seems to have a solution that worked for a couple of people, maybe try
it with this:
I have followed all the above instruction and it works till when I log in my credentials then
after that it output 'unable to contact settings server, failed to execute child process "dbus-
launch" (no such file or directory)' pls i need it been trying to fix it for months now,
thank u
hello, pls I followed the procedure u gave up but when I log in to RDP after putting in my
credentials then it will go blank and output a message, 'unable to connect settings server.
failed to execute child process"dbus-launch" (no such file or directory)'
pls i have followed all the procedure but after assigning my credentials is now showing
'unable to connect settings server, failed to execute child process "dbus-launch" (no such
file or directory)' can anyone help me solve this issue.
thank u
Hi. I'm absolutely new in this and followed your instructions step by step.
The last line of the process shows:
Started coding at the age of 13, now a professional software engineer and Scrum Master, creating
and maintaining enterprise solutions. Eat - Sleep - Code - Lift - Repeat 💪🏾
LOCATION
Mannheim, Germany
WORK
Senior Software Engineer, SCRUM Master
JOINED
Nov 14, 2017
Windows 10 FluentTerminal
#windows #terminal #productivity #wsl