[systemd-devel] Make systemd-localed modify the kernel commandline for the initrd keymap?

Javier Martinez Canillas javierm at redhat.com
Wed Sep 25 16:01:51 UTC 2019


Hello Hans,

On 9/25/19 4:50 PM, Hans de Goede wrote:
> Hi all,
> 
> Currently, at least in Fedora, but I do not believe that this problem is
> unique to Fedora, there are 2 problems with keymap handling in the initrd.
> 
> 1: If the keymap in vconsole.conf is changed then this does not apply to the
> initrd without rebuilding it. This means that any changes are only applied
> after installing a new kernel
> This has been reported a long time ago
>   https://bugzilla.redhat.com/show_bug.cgi?id=1405539
> and is also listed on the list of Fedora high prio bugs:
>   https://fedoraproject.org/wiki/Fedora_Program_Management/Prioritized_bugs_and_issues
> 
> 2: With silverblue, which ships with a generic pre-generated initrd we end up
> with always using the keymap as defined when building the initrd on the
> buildsys (KEYMAP=us), also see:
>   https://github.com/fedora-silverblue/issue-tracker/issues/3
> 
> Now arguably 1. could be fixed by regenerating the initrd, but that is tricky,
> because if some component has changed on the system since the last time the
> initrd was generated this will change more then just the embedded vconsole.conf
> possibly stopping the system from booting (this should never happen, but
> in reality this is a real risk).
> 
> Also do we want localed to trigger initrd rebuilds? And if we do not want
> that, then should tools calling the localed DBUS API do this?
> If all the tools need to do that then it seems to me that the API is
> incomplete / not fully functional, so that seems undesirable.
> 
> And for 2. we really do not want to rebuild the initrd ever, and for the
> "normal" distro case at least for Fedora we also want to move to
> pre-generated initrds so that we can sign them, etc.
> 
> TL;DR: IMHO regenerating the initrd is not the answer here.
> 
> I believe that the best alternative is to have localed append / update
> a rd.vconsole.keymap=foo argument to the kernel commandline, to override
> the vconsole.conf KEYMAP setting, but only in the initrd (so that later
> runtime changes when booted still work).
> 
> The way I see this working is that localed does a read-modify-write of
> all the BLS .conf files under /boot/loader/entries and updates their
> "options" line to have rd.vconsole.keymap=foo appended or updated if
> already present.
>

And probably you will need to add the same for all the vconsole.* options.
 > I'm willing to write localed patches implementing this (targetting Fedora 32)
> but before I spend time on this, it would be good to have consensus that
> this is the best way to handle this. Note I'm open to other suggestions.
>

Another approach could be to make localed generate an initrd that contains
an /etc/vconsole.conf, and overlay this to the main initrd. That way
changing the keymap won't require updating the kernel commandline for all
the boot entries.

The disadvantage would be that passing multiple initrds isn't supported by
neither petitboot nor zipl. But I guess this is less of an issue for s390x
and ppc64le, so in those architectures localed can be started without the
option that tells to generate an overlay initrd when changing the keymap.

> Regards,
> 
> Hans
> 

Best regards,
-- 
Javier Martinez Canillas
Software Engineer - Desktop Hardware Enablement
Red Hat


More information about the systemd-devel mailing list