Skip to content

Repair KEYMAP-only vconsole.conf installs - #11418

Open
IridescentRose wants to merge 6 commits into
omacom:quattrofrom
IridescentRose:nbourgeois/fix-install-keyboard-variables
Open

IridescentRose wants to merge 6 commits into
omacom:quattrofrom
IridescentRose:nbourgeois/fix-install-keyboard-variables

Conversation

@IridescentRose

@IridescentRose IridescentRose commented Sep 12, 2026 •

Copy link
Copy Markdown

Closes #9442

Machines set up before first-boot setup filled in the XKB variables still have a vconsole.conf with only KEYMAP for the keymaps systemd's kbd-model-map lacks (Polish, Czech, Ukrainian, Colemak, ...). The session and the SDDM greeter then resolve us, so a password typed under the chosen layout can't be reproduced at login. New installs are already covered by keyboard_xkb_settings in apply_keyboard

This pull request now only contains migration paths since upstream was fixed.

@johnpippett johnpippett left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested commit 5585559b20f72f181c892e0fd81f97abe62c0012 with temporary keyboard configuration files. Two new write paths gave incorrect results.

  1. In bin/omarchy-provision-owner, lines 618–657, a selected keymap without a variant leaves an old XKBVARIANT in the file. With KEYMAP=pl and XKBVARIANT=dvorak, the new path adds XKBLAYOUT=pl but keeps XKBVARIANT=dvorak. The migration has the same result. Please clear an old variant when the new keymap has no variant.

  2. In migrations/1789183087.sh, lines 19–38, the assignment check does not accept leading spaces. With KEYMAP=de and XKBLAYOUT=fr, the migration adds a second XKBLAYOUT=de line. The shared Lua parser accepts the first line, then reads the second value. Please use the same assignment rules for reading and writing these files.

The focused keyboard, migration, and provisioning suites passed. Two independent isolated checks reproduced these edge cases. I did not test a real first boot, login screen, or physical keyboard.

This branch also includes #9762. Maintainers closed #9762 without a merge because it overlaps with #6896. Please resolve this dependency before merging this PR.

@IridescentRose

Copy link
Copy Markdown
Author

Should be good for a re-review

@johnpippett johnpippett left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The two write defects from my earlier review no longer occur in these checks at 5d98d1dd8de0d93761c8dabf8ec6425386a65c4f.

Codex repeated the original cases with temporary files in Bubblewrap on Arch Linux. Both first-boot exposure and migration remove a stale XKBVARIANT=dvorak when the new keymap is pl. Both paths also preserve an existing indented layout assignment. The earlier head reproduces all four incorrect results; the revised head corrects them.

All 91 checks in the four focused keyboard, migration, provisioning, and setup suites gave correct results. The new shell reader also agreed with the Lua reader in 42 comparisons across 14 inputs.

A separate migration check simulated failure of the layout append. The migration reported failure, kept unrelated lines, and completed on retry. A third run left the file unchanged. Privileged commands used temporary substitutes.

One additional expectation still fails: an empty XKBLAYOUT= gives an empty resolved layout. The old head, revised head, and unchanged base b421b1b479ee9ea0863792282eee4ffeb50923dc all give this result. This is separate from the corrected write defects.

The branch now includes the current #6896 dependency. That PR remains open and unmerged.

These checks did not use a real first boot, SDDM login, initramfs rebuild, LUKS prompt, or physical keyboard. No installed configuration changed.

@omarchybot

Copy link
Copy Markdown
Collaborator

I read this pull request at 5d98d1dd against quattro, but did not run it. The second opinion, Codex Medium, did not run because the day's review allowance on this machine was used up. Without it, the bug classification I made is unconfirmed, and verification waits for that. So this has not been run on a worker, it has no verified label yet, and only Claude Opus 5.5 looked at it. It will be picked up again on a later run.

What reading checked:

  • The gap table is complete. The nine keymaps in OMARCHY_KEYBOARD_XKB_GAPS (azerty, bg-cp1251, colemak, cz, de_CH-latin1, kyrgyz, no-latin1, pl, ua) are exactly the setup-form keymaps that have no row in systemd 262's kbd-model-map. None is missing and none is extra.
  • A fresh ISO install with one of those keymaps is still not covered. The ISO saves the keymap only through systemd-firstboot --keymap (configure_keyboard in omarchy-iso's orchestrator/keyboard.py). Then omarchy-provision-user --first-install marks every shipped migration complete (bin/omarchy-provision-user:114-118), so migrations/1789183087.sh never runs on that machine. On that install, /etc/vconsole.conf keeps KEYMAP only, and the session and the greeter fall back to us. Only first-boot owner setup (apply_keyboard) and installs that already exist get XKBLAYOUT. The new paragraph in docs/file-layout.md says the ISO's configure_keyboard writes the XKB variables. For these nine keymaps it does not, so the paragraph should not say so until the ISO does the same thing.
  • This depends on Apply the system keyboard layout to the SDDM greeter #6896. The branch includes Apply the system keyboard layout to the SDDM greeter #6896's three commits, and Apply the system keyboard layout to the SDDM greeter #6896 is still open, so this can land only after it.

Next: the second opinion and a worker run on a later pass. The maintainer decides whether the ISO gap is fixed in omarchy-iso alongside this pull request.

@omarchybot omarchybot removed the bug Something isn't working label Oct 2, 2026

@johnpippett johnpippett left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approve. This review replaces my September 28 request for changes.

Tested commit: 5d98d1dd8de0d93761c8dabf8ec6425386a65c4f, merged locally into quattro at 988f44ea.

Checks and environment: Claude Code did these checks on Arch Linux. The tests used Bubblewrap with a read-only root and no network.

  • The two defects from my September 28 review do not occur at this commit. A stale XKBVARIANT is removed, and an indented XKBLAYOUT line is kept. My September 29 review gives the details.
  • #6896 merged on October 4 as 75b327bc. The dependency in my earlier reviews is closed. The local merge into quattro had no conflicts. After the merge, the #6896 commits add no changes, and the diff has seven files.
  • On the merged tree, 128 of 128 checks passed in five suites: hyprland-keyboard-layout (11), keyboard-layout (37), keyboard-xkb-migration (25), provision-owner-keyboard (33), and setup-form (22).

Remaining concerns: none from these checks.

Not tested: a real first boot, the SDDM login screen, an initramfs rebuild, LUKS password entry, and a physical keyboard.

@jandrusk

Copy link
Copy Markdown

Looks merge-ready after #6896 landed and the stale-XKBVARIANT / indented-assignment fixes. One leftover for maintainers/ISO: fresh ISO installs with the nine gap keymaps still skip the migration (omarchy-provision-user --first-install marks migrations complete), so those machines keep KEYMAP-only until something else writes XKBLAYOUT. Worth an omarchy-iso follow-up; doesn't block merging this for existing installs.

@IridescentRose

Copy link
Copy Markdown
Author

It seems #14431 has largely fixed this issue, all that remains of value to this PR is the migrations.

The XKB gap table lived in omarchy-provision-owner, where nothing else can
source it. setup-form.sh is already sourced by provision-owner and holds the
layout list the table answers for, so a migration repairing installs that
predate the table can read the same values instead of keeping a copy.
Machines set up before first-boot setup filled in the XKB variables still
carry a vconsole.conf with only KEYMAP for the keymaps systemd's
kbd-model-map lacks (Polish, Czech, Ukrainian, Colemak, ...). The session
and the SDDM greeter then resolve "us", so a password typed under the chosen
layout can't be reproduced at login (omacom#9442).

The migration takes the layout from kbd-model-map, reading its tab-padded
columns logically, and otherwise writes what keyboard_xkb_settings gives
first-boot setup today, plus French for the azerty keymap the form no
longer offers. It replaces any stale XKB lines instead of appending after
them, and first reapplies the non-Latin initramfs repair that 1784476564.sh
skips when XKBLAYOUT is absent, so a cancelled sudo leaves it pending.
@IridescentRose
IridescentRose force-pushed the nbourgeois/fix-install-keyboard-variables branch from 5d98d1d to aeaede5 Compare October 15, 2026 12:22
@IridescentRose IridescentRose changed the title Fix keyboard layout persistence after first-boot setup Repair KEYMAP-only vconsole.conf installs Oct 15, 2026
@greptile-apps

greptile-apps Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no new actionable issues were found.

Summary

Repairs existing installs whose /etc/vconsole.conf contains a console keymap but no XKB layout.

  • Older installs now carry their saved keyboard layout into the login screen.

The earlier test-path finding no longer applies because the affected test was deleted. Its thread was manually resolved without explanation.

Reviews (3) · Last reviewed commit: "Give the XKB migration a current timesta..." · Reviewed by Greptile

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
@omarchybot omarchybot added bug Something isn't working verified Omarchy Triage has verified that this issue is ready for final review labels Oct 15, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

I reviewed this at 9c862662 against quattro and ran it on a disposable Omarchy worker. The fix works for the bug it describes, but it should land after #14885, because it exposes existing encrypted installs with a Ukrainian, Kyrgyz or Bulgarian keymap to the LUKS lockout from #14246.

What ran, on the worker:

  • Reproduction against the live Hyprland session. I gave /etc/vconsole.conf only KEYMAP= for pl, cz, colemak, de_CH-latin1, ua, azerty and de-latin1. Without the migration, hyprctl getoption input:kb_layout reads us after a reload for every one of them. After migrations/1792066470.sh runs, the session gets pl, cz,us with qwerty, us with colemak, ch, ua, fr and de. Rerunning the migration exits 0 and changes nothing. Putting the KEYMAP-only file back brings us back.
  • The suite. ./test/cli passed. These shell suites passed: keyboard-xkb-migration, provision-owner-keyboard, setup-form, keyboard-layout and hyprland-keyboard-layout, plus the other eight suites that read omarchy-provision-owner or setup-form.sh.
  • Not tested: a real SDDM login, an initramfs rebuild, or a LUKS prompt.

What blocks it. The guard against non-Latin layouts at the LUKS prompt only removes Omarchy's own FILES+=(/etc/vconsole.conf) (migrations/1792066470.sh:95). On the worker, plymouth 26.134.222-3 and sd-vconsole both bundle /etc/vconsole.conf whenever it is non-empty, whatever FILES says (/usr/lib/initcpio/install/plymouth:41-43). That is #14246. So take an encrypted install that has KEYMAP=ua today. Its bundled file has no XKB layout, so Plymouth asks for the passphrase in us. After this migration writes XKBLAYOUT=ua,us, the next kernel update rebuilds the image, and Plymouth starts in Ukrainian. The Latin passphrase can no longer be typed the usual way. #14885 closes that hole for every non-Latin layout. With it merged, this migration is safe. Nothing in this branch needs to change.

Latin layouts at the LUKS prompt. For pl, cz, ch, no and Colemak, the extra XKBLAYOUT also reaches Plymouth on the next rebuild. The ISO and first-boot setup both load the chosen console keymap before they ask for the password, so this puts the prompt back on the layout the passphrase was typed in. It does not move it away from that layout.

Overlapping pull requests. #8685 fixes only the session reader and leaves the SDDM greeter on us. Its fallback table also gives Czech QWERTZ where the console uses QWERTY, and it reads azerty as Azerbaijani. #12896 has no entries for bg-cp1251 or kyrgyz and drops the qwerty variant for cz. Both currently conflict with quattro. This pull request covers the cases they miss, so it is the one to bring forward.

Second opinion. Codex Medium reviewed the same head. It found the Plymouth bundling problem, which I then confirmed on the worker. It agreed with the reading on Latin layouts and on the overlapping pull requests, though its independence from my reasoning is not guaranteed. It found no other defect. I pushed nothing.

It is labelled verified and waits on the maintainer to merge #14885 first.

omarchybot and others added 2 commits October 31, 2026 23:44
Omarchy's AGENTS.md and agents/skills/migrations.md rule out tests for migrations: a migration runs once per machine and is frozen once it ships, so a test of it stops guarding anything. keyboard_xkb_settings, the logic worth keeping covered, is still exercised by provision-owner-keyboard-test.sh.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The rebuild ran before XKBLAYOUT was written, so omarchy_vconsole.conf could not yet see a non-Latin layout and the new image held the same KEYMAP-only file as the old one: it repaired nothing, and a failed rebuild left every later migration pending. Removing a stale unconditional FILES line is the part that matters, since the image on disk predates the layout and the next rebuild then leaves the file out.

Appending to a vconsole.conf whose last line has no newline joined XKBLAYOUT onto it, corrupting KEYMAP. Start the payload on its own line.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Codex Medium <[email protected]>
Migrations are strictly ordered, and this one was named before about forty that have since shipped on quattro.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@omarchybot

Copy link
Copy Markdown
Collaborator

I reviewed this again because two things changed. #14885 merged, so a non-Latin vconsole.conf now stays out of the initramfs, which was what blocked this last time. #14684 also merged and closed #9442, which this pull request names as well. That merge doesn't replace this one. #14684 changes which console keymaps the installer picks for German and French on new installs. It doesn't touch existing installs whose /etc/vconsole.conf holds only KEYMAP, and repairing those is what this pull request does.

I pushed three commits to your branch, @IridescentRose:

  • 70e8924e removes test/shell.d/keyboard-xkb-migration-test.sh. quattro's AGENTS.md and agents/skills/migrations.md now say migrations get no tests, because a migration is frozen once it ships. provision-owner-keyboard-test.sh still covers keyboard_xkb_settings.
  • 4a02691f makes two fixes to the migration. First, the initramfs step ran limine-mkinitcpio before it wrote XKBLAYOUT, so the new image held the same KEYMAP-only file as the old one. That rebuild repaired nothing, and if it failed, every later migration stayed pending. The migration now only deletes a stale unconditional FILES+=(/etc/vconsole.conf) line. The image already on disk has no layout in it, and once that line is gone the next rebuild leaves a non-Latin file out. Second, a vconsole.conf whose last line had no newline got XKBLAYOUT= joined onto its KEYMAP line. The appended lines now start on a new line.
  • 372572a9 renames the migration to migrations/1793487371.sh, so it sorts after the roughly forty migrations quattro has shipped since it was written.

What ran. I merged this branch into current quattro (d367a568) and ran it on a disposable worker built from the Omarchy ISO (systemd 262.1, plymouth 26.134.222-3), with Omarchy pointed at the merged tree. I tested pl, cz, colemak, de_CH-latin1, no-latin1, ua, kyrgyz, bg-cp1251, azerty, de-latin1 and fr-latin1. With only KEYMAP in the file, Hyprland's kb_layout is us every time. After the migration it is the chosen layout: pl, cz,us with qwerty, us with colemak, ch, no, us,ua, us,kg, us,bg with phonetic, fr, de and fr. Running it again exits 0 and leaves the file unchanged, and putting the KEYMAP-only file back brings us back. Two edge cases also passed: a file with no final newline keeps its KEYMAP line intact, and a ua install with a stale unconditional FILES line loses that line. An image built with mkinitcpio after migrating ua leaves vconsole.conf out, and after pl includes it. ./test/cli passed, and so did provision-owner-keyboard, setup-form, hyprland-keyboard-layout, keyboard-layout, typing-setup, i18n and the other suites that read setup-form.sh or omarchy-provision-owner. I did not test a real SDDM login or a real LUKS prompt.

Second opinion. Codex Medium and muse-wonder (via pi, thinking high) reviewed it in two rounds. In the first round they found the rebuild ordering, the unchecked rebuild exit code, the missing-newline append and the stale timestamp. I confirmed each one in the source before fixing it. Both reviewed the fixes and found nothing open. Their agreement isn't guaranteed to be independent, since they can read this session's work.

Still open. The description still says Closes #9442, but #14684 closed that issue, and the French report there was a different bug. The open report this repairs is #7049, which shows a KEYMAP=no-latin1 file with no XKBLAYOUT. I haven't linked #7049, because it also covers fresh ISO installs and an fcitx5 profile, and this migration fixes neither. Competing pull requests #8685 and #12896 haven't changed since the last review, and this one still covers the cases they miss.

It is labelled verified. It is waiting on the maintainer to decide whether to merge it, including whether the migration should keep sourcing install/provisioning/setup-form.sh for keyboard_xkb_settings or carry its own copy of that table.

@omarchybot omarchybot removed the verified Omarchy Triage has verified that this issue is ready for final review label Nov 22, 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.

Keyboard layout mismatch between installation and login

4 participants