Skip to content

Point six installer keymaps at ones systemd can map - #11056

Closed
BRashad wants to merge 2 commits into
omacom:quattrofrom
BRashad:fix-installer-keymap-xkb-mappings
Closed

BRashad wants to merge 2 commits into
omacom:quattrofrom
BRashad:fix-installer-keymap-xkb-mappings

Conversation

@BRashad

@BRashad BRashad commented Sep 9, 2026 •

Copy link
Copy Markdown

Fixes six of the nine installer keyboard layouts reported in #11004, and drops one duplicate row.

systemd-firstboot derives XKBLAYOUT from kbd-model-map. A console keymap with no row there leaves XKBLAYOUT unset, and default/hypr/input.lua line 31 — local kb_layout = vconsole.XKBLAYOUT or "us" — falls back to us. Nine of the 48 offered layouts have no such row, so those users get a US desktop layout whatever they picked.

Six of the nine have an equivalent keymap that is mapped, so the fix is data only:

Label was now resulting XKBLAYOUT
Bulgarian bg-cp1251 bg_bds-utf8 bg,us
Czech cz cz-lat2 cz
German (Switzerland) de_CH-latin1 sg-latin1 ch
Norwegian no-latin1 no no
Polish pl pl2 pl
Ukrainian ua ua-utf ua,us

Bulgarian and Ukrainian are the sharp end: those users landed on a US layout with no way to type Cyrillic at all. input.lua's non_latin_layouts guard exists for exactly that case but never fired, because XKBLAYOUT was empty. The mapped keymaps also bring grp:shifts_toggle and grp_led:scroll, so switching between the Cyrillic and Latin layouts works.

Credit to @aholbreich, who widened this from the two rows I originally reported to all nine and worked out which were fixable this way.

Evidence

On Omarchy, systemd 261, kbd 2.10.0. --root writes to a throwaway directory, so nothing on the host changes:

$ systemd-firstboot --root=$T --keymap=bg-cp1251 --force
$ cat $T/etc/vconsole.conf
KEYMAP=bg-cp1251
                                    <- no XKBLAYOUT

$ systemd-firstboot --root=$T3 --keymap=bg_bds-utf8 --force
$ cat $T3/etc/vconsole.conf
KEYMAP=bg_bds-utf8
XKBLAYOUT=bg,us
XKBMODEL=pc105
XKBOPTIONS=terminate:ctrl_alt_bksp,grp:shifts_toggle,grp_led:scroll

Running that over every row in OMARCHY_KEYBOARD_LAYOUTS takes the number with no XKBLAYOUT from nine to three, and every keymap in the list is one kbd actually ships.

One trap worth recording: cz-qwerty resolves to cz,us but kbd does not ship it, so it would pass a kbd-model-map check and fail at runtime. cz-lat2 is the safe pick.

What this does not fix

Colemak, Azerbaijani and Kyrgyz have no mapped equivalent — there is no keymap to point them at. They still need the fallback table proposed in #8685, which is complementary to this: that change derives XKB from KEYMAP at runtime and so also helps machines already installed with the current values, while this one stops new installs writing a bad value in the first place.

Azerbaijani is separately mislabelled — azerty is the French console keymap and kbd has no Azerbaijani one — which is the other half of #11004 and not addressed here.

Lao

Second commit, split so it can be dropped on its own. la-latin1 is the Latin American Spanish keymap and is already offered under that name three rows down, so picking Lao gave a Spanish keyboard. kbd ships no Lao keymap, so there is nothing to point the row at. xkeyboard-config does have a lo layout, so Lao could return if the list ever carries an explicit XKB field.

Testing

  • test/shell.d/setup-form-test.sh, keyboard-layout-test.sh and hyprland-keyboard-layout-test.sh pass
  • Full test/shell reports the same 38 pre-existing failures before and after this change — none introduced. Those are environment-dependent (missing package fixtures, no external access) and fail identically on a clean checkout.

Worth flagging: nothing in this repo's suite validates the layout rows themselves. setup-form-test.sh only asserts the first row is English (US)|us; the check that every keymap is known to localectl lives in omarchy-iso's test/unit/test_keyboard.py. So these six swaps are not covered by an automated test here, before or after. I verified them by hand as above and am happy to add coverage if you want it in this repo.

Not tested from a built ISO.

Fixes #9489

systemd-firstboot derives XKBLAYOUT from kbd-model-map, so a console
keymap with no row there leaves XKBLAYOUT unset and default/hypr/input.lua
falls back to "us". Nine of the offered layouts hit this; six of them have
an equivalent keymap that is mapped, so the fix is to point those rows at
it:

  Bulgarian            bg-cp1251     -> bg_bds-utf8   (bg,us)
  Czech                cz            -> cz-lat2       (cz)
  German (Switzerland) de_CH-latin1  -> sg-latin1     (ch)
  Norwegian            no-latin1     -> no            (no)
  Polish               pl            -> pl2           (pl)
  Ukrainian            ua            -> ua-utf        (ua,us)

Bulgarian and Ukrainian are the sharp end: those users landed on a US
layout with no way to type Cyrillic, and the non_latin_layouts guard in
input.lua could not help because XKBLAYOUT was empty. The mapped keymaps
also carry grp:shifts_toggle and grp_led:scroll, so switching between the
Cyrillic and Latin layouts works.

cz-qwerty also resolves to cz,us but kbd does not ship it, so it would
pass the model-map check and fail at runtime; cz-lat2 is the safe pick.

Colemak, Azerbaijani and Kyrgyz have no mapped equivalent and still need
the fallback table proposed in omacom#8685.

Verified on Omarchy with systemd 261 and kbd 2.10.0: running
systemd-firstboot --root over every row takes the count with no XKBLAYOUT
from nine to three, and every keymap in the list is one kbd ships.
la-latin1 is the Latin American Spanish console keymap, and it is already
offered under that name three rows further down. Picking Lao therefore
gave a Spanish keyboard, not a Lao one.

kbd ships no Lao keymap, so there is nothing to point the row at. Removing
it is the accurate option; xkeyboard-config does have a lo layout, so Lao
could return if the layout list ever carries an explicit XKB field.

Split from the preceding commit because it removes a language from the
picker rather than correcting one, and is easy to drop on its own.
@omarchybot

Copy link
Copy Markdown
Collaborator

Reviewed at 6a9d678. I read it and checked every swapped row against systemd 262's kbd-model-map and the kbd 2.10.0 keymap files. I did not run it on a worker, because another open pull request fixes the same rows and I compared the two first.

The diagnosis is right. All six replacements have a kbd-model-map row, so a new install would get an XKBLAYOUT and Bulgarian and Ukrainian users would be able to type Cyrillic. Removing Lao is correct on its own: la-latin1 is the Latin American Spanish keymap, and it is already offered under that name.

#11418 fixes the same gap at the source, for all nine keymaps rather than six. It writes XKBLAYOUT/XKBVARIANT for the keymaps systemd cannot map and adds a migration for machines already installed. It does this without changing which keymap a user gets. This pull request gets its mapping by changing keymaps, and two of those changes alter what a user types:

  • Czech, install/provisioning/setup-form.sh:41. cz-lat2 starts in a US-style layer, so the unshifted 2 key types 2. systemd pairs it with XKB cz(qwerty), where the same key types ě. The old cz console map typed ě there. A password typed at setup with number-row keys would then type differently at the lock screen and login. Repair KEYMAP-only vconsole.conf installs #11418 keeps cz and pairs it with cz(qwerty), which matches.
  • Bulgarian, install/provisioning/setup-form.sh:39. bg-cp1251 is the phonetic Bulgarian map (its own header says so), and bg_bds-utf8 is BDS, so users who pick "Bulgarian" move to a different Cyrillic layout. Repair KEYMAP-only vconsole.conf installs #11418 keeps phonetic.

Also, sg-latin1 maps to ch(de_nodeadkeys), so Swiss users lose dead keys on the desktop. And default/hypr/input.lua builds its own kb_options, so the grp:shifts_toggle this pull request's description mentions is not what Hyprland ends up using.

The second opinion (Codex Medium) compared #11056, #11418, #8685 and #12896 without being told my answer. It also recommended #11418. It found the Czech number-row mismatch, which I then confirmed in the keymap files, and it found that the two pull requests merge cleanly as text. It read #11418 from a locally cached diff because GitHub was unreachable from its sandbox. Its agreement on the overall choice is not guaranteed to be independent.

Choosing between competing fixes is the maintainer's decision, so this pull request waits on them. If #11418 lands, the Lao removal is still worth keeping, as a pull request of its own.

@dhh

dhh commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

Superseded by #20187 and omacom/omarchy-iso#528, which cover all 8 unmapped installer keymaps via a shared fallback XKB table in setup-form.sh. Thanks for digging into this!

@dhh dhh closed this Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Wrong language code for Norwegian keyboard layout

3 participants