Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ubuntu 20.04: connects, then immediately disconnects #2293

Closed
andreasplesch opened this issue Jun 27, 2022 · 10 comments
Closed

Ubuntu 20.04: connects, then immediately disconnects #2293

andreasplesch opened this issue Jun 27, 2022 · 10 comments

Comments

@andreasplesch
Copy link

andreasplesch commented Jun 27, 2022

The setup is Ubuntu 20.04 starting from non-X11 configuration. Then standard

sudo apt install xrdp

which pulls in X11 and gnome (not sure how much of gnome). Nothing else is explicitly installed.

The standard non-root user was set up to only login with ssh keys, This caused xrdp authentication problems. Setting a password and using it for the xrdp connection (via krdc) seems to allow better authentication although there is still a gnome keyring problem

From what I can tell then the Xserver starts up fine but then immediately closes down (with or without parallel console ssh login).

This is how far I got.

I scoured issues and forums for an extended time but could not identify a solution. I tried Xwrapper.config allowed_users=anyone but without success.

Here are relevant logs:

$ tail /var/log/Xauth.log
Jun 27 17:33:46 linuxrdp xrdp-sesman[1721]: pam_unix(xrdp-sesman:session): session opened for user ubuntu by (uid=0)
Jun 27 17:33:46 linuxrdp systemd-logind[384]: New session c5 of user ubuntu.
Jun 27 17:33:46 linuxrdp systemd: pam_unix(systemd-user:session): session opened for user ubuntu by (uid=0)
Jun 27 17:33:47 linuxrdp gnome-keyring-daemon[1813]: couldn't access control socket: /run/user/1000/keyring/control: No such file or directory
Jun 27 17:33:49 linuxrdp xrdp-sesman[1721]: pam_unix(xrdp-sesman:session): session closed for user ubuntu
Jun 27 17:33:49 linuxrdp systemd-logind[384]: Failed to restore VT, ignoring: Bad file descriptor
Jun 27 17:33:51 linuxrdp systemd-logind[384]: Session c5 logged out. Waiting for processes to exit.
Jun 27 17:33:57 linuxrdp systemd-logind[384]: Removed session c5.
$ tail /var/log/xrdp-sesman.log
[20220627-17:33:43] [INFO ] A connection received from ::1 port 57836
[20220627-17:33:43] [INFO ] ++ created session (access granted): username ubuntu, ip ::ffff:140.XXX.XXX.XX:56248 - socket: 12
[20220627-17:33:44] [INFO ] starting Xorg session...
[20220627-17:33:44] [DEBUG] Closed socket 9 (AF_INET6 :: port 5910)
[20220627-17:33:44] [DEBUG] Closed socket 9 (AF_INET6 :: port 6010)
[20220627-17:33:44] [DEBUG] Closed socket 9 (AF_INET6 :: port 6210)
[20220627-17:33:44] [DEBUG] Closed socket 8 (AF_INET6 ::1 port 3350)
[20220627-17:33:44] [INFO ] calling auth_start_session from pid 1721
[20220627-17:33:46] [DEBUG] Closed socket 7 (AF_INET6 ::1 port 3350)
[20220627-17:33:46] [DEBUG] Closed socket 8 (AF_INET6 ::1 port 3350)
[20220627-17:33:46] [INFO ] /usr/lib/xorg/Xorg :10 -auth .Xauthority -config xrdp/xorg.conf -noreset -nolisten tcp -logfile .xorgxrdp.%s.log  
[20220627-17:33:47] [CORE ] waiting for window manager (pid 1733) to exit
[20220627-17:33:47] [CORE ] window manager (pid 1733) did exit, cleaning up session
[20220627-17:33:48] [INFO ] calling auth_stop_session and auth_end from pid 1721
[20220627-17:33:49] [DEBUG] cleanup_sockets:
[20220627-17:33:50] [DEBUG] cleanup_sockets: deleting /run/xrdp/sockdir/xrdp_chansrv_socket_10
[20220627-17:33:50] [DEBUG] cleanup_sockets: deleting /run/xrdp/sockdir/xrdpapi_10
[20220627-17:33:51] [INFO ] ++ terminated session:  username ubuntu, display :10.0, session_pid 1721, ip ::ffff:140.247.105.75:56248 - socket: 12
$ tail /var/log/xrdp.log
[20220627-17:33:38] [INFO ] Socket 12: AF_INET6 connection received from ::ffff:140.XXX.XXX.XX port 56248
[20220627-17:33:38] [DEBUG] Closed socket 12 (AF_INET6 ::ffff:192.168.0.230 port 3389)
[20220627-17:33:38] [DEBUG] Closed socket 11 (AF_INET6 :: port 3389)
[20220627-17:33:39] [INFO ] Using default X.509 certificate: /etc/xrdp/cert.pem
[20220627-17:33:39] [INFO ] Using default X.509 key file: /etc/xrdp/key.pem
[20220627-17:33:39] [ERROR] Cannot read private key file /etc/xrdp/key.pem: Permission denied
[20220627-17:33:40] [DEBUG] TLSv1.3 enabled
[20220627-17:33:40] [DEBUG] TLSv1.2 enabled
[20220627-17:33:40] [DEBUG] Security layer: requested 3, selected 0
[20220627-17:33:41] [INFO ] connected client computer name: LinuxComputer2
[20220627-17:33:41] [INFO ] adding channel item name rdpdr chan_id 1004 flags 0xc0800000
[20220627-17:33:41] [INFO ] adding channel item name rdpsnd chan_id 1005 flags 0xc0000000
[20220627-17:33:41] [INFO ] adding channel item name cliprdr chan_id 1006 flags 0xc0a00000
[20220627-17:33:42] [INFO ] Non-TLS connection established from ::ffff:140.XXX.XXX.XX port 56248: encrypted with standard RDP security
[20220627-17:33:42] [DEBUG] xrdp_000006b7_wm_login_mode_event_00000001
[20220627-17:33:42] [INFO ] Loading keymap file /etc/xrdp/km-00000409.ini
[20220627-17:33:42] [WARN ] local keymap file for 0x00000409 found and doesn't match built in keymap, using local keymap file
[20220627-17:33:43] [DEBUG] xrdp_wm_log_msg: connecting to sesman ip 127.0.0.1 port 3350
[20220627-17:33:43] [INFO ] xrdp_wm_log_msg: sesman connect ok
[20220627-17:33:43] [DEBUG] xrdp_wm_log_msg: sending login info to session manager, please wait...
[20220627-17:33:43] [DEBUG] return value from xrdp_mm_connect 0
[20220627-17:33:44] [INFO ] xrdp_wm_log_msg: login successful for display 10
[20220627-17:33:45] [DEBUG] xrdp_wm_log_msg: started connecting
[20220627-17:33:47] [INFO ] lib_mod_log_peer: xrdp_pid=1719 connected to X11rdp_pid=1734 X11rdp_uid=1000 X11rdp_gid=1000 client_ip=::ffff:140.XXX.XXX.XX client_port=56248
[20220627-17:33:47] [DEBUG] xrdp_wm_log_msg: connected ok
[20220627-17:33:49] [DEBUG] xrdp_mm_connect_chansrv: chansrv connect successful
[20220627-17:33:50] [DEBUG] Closed socket 22 (AF_INET6 ::1 port 57836)
[20220627-17:33:50] [DEBUG] Closed socket 12 (AF_INET6 ::ffff:192.168.0.230 port 3389)
[20220627-17:33:51] [DEBUG] xrdp_mm_module_cleanup
[20220627-17:33:51] [DEBUG] Closed socket 23 (AF_UNIX)
[20220627-17:33:52] [DEBUG] Closed socket 24 (AF_UNIX)
$ tail ~/.xession-errors
Xsession: X session started for ubuntu at Mon Jun 27 17:33:47 UTC 2022
dbus-update-activation-environment: setting DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
dbus-update-activation-environment: setting DISPLAY=:10.0
localuser:ubuntu being added to access control list
dbus-update-activation-environment: setting QT_ACCESSIBILITY=1
dbus-update-activation-environment: setting USER=ubuntu
dbus-update-activation-environment: setting XDG_SESSION_TYPE=x11
dbus-update-activation-environment: setting HOME=/home/ubuntu
dbus-update-activation-environment: setting XRDP_PULSE_SINK_SOCKET=xrdp_chansrv_audio_out_socket_10
dbus-update-activation-environment: setting XRDP_PULSE_SOURCE_SOCKET=xrdp_chansrv_audio_in_socket_10
dbus-update-activation-environment: setting DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
dbus-update-activation-environment: setting PULSE_SCRIPT=/etc/xrdp/pulse/default.pa
dbus-update-activation-environment: setting IM_CONFIG_PHASE=1
dbus-update-activation-environment: setting LOGNAME=ubuntu
dbus-update-activation-environment: setting XDG_SESSION_CLASS=user
dbus-update-activation-environment: setting PATH=/sbin:/bin:/usr/bin:/usr/local/bin:/snap/bin
dbus-update-activation-environment: setting XRDP_SOCKET_PATH=/run/xrdp/sockdir
dbus-update-activation-environment: setting XDG_RUNTIME_DIR=/run/user/1000
dbus-update-activation-environment: setting DISPLAY=:10.0
dbus-update-activation-environment: setting LANG=C.UTF-8
dbus-update-activation-environment: setting UID=1000
dbus-update-activation-environment: setting SHELL=/bin/bash
dbus-update-activation-environment: setting QT_ACCESSIBILITY=1
dbus-update-activation-environment: setting XRDP_SESSION=1
dbus-update-activation-environment: setting GPG_AGENT_INFO=/run/user/1000/gnupg/S.gpg-agent:0:1
dbus-update-activation-environment: setting PWD=/home/ubuntu
dbus-update-activation-environment: setting XDG_DATA_DIRS=/usr/share/gnome:/usr/local/share:/usr/share:/var/lib/snapd/desktop
tail ~/.xorgxrdp.10.log
[  5946.674] rdpRRScreenSetSize: width 800 height 600 mmWidth 212 mmHeight 159
[  5946.674] rdpRRGetInfo:
[  5946.674]   screen resized to 800x600
[  5946.674]   RRScreenSizeSet ok 1
[  5946.674] rdpClientConGotConnection:
[  5946.674] rdpClientConGotConnection: g_sck_accept ok new_sck 7
[  5946.674] rdpClientConGetConnection: idle_disconnect_timeout set to non-positive value, idle timer turned off
[  5946.674] rdpAddClientConToDev: adding first clientCon 0x555f24bc7110
[  5946.729] rdpRRGetInfo:
[  5946.770] rdpInDeferredRepeatCallback:
[  5946.770] rdpkeybChangeKeyboardControl:
[  5946.770] rdpkeybChangeKeyboardControl: autoRepeat off
[  5946.823] rdpRRGetInfo:
[  5946.829] rdpClientConProcessMsgVersion: version 0 0 0 1
[  5946.829] rdpClientConProcessScreenSizeMsg: set width 800 height 600 bpp 32
[  5946.829] rdpClientConProcessScreenSizeMsg: shmemid 12 shmemptr 0x7f69e29c0000
[  5946.829] rdpClientConProcessMsgClientInput: invalidate x 0 y 0 cx 800 cy 600
[  5947.900] KbdSync: toggling num lock
[  5947.900] rdpkeybChangeKeyboardControl:
[  5947.900] rdpkeybChangeKeyboardControl: autoRepeat off
[  5948.984] rdpmouseControl: what 2
[  5948.984] rdpmouseDeviceOff:
[  5948.984] rdpkeybControl: what 2
[  5948.984] rdpkeybDeviceOff:
[  5948.986] rdpkeybControl: what 3
[  5948.986] rdpkeybUnInit: drv 0x555f246d5bf0 info 0x555f249dc820, flags 0x0
[  5948.986] rdpUnregisterInputCallback: proc 0x7f69eacf88e0
[  5948.986] rdpmouseControl: what 3
[  5948.986] rdpmouseUnInit: drv 0x555f246d7600 info 0x555f2486c090, flags 0x0
[  5948.986] rdpUnregisterInputCallback: proc 0x7f69eacfd430
[  5948.987] rdpCloseScreen:
[  5948.987] xorgxrdpDownDown:
[  5948.987] xorgxrdpDownDown: 1
[  5948.987] rdpClientConDeinit:
[  5948.987] rdpClientConDeinit: disconnecting clientCon
[  5948.987] rdpClientConDisconnect:
[  5948.987] rdpRemoveClientConFromDev: removing clientCon 0x555f24bc7110
[  5948.987] rdpClientConDeinit: deleting file /run/xrdp/sockdir/xrdp_display_10
[  5948.987] rdpClientConDeinit: deleting file /run/xrdp/sockdir/xrdp_disconnect_display_10
[  5948.991] (II) Server terminated successfully (0). Closing log file.

No WW warnings.
@andreasplesch
Copy link
Author

andreasplesch commented Jun 27, 2022

I manually started $ gnome-keyring-daemon and reset the ubuntu user password. This gets a little further perhaps:

$ tail /var/log/auth.log
Jun 27 20:40:00 li xrdp-sesman[930]: pam_unix(xrdp-sesman:session): session opened for user ubuntu by (uid=0)
Jun 27 20:40:00 li systemd-logind[423]: New session c1 of user ubuntu.
Jun 27 20:40:16 li gnome-keyring-daemon[898]: The Secret Service was already initialized
Jun 27 20:40:16 li gnome-keyring-daemon[898]: The PKCS#11 component was already initialized
Jun 27 20:40:16 li xrdp-sesman[930]: pam_unix(xrdp-sesman:session): session closed for user ubuntu
Jun 27 20:40:16 li systemd-logind[423]: Failed to restore VT, ignoring: Bad file descriptor
Jun 27 20:40:17 li systemd-logind[423]: Session c1 logged out. Waiting for processes to exit.
Jun 27 20:40:21 li systemd-logind[423]: Removed session c1.

$ tail  /var/log/xrdp-sesman.log
[20220627-20:40:00] [INFO ] A connection received from ::1 port 50222
[20220627-20:40:00] [INFO ] ++ created session (access granted): username ubuntu, ip ::ffff:140.xxx.xxx.xx:34866 - socket: 12
[20220627-20:40:00] [INFO ] starting Xorg session...
[20220627-20:40:00] [DEBUG] Closed socket 9 (AF_INET6 :: port 5910)
[20220627-20:40:00] [DEBUG] Closed socket 9 (AF_INET6 :: port 6010)
[20220627-20:40:00] [DEBUG] Closed socket 9 (AF_INET6 :: port 6210)
[20220627-20:40:00] [DEBUG] Closed socket 8 (AF_INET6 ::1 port 3350)
[20220627-20:40:00] [INFO ] calling auth_start_session from pid 930
[20220627-20:40:00] [DEBUG] Closed socket 7 (AF_INET6 ::1 port 3350)
[20220627-20:40:00] [DEBUG] Closed socket 8 (AF_INET6 ::1 port 3350)
[20220627-20:40:00] [INFO ] /usr/lib/xorg/Xorg :10 -auth .Xauthority -config xrdp/xorg.conf -noreset -nolisten tcp -logfile .xorgxrdp.%s.log  
[20220627-20:40:01] [CORE ] waiting for window manager (pid 931) to exit
[20220627-20:40:16] [CORE ] window manager (pid 931) did exit, cleaning up session
[20220627-20:40:16] [INFO ] calling auth_stop_session and auth_end from pid 930
[20220627-20:40:16] [DEBUG] cleanup_sockets:
[20220627-20:40:16] [DEBUG] cleanup_sockets: deleting /run/xrdp/sockdir/xrdp_chansrv_audio_out_socket_10
[20220627-20:40:16] [DEBUG] cleanup_sockets: deleting /run/xrdp/sockdir/xrdp_chansrv_audio_in_socket_10
[20220627-20:40:16] [DEBUG] cleanup_sockets: deleting /run/xrdp/sockdir/xrdpapi_10
[20220627-20:40:16] [INFO ] ++ terminated session:  username ubuntu, display :10.0, session_pid 930, ip ::ffff:140.xxx.xxx.xx:34866 - socket: 12

The other logs look the same.

@matt335672
Copy link
Member

matt335672 commented Jun 28, 2022

Thanks for the comprehensive logs.

I think your window manager is exiting early:-

[20220627-17:33:47] [CORE ] waiting for window manager (pid 1733) to exit
[20220627-17:33:47] [CORE ] window manager (pid 1733) did exit, cleaning up session

Installing xrdp does not install GNOME - it might install bits of it due to pulling in other dependencies which depend on bits of GNOME however.

Do you specifically want a GNOME desktop for xrdp? If so, the next step is to explicitly install it (which pulls in a LOT of software). If not, installing another desktop (e.g. XFCE) might be a better way to go. Let me know which way you want to go.

@andreasplesch
Copy link
Author

andreasplesch commented Jun 28, 2022

Thanks ! Ok, this could be it. The leaner the better for the window manager. XFCE would be great.

@andreasplesch
Copy link
Author

andreasplesch commented Jun 28, 2022

Remote X11 with ssh forwarding works BTW but is very slow for the specific app.

@andreasplesch
Copy link
Author

andreasplesch commented Jun 28, 2022

I installed apt install xfce4 but still get the same result:

Jun 28 15:08:25 xfce xrdp-sesman[1595]: pam_unix(xrdp-sesman:session): session opened for user ubuntu by (uid=0)
Jun 28 15:08:25 xfce systemd-logind[397]: New session c3 of user ubuntu.
Jun 28 15:08:27 xfce gnome-keyring-daemon[1588]: The Secret Service was already initialized
Jun 28 15:08:27 xfce gnome-keyring-daemon[1588]: The PKCS#11 component was already initialized
Jun 28 15:08:27 xfce xrdp-sesman[1595]: pam_unix(xrdp-sesman:session): session closed for user ubuntu
Jun 28 15:08:27 xfce systemd-logind[397]: Failed to restore VT, ignoring: Bad file descriptor
Jun 28 15:08:27 xfce systemd-logind[397]: Session c3 logged out. Waiting for processes to exit.
Jun 28 15:08:36 xfce systemd-logind[397]: Removed session c3.

xrdp-sesman.log
[20220628-15:08:24] [INFO ] A connection received from ::1 port 39452
[20220628-15:08:24] [INFO ] ++ created session (access granted): username ubuntu, ip ::ffff:140.xx:57026 - socket: 12
[20220628-15:08:25] [INFO ] starting Xorg session...
[20220628-15:08:25] [DEBUG] Closed socket 9 (AF_INET6 :: port 5910)
[20220628-15:08:25] [ERROR] g_tcp_bind(9, 6010) failed bind IPv6 (errno=98) and IPv4 (errno=22).
[20220628-15:08:25] [DEBUG] Closed socket 9 (AF_INET6 :: port 0)
[20220628-15:08:25] [DEBUG] Closed socket 9 (AF_INET6 :: port 5911)
[20220628-15:08:25] [DEBUG] Closed socket 9 (AF_INET6 :: port 6011)
[20220628-15:08:25] [DEBUG] Closed socket 9 (AF_INET6 :: port 6211)
[20220628-15:08:25] [DEBUG] Closed socket 9 (AF_INET6 :: port 5912)
[20220628-15:08:25] [DEBUG] Closed socket 9 (AF_INET6 :: port 6012)
[20220628-15:08:25] [DEBUG] Closed socket 9 (AF_INET6 :: port 6212)
[20220628-15:08:25] [DEBUG] Closed socket 8 (AF_INET6 ::1 port 3350)
[20220628-15:08:25] [INFO ] calling auth_start_session from pid 1595
[20220628-15:08:25] [DEBUG] Closed socket 7 (AF_INET6 ::1 port 3350)
[20220628-15:08:26] [DEBUG] Closed socket 8 (AF_INET6 ::1 port 3350)
[20220628-15:08:26] [INFO ] /usr/lib/xorg/Xorg :12 -auth .Xauthority -config xrdp/xorg.conf -noreset -nolisten tcp -logfile .xorgxrdp.%s.log  
[20220628-15:08:26] [CORE ] waiting for window manager (pid 1596) to exit
[20220628-15:08:27] [CORE ] window manager (pid 1596) did exit, cleaning up session
[20220628-15:08:27] [INFO ] calling auth_stop_session and auth_end from pid 1595
[20220628-15:08:27] [DEBUG] cleanup_sockets:
[20220628-15:08:27] [DEBUG] cleanup_sockets: deleting /run/xrdp/sockdir/xrdp_chansrv_socket_12
[20220628-15:08:27] [DEBUG] cleanup_sockets: deleting /run/xrdp/sockdir/xrdpapi_12
[20220628-15:08:27] [INFO ] ++ terminated session:  username ubuntu, display :12.0, session_pid 1595, ip ::ffff:140.247.105.75:57026 - socket: 12

[20220628-15:08:21] [INFO ] Socket 12: AF_INET6 connection received from ::ffff:140.xx port 57026
[20220628-15:08:21] [DEBUG] Closed socket 12 (AF_INET6 ::ffff:192.168.0.57 port 3389)
[20220628-15:08:21] [DEBUG] Closed socket 11 (AF_INET6 :: port 3389)
[20220628-15:08:22] [INFO ] Using default X.509 certificate: /etc/xrdp/cert.pem
[20220628-15:08:22] [INFO ] Using default X.509 key file: /etc/xrdp/key.pem
[20220628-15:08:22] [ERROR] Cannot read private key file /etc/xrdp/key.pem: Permission denied
[20220628-15:08:22] [DEBUG] TLSv1.3 enabled
[20220628-15:08:22] [DEBUG] TLSv1.2 enabled
[20220628-15:08:23] [DEBUG] Security layer: requested 3, selected 0
[20220628-15:08:23] [INFO ] connected client computer name: LinuxGeoMuseum2
[20220628-15:08:23] [INFO ] adding channel item name rdpdr chan_id 1004 flags 0xc0800000
[20220628-15:08:23] [INFO ] adding channel item name rdpsnd chan_id 1005 flags 0xc0000000
[20220628-15:08:23] [INFO ] adding channel item name cliprdr chan_id 1006 flags 0xc0a00000
[20220628-15:08:23] [INFO ] Non-TLS connection established from ::ffff:140.xx port 57026: encrypted with standard RDP security
[20220628-15:08:23] [DEBUG] xrdp_00000639_wm_login_mode_event_00000001
[20220628-15:08:23] [INFO ] Loading keymap file /etc/xrdp/km-00000409.ini
[20220628-15:08:24] [WARN ] local keymap file for 0x00000409 found and doesn't match built in keymap, using local keymap file
[20220628-15:08:24] [DEBUG] xrdp_wm_log_msg: connecting to sesman ip 127.0.0.1 port 3350
[20220628-15:08:24] [INFO ] xrdp_wm_log_msg: sesman connect ok
[20220628-15:08:24] [DEBUG] xrdp_wm_log_msg: sending login info to session manager, please wait...
[20220628-15:08:24] [DEBUG] return value from xrdp_mm_connect 0
[20220628-15:08:25] [INFO ] xrdp_wm_log_msg: login successful for display 12
[20220628-15:08:25] [DEBUG] xrdp_wm_log_msg: started connecting
[20220628-15:08:26] [INFO ] lib_mod_log_peer: xrdp_pid=1593 connected to X11rdp_pid=1597 X11rdp_uid=1000 X11rdp_gid=1000 client_ip=::ffff:140.xx client_port=57026
[20220628-15:08:26] [DEBUG] xrdp_wm_log_msg: connected ok
[20220628-15:08:27] [DEBUG] xrdp_mm_connect_chansrv: chansrv connect successful
[20220628-15:08:27] [DEBUG] Closed socket 22 (AF_INET6 ::1 port 39452)
[20220628-15:08:27] [DEBUG] Closed socket 12 (AF_INET6 ::ffff:192.168.0.57 port 3389)
[20220628-15:08:28] [DEBUG] xrdp_mm_module_cleanup
[20220628-15:08:28] [DEBUG] Closed socket 23 (AF_UNIX)
[20220628-15:08:28] [DEBUG] Closed socket 24 (AF_UNIX)

.xsession-error
Xsession: X session started for ubuntu at Tue Jun 28 15:08:26 UTC 2022
dbus-update-activation-environment: setting DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
dbus-update-activation-environment: setting DISPLAY=:12.0
localuser:ubuntu being added to access control list
dbus-update-activation-environment: setting QT_ACCESSIBILITY=1
dbus-update-activation-environment: setting USER=ubuntu
dbus-update-activation-environment: setting XDG_SESSION_TYPE=x11
dbus-update-activation-environment: setting HOME=/home/ubuntu
dbus-update-activation-environment: setting XRDP_PULSE_SINK_SOCKET=xrdp_chansrv_audio_out_socket_12
dbus-update-activation-environment: setting XRDP_PULSE_SOURCE_SOCKET=xrdp_chansrv_audio_in_socket_12
dbus-update-activation-environment: setting DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
dbus-update-activation-environment: setting PULSE_SCRIPT=/etc/xrdp/pulse/default.pa
dbus-update-activation-environment: setting IM_CONFIG_PHASE=1
dbus-update-activation-environment: setting LOGNAME=ubuntu
dbus-update-activation-environment: setting XDG_SESSION_CLASS=user
dbus-update-activation-environment: setting PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/gam
es:/snap/bin
dbus-update-activation-environment: setting XRDP_SOCKET_PATH=/run/xrdp/sockdir
dbus-update-activation-environment: setting XDG_RUNTIME_DIR=/run/user/1000
dbus-update-activation-environment: setting DISPLAY=:12.0
dbus-update-activation-environment: setting LANG=C.UTF-8
dbus-update-activation-environment: setting UID=1000
dbus-update-activation-environment: setting SHELL=/bin/bash
dbus-update-activation-environment: setting QT_ACCESSIBILITY=1
dbus-update-activation-environment: setting XRDP_SESSION=1
dbus-update-activation-environment: setting GPG_AGENT_INFO=/run/user/1000/gnupg/S.gpg-agent:0:1
dbus-update-activation-environment: setting PWD=/home/ubuntu
dbus-update-activation-environment: setting XDG_DATA_DIRS=/usr/share/gnome:/usr/local/share:/usr/share:/var/lib/snapd/desktop

.xorgxrdp
...
[  1619.845] rdpkeybUnInit: drv 0x560cdef97d30 info 0x560cdf29eba0, flags 0x0
[  1619.845] rdpUnregisterInputCallback: proc 0x7f0f030238e0
[  1619.845] rdpmouseControl: what 3
[  1619.845] rdpmouseUnInit: drv 0x560cdef99740 info 0x560cdf12e410, flags 0x0
[  1619.845] rdpUnregisterInputCallback: proc 0x7f0f03ea4430
[  1619.846] rdpCloseScreen:
[  1619.846] xorgxrdpDownDown:
[  1619.846] xorgxrdpDownDown: 1
[  1619.847] rdpClientConDeinit:
[  1619.847] rdpClientConDeinit: disconnecting clientCon
[  1619.847] rdpClientConDisconnect:
[  1619.847] rdpRemoveClientConFromDev: removing clientCon 0x560cdf2b4870
[  1619.847] rdpClientConDeinit: deleting file /run/xrdp/sockdir/xrdp_display_12
[  1619.847] rdpClientConDeinit: deleting file /run/xrdp/sockdir/xrdp_disconnect_display_12
[  1619.848] (II) Server terminated successfully (0). Closing log file.

grep WW .xorgxrdp
   (WW) warning, (EE) error, (NI) not implemented, (??) unknown.
[  1619.128] (WW) The directory "/usr/share/fonts/X11/cyrillic" does not exist.
[  1619.128] (WW) The directory "/usr/share/fonts/X11/100dpi/" does not exist.
[  1619.129] (WW) The directory "/usr/share/fonts/X11/75dpi/" does not exist.
[  1619.129] (WW) The directory "/usr/share/fonts/X11/100dpi" does not exist.
[  1619.129] (WW) The directory "/usr/share/fonts/X11/75dpi" does not exist.
[  1619.147] (WW) Falling back to old probe method for XRDPDEV
[  1619.147] (WW) VGA arbiter: cannot open kernel arbiter, no multi-card support

Not sure why display :12 is used. :10 is for x11 forwarding, :11 probably from an earlier rdp display attempt.

I am using gdm3.

I went ahead and followed https://operavps.com/install-xrdp-on-ubuntu-20/ to circumvent Xsession startup completely by editing /etx/xrdp/startwm.sh to start xfce4 directly without dm.

That worked. It allowed my to use rdp with krdc. But it may be nicer to avoid that and use the regular Xsession setup. Would lightdm be an alternative ?

@matt335672
Copy link
Member

matt335672 commented Jun 28, 2022

By default xrdp-sesman will look for a free display number in the range {10..}. If it can't be sure the display number is free, it skips it and goes on to the next.

In terms of Ubuntu session startup, there's a lot of clever scripting that goes on to try to find the session manager to use. It's all based under /etc/X11, so if you've got an ability to read bash, I'd urge you to look in there, in particular /etc/X11/Xsession.d/50x11-common_determine-startup

TLDR; If you've got an executable file called ~/.xsession, the startup scripts will try to run that to start the session for the user. Otherwise, the scripts will probably try to start whatever /etc/alternatives/x-session-manager is pointing to - this is the system default.

On my 20.04 system which starts GNOME by default:-

$ ls -l /etc/alternatives/x-session-manager
lrwxrwxrwx 1 root root 22 Dec  7  2020 /etc/alternatives/x-session-manager -> /usr/bin/gnome-session

To set the system default to xfce4:-

$ sudo update-alternatives --config x-session-manager
There are 3 choices for the alternative x-session-manager (providing /usr/bin/x-session-manager).

  Selection    Path                    Priority   Status
------------------------------------------------------------
* 0            /usr/bin/gnome-session   50        auto mode
  1            /usr/bin/gnome-session   50        manual mode
  2            /usr/bin/startxfce4      50        manual mode
  3            /usr/bin/xfce4-session   40        manual mode

Press  to keep the current choice[*], or type selection number: 3
update-alternatives: using /usr/bin/xfce4-session to provide /usr/bin/x-session-manager (x-session-manager) in manual mode

Try that, and come back to me.

@andreasplesch
Copy link
Author

andreasplesch commented Jun 28, 2022

Thanks. I had looked at /etc/X11/Xsession.d but did not realize that x-session-manager was a symlink. Also, the scripting has a lot of indirection and options.

I restored startwm.sh and used $ sudo update-alternatives --config x-session-manager to select the xfce4-session session manager.

That worked fine !

To summarize, starting from a headless ubuntu install, it is necessary to install a desktop, choose the session manager, and then install xrdp:

  1. apt install xfce4 xfce-goodies # ca. 1.3GB, also installs xorg et al., and a lot of gnome, pick lightdm as it is lighter, goodies are optional
  2. update-alternatives --config x-session-manager #pick session manager
  3. apt install xrdp

Reboot not necessary but a good time to test if everything works after a reboot.

Looks simple enough but took a while to figure out. Let me close the issue.

@andreasplesch
Copy link
Author

andreasplesch commented Jun 28, 2022

The setup (option 3 above) directly launches the xfce4 desktop. While I prefer that to logging in through a dm, how would one configure to connect to a dm first ?

@matt335672
Copy link
Member

matt335672 commented Jun 29, 2022

If by dm, you mean something like gdm3 or lightdm, that's not possible I'm afraid. You can use the xrdp login facilities, but they're pretty light on features.

@andreasplesch
Copy link
Author

andreasplesch commented Jun 29, 2022

Yes, gdm3 or lightdm. That's ok, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants