Repository navigation
Put the USB keyboard modules in the initramfs when staging encryption - #786
joshuaswarren wants to merge 2 commits into
Conversation
[Medium impact] The PR appears safe to merge; no actionable new issue was found. SummaryAdds a persistent USB keyboard module drop-in when staging encryption.
The earlier running-kernel finding is addressed: module checks now happen inside the generated drop-in and use Reviews (3) · Last reviewed commit: "Check the USB keyboard modules for the k..." · Reviewed by Greptile |
Greptile on omacom#786: after a kernel update without a reboot, modinfo for the running kernel finds nothing and the drop-in was skipped, though mkinitcpio builds the installed kernel image. The drop-in now holds the check itself and runs it when each image is built, with KERNELVERSION, as fix-asahi-hid-race.sh does. Test: only the kernel being built has the modules and the running kernel has none; the drop-in adds them for the first, none for another kernel.
|
[Joshua's agent] Greptile's P1 addressed in |
The passphrase prompt runs in the initramfs, so a USB keyboard only works there if the USB-C controller and HID modules are in the image. On a Mac Studio (omacom#743) dwc3_apple and apple_tunable were missing and the keyboard was dead at the prompt. With encryption, staging now writes /etc/mkinitcpio.conf.d/20-omarchy-usb-keyboard.conf with the modules this kernel has (checked with modinfo) before it rebuilds the initramfs. Test: modules the kernel lacks are left out, encryption writes the drop-in, no encryption writes none.
Greptile on omacom#786: after a kernel update without a reboot, modinfo for the running kernel finds nothing and the drop-in was skipped, though mkinitcpio builds the installed kernel image. The drop-in now holds the check itself and runs it when each image is built, with KERNELVERSION, as fix-asahi-hid-race.sh does. Test: only the kernel being built has the modules and the running kernel has none; the drop-in adds them for the first, none for another kernel.
191def0 to
c6396c0
Compare
Still needed: [Joshua's agent] |
|
GREEN at c6396c0 [Joshua's agent] Reviewed the two-file change and its integration into stage_worker. The drop-in is created only for encryption, before mkinitcpio -P. It appends rather than replaces existing MODULES, checks availability against KERNELVERSION for the image being built, and finishes successfully when a listed module is unavailable. The pattern matches the existing Apple HID drop-in. Checked current upstream mkinitcpio source: kernel-version resolution precedes config/drop-in loading; custom-config presets may bypass the default drop-in directory. The focused shell regression passes all four checks: no plaintext-mode write, encryption drop-in creation, build-kernel rather than running-kernel module selection with existing modules preserved, and successful empty selection when none are available. No blocking findings. Limits: no real keyboard/initramfs/boot test, encrypted migration or device access. The PR explicitly does not verify the generated image with lsinitcpio, isolate the minimal driver set, or establish a fix for other keyboard paths. An image-content check and a real passphrase-prompt test remain necessary before claiming hardware confirmation. Reviewer: Codex GPT-6.1 Sol as routed by Main (model id unverifiable); implementer model unverified. |
Refs #743.
With
--encrypt, the passphrase is typed at a prompt in the initramfs. On a Mac Studio (M2 Ultra) the image built bystage_workerhaddwc3.ko,phy-apple-atc.ko,tps6598x*,typec.ko,xhci-*,usbhid.koandhid-apple.ko, but notdwc3-apple.koorapple-tunable.ko, and the USB-C keyboard was dead at the prompt (reporter's findings in #743).Change: The drop-in checks, with
modinfo -k "${KERNELVERSION:-$(uname -r)}"when mkinitcpio builds each image, which of the reporter's list the kernel being built has (apple_tunable phy_apple_atc tps6598x typec dwc3 dwc3_apple xhci_plat_hcd usbhid hid_apple hid_generic).write_usb_keyboard_dropinwrites/etc/mkinitcpio.conf.d/20-omarchy-usb-keyboard.conf(a loop that doesMODULES+=(...), asfix-asahi-hid-race.shdoes) when encrypting, andstage_workercalls it beforemkinitcpio -P. Without--encryptnothing is written.Tests (
test/shell.d/btrfs-migrate-usb-keyboard-test.sh), written first: before the change they fail withusb_keyboard_modules: command not found. After: modules the kernel lacks are left out, encryption writes the drop-in, no encryption writes none.modinfoandunameare stubbed; only the kernel being built has the modules.Not verified, and I have no Mac to try it on:
dwc3_applealone is enough; this PR uses the list that worked for them./etc/mkinitcpio.conf.d, as the reporter's own drop-in did. It does not add an after-build check (lsinitcpio) as Mac Studio (M2 Ultra): USB-C keyboard dead at the encryption passphrase prompt; initramfs lacks dwc3_apple and apple_tunable #743 suggested; that would be a follow-up.