FS#79391 - [systemd] ydotool uinput permission errors

Attached to Project: Arch Linux
Opened by Matthew Hague (shakedown1979) - Wednesday, 16 August 2023, 12:31 GMT
Last edited by Toolybird (Toolybird) - Friday, 08 September 2023, 21:03 GMT
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To Christian Hesse (eworm)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description: in the past week or so ydotool no longer appears to work using the userspace systemd service file when the user is in the input group. The issue is that /dev/uinput does not have g+rw access for the input group.

This is normally handled by a udev rule packaged with ydotool that chmods /dev/uinput when the uinput module is loaded. However, recently it looks like the uinput module is loaded lazily, causing a circular issue: ydotool cannot cause uinput to load because it does not have the right permissions on /dev/uinput, but the udev rule setting the permissions won't be fired until uinput is loaded.

There is a discussion about this issue on the ydotool GitHub page: https://github.com/ReimuNotMoe/ydotool/issues/210

* package version(s) -- 1:1.0.4.r0-g57ba7d0-1
* config and/or log files etc.

systemd[1306]: ydotool.service: Failed with result 'exit-code'.
systemd[1306]: ydotool.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
ydotoold[1387]: You're advised to run this program as root, or YMMV.
ydotoold[1387]: failed to open uinput device: Permission denied

* link to upstream bug report, if any

https://github.com/ReimuNotMoe/ydotool/issues/210

Steps to reproduce:

1. Add user to input group
2. systemctl --user enable ydotool
3. Reboot.
This task depends upon

Closed by  Toolybird (Toolybird)
Friday, 08 September 2023, 21:03 GMT
Reason for closing:  Fixed
Additional comments about closing:  systemd 254.2-1
Comment by Matthew Hague (shakedown1979) - Wednesday, 16 August 2023, 12:32 GMT
Apologies, the version is 1.0.4-1 -- i'd tried the -git version to see if the issue had been fixed upstream.
Comment by Toolybird (Toolybird) - Wednesday, 16 August 2023, 22:09 GMT
The cause is more than likely latest systemd (253 -> 254) upgrade. There were some other udev related bugs in 254 which have since been fixed by upstream. For example, see the "vfio" related bugs in this list [1]

Are you able to confirm by temporarily downgrading systemd? (NOTE: be careful, critical system component, have USB installation drive available for recovery, etc, etc)

[1] https://github.com/systemd/systemd/issues?q=is%3Aissue+label%3Audev+is%3Aclosed+sort%3Aupdated-desc
Comment by Matthew Hague (shakedown1979) - Thursday, 17 August 2023, 10:04 GMT
Thanks. Downgrading systemd to 253 seems to clear the issue.
Comment by loqs (loqs) - Tuesday, 22 August 2023, 18:38 GMT
Has the issue already been resolved in systemd's git tree and requires a backport or is the issue still present upstream? If it is still present upstream is their an issue for it open upstream? If there is no open issue have you considered bisecting [1] between systemd 253 and 254 to identify the causal commit and opening an issue upstream with your findings?

[1] https://wiki.archlinux.org/title/Bisecting_bugs_with_Git
Comment by Matthew Hague (shakedown1979) - Tuesday, 29 August 2023, 13:49 GMT
Didn't think of trying to compile systemd locally!

Looks like it's fixed in systemd-git 254.r66978.599a312484-1.
Comment by loqs (loqs) - Tuesday, 29 August 2023, 14:44 GMT
I suspect the issue is [1]. Please try building systemd with the attached diff.

[1] https://github.com/systemd/systemd/issues/28653
Comment by Matthew Hague (shakedown1979) - Tuesday, 29 August 2023, 17:19 GMT
Building the systemd (not -git) package with that PKGBUILD.diff seems also to work ok. Thanks.
Comment by loqs (loqs) - Thursday, 07 September 2023, 08:18 GMT
Please test if the issue is resolved in systemd 254.2-1 (currently in core-testing) which includes [1].

[1] https://github.com/systemd/systemd-stable/commit/4e639ca0f104e636458df5cce3f3e4df30f9a8b9
Comment by Matthew Hague (shakedown1979) - Friday, 08 September 2023, 15:11 GMT
Works for me.

Loading...