xrdp: xrdp-sesman fails, rendering xrdp logins impossible on WSLg / Ubuntu 22.04
xrdp version
0.9.17-2
Detailed xrdp version, build options
$ xrdp --version
The log reference is NULL - log not initialized properly
xrdp 0.9.17
A Remote Desktop Protocol Server.
Copyright (C) 2004-2020 Jay Sorg, Neutrino Labs, and all contributors.
See https://github.com/neutrinolabs/xrdp for more information.
Configure options:
--enable-ipv6
--enable-jpeg
--enable-fuse
--enable-rfxcodec
--enable-opus
--enable-painter
--enable-vsock
--build=x86_64-linux-gnu
--prefix=/usr
--includedir=${prefix}/include
--mandir=${prefix}/share/man
--infodir=${prefix}/share/info
--sysconfdir=/etc
--localstatedir=/var
--disable-silent-rules
--libdir=${prefix}/lib/x86_64-linux-gnu
--libexecdir=${prefix}/lib/x86_64-linux-gnu
--disable-maintainer-mode
--disable-dependency-tracking
--with-socketdir=/run/xrdp/sockdir
build_alias=x86_64-linux-gnu
CFLAGS=-g -O2 -ffile-prefix-map=/build/xrdp-asBei3/xrdp-0.9.17=. -flto=auto -ffat-lto-objects -flto=auto -ffat-lto-objects -fstack-protector-strong -Wformat -Werror=format-security
LDFLAGS=-Wl,-Bsymbolic-functions -flto=auto -ffat-lto-objects -flto=auto -Wl,-z,relro -Wl,-z,now -Wl,--as-needed
CPPFLAGS=-Wdate-time -D_FORTIFY_SOURCE=2 -Wno-error=deprecated-declarations
PKG_CONFIG_PATH=/build/xrdp-asBei3/xrdp-0.9.17/pkgconfig
Compiled with OpenSSL 3.0.2 15 Mar 2022
Operating system & version
WSLg / Ubuntu 22.04.2 LTS
Installation method
dnf / apt / zypper / pkg / etc
Which backend do you use?
xorgxrdp
What desktop environment do you use?
xfce
Environment xrdp running on
WSLg on Windows 10 Professional 64-bit
What’s your client?
Microsoft’s official client
Area(s) with issue?
Session manager (sesman)
Steps to reproduce
Attempt to log in via Microsoft’s remote desktop program. Affter logging in, the system just shows an empty green or black screen. If you check systemctl status xrdp, the system says “failed” due to a dependency (xrdp-sesman) failing. xrdp-sesman.
✔️ Expected Behavior
I expected to be able to log in to the xfce desktop in my Windows Subsystem for Linux Ubuntu install
❌ Actual Behavior
No login is performed, the client just stops responding and I have to close it. Restarting WSL does nothing. Restarting xrdp does nothing. re-installing xrdp and xfce4 is hit-or-miss… Genie is not installed, as WSL2 and WSLg now support Systemd natively.
Anything else?
I saw this article ( https://medium.com/@riley.kao/wsl2-ubuntu20-04-gui-remote-desktop-connection-rdp-2bbd21d2fa71 )on how to connect to WSL2 and WSLg via the Remote Desktop Protocol, and decided to give it a shot, and for a while, it worked… but if i log out and wait a while (perhaps an hour or so), or restart WSL, i lose the ability to log back in, and it’s very difficult to regain it…
the systemd service “xrdp” fails becuase it depends on “xrdp-sesman” but that fails becuase of the following errors:
results of “systemctl status xrdp.service” :
xrdp[19457]: [ERROR] g_tcp_bind(7, 3390) failed bind IPv6 (errno=98) and IPv4 (errno=22).
xrdp[19457]: [ERROR] trans_listen_address failed
xrdp[19457]: [ERROR] Failed to start xrdp daemon, possibly address already in use.
systemd[1]: xrdp.service: Control process exited, code=exited, status=1/FAILURE
results of “journalctl -xeu xrdp.service” :
xrdp.service: Failed to kill control group /system.slice/xrdp.service, ignoring: Input/output error
xrdp.service: Failed with result 'exit-code'.
results of "sudo systemctl start xrdp-sesman"
[INFO ] starting xrdp-sesman with pid 9528
Started xrdp session manager.
Stopping xrdp session manager...
xrdp-sesman.service: Control process exited, code=exited, status=1/FAILURE
[INFO ] shutting down sesman 1
xrdp-sesman.service: Failed to kill control group /system.slice/xrdp-sesman.service, ignoring: Input/output error
xrdp-sesman.service: Failed with result 'exit-code'.
at boot, this is what appears when i type “sudo systemctl start xrdp-sesman”:
systemd[1]: Starting xrdp session manager...
xrdp-sesman[792]: xrdp-sesman is already running.
xrdp-sesman[792]: if it's not running, try removing /var/run/xrdp/xrdp-sesman.pid
systemd[1]: xrdp-sesman.service: Control process exited, code=exited, status=1/FAILURE
That directory, /var/run/xrdp/ does not exist… and if i try to create it, the thing just gets deleted during the next boot, and fails anyway.
Why is it failing to end that process? it’s running as root!
contents of /etc/xrdp/startwm.sh:
#!/bin/sh
# xrdp X session start script (c) 2015, 2017, 2021 mirabilos
# published under The MirOS Licence
# Rely on /etc/pam.d/xrdp-sesman using pam_env to load both
# /etc/environment and /etc/default/locale to initialise the
# locale and the user environment properly.
unset DBUS_SESSION_BUS_ADDRESS
unset XDG_RUNTIME_DIR
.$HOME/.profile
if test -r /etc/profile; then
. /etc/profile
fi
# test -x /etc/X11/Xsession && exec /etc/X11/Xsession
# exec /bin/sh /etc/X11/Xsession
# xce4
startxfce4
(commenting-out unset and .$HOME/.profile does nothing, by the way)
contents of beginning of /etc/xrdp/xrdp.ini:
[Globals]
; xrdp.ini file version number
ini_version=1
; fork a new process for each incoming connection
fork=true
; ports to listen on, number alone means listen on all interfaces
; 0.0.0.0 or :: if ipv6 is configured
; space between multiple occurrences
; ALL specified interfaces must be UP when xrdp starts, otherwise xrdp will fail to start
;
; Examples:
; port=3390
; port=unix://./tmp/xrdp.socket
; port=tcp://.:3390 127.0.0.1:3390
; port=tcp://:3390 *:3390
; port=tcp://<any ipv4 format addr>:3390 192.168.1.1:3390
; port=tcp6://.:3390 ::1:3390
; port=tcp6://:3390 *:3390
; port=tcp6://{<any ipv6 format addr>}:3390 {FC00:0:0:0:0:0:0:1}:3390
; port=vsock://<cid>:<port>
port=3390
; 'port' above should be connected to with vsock instead of tcp
; use this only with number alone in port above
; prefer use vsock://<cid>:<port> above
use_vsock=false
I’ve attached log files in the hopes we can figure out why this happens. Xrdp.txt is the /etc/xrdp/xrdp.ini file. xrdp.log xrdp-sesman.log xrdp.txt
About this issue
- Original URL
- State: open
- Created a year ago
- Comments: 19 (9 by maintainers)
yeah, i did remove it… apparently, the system re-added it a couple of times. i ran systemctl daemon-reload three times and it finally accepted the edits.
so, let’s see what’s going on with the daemon processes themselves…
THAT"S A HUGE CHANGE! Usually, xrdp-sesman dies, and that makes xrdp not load… okay, let’s see if xrdp loads next!
Well, as Bon Jovi sang in the 1980s: We’re Half-way There!
Edit:
so far, nothing is listening on port 3390, but xrdp seems to think so…
one reboot of WSL later and xrdp-sesman is back to failing as well… and on boot, i saw this one line:
I bet the two are related (like, a handle or PID not being given up properly when the system shuts down…
what’s bizarre is if i edit /etc/xrdp/xrdp.ini and tell it to use port 3391, the service then starts and i can log in, even without xrdp-sesman running… i just don’t want to have to constantly change ports…