Bug 265728 - net/xrdp broken after recent xf86 update
Summary: net/xrdp broken after recent xf86 update
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Koichiro Iwao
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-08-09 08:42 UTC by Jürgen Weber
Modified: 2022-12-26 01:41 UTC (History)
3 users (show)

See Also:
bugzilla: maintainer-feedback? (meta)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jürgen Weber 2022-08-09 08:42:23 UTC
Got xfree updates today, now xrdp is broken. Black screen after login.

xrdp log:

[20220809-10:33:07] [INFO ] lib_mod_connect: connecting via UNIX socket
[20220809-10:36:42] [INFO ] connection problem, giving up
[20220809-10:36:42] [INFO ] some problem
[20220809-10:36:42] [ERROR] xrdp_wm_log_msg: Error connecting to user session
[20220809-10:36:42] [INFO ] Error connecting to user session
[20220809-10:36:42] [ERROR] xrdp_sec_recv: xrdp_mcs_recv failed
[20220809-10:36:42] [ERROR] xrdp_rdp_recv: xrdp_sec_recv failed
[20220809-10:36:42] [ERROR] libxrdp_process_data: xrdp_rdp_recv failed
[20220809-10:36:42] [ERROR] xrdp_process_data_in: xrdp_process_loop failed

updates were:

        xf86-input-keyboard: 1.9.0_4 -> 1.9.0_5
        xf86-input-libinput: 1.2.0 -> 1.2.0_1
        xf86-input-mouse: 1.9.3_3 -> 1.9.3_4
        xf86-video-scfb: 0.0.7 -> 0.0.7_1
        xf86-video-vesa: 2.5.0 -> 2.5.0_1
        xorg-drivers: 7.7_6 -> 7.7_7
        xorg-vfbserver: 1.20.14,1 -> 21.1.4,1
Comment 1 Koichiro Iwao freebsd_committer freebsd_triage 2022-08-09 09:13:03 UTC
I think x11-drivers/xorgxrdp needs to be rebuilt after x11-servers/xorgxrdp update.
Comment 2 commit-hook freebsd_committer freebsd_triage 2022-08-09 09:24:30 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=e1d8cb6be51fdd656bbc51babb5b4ac0722334dd

commit e1d8cb6be51fdd656bbc51babb5b4ac0722334dd
Author:     Koichiro Iwao <meta@FreeBSD.org>
AuthorDate: 2022-08-09 09:16:57 +0000
Commit:     Koichiro Iwao <meta@FreeBSD.org>
CommitDate: 2022-08-09 09:23:14 +0000

    x11-drivers/xorgxrdp{,-devel}: force rebuild after xorg-server update

    PR:             265728
    Reported by:    Jürgen Weber <weberbug@gmx.de>

 x11-drivers/xorgxrdp-devel/Makefile | 3 ++-
 x11-drivers/xorgxrdp/Makefile       | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)
Comment 3 Benedikt Hochstrasser 2022-08-12 15:27:16 UTC
it's not (xorg)xrdp, or not alone. I had a box running xorg, openbox, and slim. Logged in to a working desktop, did a pkg upgrade, rebooted, and got a black and unresponsive screen (ctrl-alt-F2 etc did not work).
So it must be something with the xserver and/or one of the drivers (I had xf86-vesa). Disabling slim brought me to a shell login, and running X alone yielded

sudo X

X.Org X Server 1.21.1.4
X Protocol Version 11, Revision 0
Current Operating System: FreeBSD somehost.domain.org 13.1-RELEASE FreeBSD 13.1-RELEASE releng/13.1-n250148-fc952ac2212 GENERIC amd64
 
Current version of pixman: 0.40.0
	Before reporting problems, check http://wiki.x.org
	to make sure that you have the latest version.
Markers: (--) probed, (**) from config file, (==) default setting,
	(++) from command line, (!!) notice, (II) informational,
	(WW) warning, (EE) error, (NI) not implemented, (??) unknown.
(==) Log file: "/var/log/Xorg.0.log", Time: Fri Aug 12 17:15:01 2022
(==) Using config directory: "/usr/local/etc/X11/xorg.conf.d"
(==) Using system config directory "/usr/local/share/X11/xorg.conf.d"
failed to set mtrr: Device not configured
ld-elf.so.1: /usr/local/lib/xorg/modules/drivers/vesa_drv.so: Undefined symbol "xf86SlowBcopy"

from then on, the console is dead (so it's a good idea to play via ssh), and no X or Xorg tasks are running. It's as if it dies a very silent death.

So, in my opinion, it's not about xorgxrdp or xrdp, but the new incarnation of the X.Org X Server.

Best, Ben
Comment 4 Koichiro Iwao freebsd_committer freebsd_triage 2022-08-16 01:51:30 UTC
Raise a separate bug for vesa driver. xorgxrdp has been fixed.
Comment 5 Jürgen Weber 2022-08-16 07:16:37 UTC
Got xorgxrdp: 0.2.18_2 -> 0.2.18_3

Problem has changed somewhat. Blue Screen after login.

/usr/local/etc/xrdp/startwm.sh

exec xterm

No user startwm.sh

xrdp-sesman.log


[20220816-09:09:34] [INFO ] sesman_main_loop: sesman asked to terminate
[20220816-09:09:34] [INFO ] starting xrdp-sesman with pid 32741
[20220816-09:09:49] [INFO ] Socket 12: AF_INET6 connection received from ::1 port 31621
[20220816-09:09:49] [INFO ] Terminal Server Users group is disabled, allowing authentication
[20220816-09:09:49] [INFO ] ++ created session (access granted): username firefox, ip ::ffff:***:60166 - socket: 12
[20220816-09:09:49] [INFO ] starting Xorg session...
[20220816-09:09:49] [INFO ] Found X server running at /tmp/.xrdp/xrdp_chansrv_socket_10
[20220816-09:09:49] [INFO ] Starting session: session_pid 32748, display :11.0, width 1920, height 1080, bpp 24, client ip ::ffff:***:60166 - socket: 12, user name firefox
[20220816-09:09:49] [INFO ] [session start] (display 11): calling auth_start_session from pid 32748
[20220816-09:09:49] [ERROR] sesman_data_in: scp_process_msg failed
[20220816-09:09:49] [INFO ] PAM: Last login: Tue Aug 16 09:07:24 on :11
[20220816-09:09:49] [ERROR] sesman_main_loop: trans_check_wait_objs failed, removing trans
[20220816-09:09:49] [INFO ] Starting X server on display 11: Xorg :11 -auth .Xauthority -config xrdp/xorg.conf -noreset -nolisten tcp
[20220816-09:09:59] [WARN ] Timed out waiting for X server on display 11 to startup
[20220816-09:09:59] [INFO ] Session started successfully for user firefox on display 11
[20220816-09:09:59] [INFO ] Starting the xrdp channel server for display 11
[20220816-09:09:59] [INFO ] Session in progress on display 11, waiting until the window manager (pid 32750) exits to end the session
[20220816-09:09:59] [WARN ] Timed out waiting for X server on display 11 to startup
[20220816-09:09:59] [ERROR] There is no X server active on display 11
[20220816-09:09:59] [ERROR] A fatal error has occured attempting to start the window manager on display 11, aborting connection
[20220816-09:09:59] [WARN ] Window manager (pid 32750, display 11) exited quickly (0 secs). This could indicate a window manager config problem
[20220816-09:09:59] [INFO ] Calling auth_stop_session and auth_end from pid 32749
[20220816-09:09:59] [INFO ] Terminating X server (pid 32751) on display 11
[20220816-09:09:59] [INFO ] Terminating the xrdp channel server (pid 32754) on display 11
[20220816-09:09:59] [INFO ] X server on display 11 (pid 32751) returned exit code 1 and signal number 0
[20220816-09:09:59] [INFO ] xrdp channel server for display 11 (pid 32754) exit code 0 and signal number 0
[20220816-09:09:59] [INFO ] cleanup_sockets:
[20220816-09:09:59] [INFO ] Process 32748 has exited
[20220816-09:09:59] [INFO ] ++ terminated session:  username firefox, display :11.0, session_pid 32748, ip ::ffff:***:60166 - socket: 12
Comment 6 Jürgen Weber 2022-08-17 07:02:02 UTC
Repeated the exercise in a fresh new VirtualBox VM, 13.1, pkg latest.

Same outcome:

pkg install xorg xfce xrdp
dbus_enable="YES"
xrdp_enable="YES"
xrdp_sesman_enable="YES"

Login prompt appears, so X is working, then blank blue screen.
Comment 7 Jürgen Weber 2022-08-17 07:08:22 UTC
When I log in as root things are working fine.
Comment 8 Benedikt Hochstrasser 2022-08-17 11:47:19 UTC
(In reply to Jürgen Weber from comment #7)
Ha! That actually brought me to the solution:

I compared the xrdp-sesman logs for user and root logins, respectively.
For users, it stopped after the line

[INFO ] Starting X server on display 10: (...)

Trying to start Xorg as a user from the ssh session resulted in

/usr/local/libexec/Xorg.wrap: Only console users are allowed to run the X server

A bit more digging brought the hint to add "allowed_users = anybody" to (the non-existent) /usr/local/etc/X11/Xwrapper.config file. I created that file containing that sole line, logged in as user and ...
...drumroll...
it works!

So the solution, in one line:

echo "allowed_users = anybody" | sudo tee -a /usr/local/etc/X11/Xwrapper.config

Cheers, Ben
Comment 9 Simon B 2022-08-17 13:46:23 UTC
After hitting this issue and spending all week trying to track it down, pleased to say it's already been reported and fixed.

Independently, I've fixed the issue by changing sesman.ini with the following:

[Xorg]
; Specify the path of non-suid Xorg executable. It might differ depending
; .....
;
; param=Xorg
; ^commented and full path specified below
param=/usr/local/libexec/Xorg
Comment 10 Jürgen Weber 2022-08-17 14:28:12 UTC
Simon, I also stumbled over param=/usr/local/libexec/Xorg
but this didn't work for me.
(https://github.com/neutrinolabs/xrdp/issues/2224)

But Ben's fix is working for me.

What's the orginal cause that broke xrdp? the allowed_users thing looks like a work-around.

Anyway, xrdp should go in the X port maintainers' after-update-test list.

Thanks to all!
Comment 11 Benedikt Hochstrasser 2022-08-17 17:45:49 UTC
(In reply to Jürgen Weber from comment #10)

I *think* that the recent Xorg update brought a new wrapper (or one behaving differently); if you check /usr/local/bin/Xorg, it says

#!/bin/sh
#
# Execute Xorg.wrap if it exists otherwise execute Xorg directly.
# This allows distros to put the suid wrapper in a separate package.

basedir="/usr/local/libexec"
if [ -x "$basedir"/Xorg.wrap ]; then
	exec "$basedir"/Xorg.wrap "$@"
else
	exec "$basedir"/Xorg "$@"
fi

admittedly, I was too lazy to check the old Xorg package if that was one of the changes.

I did check with the sesman.ini modifications, and they work for me too, and the logs say it now starts "/usr/local/libexec/Xorg" rather than just "Xorg".

(Of course you need to restart the xrdp-sesman service, while the Xwrapper.config thing works without restarting anything)
Comment 12 commit-hook freebsd_committer freebsd_triage 2022-08-25 04:10:52 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=bca32457500385841ff944021eb4259bd265383e

commit bca32457500385841ff944021eb4259bd265383e
Author:     Koichiro Iwao <meta@FreeBSD.org>
AuthorDate: 2022-08-25 04:05:51 +0000
Commit:     Koichiro Iwao <meta@FreeBSD.org>
CommitDate: 2022-08-25 04:09:43 +0000

    UPDATING: add entry for net/xrdp after xorg upgrade

    PR:             265728

 UPDATING | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)
Comment 13 Koichiro Iwao freebsd_committer freebsd_triage 2022-08-25 04:14:18 UTC
Added recommended solution by xrdp developer to UPDATING.
But either method is fine.
Comment 14 mr44er 2022-12-25 16:10:46 UTC
After reading through and following this, I think it has changed again (haven't used xrdp in a long time unfortunately, so fresh install here without compare), because I needed to set param=/usr/local/libexec/Xorg.wrap in sesman.ini and the allowed users-setting like Benedikt suggested in comment #8

Running only one of the two changes via commandline results in both cases:
(EE) xf86OpenConsole: Server must be suid root(EE)

Complete restart of the machine was between every test.

For now it works, but I don't know if the wrapper was intended to use that way.

Same solution works also on DragonflyBSD:
https://github.com/neutrinolabs/xrdp/issues/2477
Comment 15 Koichiro Iwao freebsd_committer freebsd_triage 2022-12-26 01:06:28 UTC
(In reply to mr44er from comment #14)

> because I needed to set param=/usr/local/libexec/Xorg.wrap in sesman.ini and the allowed users-setting like Benedikt suggested

You don't need to do that. It will actually work but I finally recomended param=/usr/local/libexec/Xorg. Didn't it work for you? See also sesman.ini.sample.

Of course, the way that Benedikt suggested will work but I updated /usr/ports/UPDATING to use /usr/local/libexex/Xorg as final xrdp developer and maintainer's decision because it requires only one change. Using Xorg.wrap two changes and changing Xorg.wrapper affects system-wide. To keep it simple and make impact minimum, I decided to use /usr/local/libexec/Xorg.

Please see UPDATING first of all. Discussions on Bugzilla are intermediate output but instructions in UPDATING is final summary.
Comment 16 Koichiro Iwao freebsd_committer freebsd_triage 2022-12-26 01:11:44 UTC
Ah, I have just read the GitHub issue that you commented. That's very interesting case.

Sorry for the confusion in my comment #15. Just ignore it.
Comment 17 mr44er 2022-12-26 01:24:45 UTC
No prob :)
Yes, I first checked my fresh sesman.ini and was happy that it was already fixed and double-checked that the path is right, just to be sure. Then it did not work, console threw error of :10 not starting etc.

Found the thread on github and starting digging through the comments here and there.

I think the wrapper does not work as it was initially intended, but I don't have deeper knowledge to this.
Comment 18 Koichiro Iwao freebsd_committer freebsd_triage 2022-12-26 01:41:29 UTC
(In reply to mr44er from comment #17)

Your case might be an edge case that not using Xorg.wrap. Anyway, I could notice that suggested configuration is not working for a few people. Thank you for your report.

I'll trace this issue in xrdp upstream GitHub. I'll also try fresh DragonFlyBSD installation.