FS#77789 - [systemd] updating resets keyboard layout / udev reload
Attached to Project:
Arch Linux
Opened by Dawid Potocki (dawidpotocki) - Thursday, 09 March 2023, 09:46 GMT
Last edited by Christian Hesse (eworm) - Wednesday, 27 September 2023, 09:56 GMT
Opened by Dawid Potocki (dawidpotocki) - Thursday, 09 March 2023, 09:46 GMT
Last edited by Christian Hesse (eworm) - Wednesday, 27 September 2023, 09:56 GMT
|
Details
Description:
I set my keyboard layout using `setxkbmap`, keyboard remaps using `xcape` and disable my trackpad using `xinput` in xinitrc; it all gets reset after a systemd update. Got introduced by adding `/usr/bin/udevadm trigger` in this commit: https://github.com/archlinux/svntogit-packages/commit/cf15dcc297bcef0ce9f2b5566e542b84f75d08d3#diff-49b7f98d935f6214ecbc8d41675ef3f88695ae9962dc791fe8cf4401455d2da6R36 Steps to reproduce: 1. Update systemd 2. Cry while struggling to run the commands to fix your stuff |
This task depends upon
Closed by Christian Hesse (eworm)
Wednesday, 27 September 2023, 09:56 GMT
Reason for closing: Fixed
Additional comments about closing: systemd 254.4-3
Wednesday, 27 September 2023, 09:56 GMT
Reason for closing: Fixed
Additional comments about closing: systemd 254.4-3
And the trackpad thing could be a udev rule...
Before the change we made udev reload the rules, but they were not applied. Now they are. That was important as udev from systemd 253 now creates device files that did not exist before, but are important for boot preparation and boot loader installation.
> And the trackpad thing could be a udev rule...
It allows me to dump it in my dotfiles without having to modify system files.
Correction:
xcape still works
This hook runs not only when you update systemd but when anything that put files in /usr/lib/udev/rules.d/* updates.
https://github.com/archlinux/svntogit-packages/blob/packages/systemd/trunk/30-systemd-udev-reload.hook#L6
There are dozens of such packages. See https://bugs.archlinux.org/task/77815 for another example.
FS#77815After everz rebuild of the initramfs the kezboard lazout is reset back to US
# localectl
System Locale: LANG=de_DE.UTF-8
VC Keymap: de
X11 Layout: de
X11 Model: pc105
00-keyboard.conf
# Written by systemd-localed(8), read by systemd-localed and Xorg. It's
# probably wise not to edit this file manually. Use localectl(1) to
# instruct systemd-localed to update it.
Section "InputClass"
Identifier "system-keyboard"
MatchIsKeyboard "on"
Option "XkbLayout" "de"
Option "XkbModel" "pc105"
EndSection
Even 'loadkeys de-latin1' does not bring back german keyboard layout.
I|am not using .xinitrc to set locales!
@eworm do you have an example/commit ref where doing this is "necessary" for boot prep/bootloader config (... and by extension this will presumably only be relevant for systemd-boot?) It seems weird to me to trigger a logical reload of every single piece of HW just because something "might" have changed (... from presumably previously already working hardware). Leave that to - well - the actual boot or when the hardware actually changes due to being triggered/reconnected
https://github.com/systemd/systemd/commit/583dc6d933d8eb84f338c28cbe2f4c86ee1ff069
The symlink was used and thus required in a userland tool shipped by systemd... Would have to look up the details myself.
FS#78097...That last one might be some racyness that could be worked around with a bit of a sleep or so (or the --settle argument), though IMO the amount of potential side effects and breakage seems much higher than some userland tool crashing once for one specific systemd version/update/command.
Some more refs e.g. https://bbs.archlinux.org/viewtopic.php?id=284249 - this might be a plasma bug at the end of the day but could be avoided by not triggering udev reloads.
Due to all of the potential side effects I'm personally still voting for not doing the explicit trigger unconditionally anyway, but is technically something that can be up to debate. Ensuring the devices are ready for mkinitcpio to work isn't.
I think the '/usr/bin/udevadm trigger' should be backed out. Requiring one time reboot after systemd 252 -> 253 update is minor issue in comparison with constant problem with updates and each day passed makes it even less relevant.
I considered https://bugs.archlinux.org/task/77789 my personal go to for checking regarding this, but this really isn't just limited to session hangs or problems in mkinitcpio itself. While this has inadvertently uncovered that a bunch of people have old broken xorg evdev configs around that can get fixed by removing them, there are a bunch of other people where this leads to a variety of issues still. E.g.
https://bbs.archlinux.org/viewtopic.php?pid=2098380#p2098380
https://bbs.archlinux.org/viewtopic.php?id=285369
https://bbs.archlinux.org/viewtopic.php?id=285241
to name a few.
Any news on this? Symptoms gets quite annoying and the fix seems straightforward.
FS#79219(The issue is not systemd / udevd handling this wrong. This issue is device drivers not handling the CHANGE event properly. So if you are effected - please report upstream!)
However I do understand that the behavior is annoying for those being hit. On the other hand I - as expressed before - do not intend to revert the default behavior. How about an option to opt-out from reloading udev rules on updates? This is what I came up with:
https://gitlab.archlinux.org/archlinux/packaging/packages/systemd/-/commits/udev-rules/
It introduces a new configuration file (/etc/systemd/pacman.conf) that is read by the pacman / libalpm hook. Adding `UdevadmTriggerAndSettle = false` will make the hook skip the step reloading the rules.
Any comments? Concerns? Suggestions?
For clarity, it seems to be documented here [1]
[1] https://github.com/systemd/systemd-stable/blob/v254.4/NEWS#L4631-L4656
https://github.com/systemd/systemd-stable/blob/v247/NEWS#L89-L114
I'm one of those users that edited the service file and put it in noupgrade. The opt-out solution is an improvement over that method.
The best solution in my opinion though would be if pacman warned the user of the intrusive nature of the update and gave the option to abort it.
The upstream news had an issue, where the wrong option was mentioned for the command. Instead of `udevadm trigger -a change` this should have read `udevadm trigger -c change` to match the action. I have just fixed that:
https://github.com/systemd/systemd/commit/75271582bead7e65c20fa3ca4fb729a5c9e261d0
... and also put the correct and complete command into the hook:
https://gitlab.archlinux.org/archlinux/packaging/packages/systemd/-/commit/368be7309b1102481f8302f59cccb7022f2ec322
Wondering if that fixes it, at least for some of the cases. So please try without workaround first!
For sure there are still cases where this does cause issues, see the link from previous comment for details. So I added a workaround to opt-out from reloading udev rules. Use at your own risk!
https://gitlab.archlinux.org/archlinux/packaging/packages/systemd/-/commit/17aae5e870a770426ab303b6e4d38e97e8b3baff