Score:0

xRDP connection failed: login failed for display 0 + rejection

I will update info as I find out

The problem

I am using a recently installed Lubuntu 20.04.3, in an old PC. I mean to connect via xRDP from both Ubuntu (remmina) and Windows 10 PCs, and so far I cannot from either.

What I see when connecting from Ubuntu 20.04.3, remmina:

  1. Screen 1 with the message login failed for display 0.
    From logs below, I understand this is just a warning, but then an attempt to connect with display 10 (or display 11 if there is already an X connection using display 10) is successful.
    So I would only later bother about how to remove this initial attempt with display 0, or how to make it succeed.
  2. Screen 2 with the login prompt.
  3. A brief black screen, and then the connection window closes.

enter image description here enter image description here

How can I fix this?

Note: I don't think there is a problem with username/password. There are no special characters, nor capital letters in either. And I can ssh to that server with no problem from both Ubuntu and Win 10. Plus, logs below suggest this is ok.

What I tried so far

See below for specific info; none of this changed the outcome:

  1. Installed required packages: xrdp xorgxrdp xserver-xorg-core xserver-xorg-input-all

  2. Enabled the service.

  3. Added two lines in /etc/xrdp/startwm.sh as shown under Fix Black Ubuntu Screen. Restaring the service.

  4. Removed an issue with certifcates (Option 2 here), with sudo adduser xrdp ssl-cert Restaring the service. Upon connecting again, remmina asked me to accept certificates, which I did.

  5. Edited /etc/X11/Xwrapper.config as shown here. Restaring the service.

  6. Given the error message in ~/.xorgxrdp.11.log (failed to take device: Operation not permitted) and this solved similar problem (although not with xrdp), I tried enabling KMS (I learned radeon is the driver) with

    $ sudo nano /etc/initram-tools/modules
    (adding radeon at the end)
    $ sudo update-initramfs -u
    $ sudo shutdown -r
    
  7. Logging out in the server and remote-connecting, as per this.

I am not sure about a few points:

  1. Could the problem be related to the fact I am using Gnome in the client, and another WM in the server? If it could, how can I confirm or rule out this? How can I solve this? See below.
  2. Could the problem be related to the first attempt at using display 0? If so, how could I remove that initial attempt, and use the available display (10, 11, etc.) in the first attempt?
  3. Do I need any UFW rule, given I am at home, with all PCs connected to the same router? If so, which are the commands to set the rule/s?
  4. Should I modify /etc/xrdp/xrdp.ini as shown here?
  5. Is the excerpt from ~/.xsession-errors below indicative of what to try next? If so, what are the commands that should follow?
  6. Is line [ERROR] g_tcp_bind(9, 6010) failed bind IPv6 (errno=98) and IPv4 (errno=22) the key for the solution? If so, what are the commands that should follow?
  7. Can I do this without a VNC server? (I would keep the demand on my server as low as possible, it is an old PC). This and this mention the VNC server as a requirement.

Specific info

On firewall

$ sudo ufw status verbose
Status: inactive

On packages

$ dpkg -l | grep xrdp
ii  xorgxrdp                      1:0.2.12-1                    amd64   Remote Desktop Protocol (RDP) modules for X.org
ii  xrdp                          0.9.12-1                      amd64   Remote Desktop Protocol (RDP) server
$ dpkg -l | grep xserver
ii  x11-xserver-utils             7.7+8                         amd64   X server utilities
ii  xserver-common                2:1.20.11-1ubuntu1~20.04.2    all     common files used by various X servers
ii  xserver-xorg                  1:7.7+19ubuntu14              amd64   X.Org X server
ii  xserver-xorg-core             2:1.20.11-1ubuntu1~20.04.2    amd64   Xorg X server - core server
ii  xserver-xorg-input-all        1:7.7+19ubuntu14              amd64   X.Org X server -- input driver metapackage
ii  xserver-xorg-input-libinput   0.29.0-1                      amd64   X.Org X server -- libinput input driver
ii  xserver-xorg-input-wacom      1:0.39.0-0ubuntu1             amd64   X.Org X server -- Wacom input driver
ii  xserver-xorg-legacy           2:1.20.11-1ubuntu1~20.04.2    amd64   setuid root Xorg server wrapper
ii  xserver-xorg-video-all        1:7.7+19ubuntu14              amd64   X.Org X server -- output driver metapackage
ii  xserver-xorg-video-amdgpu     19.1.0-1                      amd64   X.Org X server -- AMDGPU display driver
ii  xserver-xorg-video-ati        1:19.1.0-1                    amd64   X.Org X server -- AMD/ATI display driver wrapper
ii  xserver-xorg-video-fbdev      1:0.5.0-1ubuntu1              amd64   X.Org X server -- fbdev display driver
ii  xserver-xorg-video-intel      2:2.99.917+git20200226-1      amd64   X.Org X server -- Intel i8xx, i9xx display driver
ii  xserver-xorg-video-nouveau    1:1.0.16-1                    amd64   X.Org X server -- Nouveau display driver
ii  xserver-xorg-video-qxl        0.1.5+git20200331-1           amd64   X.Org X server -- QXL display driver
ii  xserver-xorg-video-radeon     1:19.1.0-1                    amd64   X.Org X server -- AMD/ATI Radeon display driver
ii  xserver-xorg-video-vesa       1:2.4.0-2                     amd64   X.Org X server -- VESA display driver
ii  xserver-xorg-video-vmware     1:13.3.0-3                    amd64   X.Org X server -- VMware display driver

On the service (at the time of writing)

$ sudo systemctl status xrdp
[sudo] password for user1: 
● xrdp.service - xrdp daemon
     Loaded: loaded (/lib/systemd/system/xrdp.service; enabled; vendor preset: enabled)
     Active: active (running) since Wed 2021-11-03 07:17:27 -03; 46min ago
       Docs: man:xrdp(8)
             man:xrdp.ini(5)
    Process: 794 ExecStartPre=/bin/sh /usr/share/xrdp/socksetup (code=exited, status=0/SUCCESS)
    Process: 809 ExecStart=/usr/sbin/xrdp $XRDP_OPTIONS (code=exited, status=0/SUCCESS)
   Main PID: 821 (xrdp)
      Tasks: 2 (limit: 4114)
     Memory: 13.6M
     CGroup: /system.slice/xrdp.service
             ├─ 821 /usr/sbin/xrdp
             └─2270 /usr/sbin/xrdp

nov 03 07:51:49 server1 xrdp[2270]: (2270)(140250390095680)[DEBUG] xrdp_000008de_wm_login_mode_event_00000001
nov 03 07:51:49 server1 xrdp[2270]: (2270)(140250390095680)[INFO ] Loading keymap file /etc/xrdp/km-0000080a.ini
nov 03 07:51:49 server1 xrdp[2270]: (2270)(140250390095680)[WARN ] local keymap file for 0x0000080a found and doesn't match built in keym>
nov 03 07:51:50 server1 xrdp[2270]: (2270)(140250390095680)[DEBUG] xrdp_wm_log_msg: connecting to sesman ip 127.0.0.1 port 3350
nov 03 07:51:50 server1 xrdp[2270]: (2270)(140250390095680)[INFO ] xrdp_wm_log_msg: sesman connect ok
nov 03 07:51:50 server1 xrdp[2270]: (2270)(140250390095680)[DEBUG] xrdp_wm_log_msg: sending login info to session manager, please wait...
nov 03 07:51:50 server1 xrdp[2270]: (2270)(140250390095680)[DEBUG] return value from xrdp_mm_connect 0
nov 03 07:51:52 server1 xrdp[2270]: (2270)(140250390095680)[INFO ] xrdp_wm_log_msg: login failed for display 0
nov 03 07:51:52 server1 xrdp[2270]: (2270)(140250390095680)[DEBUG] xrdp_mm_module_cleanup
nov 03 07:51:52 server1 xrdp[2270]: (2270)(140250390095680)[DEBUG] Closed socket 16 (AF_INET6 ::1 port 33602)

On the last 2 connection attempts (at the time of writing), via tail -100 /var/log/xrdp.log. Note that the log for the second to last is much briefer (I wouldn't know why).

[20211103-08:12:23] [DEBUG] xrdp_wm_log_msg: connecting to sesman ip 127.0.0.1 port 3350
[20211103-08:12:23] [INFO ] xrdp_wm_log_msg: sesman connect ok
[20211103-08:12:23] [DEBUG] xrdp_wm_log_msg: sending login info to session manager, please wait...
[20211103-08:12:23] [DEBUG] return value from xrdp_mm_connect 0
[20211103-08:12:24] [INFO ] xrdp_wm_log_msg: login successful for display 11
[20211103-08:12:24] [DEBUG] xrdp_wm_log_msg: started connecting
[20211103-08:12:25] [INFO ] lib_mod_log_peer: xrdp_pid=2270 connected to X11rdp_pid=2309 X11rdp_uid=1000 X11rdp_gid=1001 client_ip=::ffff:192.168.0.139 client_port=42290
[20211103-08:12:25] [DEBUG] xrdp_wm_log_msg: connected ok
[20211103-08:12:25] [DEBUG] xrdp_mm_connect_chansrv: chansrv connect successful
[20211103-08:12:25] [DEBUG] Closed socket 16 (AF_INET6 ::1 port 33604)
[20211103-08:12:27] [DEBUG] Closed socket 12 (AF_INET6 ::ffff:192.168.0.176 port 3389)
[20211103-08:12:27] [DEBUG] xrdp_mm_module_cleanup
[20211103-08:12:27] [DEBUG] Closed socket 17 (AF_UNIX)
[20211103-08:12:27] [DEBUG] Closed socket 18 (AF_UNIX)
[20211103-08:20:06] [DEBUG] Closed socket 11 (AF_INET6 :: port 3389)
[20211103-08:20:06] [INFO ] address [0.0.0.0] port [3389] mode 1
[20211103-08:20:06] [INFO ] listening to port 3389 on 0.0.0.0
[20211103-08:20:06] [INFO ] xrdp_listen_pp done
[20211103-08:20:07] [DEBUG] Closed socket 7 (AF_INET6 :: port 3389)
[20211103-08:20:09] [INFO ] starting xrdp with pid 2430
[20211103-08:20:09] [INFO ] address [0.0.0.0] port [3389] mode 1
[20211103-08:20:09] [INFO ] listening to port 3389 on 0.0.0.0
[20211103-08:20:09] [INFO ] xrdp_listen_pp done
[20211103-08:20:34] [INFO ] Socket 12: AF_INET6 connection received from ::ffff:192.168.0.139 port 42446
[20211103-08:20:34] [DEBUG] Closed socket 12 (AF_INET6 ::ffff:192.168.0.176 port 3389)
[20211103-08:20:34] [DEBUG] Closed socket 11 (AF_INET6 :: port 3389)
[20211103-08:20:34] [INFO ] Using default X.509 certificate: /etc/xrdp/cert.pem
[20211103-08:20:34] [INFO ] Using default X.509 key file: /etc/xrdp/key.pem
[20211103-08:20:34] [DEBUG] TLSv1.3 enabled
[20211103-08:20:34] [DEBUG] TLSv1.2 enabled
[20211103-08:20:34] [DEBUG] Security layer: requested 3, selected 1
[20211103-08:20:40] [INFO ] connected client computer name: ViaLactea
[20211103-08:20:40] [INFO ] adding channel item name rdpdr chan_id 1004 flags 0xc0800000
[20211103-08:20:40] [INFO ] adding channel item name rdpsnd chan_id 1005 flags 0xc0000000
[20211103-08:20:40] [INFO ] adding channel item name cliprdr chan_id 1006 flags 0xc0a00000
[20211103-08:20:40] [INFO ] adding channel item name drdynvc chan_id 1007 flags 0xc0800000
[20211103-08:20:41] [INFO ] TLS connection established from ::ffff:192.168.0.139 port 42446: TLSv1.3 with cipher TLS_AES_256_GCM_SHA384
[20211103-08:20:41] [DEBUG] xrdp_0000097f_wm_login_mode_event_00000001
[20211103-08:20:41] [INFO ] Loading keymap file /etc/xrdp/km-0000080a.ini
[20211103-08:20:41] [WARN ] local keymap file for 0x0000080a found and doesn't match built in keymap, using local keymap file
[20211103-08:20:41] [DEBUG] xrdp_wm_log_msg: connecting to sesman ip 127.0.0.1 port 3350
[20211103-08:20:42] [INFO ] xrdp_wm_log_msg: sesman connect ok
[20211103-08:20:42] [DEBUG] xrdp_wm_log_msg: sending login info to session manager, please wait...
[20211103-08:20:42] [DEBUG] return value from xrdp_mm_connect 0
[20211103-08:20:43] [INFO ] xrdp_wm_log_msg: login failed for display 0
[20211103-08:20:43] [DEBUG] xrdp_mm_module_cleanup
[20211103-08:20:43] [DEBUG] Closed socket 18 (AF_INET6 ::1 port 33606)
[20211103-08:20:52] [DEBUG] xrdp_wm_log_msg: connecting to sesman ip 127.0.0.1 port 3350
[20211103-08:20:52] [INFO ] xrdp_wm_log_msg: sesman connect ok
[20211103-08:20:52] [DEBUG] xrdp_wm_log_msg: sending login info to session manager, please wait...
[20211103-08:20:52] [DEBUG] return value from xrdp_mm_connect 0
[20211103-08:20:53] [INFO ] xrdp_wm_log_msg: login successful for display 11
[20211103-08:20:53] [DEBUG] xrdp_wm_log_msg: started connecting
[20211103-08:20:53] [INFO ] lib_mod_log_peer: xrdp_pid=2431 connected to X11rdp_pid=2434 X11rdp_uid=1000 X11rdp_gid=1001 client_ip=::ffff:192.168.0.139 client_port=42446
[20211103-08:20:53] [DEBUG] xrdp_wm_log_msg: connected ok
[20211103-08:20:54] [DEBUG] xrdp_mm_connect_chansrv: chansrv connect successful
[20211103-08:20:54] [DEBUG] Closed socket 18 (AF_INET6 ::1 port 33608)
[20211103-08:20:55] [DEBUG] Closed socket 12 (AF_INET6 ::ffff:192.168.0.176 port 3389)
[20211103-08:20:55] [DEBUG] xrdp_mm_module_cleanup
[20211103-08:20:55] [DEBUG] Closed socket 19 (AF_UNIX)
[20211103-08:20:55] [DEBUG] Closed socket 20 (AF_UNIX)

On the last connection attempt (at the time of writing), via tail -200 /var/log/xrdp-sesman.log. Note that ... created session (access granted): username user1... suggests username/password are ok.

[20211103-08:20:06] [INFO ] shutting down sesman 1
[20211103-08:20:06] [DEBUG] Closed socket 7 (AF_INET6 ::1 port 3350)
[20211103-08:20:06] [DEBUG] libscp initialized
[20211103-08:20:06] [DEBUG] Testing if xrdp-sesman can listen on 127.0.0.1 port 3350.
[20211103-08:20:06] [DEBUG] Closed socket 5 (AF_INET6 ::1 port 3350)
[20211103-08:20:06] [INFO ] starting xrdp-sesman with pid 2420
[20211103-08:20:06] [INFO ] listening to port 3350 on 127.0.0.1
[20211103-08:20:41] [INFO ] A connection received from ::1 port 33606
[20211103-08:20:43] [DEBUG] Closed socket 8 (AF_INET6 ::1 port 3350)
[20211103-08:20:52] [INFO ] A connection received from ::1 port 33608
[20211103-08:20:52] [INFO ] ++ created session (access granted): username user1, ip ::ffff:192.168.0.139:42446 - socket: 12
[20211103-08:20:52] [INFO ] starting Xorg session...
[20211103-08:20:52] [DEBUG] Closed socket 9 (AF_INET6 :: port 5910)
[20211103-08:20:52] [ERROR] g_tcp_bind(9, 6010) failed bind IPv6 (errno=98) and IPv4 (errno=22).
[20211103-08:20:52] [DEBUG] Closed socket 9 (AF_INET6 :: port 0)
[20211103-08:20:52] [DEBUG] Closed socket 9 (AF_INET6 :: port 5911)
[20211103-08:20:52] [DEBUG] Closed socket 9 (AF_INET6 :: port 6011)
[20211103-08:20:52] [DEBUG] Closed socket 9 (AF_INET6 :: port 6211)
[20211103-08:20:53] [DEBUG] Closed socket 8 (AF_INET6 ::1 port 3350)
[20211103-08:20:53] [INFO ] calling auth_start_session from pid 2432
[20211103-08:20:53] [DEBUG] Closed socket 7 (AF_INET6 ::1 port 3350)
[20211103-08:20:53] [DEBUG] Closed socket 8 (AF_INET6 ::1 port 3350)
[20211103-08:20:53] [INFO ] /usr/lib/xorg/Xorg :11 -auth .Xauthority -config xrdp/xorg.conf -noreset -nolisten tcp -logfile .xorgxrdp.%s.log  
[20211103-08:20:53] [CORE ] waiting for window manager (pid 2433) to exit
[20211103-08:20:55] [CORE ] window manager (pid 2433) did exit, cleaning up session
[20211103-08:20:55] [INFO ] calling auth_stop_session and auth_end from pid 2432
[20211103-08:20:55] [DEBUG] cleanup_sockets:
[20211103-08:20:55] [DEBUG] cleanup_sockets: deleting /run/xrdp/sockdir/xrdp_chansrv_audio_out_socket_11
[20211103-08:20:55] [DEBUG] cleanup_sockets: deleting /run/xrdp/sockdir/xrdp_chansrv_audio_in_socket_11
[20211103-08:20:55] [DEBUG] cleanup_sockets: deleting /run/xrdp/sockdir/xrdpapi_11
[20211103-08:20:55] [INFO ] ++ terminated session:  username user1, display :11.0, session_pid 2432, ip ::ffff:192.168.0.139:42446 - socket: 12

On the Window Manager.

  1. From a graphical terminal at the server.

     $ wmctrl -m
     Name: Openbox
     Class:
     PID: N/A
     Window manager's "showing the desktop" mode: OFF
    
  2. From a graphical terminal at an ssh-logged client.

     $ wmctrl -m
     Name: GNOME Shell
     Class: N/A
     PID: N/A
     Window manager's "showing the desktop" mode: OFF
    

Excerpt from ~/.xsession-errors (at the time of writing)

Xsession: X session started for user1 at mié 03 nov 2021 10:33:01 -03
dbus-update-activation-environment: systemd --user not found, ignoring --systemd argument
dbus-update-activation-environment: setting DISPLAY=:11.0
localuser:user1 being added to access control list
dbus-update-activation-environment: systemd --user not found, ignoring --systemd argument
dbus-update-activation-environment: setting QT_ACCESSIBILITY=1
dbus-update-activation-environment: systemd --user not found, ignoring --systemd argument
dbus-update-activation-environment: setting USER=user1

Excerpt from ~/.xorgxrdp.11.log (at the time of writing, checked based on this)

[ 10692.409] (EE) systemd-logind: failed to take device /dev/dri/card0: Operation not permitted
[ 10692.409] (EE) /dev/dri/card0: failed to set DRM interface version 1.4: Permission denied

Related

  1. https://aguslr.com/blog/2017/04/15/debian-thinclient.html
  2. https://thunderboltlaptop.com/install-xrdp-ubuntu/
  3. Openbox vs. LXQt
guiverc avatar
cn flag
Lubuntu is LXQt & not LXDE. There is no `lxsession` used by Lubuntu anymore (`lxqt-session` has been used since 18.10); so you shouldn't refer to it as Lubuntu - the packages you're wanting to use are no longer associated with Lubuntu (config files refer to LXQt for 18.10 & later; LXDE being *deprecated* as relied on *deprecated* libs). I'd remove the reference to Lubuntu as configs from repositories will have it refer to different apps than you're trying to use (did you confirm you've not added any Lubuntu config! thus avoiding any potential for clash).
guiverc avatar
cn flag
I forgot you mentioned Lubuntu 20.04 given the references later in your post that apply to LXDE... Your paste refers to non-Lubuntu programs & a non-Lubuntu desktop, so if you're trying to use Lubuntu & LXQt, correct the references that apply to *legacy* Lubuntu (up to 18.04 but not later).
sancho.s ReinstateMonicaCellio avatar
@guiverc - I was afraid something could have changed from 18.04 to 20.04. But other than tidying up the post (which I would do), 1) Would you say any of what I did led to the failure? Which parts? 2) What should I specifically do to further diagnose the problem, and solve it? Perhaps I missed it, but I didn't see any suggestion on this in your comments. For instance, I am not sure about following [this](https://www.linuxquestions.org/questions/linux-newbie-8/xrdp-sending-login-information-to-login-manager-failed-display-0-a-4175676157/#post6130133).
guiverc avatar
cn flag
I wasn't worried about your post (being untidy) sorry; it was the references to non-Lubuntu & LXDE that made me think you were using Ubuntu & had added LXDE. You mention `lxsession -e LXDE -s Lubuntu` in a file; but Lubuntu doesn't use `lxsession` or LXDE; it uses `lxqt-session` & LXQt & has for the last 7 releases (+ re-spins; ie. all since 18.10; as LXDE is *deprecated* with *devs* switching to Qt5 years ago). FYI: this maybe helpful; Lubuntu's bugs page has a table of legacy/LXDE vs modern/LXQt; see https://phab.lubuntu.me/w/bugs/
sancho.s ReinstateMonicaCellio avatar
@guiverc - I understood that, and I did not know it. But still, I am not seeing any suggestion that I do anything specific, did I miss that? My two specific questions aimed at understanding this. **PLUS**, please see updated info in the OP.
guiverc avatar
cn flag
There is no application `lxsession` included with Lubuntu; it's a LXDE app so your `.xsession` file can only produce errors as written on a *modern* Lubuntu system (unless you've added LXDE, `lxsession` etc to your system). I mentioned the Lubuntu equivalent app in my first comment (and you'll find it in the table in my last too). You mention two different DEsktops; use one or the other; ie. Lubuntu & LXQt or non-Lubuntu LXDE. Currently you've mentioned both & thus errors in logs are what I'd expect with what you pasted.
sancho.s ReinstateMonicaCellio avatar
@guiverc - Please see heavily edited OP. I have removed the added line in `~/.xsession` but the problem persists.
Ryan avatar
in flag
I'm having this problem now. Did you ever find the answer? Thanks.
sancho.s ReinstateMonicaCellio avatar
@Ryan - It is an old post, and I am not using that PC anymore, so I am not sure what I did about this.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.