Repository navigation
Conversation
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds an initramfs hook to auto-authorize Thunderbolt devices early in boot (before encrypt) so attached USB peripherals work at the encrypted root prompt, plus a migration to rebuild the initramfs/UKI and a shell test to validate behavior.
Changes:
- Insert
thunderbolt_autoauthinto the mkinitcpioHOOKSsequence immediately beforeencrypt. - Add mkinitcpio install + runtime hook to authorize connected Thunderbolt endpoints early in initramfs.
- Add a migration + shell test to validate hook ordering, hook behavior, and one-time rebuild behavior.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| test/shell.d/thunderbolt-autoauth-test.sh | Adds an integration-style shell test covering hooks ordering, runtime authorization behavior, and migration one-time rebuild behavior. |
| migrations/1786961462.sh | Adds a migration that triggers a rebuild when the hook is present/configured and records a marker to avoid repeated rebuilds. |
| etc/mkinitcpio.conf.d/omarchy_hooks.conf | Updates mkinitcpio hook ordering to run Thunderbolt authorization before encrypt. |
| etc/initcpio/install/thunderbolt_autoauth | Adds mkinitcpio install hook to include the runtime hook in initramfs. |
| etc/initcpio/hooks/thunderbolt_autoauth | Adds initramfs runtime hook that authorizes attached Thunderbolt endpoints (and conditionally delays to let topology settle). |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
In my case, a NuPhy keyboard is connected to my Studio Display, which is connected to my Beelink SER8 via Thunderbolt. Without early authorization, I can’t enter the LUKS passphrase. |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.
Suppressed comments (5)
migrations/1786961462.sh:14
- This script has no shebang and doesn’t enable strict mode, which makes its runtime behavior dependent on how the migration runner executes it and can mask failures. Add an explicit interpreter line (e.g., bash) and enable
set -euo pipefail(or the project’s standard for migrations) near the top so failures in rebuild/marker creation are reliably surfaced.
echo "Rebuild the initramfs with early Thunderbolt authorization"
hooks_conf="${OMARCHY_THUNDERBOLT_HOOKS_CONF:-/etc/mkinitcpio.conf.d/omarchy_hooks.conf}"
install_hook="${OMARCHY_THUNDERBOLT_INSTALL_HOOK:-/etc/initcpio/install/thunderbolt_autoauth}"
runtime_hook="${OMARCHY_THUNDERBOLT_RUNTIME_HOOK:-/etc/initcpio/hooks/thunderbolt_autoauth}"
rebuild_marker="${OMARCHY_THUNDERBOLT_REBUILD_MARKER:-/var/lib/omarchy/migrations/1786961462}"
omarchy-cmd-present limine-mkinitcpio || exit 0
[[ -f $hooks_conf && -f $install_hook && -f $runtime_hook ]] || exit 0
grep -q ' thunderbolt_autoauth encrypt' "$hooks_conf" || exit 0
[[ ! -e $rebuild_marker ]] || exit 0
sudo limine-mkinitcpio
sudo install -Dm644 /dev/null "$rebuild_marker"
migrations/1786961462.sh:1
- The script prints a rebuild message even when it immediately exits due to unmet prerequisites (command missing, hook files missing, marker present, etc.). To avoid misleading/noisy logs, move the
echoto after the exit-guards (right beforesudo limine-mkinitcpio), or make the message conditional on actually performing the rebuild.
echo "Rebuild the initramfs with early Thunderbolt authorization"
migrations/1786961462.sh:11
- The script prints a rebuild message even when it immediately exits due to unmet prerequisites (command missing, hook files missing, marker present, etc.). To avoid misleading/noisy logs, move the
echoto after the exit-guards (right beforesudo limine-mkinitcpio), or make the message conditional on actually performing the rebuild.
omarchy-cmd-present limine-mkinitcpio || exit 0
[[ -f $hooks_conf && -f $install_hook && -f $runtime_hook ]] || exit 0
grep -q ' thunderbolt_autoauth encrypt' "$hooks_conf" || exit 0
[[ ! -e $rebuild_marker ]] || exit 0
etc/initcpio/hooks/thunderbolt_autoauth:36
- The
2>/dev/nullhere may not suppress errors from the redirection itself (opening/writing$authorized), depending on shell redirection evaluation order. If the goal is to keep early-boot output clean, redirect stderr in a way that also covers redirection failures (e.g., place2>/dev/nullbefore the output redirection, or group the write and redirect the group).
echo 1 > "$authorized" 2>/dev/null
migrations/1786961462.sh:11
- These
[[ ... ]]checks use unquoted variables. While[[avoids word-splitting in many cases, quoting is still the safer and more consistent approach (especially for paths) and prevents surprising behavior if any value contains whitespace or glob characters.
[[ -f $hooks_conf && -f $install_hook && -f $runtime_hook ]] || exit 0
grep -q ' thunderbolt_autoauth encrypt' "$hooks_conf" || exit 0
[[ ! -e $rebuild_marker ]] || exit 0
omacom#934's installer copied its hook to /etc/initcpio/{hooks,install}/thunderbolt_autoauth, unowned by any package. omarchy-settings ships etc/ wholesale, so owning those same paths makes pacman refuse the whole upgrade with "exists in filesystem" on every machine that ran it — exactly the machines this change is for. Under an omarchy- name the old files stay inert, since omarchy_hooks.conf no longer lists them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…arent The kernel refuses to authorize a device until its parent is authorized, and route names are hex, so the glob visits 0-103 before its parent 0-3. The single pass left that device unauthorized with the error suppressed, and a keyboard behind it dead at the LUKS prompt. Passes now repeat until one authorizes nothing; each success flips a device to 1, so the loop ends. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-Authored-By: Codex Medium <noreply@openai.com>
|
Reviewed at 56de916 against What ran, on a disposable Omarchy VM with no Thunderbolt hardware:
Pushed to this branch:
Open, not changed here:
For the maintainer: this authorizes every Thunderbolt endpoint attached at boot, before the disk is unlocked, on every install. That replaces the Codex Medium raised the ordering defect and the enumeration race on its own, and agreed on the pacman conflict and the trust-model question. It reviewed both pushed commits and found nothing wrong with them. It can read this session's work, so its independence is not guaranteed. I did not act on its point that the migration's literal This waits on the maintainer's decision about the trust model, and on a hardware confirmation. |
|
Tested commit System:
I installed the two Results:
The cold-boot journal shows the firmware-provided WD19TB xHCI controller being removed at The warm-boot sequence was similar: the controller was removed at So on this hardware the hook authorized the dock and restored its USB input before Plymouth/LUKS on both warm and cold boot, independently of userspace |
|
Thank you, @davidisgeek. Your test is the hardware confirmation this was waiting on. It covers 56de916, the current head: on the WD19TB from #10453, the dock keyboard worked at the LUKS prompt on both warm and cold boot. The pull request is now labelled Nothing was pushed and nothing was re-run on a worker: the head has not moved since the last review, and it still merges cleanly into current Codex Medium reviewed the confirmation and the diff again. It agreed that the confirmation shows the symptom fixed on that hardware, and it found no new defect. It can read this session's work, so its independence is not guaranteed. It made two points of its own:
The label is |
|
The head is still 56de916, but this no longer merges into The conflict. e1b0e5e (#14431) moved the HOOKS baseline out of The policy. #11874 merged into
In short, porting it as it stands would ship a default that overrides the default Options for the maintainer:
The rest of the earlier findings stand. On the WD19TB from #10453, @davidisgeek's confirmation still shows the hook fixing the symptom at this head. The change is the right size for the problem. The one-shot first scan can still miss a dock that has not finished enumerating. Codex Medium reviewed the same questions. It agreed with the analysis and the recommendation not to port mechanically. It can read this session's work, so its independence is not guaranteed. It added three points of its own: the This waits on the maintainer's decision about how this should coexist with #11874. Once that is decided, @chriopter or I can port it to match. |
Summary
Restore early authorization for Thunderbolt devices already connected at boot, allowing keyboards behind Thunderbolt/USB-C displays and docks to work at the LUKS prompt.
Omarchy already includes the Thunderbolt module in its UKI. The missing piece is authorizing the attached endpoint before
encryptasks for the disk password. Quattro's packagedomarchy_hooks.confreplacesHOOKS, so the machine-local hook previously used for this is no longer included.Changes
thunderbolt_autoauthmkinitcpio install and runtime hooks.encrypt.Security
This treats every Thunderbolt endpoint already connected during early boot as trusted. It does not authorize devices connected after the hook has run. This is the same trust model discussed in #934: entering the LUKS passphrase is considered implicit trust in the hardware attached at boot.
Relation to #934
This is the focused early-boot part of #934 and supersedes that proposal.
#934 also changed userspace hotplug authorization, installed
bolt, and added Hyprland ghost-display handling. None of those changes are included here. Omarchy now already ships the Thunderbolt module, so this PR only restores the missing authorization required for USB keyboards behind a Thunderbolt dock at LUKS unlock.The hook has also been updated for Quattro: it is part of the packaged hook order instead of editing
/etc/mkinitcpio.conf, whichomarchy_hooks.confnow overrides. Related: #6876.Testing
encrypt.lsinitcpioreportsudev plymouth keymap thunderbolt_autoauth encrypt, and the keyboard works at the LUKS prompt.Fixes #10453