Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request for localectl to write the X11 keymap to /etc/vconsole.conf #24228

Closed
n3rdopolis opened this issue Aug 7, 2022 · 13 comments · Fixed by #25805
Closed

Request for localectl to write the X11 keymap to /etc/vconsole.conf #24228

n3rdopolis opened this issue Aug 7, 2022 · 13 comments · Fixed by #25805
Labels
locale RFE 🎁 Request for Enhancement, i.e. a feature request

Comments

@n3rdopolis
Copy link
Contributor

Component

other

Is your feature request related to a problem? Please describe

I hope I am describing this issue correctly, this came up on a draft merge request for Plymouth to make it so it doesn't rely on the kernel mode console for input, but evdev instead.

localectl writes the keymaps to the kernel console in /etc/vconsole.conf, but writes the value for the X11 keymaps in an X11 file, and it seems like it's smart enough to translate the keymap names, As I understand X11 (or user mode) keymap names are not one-to-one with the console keymap names

User mode processes that are not X11, and can't understand X11 config files easily might want a single place to refer to the default configured keymap that libxkbcommon understands.

Having the value saved in /etc/vconsole.conf by localectl might be good because the file is already known, maybe as an additional key like XKB_KEYMAP

Describe the solution you'd like

It might be hard since now the value will be in two places since one would have to win, (like if someone manually edits the value on vconsole.conf, and not the X11 file, and now the current default one has to be read) but writing the XKB keymap as a key such as XKB_KEYMAP=foo to vconsole.conf would allow things that are not Xorg, such as some Wayland servers, or Plymouth. (OK mostly Plymouth)

Plymouth on distros that use dracut already have /etc/vconsole.conf in their initrd, so amending this file might be the best bet for it

Describe alternatives you've considered

No response

The systemd version you checked that didn't have the feature you are asking for

No response

@n3rdopolis n3rdopolis added the RFE 🎁 Request for Enhancement, i.e. a feature request label Aug 7, 2022
@yuwata yuwata added the locale label Aug 7, 2022
@marcosfrm
Copy link
Contributor

Fedora unified kernel console keymaps with XKB long time ago:
https://bugzilla.redhat.com/show_bug.cgi?id=837292
https://src.fedoraproject.org/rpms/kbd/blob/rawhide/f/kbd.spec

@poettering
Copy link
Member

makes sense. by all means, send a patch adding this.

@jwrdegoede
Copy link
Contributor

jwrdegoede commented Aug 8, 2022

Fedora unified kernel console keymaps with XKB long time ago: https://bugzilla.redhat.com/show_bug.cgi?id=837292 https://src.fedoraproject.org/rpms/kbd/blob/rawhide/f/kbd.spec

Right, Fedora generates console keymaps from xkb keymaps. But what we want to know for the plymouth changes being worked on is which xkb keymap + variant was used to generate the console keymap. Which AFAICT is currently not available anywhere.

ATM plymouth is using the console keymap since it is using the tty to get keyboard input for unlocking disks encrypted with a password. There are plans: https://gitlab.freedesktop.org/plymouth/plymouth/-/issues/172
to make plymouth use /dev/input/event* directly itself instead of going to the tty.

These plans involve using libxkbcommon to deal with the keymap. The problem is that there is no standard way to get the XKB keymap as set by localectl set-x11-keymap the converted/simplified console keymap is stored in /etc/vconsole.conf but going back to the XKB keymap from there (through /usr/share/systemd/kbd-model-map) is somewhat lossy.

Currently the full LAYOUT [MODEL [VARIANT [OPTIONS]]] info passed to localectl set-x11-keymap is not stored by localectl in either vconsole.conf or locale.conf instead it is only written to /etc/X11/xorg.conf.d/00-keyboard.conf in a hard to parse Xorg specific config format; and I guess also in some place for gdm...

So this RFE is about storing the full LAYOUT [MODEL [VARIANT [OPTIONS]]] info passed to localectl set-x11-keymap in some standard key=value style config file where it is easy for other software to read it.

@jwrdegoede
Copy link
Contributor

makes sense. by all means, send a patch adding this.

Thanks, any suggestions for the format? Since we need to store multiple values when also taking the model / variant and options into account I guess we should probably use multiple key-value pairs for this ?

So instead of adding a KXB_KEYMAP to /etc/vconsole.conf at XKB_LAYOUT XKB_MODEL XKB_VARIANT and XKB_OPTIONS key-value pairs; and then not write the ones not specified by the user to vconsole.conf ?

Also XKB_OPTIONS value needs to be a set of whitespace seperated options I think as I believe there can be more then one option.

@jwrdegoede
Copy link
Contributor

and then not write the ones not specified by the user to vconsole.conf ?

To be clear what I'm trying to say here is if e.g. the user has only specified a layout then only write XKB_LAYOUT to /etc/vconsole.conf and leave the other ones unset (rather then writing them with an empty value).

@poettering
Copy link
Member

Thanks, any suggestions for the format? Since we need to store multiple values when also taking the model / variant and options into account I guess we should probably use multiple key-value pairs for this ?

So instead of adding a KXB_KEYMAP to /etc/vconsole.conf at XKB_LAYOUT XKB_MODEL XKB_VARIANT and XKB_OPTIONS key-value pairs; and then not write the ones not specified by the user to vconsole.conf ?

yeah

@poettering
Copy link
Member

Also XKB_OPTIONS value needs to be a set of whitespace seperated options I think as I believe there can be more then one option.

yeah, if that's how it is it is how it is

@poettering
Copy link
Member

To be clear what I'm trying to say here is if e.g. the user has only specified a layout then only write XKB_LAYOUT to /etc/vconsole.conf and leave the other ones unset (rather then writing them with an empty value).

yeah, makes sense

@Diegovsky
Copy link

Diegovsky commented Aug 8, 2022

So instead of adding a XKB_KEYMAP to /etc/vconsole.conf at XKB_LAYOUT XKB_MODEL XKB_VARIANT and XKB_OPTIONS key-value pairs; and then not write the ones not specified by the user to vconsole.conf ?

Also XKB_OPTIONS value needs to be a set of whitespace seperated options I think as I believe there can be more then one option.

I like this. Makes more sense than what I proposed initially, however I think using commas for XKB_OPTIONS would be better since it's the format used by lixkbcommon

@n3rdopolis
Copy link
Contributor Author

I also like the commas better than spaces, I think that might make it easier for folks that might be sourceing the file for whatever reason too...

@legionus
Copy link

Fedora unified kernel console keymaps with XKB long time ago: https://bugzilla.redhat.com/show_bug.cgi?id=837292 https://src.fedoraproject.org/rpms/kbd/blob/rawhide/f/kbd.spec

FYI I am planning to add xkb support[1] to kbd[2]. If this is done, then xkb keymaps can be used in the linux console with some reservations. I wanted to complete support in the spring, but unfortunately xkbcommon still lacks the necessary APIs.

[1] legionus/kbd#72
[2] https://github.com/legionus/kbd/tree/xkbcommon

@Diegovsky
Copy link

I am willing to open a new PR to implement this feature asap

@poettering
Copy link
Member

See → #26182, which renames the variables.

bluca added a commit to bluca/systemd that referenced this issue Jan 24, 2023
Debian/Ubuntu use almost the same variables, but without '_'. Given
our usage is new, rename them so that they match and downstream tech
debt can be removed.

Follow-up for systemd#25805

See:
 systemd#24228
 systemd#25412
keszybz pushed a commit that referenced this issue Jan 24, 2023
Debian/Ubuntu use almost the same variables, but without '_'. Given
our usage is new, rename them so that they match and downstream tech
debt can be removed.

Follow-up for #25805

See:
 #24228
 #25412
d-hatayama pushed a commit to d-hatayama/systemd that referenced this issue Feb 15, 2023
d-hatayama pushed a commit to d-hatayama/systemd that referenced this issue Feb 15, 2023
Debian/Ubuntu use almost the same variables, but without '_'. Given
our usage is new, rename them so that they match and downstream tech
debt can be removed.

Follow-up for systemd#25805

See:
 systemd#24228
 systemd#25412
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
locale RFE 🎁 Request for Enhancement, i.e. a feature request
7 participants