Bug 2189200 - Setting X11 keyboard overrides console keyboard settings
Summary: Setting X11 keyboard overrides console keyboard settings
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: systemd
Version: 38
Hardware: All
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: systemd-maint
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-04-24 12:17 UTC by Renaud Métrich
Modified: 2023-07-17 13:18 UTC (History)
9 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2023-07-17 13:18:59 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Renaud Métrich 2023-04-24 12:17:47 UTC
I have a laptop with builtin US keyboard, and an external USB keyboard in FR layout used when docked.
When booting, because my disk is encrypted, I need to enter the passphrase for LUKS.

Because the keyboard I'll use depends on whether I'm docked or not, I need to be able to switch layout.
For this to happen, I use the `localectl set-keymap us fr` command then rebuilt the initramfs (this changes `/etc/vconsole.conf`).
But actually I wasn't able to test if that works yet.

Still, it appears that if I set the X11 keyboard similarly, this overrides the console layout:
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
# localectl set-keymap us fr

# cat /etc/vconsole.conf 
KEYMAP=us
FONT=eurlatgr
XKBLAYOUT=us
KEYMAP_TOGGLE=fr
XKBMODEL=pc105+inet
XKBOPTIONS=terminate:ctrl_alt_bksp
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

Here above, XKBLAYOUT is now "us" only.

-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
# localectl set-x11-keymap us,fr

# cat /etc/vconsole.conf 
KEYMAP=us
FONT=eurlatgr
XKBLAYOUT=us,fr
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

Here above, XKBLAYOUT is now "us,fr" but console's KEYMAP_TOGGLE vanished.

The only way I found to avoid overriding the settings is to first use "set-x11-keymap" then "set-keymap --no-convert":

-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
# localectl set-x11-keymap us,fr
--> breaks console keyboard

# localectl set-keymap us fr --no-convert 
--> sets back console keyboard without modifying X11 keyboard
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

IMHO neither "set-keymap" nor "set-x11-keymap" should modify the other's console settings.

Reproducible: Always

Steps to Reproduce:
Setup a system with 2 keyboards

Comment 1 David Tardon 2023-05-17 14:30:51 UTC
(In reply to Renaud Métrich from comment #0)
> IMHO neither "set-keymap" nor "set-x11-keymap" should modify the other's
> console settings.

No, that's intentional and documented behavior. We want the settings to be in sync.

Comment 2 Zbigniew Jędrzejewski-Szmek 2023-07-17 13:18:59 UTC
Yeah, keeping both in sync is the expected behaviour. If you need something
different, it's OK to write some special configuration, but the automation
provided by localed works like it does, and we want to keep it this way. It's
the right thing for 99% of users.


Note You need to log in before you can comment on or make changes to this bug.