FS#79287 - [systemd] systemd-vconsole hook should fallback to adding default keymap "us"
Attached to Project:
Arch Linux
Opened by Tim Ruffing (realorrandom) - Thursday, 03 August 2023, 09:49 GMT
Last edited by Buggy McBugFace (bugbot) - Saturday, 25 November 2023, 20:15 GMT
Opened by Tim Ruffing (realorrandom) - Thursday, 03 August 2023, 09:49 GMT
Last edited by Buggy McBugFace (bugbot) - Saturday, 25 November 2023, 20:15 GMT
|
Details
Description:
systemd 254 introduced a default vconsole keymap that it sets when no KEYMAP is set in /etc/vconsole.conf, see https://github.com/systemd/systemd/commit/f129d0e77c4c9a0e12ae38cd241cd49846844a80. The default keymap is configurable at build time, the build config defaults to "us". But the systemd-vconsole hook does not add any keymap to the initrd if no KEYMAP is set in /etc/vconsole.conf. This leads to errors in systemd-vconsole-setup.service in early userspace. "journalctl --boot --unit systemd-vconsole-setup.service": [...] Aug 03 10:13:37 systemd-vconsole-setup[355]: loadkeys: Unable to open file: us: No such file or directory Aug 03 10:13:37 systemd-vconsole-setup[345]: /usr/bin/loadkeys failed with exit status 1. [...] (There are more warnings and errors, see attached log file, but I think they are separate issues, and some of them already existed before this issue appeared.) On my system, this leads to multiple error messages "[FAIL] Failed to start Virtual Console Setup." (corresponding to multiple ttys) that appear even when "quiet" is set. Anyway, I believe the proper fix is to build systemd with -D default-keymap="" (see https://github.com/systemd/systemd/pull/28505). Then systemd-vconsole-setup will not try to set anything, i.e., we keep the kernel keymap (which is what we always did, and which is the only fix that gives the user the possibility to stick to the kernel keymap). (I think "" should be the upstream build default, I'll comment in https://github.com/systemd/systemd/pull/28505). Additional info: * mkinitcpio 36-1 * systemd 254-1 Steps to reproduce: - have a /etc/vconsole.conf without KEYMAP (e.g., the default file /usr/share/factory/etc/vconsole.conf as shipped with systemd) - run "mkinitcpio -P" - "lsinitcpio <path> | grep keymaps" is empty Workaround: - set KEYMAP=us in /etc/vconsole.conf (which is the build-time-default default keymap https://github.com/systemd/systemd/blob/e3b7fe92e90fd107ea9be30112e00e227ca18501/meson_options.txt#L315, which is used by systemd if no KEYMAP is set explicitly https://github.com/systemd/systemd/blob/f129d0e77c4c9a0e12ae38cd241cd49846844a80/src/vconsole/vconsole-setup.c#L474 ) - run "mkinitcpio -P" - "lsinitcpio <path> | grep keymaps" has "usr/share/kbd/keymaps/i386/qwerty/us.map" (among others) |
This task depends upon
Closed by Buggy McBugFace (bugbot)
Saturday, 25 November 2023, 20:15 GMT
Reason for closing: Moved
Additional comments about closing: https://gitlab.archlinux.org/archlinux/p ackaging/packages/systemd/issues/9
Saturday, 25 November 2023, 20:15 GMT
Reason for closing: Moved
Additional comments about closing: https://gitlab.archlinux.org/archlinux/p ackaging/packages/systemd/issues/9
[1] https://gitlab.archlinux.org/archlinux/mkinitcpio/mkinitcpio/-/merge_requests/251
This issue affects the "sd-vconsole" hook which is typically included when opting for a systemd based initrd. But IIUC, it only affects those systems with an empty or non-existent /etc/vconsole.conf
The mkinitcpio situation should be improved by the aforementioned MR.
We will get the upstream systemd "fixlet" in the next stable bump. But I'm still unclear if our systemd PKGBUILD needs tweaking.
FS#79296here.I don't think so. The problem will disappear after the mkinitcpio MR. Now that systemd has decided that they really want the "us" default [2], we shouldn't deviate it from it unless there is a good reason. In particular, "man vconsole.conf" says that KEYMAP= defaults to "us" if not set. So if we reconfigure this at build time, the man page will be wrong.
[1] https://github.com/systemd/systemd/pull/28505#issuecomment-1664056741
Not actually. man/vconsole.conf also shows the build-time default: https://github.com/systemd/systemd/blob/804c6397bc39a95968366c031082e96e94ef218c/man/vconsole.conf.xml#L78
My set of hooks is: HOOKS=(base systemd autodetect plymouth hostdata modconf block keyboard sd-encrypt filesystems)
My /etc/vconsole.conf contains only comments. I don't need systemd to set fonts in my console, and I want to spare a tiny bit of space in my initramfs, therefore I don't have vconsole.conf configured nor the sd-vconsole hook.
This change https://gitlab.archlinux.org/archlinux/packaging/packages/systemd/-/commit/4ae88c260a0aeec89956063ccfb887a416f40f52 started installing systemd-vconsole-setup.service as part of the systemd hook, however all the relevant files (such as /usr/lib/systemd/systemd-vconsole-setup, /usr/bin/loadkeys and /usr/bin/setfont) are still added by sd-vconsole. When the systemd hook is used without sd-vconsole, it leads to a failure to load systemd-vconsole-setup.service with the following message in the journal and a brief error message in the terminal:
systemd[1]: systemd-vconsole-setup.service: Main process exited, code=exited, status=1/FAILURE
systemd[1]: systemd-vconsole-setup.service: Failed with result 'exit-code'.
systemd[1]: Failed to start Virtual Console Setup.
systemd-vconsole-setup[131]: /usr/bin/loadkeys failed with exit status 1.
I believe the fix is as simple as reverting that part of the change that added systemd-vconsole-setup.service to the systemd hook and adding it to sd-vconsole instead. It works for my use case, removing the error message on boot and in the journal, and it shouldn't change anything for those who use sd-vconsole, as systemd-vconsole-setup.service will be installed by that hook.
In other words:
--- /usr/lib/initcpio/install/systemd
+++ /usr/lib/initcpio/install/systemd
@@ -116,7 +116,6 @@
systemd-udevd-kernel.socket \
systemd-udevd.service \
systemd-udev-trigger.service \
- systemd-vconsole-setup.service \
timers.target \
rescue.target \
emergency.target
--- /usr/lib/initcpio/install/sd-vconsole
+++ /usr/lib/initcpio/install/sd-vconsole
@@ -6,6 +6,7 @@
# shellcheck disable=SC2034
local KEYMAP KEYMAP_TOGGLE FONT FONT_MAP FONT_UNIMAP XKBLAYOUT XKBMODEL XKBVARIANT XKBOPTIONS
+ add_systemd_unit systemd-vconsole-setup.service
add_binary /usr/lib/systemd/systemd-vconsole-setup
add_binary loadkeys
add_binary setfont
Unfortunately, I can't register at https://gitlab.archlinux.org/ (as suggested by Toolybird) and submit a pull request. I can't create a regular account, and even after signing with GitHub SSO it asks me to enter a login and password. Can someone assist with creating an account for me, and I'll submit those oneliners?