Open ringtailedfox opened 12 months ago
There seem to be multiple problems here. Let's start with xrdp.
At some point you've changed the port it's listening on from 3389 to 3390. That's fine, but it looks like something else is on that port already:-
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
I'll assume that you want to use port 3390 on your VM.
Can you restart the system and then post the results of these two commands:-
sudo journalctl -xeu xrdp.service
sudo ss -lp sport = :3390
Yes, i wanted to use port 3390 since this is on WSL and how i understand it is that port 3389 is how X11/Wayland renders graphical programs outside of RDP... this is basically a second RDP connection.
the results for sudo journalctl -xeu xrdp.service:
user@XOTICPC:/var/log/apache2$ sudo journalctl -xeu xrdp.service [sudo] password for user: Jul 22 23:29:08 XOTICPC xrdp[6847]: [INFO ] Using default X.509 certificate: /etc/xrdp/cert.pem Jul 22 23:29:08 XOTICPC xrdp[6845]: [ERROR] xrdp_iso_send: trans_write_copy_s failed Jul 22 23:29:08 XOTICPC xrdp[6847]: [INFO ] Using default X.509 key file: /etc/xrdp/key.pem Jul 22 23:29:08 XOTICPC xrdp[6845]: [ERROR] Sending [ITU T.125] DisconnectProviderUltimatum failed Jul 22 23:29:08 XOTICPC xrdp[6847]: [ERROR] Cannot read private key file /etc/xrdp/key.pem: Permission denied Jul 22 23:29:08 XOTICPC xrdp[6847]: [INFO ] Connected client computer name: XOTICPC Jul 22 23:29:08 XOTICPC xrdp[6847]: [WARN ] Received [MS-RDPBCGR] TS_UD_HEADER type 0xc006 is unknown (ignored) Jul 22 23:29:08 XOTICPC xrdp[6847]: [WARN ] Received [MS-RDPBCGR] TS_UD_HEADER type 0xc00a is unknown (ignored) Jul 22 23:29:08 XOTICPC xrdp[6847]: [INFO ] xrdp_load_keyboard_layout: Keyboard information sent by the RDP client, keyboard_type:[0x04], keyboard_subtype:[0x00], keylayout:[0x00000409] Jul 22 23:29:08 XOTICPC xrdp[6847]: [INFO ] xrdp_load_keyboard_layout: model [] variant [] layout [us] options [] Jul 22 23:29:08 XOTICPC xrdp[6847]: [INFO ] Non-TLS connection established from ::1 port 59796: encrypted with standard RDP security Jul 22 23:29:08 XOTICPC xrdp[6847]: [INFO ] xrdp_caps_process_pointer: client supports new(color) cursor Jul 22 23:29:08 XOTICPC xrdp[6847]: [INFO ] xrdp_process_offscreen_bmpcache: support level 1 cache size 10485760 MB cache entries 100 Jul 22 23:29:08 XOTICPC xrdp[6847]: [INFO ] xrdp_caps_process_codecs: nscodec, codec id 1, properties len 3 Jul 22 23:29:08 XOTICPC xrdp[6847]: [WARN ] xrdp_caps_process_codecs: unknown codec id 5 Jul 22 23:29:08 XOTICPC xrdp[6847]: [INFO ] xrdp_caps_process_codecs: RemoteFX, codec id 3, properties len 49 Jul 22 23:29:08 XOTICPC xrdp[6847]: [INFO ] Loading keymap file /etc/xrdp/km-00000409.ini Jul 22 23:29:08 XOTICPC xrdp[6847]: [WARN ] local keymap file for 0x00000409 found and doesn't match built in keymap, using local keymap file Jul 22 23:29:10 XOTICPC xrdp[6847]: [INFO ] connecting to sesman ip 127.0.0.1 port 3350 Jul 22 23:29:10 XOTICPC xrdp[6847]: [INFO ] xrdp_wm_log_msg: sesman connect ok Jul 22 23:29:10 XOTICPC xrdp[6847]: [INFO ] sesman connect ok Jul 22 23:29:10 XOTICPC xrdp[6847]: [INFO ] sending login info to session manager, please wait... Jul 22 23:29:10 XOTICPC xrdp[6847]: [INFO ] xrdp_wm_log_msg: login successful for display 10 Jul 22 23:29:10 XOTICPC xrdp[6847]: [INFO ] login successful for display 10 Jul 22 23:29:10 XOTICPC xrdp[6847]: [INFO ] loaded module 'libxup.so' ok, interface size 10296, version 4 Jul 22 23:29:10 XOTICPC xrdp[6847]: [INFO ] started connecting Jul 22 23:29:11 XOTICPC xrdp[6847]: [INFO ] lib_mod_connect: connecting via UNIX socket Jul 22 23:29:12 XOTICPC xrdp[6847]: [INFO ] lib_mod_log_peer: xrdp_pid=6847 connected to X11rdp_pid=6862 X11rdp_uid=1000 X11rdp_gid=1000 client_ip=::1 client_port=59796 Jul 22 23:29:12 XOTICPC xrdp[6847]: [INFO ] connected ok
the results of sudo ss -lp sport = :3390:
user@XOTICPC:/var/log/apache2$ sudo ss -lp sport = :3390 Netid State Recv-Q Send-Q Local Address:Port Peer Address:Port Process tcp LISTEN 0 2 :3390 :* users:(("xrdp",pid=6781,fd=11))
That all looks OK.
What do you now get for systemctl status xrdp.service
and systemctl status xrdp-sesman.service
?
right now it's working normally...
user@XOTICPC:/var/log/apache2$ systemctl status xrdp.service
● xrdp.service - xrdp daemon
Loaded: loaded (/lib/systemd/system/xrdp.service; enabled; vendor preset: enabled)
Active: active (running) since Sat 2023-07-22 23:28:54 EDT; 1 week 2 days ago
Docs: man:xrdp(8)
man:xrdp.ini(5)
Main PID: 6781 (xrdp)
Tasks: 2 (limit: 19120)
Memory: 20.3M
CGroup: /system.slice/xrdp.service
├─ 6781 /usr/sbin/xrdp
└─199570 /usr/sbin/xrdp
Jul 31 16:46:03 XOTICPC xrdp[199570]: [INFO ] xrdp_wm_log_msg: sesman connect ok
Jul 31 16:46:03 XOTICPC xrdp[199570]: [INFO ] sesman connect ok
Jul 31 16:46:03 XOTICPC xrdp[199570]: [INFO ] sending login info to session manager, please wait...
Jul 31 16:46:03 XOTICPC xrdp[199570]: [INFO ] xrdp_wm_log_msg: login successful for display 10
Jul 31 16:46:03 XOTICPC xrdp[199570]: [INFO ] login successful for display 10
Jul 31 16:46:03 XOTICPC xrdp[199570]: [INFO ] loaded module 'libxup.so' ok, interface size 10296, version 4
Jul 31 16:46:03 XOTICPC xrdp[199570]: [INFO ] started connecting
Jul 31 16:46:03 XOTICPC xrdp[199570]: [INFO ] lib_mod_connect: connecting via UNIX socket
Jul 31 16:46:03 XOTICPC xrdp[199570]: [INFO ] lib_mod_log_peer: xrdp_pid=199570 connected to X11rdp_pid=6862 X11rdp_uid>
Jul 31 16:46:03 XOTICPC xrdp[199570]: [INFO ] connected ok
lines 1-22/22 (END)
and when i run the next command, i get this:
● xrdp-sesman.service - xrdp session manager
Loaded: loaded (/lib/systemd/system/xrdp-sesman.service; enabled; vendor preset: enabled)
Active: active (running) since Sat 2023-07-22 23:28:53 EDT; 1 week 2 days ago
Docs: man:xrdp-sesman(8)
man:sesman.ini(5)
Main PID: 6771 (xrdp-sesman)
Tasks: 177 (limit: 19120)
Memory: 2.1M
CGroup: /system.slice/xrdp-sesman.service
├─ 6771 /usr/sbin/xrdp-sesman
├─ 6860 /usr/sbin/xrdp-sesman
├─ 6861 /bin/sh /etc/xrdp/startwm.sh
├─ 6862 /usr/lib/xorg/Xorg :10 -auth .Xauthority -config xrdp/xorg.conf -noreset -nolisten tcp -logfile .xorgxrdp.%s.log
├─ 6874 xfce4-session
├─ 6889 /usr/sbin/xrdp-chansrv
├─ 6919 /usr/bin/dbus-launch --sh-syntax --exit-with-session xfce4-session
├─ 6920 /usr/bin/dbus-daemon --syslog --fork --print-pid 5 --print-address 7 --session
├─ 6927 /usr/libexec/at-spi-bus-launcher
├─ 6931 /usr/bin/dbus-daemon --config-file=/usr/share/defaults/at-spi2/accessibility.conf --nofork --print-address 10 --address=unix:path=/home/user/.cache/at-spi/bus_10.0
├─ 6935 /usr/lib/x86_64-linux-gnu/xfce4/xfconf/xfconfd
├─ 6940 /usr/libexec/at-spi2-registryd --use-gnome-session
├─ 6947 /usr/bin/ssh-agent -s
├─ 6952 /usr/bin/gpg-agent --sh --daemon
├─ 6953 xfwm4 --replace --display :10.0 --sm-client-id 274e41055-a508-484b-bba8-8ac54c5bc1d8
├─ 6957 /usr/libexec/gvfsd
├─ 6962 /usr/libexec/gvfsd-fuse /home/user/.cache/gvfs -f
├─ 6987 xfsettingsd --display :10.0 --sm-client-id 2a443239d-2270-4618-a5fe-ab1994629d9b
├─ 7008 xfce4-panel --display :10.0 --sm-client-id 27a727398-0a3b-4411-b04b-8491fd3f3adb
├─ 7012 Thunar --sm-client-id 2570230d7-d489-49c5-bbd1-373b742b3ea4 --daemon
├─ 7017 xfdesktop "&" --display :10.0 --sm-client-id 2def59622-3070-42ab-a70e-4e9a138d5d1b
├─ 7020 /usr/lib/x86_64-linux-gnu/xfce4/panel/wrapper-2.0 /usr/lib/x86_64-linux-gnu/xfce4/panel/plugins/llibsystray.so 6 18874376 systray "Status Tray Plugin" "Provides status notifier items (application indicators) and legacy systray items"
├─ 7021 /usr/lib/x86_64-linux-gnu/xfce4/panel/wrapper-2.0 /usr/lib/x86_64-linux-gnu/xfce4/panel/plugins/llibxfce4powermanager.so 9 18874377 power-manager-plugin "Power Manager Plugin" "Display the battery levels of your devices and control the brightness of your display"
├─ 7022 /usr/lib/x86_64-linux-gnu/xfce4/panel/wrapper-2.0 /usr/lib/x86_64-linux-gnu/xfce4/panel/plugins/libnotification-plugin.so 10 18874378 notification-plugin "Notification Plugin" "Notification plugin for the Xfce panel"
├─ 7023 /usr/lib/x86_64-linux-gnu/xfce4/panel/wrapper-2.0 /usr/lib/x86_64-linux-gnu/xfce4/panel/plugins/libactions.so 14 18874379 actions "Action Buttons" "Log out, lock or other system actions"
├─ 7032 /usr/lib/x86_64-linux-gnu/xfce4/panel/wrapper-2.0 /usr/lib/x86_64-linux-gnu/xfce4/panel/plugins/llibcpugraph.so 7 18874388 cpugraph "CPU Graph" "Graphical representation of the CPU load"
├─ 7033 /usr/lib/x86_64-linux-gnu/xfce4/panel/wrapper-2.0 /usr/lib/x86_64-linux-gnu/xfce4/panel/plugins/libweather.so 24 18874389 weather "Weather Update" "Show current weather conditions"
├─ 7037 xfce4-power-manager --restart --sm-client-id 2af49cd6b-9e06-469f-9b90-9c7978c02fff
├─ 7054 /usr/bin/dunst
├─ 7082 xiccd
├─ 7095 xscreensaver -no-splash
├─ 7101 /usr/libexec/geoclue-2.0/demos/agent
├─ 7112 nm-applet
├─ 7119 /usr/bin/python3 /usr/bin/hp-systray -x
├─ 7132 /usr/lib/x86_64-linux-gnu/libexec/kdeconnectd
├─ 7135 diodon
├─ 7137 xscreensaver-systemd
├─ 7144 /usr/bin/python3 /usr/share/system-config-printer/applet.py
├─ 7151 pasystray
├─ 7157 /usr/bin/python3 /usr/bin/hp-systray -x
├─ 7158 /usr/bin/python3 /usr/bin/hp-systray -x
├─ 7164 /bin/sh -c "/usr/lib/zeitgeist/zeitgeist-maybe-vacuum; /usr/bin/zeitgeist-daemon"
├─ 7168 /usr/bin/zeitgeist-daemon
├─ 7179 /usr/lib/zeitgeist/zeitgeist-fts
├─ 7223 /usr/libexec/gvfs-udisks2-volume-monitor
├─ 7236 /usr/libexec/gvfs-goa-volume-monitor
├─ 7243 /usr/libexec/gvfs-afc-volume-monitor
├─ 7249 /usr/libexec/gvfs-mtp-volume-monitor
├─ 7254 /usr/libexec/gvfs-gphoto2-volume-monitor
├─ 7254 /usr/libexec/gvfs-gphoto2-volume-monitor
├─ 7268 /usr/libexec/gvfsd-trash --spawner :1.7 /org/gtk/gvfs/exec_spaw/0
├─ 7274 /usr/libexec/gvfsd-metadata
├─188287 /bin/sh /usr/bin/lmc
├─188288 /usr/lib/lmc/lan-messenger
└─206962 scooter -root
Aug 01 01:21:07 XOTICPC xrdp-chansrv[6889]: [ERROR] clipboard_event_selection_request: unknown target unknown atom 0x00000203
Aug 01 09:04:01 XOTICPC xrdp-chansrv[6889]: [ERROR] clipboard_event_selection_request: unknown target unknown atom 0x00000203
Aug 01 09:04:01 XOTICPC zeitgeist-fts[7179]: Unable to get info on application://xfdesktop.desktop
Aug 01 09:54:14 XOTICPC xrdp-chansrv[6889]: [ERROR] clipboard_event_selection_request: unknown target unknown atom 0x00000203
Aug 01 09:54:15 XOTICPC zeitgeist-fts[7179]: Unable to get info on application://xfdesktop.desktop
Aug 01 09:54:44 XOTICPC xrdp-chansrv[6889]: [ERROR] clipboard_event_selection_request: unknown target unknown atom 0x00000203
Aug 01 09:54:44 XOTICPC xrdp-chansrv[6889]: [ERROR] clipboard_event_selection_request: unknown target unknown atom 0x00000203
Aug 01 09:54:51 XOTICPC xrdp-chansrv[6889]: [ERROR] clipboard_event_selection_request: unknown target unknown atom 0x00000203
Aug 01 09:54:52 XOTICPC zeitgeist-fts[7179]: Unable to get info on application://xfdesktop.desktop
Aug 01 09:54:52 XOTICPC xrdp-chansrv[6889]: [ERROR] clipboard_event_selection_request: unknown target unknown atom 0x00000203
It looks like everything is working normally at the moment.
When it fails, can you repost the output of both systemctl status
commands. Also the output of df -h
. It's possible you've got a disk space issue here.
user@XOTICPC:/var/log/apache2$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sdc 251G 176G 63G 74% /
Disk space isn't that much of an issue. I've restarted Windows Subsystem for Linux and this is what i get as a result:
Sleeping for 1 second to let systemd settle
Welcome to Ubuntu 22.04.2 LTS (GNU/Linux 5.15.90.1-microsoft-standard-WSL2 x86_64)
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
System information as of Wed Aug 2 11:58:15 EDT 2023
System load: 1.7197265625 Processes: 168
Usage of /: 69.9% of 250.92GB Users logged in: 0
Memory usage: 4% IPv4 address for docker0: 172.17.0.1
Swap usage: 0% IPv4 address for eth0: 192.168.252.113
=> There are 2 zombie processes.
* Strictly confined Kubernetes makes edge and IoT secure. Learn how MicroK8s
just raised the bar for easy, resilient and secure K8s cluster deployment.
https://ubuntu.com/engage/secure-kubernetes-at-the-edge
Expanded Security Maintenance for Applications is not enabled.
0 updates can be applied immediately.
80 additional security updates can be applied with ESM Apps.
Learn more about enabling ESM Apps service at https://ubuntu.com/esm
Last login: Sat Jul 22 23:11:47 EDT 2023 on pts/0
The "2 zombie processes" makes me wonder if this is related?
user@XOTICPC:~$ sudo systemctl status xrdp-sesman
Failed to dump process list for 'xrdp-sesman.service', ignoring: Input/output error
× xrdp-sesman.service - xrdp session manager
Loaded: loaded (/lib/systemd/system/xrdp-sesman.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Wed 2023-08-02 11:58:24 EDT; 5min ago
Docs: man:xrdp-sesman(8)
man:sesman.ini(5)
Process: 1188 ExecStart=/usr/sbin/xrdp-sesman $SESMAN_OPTIONS (code=exited, status=1/FAILURE)
Tasks: 1 (limit: 19120)
Memory: 1.1M
CGroup: /system.slice/xrdp-sesman.service
Aug 02 11:58:24 XOTICPC systemd[1]: Starting xrdp session manager...
Aug 02 11:58:24 XOTICPC systemd[1]: xrdp-sesman.service: Control process exited, code=exited, status=1/FAILURE
Aug 02 11:58:24 XOTICPC systemd[1]: xrdp-sesman.service: Failed to kill control group /system.slice/xrdp-sesman.service, ignoring: Input/output error
Aug 02 11:58:24 XOTICPC systemd[1]: xrdp-sesman.service: Failed to kill control group /system.slice/xrdp-sesman.service, ignoring: Input/output error
Aug 02 11:58:24 XOTICPC systemd[1]: xrdp-sesman.service: Failed to kill control group /system.slice/xrdp-sesman.service, ignoring: Input/output error
Aug 02 11:58:24 XOTICPC systemd[1]: xrdp-sesman.service: Failed to kill control group /system.slice/xrdp-sesman.service, ignoring: Input/output error
Aug 02 11:58:24 XOTICPC systemd[1]: xrdp-sesman.service: Failed with result 'exit-code'.
Aug 02 11:58:24 XOTICPC systemd[1]: Failed to start xrdp session manager.
user@XOTICPC:~$ sudo systemctl status xrdp
○ xrdp.service - xrdp daemon
Loaded: loaded (/lib/systemd/system/xrdp.service; enabled; vendor preset: enabled)
Active: inactive (dead)
Docs: man:xrdp(8)
man:xrdp.ini(5)
Aug 02 11:58:08 XOTICPC xrdp[565]: [INFO ] listening to port 3390 on 0.0.0.0
Aug 02 11:58:08 XOTICPC xrdp[565]: [INFO ] xrdp_listen_pp done
Aug 02 11:58:08 XOTICPC systemd[1]: xrdp.service: Can't open PID file /run/xrdp/xrdp.pid (yet?) after start: Operation not permitted
Aug 02 11:58:10 XOTICPC systemd[1]: Started xrdp daemon.
Aug 02 11:58:10 XOTICPC xrdp[623]: [INFO ] starting xrdp with pid 623
Aug 02 11:58:10 XOTICPC xrdp[623]: [INFO ] address [0.0.0.0] port [3390] mode 1
Aug 02 11:58:11 XOTICPC xrdp[623]: [INFO ] listening to port 3390 on 0.0.0.0
Aug 02 11:58:11 XOTICPC xrdp[623]: [INFO ] xrdp_listen_pp done
Aug 02 11:58:24 XOTICPC systemd[1]: Dependency failed for xrdp daemon.
Aug 02 11:58:24 XOTICPC systemd[1]: xrdp.service: Job xrdp.service/start failed with result 'dependency'.
xrdp seems to fail becuase it depends on xrdp-sesman... which dies for... reasons.
user@XOTICPC:~$ sudo ss -lp sport = :3390
Netid State Recv-Q Send-Q Local Address:Port Peer Address:Port Process
tcp LISTEN 0 2 *:3390 *:*
user@XOTICPC:~$ journalctl -xeu xrdp-sesman
░░ Subject: A start job for unit xrdp-sesman.service has begun execution
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░
░░ A start job for unit xrdp-sesman.service has begun execution.
░░
░░ The job identifier is 147.
Aug 02 11:58:08 XOTICPC xrdp-sesman[549]: [INFO ] starting xrdp-sesman with pid 549
Aug 02 11:58:08 XOTICPC systemd[1]: Started xrdp session manager.
░░ Subject: A start job for unit xrdp-sesman.service has finished successfully
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░
░░ A start job for unit xrdp-sesman.service has finished successfully.
░░
░░ The job identifier is 147.
Aug 02 11:58:24 XOTICPC systemd[1]: xrdp-sesman.service: Failed to migrate controller cgroups from /system.slice/xrdp-sesman.service, ignoring: Input/output error
Aug 02 11:58:24 XOTICPC systemd[1]: Starting xrdp session manager...
░░ Subject: A start job for unit xrdp-sesman.service has begun execution
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░
░░ A start job for unit xrdp-sesman.service has begun execution.
░░
░░ The job identifier is 194.
Aug 02 11:58:24 XOTICPC systemd[1]: xrdp-sesman.service: Control process exited, code=exited, status=1/FAILURE
░░ Subject: Unit process exited
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░
░░ An ExecStart= process belonging to unit xrdp-sesman.service has exited.
░░
░░ The process' exit code is 'exited' and its exit status is 1.
Aug 02 11:58:24 XOTICPC systemd[1]: xrdp-sesman.service: Failed to kill control group /system.slice/xrdp-sesman.service, ignoring: Input/output error
Aug 02 11:58:24 XOTICPC systemd[1]: xrdp-sesman.service: Failed to kill control group /system.slice/xrdp-sesman.service, ignoring: Input/output error
Aug 02 11:58:24 XOTICPC systemd[1]: xrdp-sesman.service: Failed to kill control group /system.slice/xrdp-sesman.service, ignoring: Input/output error
Aug 02 11:58:24 XOTICPC systemd[1]: xrdp-sesman.service: Failed to kill control group /system.slice/xrdp-sesman.service, ignoring: Input/output error
Aug 02 11:58:24 XOTICPC systemd[1]: xrdp-sesman.service: Failed with result 'exit-code'.
░░ Subject: Unit failed
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░
░░ The unit xrdp-sesman.service has entered the 'failed' state with result 'exit-code'.
Aug 02 11:58:24 XOTICPC systemd[1]: Failed to start xrdp session manager.
░░ Subject: A start job for unit xrdp-sesman.service has failed
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░
░░ A start job for unit xrdp-sesman.service has finished with a failure.
░░
░░ The job identifier is 194 and the job result is failed.
it's at this point that i'd need to uninstall xrdp, restart WSL then re-install if i want to login via RDP...
This is all very bewildering for me... I have no idea what causes it, or how to remedy it...
I've noticed this problem also happens with apache2 (except it seems to freeze on starting or restarting)... i suspect that is also related, but it getting beyond the scope of this bug report...
xrdp-sesman is getting a SIGINT or a SIGTERM from somewhere. This is generating the message [INFO ] shutting down sesman 1
in xrdp-sesman.log. This seems likely systemd-related. There seem to be a few issues with systemd on WSL at the moment (see also #2728).
Maybe we can hack the unit files about to fix this. What do you get for these commands:-
systemctl cat xrdp.service
systemctl cat xrdp-sesman.service
that returns the following:
user@XOTICPC:~$ systemctl cat xrdp.service
# /lib/systemd/system/xrdp.service`
[Unit]
Description=xrdp daemon
Documentation=man:xrdp(8) man:xrdp.ini(5)
Requires=xrdp-sesman.service
After=network.target xrdp-sesman.service
[Service]
Type=forking
PIDFile=/run/xrdp/xrdp.pid
RuntimeDirectory=xrdp
EnvironmentFile=-/etc/sysconfig/xrdp
EnvironmentFile=-/etc/default/xrdp
User=xrdp
Group=xrdp
PermissionsStartOnly=true
ExecStartPre=/bin/sh /usr/share/xrdp/socksetup
ExecStart=/usr/sbin/xrdp $XRDP_OPTIONS
ExecStop=/usr/sbin/xrdp $XRDP_OPTIONS --kill
[Install]
WantedBy=multi-user.target
user@XOTICPC:~$ systemctl cat xrdp-sesman.service
# /lib/systemd/system/xrdp-sesman.service`
[Unit]
Description=xrdp session manager
Documentation=man:xrdp-sesman(8) man:sesman.ini(5)
After=network.target
StopWhenUnneeded=true
BindsTo=xrdp.service
[Service]
Type=forking
PIDFile=/run/xrdp/xrdp-sesman.pid
RuntimeDirectory=xrdp
EnvironmentFile=-/etc/sysconfig/xrdp
EnvironmentFile=-/etc/default/xrdp
ExecStart=/usr/sbin/xrdp-sesman $SESMAN_OPTIONS
ExecStop=/usr/sbin/xrdp-sesman $SESMAN_OPTIONS --kill
[Install]
WantedBy=multi-user.target
i did try creating /run/xrdp/ as root and chmod it to +777 but that doesn't seem to make a difference (and it disappears between restarts of WSL, anyway)...
/run/xrdp
is created by sesman if it starts properly.
Those files look pretty standard to me.
Since the only place that xrdp-sesman can be getting a SIGTERM from is systemd (at least as far as I can tell), I suggest we try simplifying these files to the bare minimum that will work. The changes below will remove most of the coupling between the services. This should be OK I think for your use-case.
Can you make the following edits:-
Requires=xrdp-sesman.service
StopWhenUnneeded=true
BindsTo=xrdp.service
Then, sudo systemctl daemon-reload
This should give to the following:-
$ systemctl cat xrdp.service
# /lib/systemd/system/xrdp.service`
[Unit]
Description=xrdp daemon
Documentation=man:xrdp(8) man:xrdp.ini(5)
After=network.target xrdp-sesman.service
[Service]
Type=forking
PIDFile=/run/xrdp/xrdp.pid
RuntimeDirectory=xrdp
EnvironmentFile=-/etc/sysconfig/xrdp
EnvironmentFile=-/etc/default/xrdp
User=xrdp
Group=xrdp
PermissionsStartOnly=true
ExecStartPre=/bin/sh /usr/share/xrdp/socksetup
ExecStart=/usr/sbin/xrdp $XRDP_OPTIONS
ExecStop=/usr/sbin/xrdp $XRDP_OPTIONS --kill
[Install]
WantedBy=multi-user.target
user@XOTICPC:~$ systemctl cat xrdp-sesman.service
# /lib/systemd/system/xrdp-sesman.service`
[Unit]
Description=xrdp session manager
Documentation=man:xrdp-sesman(8) man:sesman.ini(5)
After=network.target
[Service]
Type=forking
PIDFile=/run/xrdp/xrdp-sesman.pid
RuntimeDirectory=xrdp
EnvironmentFile=-/etc/sysconfig/xrdp
EnvironmentFile=-/etc/default/xrdp
ExecStart=/usr/sbin/xrdp-sesman $SESMAN_OPTIONS
ExecStop=/usr/sbin/xrdp-sesman $SESMAN_OPTIONS --kill
[Install]
WantedBy=multi-user.target
Let me know how it goes.
alrighty! i made those edits and restarted WSL again...
user@XOTICPC:~$ systemctl status xrdp
Failed to dump process list for 'xrdp.service', ignoring: Input/output error
× xrdp.service - xrdp daemon
Loaded: loaded (/lib/systemd/system/xrdp.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Sat 2023-08-05 11:37:25 EDT; 4min 29s ago
Docs: man:xrdp(8)
man:xrdp.ini(5)
Tasks: 1 (limit: 19120)
Memory: 1.5M
CGroup: /system.slice/xrdp.service
Aug 05 11:37:24 XOTICPC xrdp[744]: [ERROR] g_tcp_bind(7, 3390) failed bind IPv6 (errno=98) and IPv4 (errno=22).
Aug 05 11:37:24 XOTICPC xrdp[744]: [ERROR] trans_listen_address failed
Aug 05 11:37:24 XOTICPC xrdp[744]: [ERROR] Failed to start xrdp daemon, possibly address already in use.
Aug 05 11:37:25 XOTICPC systemd[1]: xrdp.service: Control process exited, code=exited, status=1/FAILURE
Aug 05 11:37:25 XOTICPC systemd[1]: xrdp.service: Failed to kill control group /system.slice/xrdp.service, ignoring: Input/output error
Aug 05 11:37:25 XOTICPC systemd[1]: xrdp.service: Failed to kill control group /system.slice/xrdp.service, ignoring: Input/output error
Aug 05 11:37:25 XOTICPC systemd[1]: xrdp.service: Failed to kill control group /system.slice/xrdp.service, ignoring: Input/output error
Aug 05 11:37:25 XOTICPC systemd[1]: xrdp.service: Failed to kill control group /system.slice/xrdp.service, ignoring: Input/output error
Aug 05 11:37:25 XOTICPC systemd[1]: xrdp.service: Failed with result 'exit-code'.
Aug 05 11:37:25 XOTICPC systemd[1]: Failed to start xrdp daemon.
user@XOTICPC:~$ systemctl status xrdp-sesman
Failed to dump process list for 'xrdp-sesman.service', ignoring: Input/output error
× xrdp-sesman.service - xrdp session manager
Loaded: loaded (/lib/systemd/system/xrdp-sesman.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Sat 2023-08-05 11:37:24 EDT; 4min 32s ago
Docs: man:xrdp-sesman(8)
man:sesman.ini(5)
Tasks: 1 (limit: 19120)
Memory: 1.1M
CGroup: /system.slice/xrdp-sesman.service
Aug 05 11:37:24 XOTICPC systemd[1]: Starting xrdp session manager...
Aug 05 11:37:24 XOTICPC systemd[1]: xrdp-sesman.service: Control process exited, code=exited, status=1/FAILURE
Aug 05 11:37:24 XOTICPC systemd[1]: xrdp-sesman.service: Failed to kill control group /system.slice/xrdp-sesman.service, ignoring: Input/output error
Aug 05 11:37:24 XOTICPC systemd[1]: xrdp-sesman.service: Failed to kill control group /system.slice/xrdp-sesman.service, ignoring: Input/output error
Aug 05 11:37:24 XOTICPC systemd[1]: xrdp-sesman.service: Failed to kill control group /system.slice/xrdp-sesman.service, ignoring: Input/output error
Aug 05 11:37:24 XOTICPC systemd[1]: xrdp-sesman.service: Failed to kill control group /system.slice/xrdp-sesman.service, ignoring: Input/output error
Aug 05 11:37:24 XOTICPC systemd[1]: xrdp-sesman.service: Failed with result 'exit-code'.
Aug 05 11:37:24 XOTICPC systemd[1]: Failed to start xrdp session manager.
so far it looks like business as usual.
let's attempt logging in, though...
hrmm. still a blank screen... okay, let's see what's going on.
user@XOTICPC:~$ journalctl -xeu xrdp.service
Aug 05 11:42:23 XOTICPC xrdp[13344]: [INFO ] xrdp_caps_process_codecs: RemoteFX, codec id 3, properties len 49
Aug 05 11:42:23 XOTICPC xrdp[13344]: [INFO ] Loading keymap file /etc/xrdp/km-00000409.ini
Aug 05 11:42:23 XOTICPC xrdp[13344]: [WARN ] local keymap file for 0x00000409 found and doesn't match built in keymap, using local keymap file
Aug 05 11:42:28 XOTICPC xrdp[13344]: [INFO ] connecting to sesman ip 127.0.0.1 port 3350
Aug 05 11:42:28 XOTICPC xrdp[13344]: [INFO ] xrdp_wm_log_msg: sesman connect ok
Aug 05 11:42:28 XOTICPC xrdp[13344]: [INFO ] sesman connect ok
Aug 05 11:42:28 XOTICPC xrdp[13344]: [INFO ] sending login info to session manager, please wait...
Aug 05 11:42:28 XOTICPC xrdp[13344]: [INFO ] xrdp_wm_log_msg: login successful for display 10
Aug 05 11:42:28 XOTICPC xrdp[13344]: [INFO ] login successful for display 10
Aug 05 11:42:28 XOTICPC xrdp[13344]: [INFO ] loaded module 'libxup.so' ok, interface size 10296, version 4
Aug 05 11:42:28 XOTICPC xrdp[13344]: [INFO ] started connecting
Aug 05 11:42:28 XOTICPC xrdp[13344]: [INFO ] lib_mod_connect: connecting via UNIX socket
Aug 05 11:44:28 XOTICPC systemd[1]: Starting xrdp daemon...
░░ Subject: A start job for unit xrdp.service has begun execution
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░
░░ A start job for unit xrdp.service has begun execution.
░░
░░ The job identifier is 13173.
Aug 05 11:44:28 XOTICPC xrdp[11492]: [INFO ] address [0.0.0.0] port [3390] mode 1
Aug 05 11:44:28 XOTICPC xrdp[11492]: [INFO ] listening to port 3390 on 0.0.0.0
Aug 05 11:44:28 XOTICPC xrdp[11492]: [ERROR] g_tcp_bind(7, 3390) failed bind IPv6 (errno=98) and IPv4 (errno=22).
Aug 05 11:44:28 XOTICPC xrdp[11492]: [ERROR] trans_listen_address failed
Aug 05 11:44:28 XOTICPC xrdp[11492]: [ERROR] Failed to start xrdp daemon, possibly address already in use.
Aug 05 11:44:28 XOTICPC systemd[1]: xrdp.service: Control process exited, code=exited, status=1/FAILURE
░░ Subject: Unit process exited
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░
░░ An ExecStart= process belonging to unit xrdp.service has exited.
░░
░░ The process' exit code is 'exited' and its exit status is 1.
Aug 05 11:44:28 XOTICPC systemd[1]: xrdp.service: Failed to kill control group /system.slice/xrdp.service, ignoring: Input/output error
Aug 05 11:44:28 XOTICPC systemd[1]: xrdp.service: Failed to kill control group /system.slice/xrdp.service, ignoring: Input/output error
Aug 05 11:44:28 XOTICPC systemd[1]: xrdp.service: Failed to kill control group /system.slice/xrdp.service, ignoring: Input/output error
Aug 05 11:44:28 XOTICPC systemd[1]: xrdp.service: Failed to kill control group /system.slice/xrdp.service, ignoring: Input/output error
Aug 05 11:44:28 XOTICPC systemd[1]: xrdp.service: Failed with result 'exit-code'.
░░ Subject: Unit failed
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░
░░ The unit xrdp.service has entered the 'failed' state with result 'exit-code'.
Aug 05 11:44:28 XOTICPC systemd[1]: Failed to start xrdp daemon.
░░ Subject: A start job for unit xrdp.service has failed
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░
░░ A start job for unit xrdp.service has finished with a failure.
░░
░░ The job identifier is 13173 and the job result is failed.
user@XOTICPC:~$ journalctl -xeu xrdp-sesman.service
Aug 05 11:37:24 XOTICPC systemd[1]: xrdp-sesman.service: Failed to kill control group /system.slice/xrdp-sesman.service, ignoring: Input/output error
Aug 05 11:37:24 XOTICPC systemd[1]: xrdp-sesman.service: Failed to kill control group /system.slice/xrdp-sesman.service, ignoring: Input/output error
Aug 05 11:37:24 XOTICPC systemd[1]: xrdp-sesman.service: Failed with result 'exit-code'.
░░ Subject: Unit failed
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░
░░ The unit xrdp-sesman.service has entered the 'failed' state with result 'exit-code'.
Aug 05 11:37:24 XOTICPC systemd[1]: Failed to start xrdp session manager.
░░ Subject: A start job for unit xrdp-sesman.service has failed
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░
░░ A start job for unit xrdp-sesman.service has finished with a failure.
░░
░░ The job identifier is 198 and the job result is failed.
Aug 05 11:42:28 XOTICPC xrdp-sesman[550]: [INFO ] Socket 8: AF_INET6 connection received from ::1 port 56236
Aug 05 11:42:28 XOTICPC xrdp-sesman[550]: [INFO ] Terminal Server Users group is disabled, allowing authentication
Aug 05 11:42:28 XOTICPC xrdp-sesman[550]: [INFO ] ++ created session (access granted): username user, ip ::1:39396 - socket: 12
Aug 05 11:42:28 XOTICPC xrdp-sesman[550]: [INFO ] starting Xorg session...
Aug 05 11:42:28 XOTICPC xrdp-sesman[550]: [INFO ] Starting session: session_pid 13436, display :10.0, width 1920, height 1080, bpp 24, client ip ::1:39396 - socket: 12, user name user
Aug 05 11:42:28 XOTICPC xrdp-sesman[13436]: [INFO ] [session start] (display 10): calling auth_start_session from pid 13436
Aug 05 11:42:28 XOTICPC xrdp-sesman[550]: [ERROR] sesman_data_in: scp_process_msg failed
Aug 05 11:42:28 XOTICPC xrdp-sesman[13436]: pam_unix(xrdp-sesman:session): session opened for user user(uid=1000) by (uid=0)
Aug 05 11:42:28 XOTICPC xrdp-sesman[13436]: pam_systemd(xrdp-sesman:session): Failed to create session: Message recipient disconnected from message bus without replying
Aug 05 11:42:28 XOTICPC xrdp-sesman[550]: [ERROR] sesman_main_loop: trans_check_wait_objs failed, removing trans
Aug 05 11:42:28 XOTICPC xrdp-sesman[13440]: [INFO ] Starting X server on display 10: /usr/lib/xorg/Xorg :10 -auth .Xauthority -config xrdp/xorg.conf -noreset -nolisten tcp -logfile .xorgxrdp.%s.log
Aug 05 11:42:28 XOTICPC xrdp-sesman[13436]: [INFO ] Found X server running at /tmp/.X10-lock
Aug 05 11:42:28 XOTICPC xrdp-sesman[13436]: [INFO ] Session started successfully for user user on display 10
Aug 05 11:42:28 XOTICPC xrdp-sesman[13446]: [INFO ] Starting the xrdp channel server for display 10
Aug 05 11:42:28 XOTICPC xrdp-sesman[13436]: [INFO ] Session in progress on display 10, waiting until the window manager (pid 13439) exits to end the session
Aug 05 11:42:29 XOTICPC xrdp-sesman[13439]: [INFO ] Found X server running at /tmp/.X10-lock
Aug 05 11:42:29 XOTICPC xrdp-sesman[13439]: [INFO ] Found X server running at /tmp/.X10-lock
Aug 05 11:42:29 XOTICPC xrdp-sesman[13439]: [INFO ] Starting the default window manager on display 10: /etc/xrdp/startwm.sh
Aug 05 11:44:24 XOTICPC systemd[1]: Starting xrdp session manager...
░░ Subject: A start job for unit xrdp-sesman.service has begun execution
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░
░░ A start job for unit xrdp-sesman.service has begun execution.
░░
░░ The job identifier is 12911.
Aug 05 11:44:24 XOTICPC xrdp-sesman[11446]: [INFO ] starting xrdp-sesman with pid 11446
Aug 05 11:44:24 XOTICPC systemd[1]: Started xrdp session manager.
░░ Subject: A start job for unit xrdp-sesman.service has finished successfully
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░
░░ A start job for unit xrdp-sesman.service has finished successfully.
░░
░░ The job identifier is 12911.
Edit: after a long while, xrdp sends this error message to Remote Desktop Protocol client for Windows:
connection to sesman ip 127.0.0.1 port 3350
sesman connect ok
sending login info to session manager, please wait...
login successful for display 10
started connecting
connection problem, giving up
some problem
[ OK ]
This is quite the head-scratcher... i'll be honest, I don't get it...
Edit: I ran systemctl status xrdp.service and systemctl status xrdp-sesman.service afterwards and this is what came up:
user@XOTICPC:~$ systemctl status xrdp
Failed to dump process list for 'xrdp.service', ignoring: Input/output error
× xrdp.service - xrdp daemon
Loaded: loaded (/lib/systemd/system/xrdp.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Sat 2023-08-05 15:07:59 EDT; 4h 15min ago
Docs: man:xrdp(8)
man:xrdp.ini(5)
Process: 1119 ExecStartPre=/bin/sh /usr/share/xrdp/socksetup (code=exited, status=0/SUCCESS)
Process: 1164 ExecStart=/usr/sbin/xrdp $XRDP_OPTIONS (code=exited, status=1/FAILURE)
Tasks: 1 (limit: 19120)
Memory: 2.8M
CGroup: /system.slice/xrdp.service
Aug 05 15:12:14 XOTICPC xrdp[8592]: [INFO ] loaded module 'libxup.so' ok, interface size 10296, version 4
Aug 05 15:12:14 XOTICPC xrdp[8592]: [INFO ] started connecting
Aug 05 15:12:14 XOTICPC xrdp[8592]: [INFO ] lib_mod_connect: connecting via UNIX socket
Aug 05 15:15:44 XOTICPC xrdp[8592]: [INFO ] connection problem, giving up
Aug 05 15:15:44 XOTICPC xrdp[8592]: [INFO ] some problem
Aug 05 15:45:23 XOTICPC xrdp[8592]: [ERROR] xrdp_rdp_recv: xrdp_channel_process failed
Aug 05 15:45:24 XOTICPC xrdp[8592]: [ERROR] xrdp_rdp_recv: xrdp_channel_process failed
Aug 05 15:45:24 XOTICPC xrdp[8592]: [ERROR] xrdp_rdp_recv: xrdp_channel_process failed
Aug 05 15:45:31 XOTICPC xrdp[8592]: [ERROR] xrdp_rdp_recv: xrdp_channel_process failed
Aug 05 15:45:31 XOTICPC xrdp[8592]: [ERROR] xrdp_rdp_recv: xrdp_channel_process failed
user@XOTICPC:~$ systemctl status xrdp-sesman
Failed to dump process list for 'xrdp-sesman.service', ignoring: Input/output error
× xrdp-sesman.service - xrdp session manager
Loaded: loaded (/lib/systemd/system/xrdp-sesman.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Sat 2023-08-05 15:07:58 EDT; 4h 14min ago
Docs: man:xrdp-sesman(8)
man:sesman.ini(5)
Process: 1019 ExecStart=/usr/sbin/xrdp-sesman $SESMAN_OPTIONS (code=exited, status=1/FAILURE)
Tasks: 217 (limit: 19120)
Memory: 2.4M
CGroup: /system.slice/xrdp-sesman.service
Aug 05 15:12:14 XOTICPC xrdp-sesman[8621]: pam_systemd(xrdp-sesman:session): Failed to create session: Message recipient disconnected from message bus without replying
Aug 05 15:12:14 XOTICPC xrdp-sesman[534]: [ERROR] sesman_main_loop: trans_check_wait_objs failed, removing trans
Aug 05 15:12:14 XOTICPC xrdp-sesman[8623]: [INFO ] Starting X server on display 10: /usr/lib/xorg/Xorg :10 -auth .Xauthority -config xrdp/xorg.conf -noreset -nolisten tcp -logfile .xorgxrdp.%s.log
Aug 05 15:12:14 XOTICPC xrdp-sesman[8622]: [INFO ] Found X server running at /tmp/.X10-lock
Aug 05 15:12:14 XOTICPC xrdp-sesman[8621]: [INFO ] Found X server running at /tmp/.X10-lock
Aug 05 15:12:14 XOTICPC xrdp-sesman[8621]: [INFO ] Session started successfully for user user on display 10
Aug 05 15:12:14 XOTICPC xrdp-sesman[8631]: [INFO ] Starting the xrdp channel server for display 10
Aug 05 15:12:14 XOTICPC xrdp-sesman[8622]: [INFO ] Found X server running at /tmp/.X10-lock
Aug 05 15:12:14 XOTICPC xrdp-sesman[8621]: [INFO ] Session in progress on display 10, waiting until the window manager (pid 8622) exits to end the session
Aug 05 15:12:14 XOTICPC xrdp-sesman[8622]: [INFO ] Starting the default window manager on display 10: /etc/xrdp/startwm.sh
after restarting dbus via sudo systemctl restart dbus, i tried both "systemctl start xrdp" and "systemctl start xrdp-sesman" but the command just hangs, as if waiting for something else to happen first and i have to type [CTRL]+[C] to abort.. the same happens when i attempt "systemctl enable xrdp"... it just hangs after saying this:
user@XOTICPC:~$ systemctl enable xrdp
Synchronizing state of xrdp.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable xrdp
user@XOTICPC:~$ systemctl enable xrdp-sesman
There's a bit of a clue here:-
Aug 05 11:42:23 XOTICPC xrdp[13344]: [WARN ] local keymap file for 0x00000409 found and doesn't match built in keymap, using local keymap file
Aug 05 11:42:28 XOTICPC xrdp[13344]: [INFO ] connecting to sesman ip 127.0.0.1 port 3350
Aug 05 11:42:28 XOTICPC xrdp[13344]: [INFO ] xrdp_wm_log_msg: sesman connect ok
Aug 05 11:42:28 XOTICPC xrdp[13344]: [INFO ] sesman connect ok
Aug 05 11:42:28 XOTICPC xrdp[13344]: [INFO ] sending login info to session manager, please wait...
Aug 05 11:42:28 XOTICPC xrdp[13344]: [INFO ] xrdp_wm_log_msg: login successful for display 10
Aug 05 11:42:28 XOTICPC xrdp[13344]: [INFO ] login successful for display 10
Aug 05 11:42:28 XOTICPC xrdp[13344]: [INFO ] loaded module 'libxup.so' ok, interface size 10296, version 4
Aug 05 11:42:28 XOTICPC xrdp[13344]: [INFO ] started connecting
Aug 05 11:42:28 XOTICPC xrdp[13344]: [INFO ] lib_mod_connect: connecting via UNIX socket
Aug 05 11:44:28 XOTICPC systemd[1]: Starting xrdp daemon...
░░ Subject: A start job for unit xrdp.service has begun execution
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░
░░ A start job for unit xrdp.service has begun execution.
░░
░░ The job identifier is 13173.
It looks like xrdp is already running, but when you log in, for some reason the system tries to start another instance of xrdp in addition to the one that is already active. This one fails as port 3390 is already in use.
You've also got this output:-
user@XOTICPC:~$ systemctl enable xrdp
Synchronizing state of xrdp.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable xrdp
I've just noticed that Debian ship the xrdp package with a SysV init script as well as a systemd unit file. I don't know why they do this, but maybe it's to support running without systemd. This may be confusing things on WSL. Can you take a copy of this script and remove it?
cd $HOME
cd /etc/init.d/xrdp ./xrdp.init.sav
sudo rm /etc/init.d/xrdp
Then try restarting WSL and see what happens.
is the second line supposd to be two seperate lines? i get this:
user@XOTICPC:~$ cd /etc/init.d/xrdp ./xrdp.init.sav -bash: cd: too many arguments
did you mean something like: user@XOTICPC:/etc/init.d$ sudo mv xrdp /home/user/xrdp.init.sav ?
i did that and restarted WSL and still get the error that xrdp-sesman can't start, and that xrdp depends on it, so it can't start...
i'm honestly wondering if i should just clone the git repository and compile from source...
That's what I meant - sorry. Or near enough anyway.
The problem you've got is the way systemd is working. I can't see it will be any better with compiling from source.
I don't understand why xrdp.service is dependent on xrdp-sesman.service. I thought we'd removed that link by editing the service manifest for xrdp-sesman and removing the BindsTo
. Can you check that's not there?
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.
user@XOTICPC:/lib/systemd/system$ cat xrdp-sesman.service
[Unit]
Description=xrdp session manager
Documentation=man:xrdp-sesman(8) man:sesman.ini(5)
After=network.target
[Service]
Type=forking
PIDFile=/run/xrdp/xrdp-sesman.pid
RuntimeDirectory=xrdp
EnvironmentFile=-/etc/sysconfig/xrdp
EnvironmentFile=-/etc/default/xrdp
ExecStart=/usr/sbin/xrdp-sesman $SESMAN_OPTIONS
ExecStop=/usr/sbin/xrdp-sesman $SESMAN_OPTIONS --kill
[Install]
WantedBy=multi-user.target
user@XOTICPC:/lib/systemd/system$ cat xrdp-sesman.service
[Unit]
Description=xrdp session manager
Documentation=man:xrdp-sesman(8) man:sesman.ini(5)
After=network.target
[Service]
Type=forking
PIDFile=/run/xrdp/xrdp-sesman.pid
RuntimeDirectory=xrdp
EnvironmentFile=-/etc/sysconfig/xrdp
EnvironmentFile=-/etc/default/xrdp
ExecStart=/usr/sbin/xrdp-sesman $SESMAN_OPTIONS
ExecStop=/usr/sbin/xrdp-sesman $SESMAN_OPTIONS --kill
[Install]
WantedBy=multi-user.target
so, let's see what's going on with the daemon processes themselves...
user@XOTICPC:/lib/systemd/system$ systemctl status xrdp-sesman
Failed to dump process list for 'xrdp-sesman.service', ignoring: Input/output error
● xrdp-sesman.service - xrdp session manager
Loaded: loaded (/lib/systemd/system/xrdp-sesman.service; enabled; vendor preset: enabled)
Active: active (running) since Tue 2023-08-08 08:57:11 EDT; 4min 37s ago
Docs: man:xrdp-sesman(8)
man:sesman.ini(5)
Process: 7156 ExecStart=/usr/sbin/xrdp-sesman $SESMAN_OPTIONS (code=exited, status=0/SUCCESS)
Main PID: 7157 (xrdp-sesman)
Tasks: 2 (limit: 19120)
Memory: 2.0M
CGroup: /system.slice/xrdp-sesman.service
Aug 08 08:57:11 XOTICPC systemd[1]: Starting xrdp session manager...
Aug 08 08:57:11 XOTICPC xrdp-sesman[7157]: [INFO ] starting xrdp-sesman with pid 7157
Aug 08 08:57:11 XOTICPC systemd[1]: Started xrdp session manager.
THAT"S A HUGE CHANGE! Usually, xrdp-sesman dies, and that makes xrdp not load... okay, let's see if xrdp loads next!
user@XOTICPC:/lib/systemd/system$ systemctl status xrdp
Failed to dump process list for 'xrdp.service', ignoring: Input/output error
× xrdp.service - xrdp daemon
Loaded: loaded (/lib/systemd/system/xrdp.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Tue 2023-08-08 08:57:22 EDT; 5min ago
Docs: man:xrdp(8)
man:xrdp.ini(5)
Process: 7164 ExecStartPre=/bin/sh /usr/share/xrdp/socksetup (code=exited, status=0/SUCCESS)
Process: 7172 ExecStart=/usr/sbin/xrdp $XRDP_OPTIONS (code=exited, status=1/FAILURE)
Tasks: 1 (limit: 19120)
Memory: 2.7M
CGroup: /system.slice/xrdp.service
Aug 08 08:57:22 XOTICPC xrdp[7172]: [ERROR] g_tcp_bind(7, 3390) failed bind IPv6 (errno=98) and IPv4 (errno=22).
Aug 08 08:57:22 XOTICPC xrdp[7172]: [ERROR] trans_listen_address failed
Aug 08 08:57:22 XOTICPC xrdp[7172]: [ERROR] Failed to start xrdp daemon, possibly address already in use.
Aug 08 08:57:22 XOTICPC systemd[1]: xrdp.service: Control process exited, code=exited, status=1/FAILURE
Aug 08 08:57:22 XOTICPC systemd[1]: xrdp.service: Failed to kill control group /system.slice/xrdp.service, ignoring: Input/output error
Aug 08 08:57:22 XOTICPC systemd[1]: xrdp.service: Failed to kill control group /system.slice/xrdp.service, ignoring: Input/output error
Aug 08 08:57:22 XOTICPC systemd[1]: xrdp.service: Failed to kill control group /system.slice/xrdp.service, ignoring: Input/output error
Aug 08 08:57:22 XOTICPC systemd[1]: xrdp.service: Failed to kill control group /system.slice/xrdp.service, ignoring: Input/output error
Aug 08 08:57:22 XOTICPC systemd[1]: xrdp.service: Failed with result 'exit-code'.
Aug 08 08:57:22 XOTICPC systemd[1]: Failed to start xrdp daemon.
Well, as Bon Jovi sang in the 1980s: We're Half-way There!
Edit:
user@XOTICPC:/lib/systemd/system$ sudo ss -lp sport = :3390
[sudo] password for user:
Netid State Recv-Q Send-Q Local Address:Port Peer Address:Port Process
tcp LISTEN 0 2 *:3390 *:*
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:
Sleeping for 1 second to let systemd settle
Welcome to Ubuntu 22.04.3 LTS (GNU/Linux 5.15.90.1-microsoft-standard-WSL2 x86_64)
...
=> There are 5 zombie processes.
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...
Your ss
output does indeed show something is listening on port 3390, but there's no PID for it.
I've had a look at a few online articles. It's possible one of your zombie processes used to be an xrdp process and it's holding on to the port. This would be down to some problem related to the interaction between systemd and the kernel.
I don't know enough about WSL to know what 'shutting down WSL' does. After you restart WSL, what does the uptime
command show you in the Ubuntu VM? Also, you might want to check that restarting the machine is doing just that. See https://www.howtogeek.com/780506/youre-shutting-down-wrong-how-to-really-shut-down-windows/
user@XOTICPC:/etc/apache2$ uptime 12:16:43 up 1 day, 1:57, 1 user, load average: 0.86, 0.94, 0.84
yeah, that looks right. i last ran wsl --shutdown in PowerShell around this time yesterday.
hrmm, i guess this is just a bug with WSL... though i wonder if there's an option like "ask3390" for xrdp to request port 3390, before settling on something else automatically, like what kali linux did for win-kex and their build of xrdp...
The other problem you've got is that sesman listens on a port too, so you're going to have exactly the same problems with that.
From what I've read about WSL, the kernel is separate from the distro that's running on it. That might be something to do with it, but it's not anything I have any experience with. The other possibility is you've got more than one VM running on the WSL kernel, and they're both tripping over each other.
The only thing I have in WSL is ubuntu... nothing else is running there... i think this might just be a kernel issue within WSL that's causing xrdp to choke. This didn't happen until WSL gained native systemd support a few months back...
user@XOTICPC:/etc/apache2$ uptime 12:16:43 up 1 day, 1:57, 1 user, load average: 0.86, 0.94, 0.84
yeah, that looks right. i last ran wsl --shutdown in PowerShell around this time yesterday.
hrmm, i guess this is just a bug with WSL... though i wonder if there's an option like "ask3390" for xrdp to request port 3390, before settling on something else automatically, like what kali linux did for win-kex and their build of xrdp...
You can check who listens on a port. For example:
lsof -i
xrdp 28081 xrdp 11u IPv6 811797 0t0 TCP *:3390 (LISTEN)
and then
kill 28081
xrdp version
0.9.17-2
Detailed xrdp version, build options
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" :
results of "journalctl -xeu xrdp.service" :
at boot, this is what appears when i type "sudo systemctl start xrdp-sesman":
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:
(commenting-out unset and .$HOME/.profile does nothing, by the way)
contents of beginning of /etc/xrdp/xrdp.ini:
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