Arch Linux

Please read this before reporting a bug:
https://wiki.archlinux.org/title/Bug_reporting_guidelines

Do NOT report bugs when a package is just outdated, or it is in the AUR. 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#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 Toolybird (Toolybird) - Saturday, 11 March 2023, 20:59 GMT
Task Type Bug Report
Category Packages: Core
Status Assigned
Assigned To Christian Hesse (eworm)
Architecture All
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 6
Private No

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

Comment by Toolybird (Toolybird) - Thursday, 09 March 2023, 19:47 GMT
You don't reboot after updating systemd? There are some pkg updates where a reboot just seems naturally wise...kernel, glibc, systemd. The commit message doesn't explain the motivation for the change, but on face value it doesn't seem like much of a bug. Maybe you also need to "hook" your config changes somehow?
Comment by Christian Hesse (eworm) - Thursday, 09 March 2023, 20:20 GMT
Is there any reason you do not set the keyboard layout properly for the system, with `localectl`?
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.
Comment by Dawid Potocki (dawidpotocki) - Thursday, 09 March 2023, 20:54 GMT
> Is there any reason you do not set the keyboard layout properly for the system, with `localectl`?
> 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
Comment by Michel Koss (MichelKoss1) - Saturday, 11 March 2023, 20:36 GMT
> You don't reboot after updating systemd? There are some pkg updates where a reboot just seems naturally wise...kernel, glibc, systemd

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.
Comment by Toolybird (Toolybird) - Saturday, 11 March 2023, 20:58 GMT
Dupe  FS#77815 
Comment by Tarqi Kazan (Tarqi) - Thursday, 23 March 2023, 20:46 GMT
Same here, all settings (keymap,key delay/rate, touchpad, autorandr, ...) are applied in .xinitrc which is used on multiple systems, so no explicit system settings are necessary and the config is portable. If there is another *portable* way, please let me know. Otherwise the whole xinit configuration using 'xset', 'setxkbmap', 'xinput set-prop ...' and so on would be broken and obsolete and the configuration much more complicated.
Comment by Gerry Kessler (renegat) - Tuesday, 04 April 2023, 14:57 GMT
I set the locale settings with localectl / xorg.d conf files and experience the same issue:
After 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!
Comment by Tarqi Kazan (Tarqi) - Tuesday, 04 April 2023, 15:19 GMT
@renegat: loadkeys is used for console only, try 'setxkbmap de'.
Comment by David Roth (V1del) - Wednesday, 05 April 2023, 11:30 GMT
There are quite a few weird behaviours possible from this in my case I always lose/reload audio devices for a split second and I've had a complete session crash once from kwin_wayland not being able to access the DRM device anymore/broken monitor setup from device names switching around.

@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
Comment by Christian Hesse (eworm) - Wednesday, 05 April 2023, 12:02 GMT
IIRC this one required a rule reload (which we already did before), followed by a trigger:
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.
Comment by Christian Hesse (eworm) - Wednesday, 05 April 2023, 12:27 GMT
I guess the complete session crash was caused by  FS#78097 ...
Comment by David Roth (V1del) - Wednesday, 05 April 2023, 13:13 GMT
That was a one time thing/potentially freak accident so I'd also not consider investigating too much there and I'm also hoping that got fixed by that (... though from looking at the logs there were definitely some issues with the DRM device/amdgpu), but just from a logic perspective it seems weird to me to retrigger everything (... FWIW another one I definitely had just yesterday is the following mkinitcpio initramfs rebuild not finding a certain device node -- which could lead to failure to boot from the non-fallback initramfs)

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.
Comment by David Roth (V1del) - Thursday, 06 April 2023, 08:28 GMT
This definitely is also related to https://gitlab.archlinux.org/archlinux/mkinitcpio/mkinitcpio/-/issues/177 and this currently can actively break initramfs generation for people. If you want to keep the udevadm trigger, then please add --settle as an argument so that the devices are populated when mkinitcpio runs. There are a bunch of threads on the boards already where this actively breaks the boot for people.

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.

Loading...