DEV Community

Discussion on: Linux on Windows: WSL with Desktop Environment via RDP

Collapse
 
avanishsubbiah profile image
avanishsubbiah

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.

Collapse
 
darksmile92 profile image
Robin Kretzschmar

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

Collapse
 
pyroglyph profile image
Connor McCarroll

I have the same issue.
/var/log/syslog and /var/log/sesman.log don't exist for me, but /var/log/xrdp-sesman.log contains the following:

[20200309-11:24:30] [DEBUG] libscp initialized
[20200309-11:24:30] [DEBUG] Testing if xrdp-sesman can listen on 127.0.0.1 port 3350.
[20200309-11:24:30] [DEBUG] Closed socket 0 (AF_INET6 ::1 port 3350)
[20200309-11:24:30] [INFO ] starting xrdp-sesman with pid 15356
[20200309-11:24:30] [INFO ] listening to port 3350 on 127.0.0.1
[20200309-11:24:54] [INFO ] A connection received from ::1 port 9186
[20200309-11:24:55] [INFO ] ++ created session (access granted): username pyro, ip ::ffff:127.0.0.1:9181 - socket: 11
[20200309-11:24:55] [INFO ] starting Xorg session...
[20200309-11:24:55] [DEBUG] Closed socket 8 (AF_INET6 :: port 5910)
[20200309-11:24:55] [DEBUG] Closed socket 8 (AF_INET6 :: port 6010)
[20200309-11:24:55] [DEBUG] Closed socket 8 (AF_INET6 :: port 6210)
[20200309-11:24:55] [DEBUG] Closed socket 7 (AF_INET6 ::1 port 3350)
[20200309-11:24:55] [INFO ] calling auth_start_session from pid 15381
[20200309-11:24:55] [DEBUG] Closed socket 6 (AF_INET6 ::1 port 3350)
[20200309-11:24:55] [DEBUG] Closed socket 7 (AF_INET6 ::1 port 3350)
[20200309-11:24:55] [INFO ] /usr/lib/xorg/Xorg :10 -auth .Xauthority -config xrdp/xorg.conf -noreset -nolisten tcp -logfile .xorgxrdp.%s.log      [20200309-11:24:55] [CORE ] waiting for window manager (pid 15382) to exit
[20200309-11:24:56] [CORE ] window manager (pid 15382) did exit, cleaning up session
[20200309-11:24:56] [INFO ] calling auth_stop_session and auth_end from pid 15381
[20200309-11:24:56] [DEBUG] cleanup_sockets:
[20200309-11:24:56] [DEBUG] cleanup_sockets: deleting /var/run/xrdp/sockdir/xrdp_chansrv_audio_out_socket_10
[20200309-11:24:56] [DEBUG] cleanup_sockets: deleting /var/run/xrdp/sockdir/xrdp_chansrv_audio_in_socket_10
[20200309-11:24:56] [DEBUG] cleanup_sockets: deleting /var/run/xrdp/sockdir/xrdpapi_10
[20200309-11:24:56] [INFO ] ++ terminated session:  username pyro, display :10.0, session_pid 15381, ip ::ffff:127.0.0.1:9181 - socket: 11

I'm not entirely sure what's going on here. Any ideas?

Thread Thread
 
darksmile92 profile image
Robin Kretzschmar

Sorry no idea just from the logs.
Can you please post the content of your xorg.conf file?
Maybe this gives a hint.

Thread Thread
 
pyroglyph profile image
Connor McCarroll

Sure, here it is:

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 -vsync
    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" "1920x1080"
    EndSubSection
EndSection
Collapse
 
darksmile92 profile image
Robin Kretzschmar

You could start analyzing it by checking the logs. Open your wsdl env in powershell and check logs located at /var/log for clues.

Collapse
 
rescenic profile image
Muhammad Ridwan Hakim • Edited

In Ubuntu WSL:
sudo apt-get purge xrdp

then

sudo apt-get install xrdp
sudo apt-get install xfce4
sudo apt-get install xfce4-goodies

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

add these lines:
# xfce
startxfce4

sudo /etc/init.d/xrdp start

Now in Windows, use Remote Desktop Connection
localhost:3390
then login with Xorg, fill in your username and password.

Collapse
 
r33code profile image
r33

Those instructions did the trick for me. :)
Thank you very much.

Collapse
 
dowenrei profile image
wenrei

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

Collapse
 
myrons profile image
Myron

Thank-you. Worked perfectly. :-)

Collapse
 
vinimartins profile image
Vinicius Martins

Thaaaanks! It Worked

Collapse
 
bakaratiq profile image
Mohammad Abubakar Atiq

I just change the port to 3400 i hope it dont effect the server but this error is coming up. Any recommendations?

Thread Thread
 
rescenic profile image
Muhammad Ridwan Hakim

which error?

Collapse
 
raviln profile image
Ravil Nugmanov

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.

Thread Thread
 
darksmile92 profile image
Robin Kretzschmar

It seems like newer versions of wsl are having this behavior, good that Ridwan shared his solution and you got it working with it 😊

Thread Thread
 
bagoes profile image
bagoes

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.

Collapse
 
asap profile image
S.P.

Thanks, @rescenic ! I had the same problem, you solution works