Arch Linux

Please read this before reporting a bug:
https://wiki.archlinux.org/index.php/Reporting_Bug_Guidelines

Do NOT report bugs when a package is just outdated, or it is in Unsupported. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!
Tasklist

FS#58644 - [xorg-server] xorg.wrap broken in 1.20.0-2

Attached to Project: Arch Linux
Opened by Ernest Grothauzen (Lone_Wolf) - Friday, 18 May 2018, 00:29 GMT
Last edited by Laurent Carlier (lordheavy) - Saturday, 02 June 2018, 08:57 GMT
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To Jan de Groot (JGC)
Andreas Radke (AndyRTR)
Laurent Carlier (lordheavy)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 5
Private No

Details

Xorg 1.20.0-2

I need to run X with root rights on my main system and have configured /etc/X11/Xwrapper.config as described in wiki[1] .

In xorg-server 1.19.6+13+gd0d1a694f-2 this is taken care of by a wrapper script at /usr/bin/Xorg (attached) .

/usr/bin/Xorg In xorg-server 1.20.0-2 however is no longer a wrapper script.
Instead it's a binary that appears to be identical to the one at /usr/lib/xorg/Xorg .
This breaks the execution of X with root rights.


[1] https://wiki.archlinux.org/index.php/Xorg#Rootless_Xorg
   Xorg (0.3 KiB)
This task depends upon

Closed by  Laurent Carlier (lordheavy)
Saturday, 02 June 2018, 08:57 GMT
Reason for closing:  Fixed
Additional comments about closing:  xorg-server-1.20.0-5
Comment by Abdó Roig-Maranges (abdo) - Friday, 18 May 2018, 05:53 GMT
The wrapper script seems to have moved to /usr/lib/Xorg.wrap. However, it has no longer the suid bit set. This is a bug and should be reverted, as this is intended to be a suid wrapper.
Comment by Darek (blablo) - Friday, 18 May 2018, 06:56 GMT
Please try (changes in package_xorg-server())
- _install fakeinstall/usr/lib/Xorg{,.wrap}
+ _install fakeinstall/usr/lib/xorg-server
Edit:
FWIW "fakeinstall" installs these files in /usr/libexec/Xorg{,.wrap}
Edit2:
+ -Dlibexecdir=/usr/lib/xorg-server
Edit3:
If it works then we should install in '/usr/libexec' without setting -Dlibexecdir
Comment by Ernest Grothauzen (Lone_Wolf) - Friday, 18 May 2018, 15:16 GMT
arch-meson has --libexecdir /usr/lib \ .

When i try -D libexecdir=/usr/lib/xorg-server , meson complaints :
mesonbuild.mesonlib.MesonException: Argument "libexecdir" passed as both --libexecdir and -Dlibexecdir, but only one is allowed

Will try to adjust old wrapper script for new location .
Comment by Darek (blablo) - Friday, 18 May 2018, 15:37 GMT
> arch-meson has --libexecdir /usr/lib \ .
Ops, I do not use arch-meson (https://github.com/fafryd1125/PKGBUILDs)
Comment by Ernest Grothauzen (Lone_Wolf) - Friday, 18 May 2018, 16:02 GMT
I try to avoid arch-meson also, prefor setting things myself.

I have found a manual workaround though :

install xorg-server 1.20
replace /usr/bin/Xorg with the version from pre-1.20 xorg-server
edit /usr/bin/Xorg so basedir points to /usr/lib/
run chmod u+s /usr/lib/Xorg.wrap
Comment by Darek (blablo) - Friday, 18 May 2018, 16:09 GMT
'/usr/lib' should work if arch-meson has '-libexecdir /usr/lib' set.
> run chmod u+s /usr/lib/Xorg.wrap

Now it makes sense :)
Comment by Darek (blablo) - Friday, 18 May 2018, 17:08 GMT
man Xorg.wrap:
>The Xorg X server may need root rights to function properly. To start the Xorg X server with these rights your system is using a suid root wrapper installed as /usr/libexec/Xorg.wrap which will execute the real X server which is installed as /usr/libexec/Xorg.

@Ernest Grothauzen (Lone_Wolf)
Please, verify the default path
Comment by Ernest Grothauzen (Lone_Wolf) - Friday, 18 May 2018, 17:33 GMT
Both extra/xorg-server and the PKGBUILD from https://github.com/fafryd1125/PKGBUILDs fail to build with this message :
undefined reference to `glXGetProcAddressARB'

I noticed xorg-server pkgbuilds switched from autotools / make destdir to meson / fakeinstall , so changes between the PGBUILDs for 1.19 and 1.20 are rather big.
Maybe it would be easier to update the last 1.19 PKGBUILD to build 1.20 WITHOUT changing from autotools to meson .
Comment by Darek (blablo) - Friday, 18 May 2018, 17:55 GMT
> Maybe it would be easier to update the last 1.19 PKGBUILD to build 1.20 WITHOUT changing from autotools to meson .
https://github.com/fafryd1125/PKGBUILDs/blob/a5f4a9a9244937a59b137dcd38498314812773b2/xorg-server/PKGBUILD
It requires changes, but please try. Do not forget to change --libexecdir=/usr/lib/xorg-server \ :)
Comment by loqs (loqs) - Friday, 18 May 2018, 20:20 GMT
https://cgit.freedesktop.org/xorg/xserver/tree/hw/xfree86/meson.build?h=xorg-server-1.20.0#n150
changing the output to Xorg.sh and /usr/bin/Xorg.sh is produced as the ascii text file instead of the binary from the libexec dir.
Comment by loqs (loqs) - Friday, 18 May 2018, 22:53 GMT
@Lone_Wolf please try this patch if it fails please try building it with extra-x86_64-build
Comment by Ernest Grothauzen (Lone_Wolf) - Friday, 18 May 2018, 23:11 GMT
I figured out my build failure was due to the presence of mesa-git, reverted to stock mesa.

Building extra/xorg-server multiple times results in this :

After "meson configure build" xorg-server/src/build/hw/xfree86/Xorg is an ascii text file similar to /usr/bin/Xorg in pre-1.20 .
When ninja -C build has run, that Xorg file is a binary.
This matches what loqs found .

Next try will be using configure / make instead of meson / ninja .

Comment by Darek (blablo) - Saturday, 19 May 2018, 02:50 GMT
@Lone_Wolf Please try 0001-FS-58644.patch
Comment by Darek (blablo) - Saturday, 19 May 2018, 12:58 GMT
@Lone_Wolf @all Please try
Now it should work. I added the changed PKGBUILD from the repositories
   PKGBUILD (8.6 KiB)
Comment by loqs (loqs) - Saturday, 19 May 2018, 14:35 GMT
@blablo is this an accurate summary?
hw/xfree86/meson.build creates the 'Xorg' executable which the configure_file rule for 'Xorg.sh.in' also having output 'Xorg' skips its build and uses.
meson does not apply install_mode for executable targets so the suid is not set infact the meson.build does not even try to set it.
Comment by Darek (blablo) - Saturday, 19 May 2018, 14:46 GMT
Bug#1
'Xorg'[1] and 'Xorg'[2] are generated in the same build meson directory. One overwrites the other

Bug#2
>meson does not apply install_mode for executable targets so the suid is not set infact the meson.build does not even try to set it.

Yes

[1] https://cgit.freedesktop.org/xorg/xserver/tree/hw/xfree86/meson.build?h=xorg-server-1.20.0#n101
[2] https://cgit.freedesktop.org/xorg/xserver/tree/hw/xfree86/meson.build?h=xorg-server-1.20.0#n148
Comment by loqs (loqs) - Saturday, 19 May 2018, 23:38 GMT
@blablo are you going to report the issue upstream? I could not see a report at https://bugs.freedesktop.org/buglist.cgi?component=Server%2FGeneral&product=xorg
Comment by Darek (blablo) - Sunday, 20 May 2018, 07:44 GMT
@loqs No

https://bugs.archlinux.org/task/58644#comment169568
No feedback from users. So it is pointless to report this upstream
Comment by Darek (blablo) - Sunday, 20 May 2018, 12:43 GMT
Please try 0001-v2-FS-58644.patch
workaround-> https://github.com/mesonbuild/meson/issues/3328
Comment by Ernest Grothauzen (Lone_Wolf) - Sunday, 20 May 2018, 15:23 GMT
Had little time yesterday & today, so went directly to the v2 patch.

With that patch xorg.wrap works as intended afaict.
Used PKGBUILD attached to avoid confusion.

Blablo, you did most of the work on this.
Maybe you could report this in X bug tracker AND submit the patch to xorg-devel mailinglist ?

   PKGBUILD (8.6 KiB)
Comment by Darek (blablo) - Sunday, 20 May 2018, 16:12 GMT Comment by Laurent Carlier (lordheavy) - Monday, 21 May 2018, 17:44 GMT
@Darek

I've pushed xorg-server-1.20.0-4 with your patch.

Thanks!
Comment by Darek (blablo) - Thursday, 24 May 2018, 05:43 GMT
@Laurent
Please see https://bbs.archlinux.org/viewtopic.php?pid=1787318#p1787318

Edit:
Please consider switching to autotools, it looks like xserver (meson) has experimental status (WIP)
Comment by Aaron Muir Hamilton (microcode) - Wednesday, 30 May 2018, 17:44 GMT
I second the call to use autotools for the time being. The meson-based PKGBUILD (and possibly the xserver meson build system config) is broken in apparently four or five distinct ways (see my report, others). I don't think fiddling around with an experimental build system configuration on the main stable rolling release of xorg-server is appropriate, it is currently causing bugs that do not exist when building xserver 1.20 with autotools.
Comment by Darek (blablo) - Wednesday, 30 May 2018, 18:00 GMT
Xorg.wrap (autotools)
/usr/bin/install -c -m 755 Xorg.sh /build/xorg-server/src/fakeinstall/usr/bin/Xorg
chown root /build/xorg-server/src/fakeinstall/usr/lib/Xorg.wrap && chmod u+s /build/xorg-server/src/fakeinstall/usr/lib/Xorg.wrap
chown: changing ownership of '/build/xorg-server/src/fakeinstall/usr/lib/Xorg.wrap': Operation not permitted
make[6]: [Makefile:1158: install-exec-hook] Error 1 (ignored)

-rwxr-xr-x root/root 2453392 2018-05-23 22:41 usr/lib/Xorg
-rwxr-xr-x root/root 10152 2018-05-23 22:41 usr/lib/Xorg.wrap

Autotools also has a broken Xorg.warp :)
Edit:
https://src.fedoraproject.org/cgit/rpms/xorg-x11-server.git/tree/0001-Fedora-hack-Make-the-suid-root-wrapper-always-start-.patch
Comment by loqs (loqs) - Wednesday, 30 May 2018, 19:28 GMT
@blablo fedora has been using that patch for years including for 1.19.6 [1] where arch did not require an equivalent patch.
[1] https://src.fedoraproject.org/rpms/xorg-x11-server/blob/3a9dd861fd2a9b9f2e38d8b7d995e1f45f6b074e/f/0001-Fedora-hack-Make-the-suid-root-wrapper-always-start-.patch
Comment by Ernest Grothauzen (Lone_Wolf) - Friday, 01 June 2018, 00:27 GMT
I started with the most recent PKGBUILD that uses autotools, xorg-server 1.19.6+13+gd0d1a694f-2 .
Adjusted it to build the 1.20.0 tarball, tested the patches were no longer needed, removed some configure options that no longer exist etc.
Did my best to keep changes minimal and am now using it with success.

$ pacman -Qs xorg-server
local/xorg-server 1.20.0-5.2 (xorg)
Xorg X server
local/xorg-server-common 1.20.0-5.2 (xorg)
Xorg server common files
local/xorg-server-devel 1.20.0-5.2 (xorg)
Development files for the X.Org X server
$

/usr/bin/X , /usr/bin/Xorg , /usr/lib/xorg-server/Xorg & /usr/lib/xorg-server/Xorg.wrap are all as they should be.
PKGBUILD and other needed files are in the attached xorg-server-1.20.0-autotools.tar.bz2 .

Loading...