Skip to content

Hibernation: keep native GPU drivers out of the initramfs so resume runs before any GPU driver touches the hardware - #10065

Open
madakas wants to merge 2 commits into
omacom:quattrofrom
madakas:hibernation-defer-gpu
Open

madakas wants to merge 2 commits into
omacom:quattrofrom
madakas:hibernation-defer-gpu

Conversation

@madakas

@madakas madakas commented Sep 3, 2026 •

Copy link
Copy Markdown

Problem

One mechanism sits behind #10061, #10039, #8352 and #7848: the initramfs loads the native GPU driver before the resume hook can run. The kms hook (or the NVIDIA MODULES+= drop-in, which busybox init modprobes before any hook) exists so Plymouth can theme the LUKS prompt — but the resume decision structurally cannot happen until after unlock, because the swapfile sits inside LUKS. So on every resume-from-hibernate boot, the boot kernel fully initializes the GPU, its .freeze callback then suspends and ASIC-resets it (amdgpu does this unconditionally on dGPUs since kernel commit daf8de0874ab), and the restored kernel has to reclaim hardware a second driver instance just reprogrammed. On robust hardware that survives; on plenty of real machines it does not — nv_pmops_freeze → -EIO on NVIDIA, nouveau FIFO faults on Macs, and a silent hard hang on amdgpu CIK iMacs (silent because the whole window runs with consoles suspended and Arch builds without CONFIG_DPM_WATCHDOG). Full source-level analysis with citations: #10061 (comment)

Two reporters have already verified the workaround independently (#10039, #8352): remove the GPU driver from the initramfs and resume works. Fedora shipped exactly this model distro-wide in F42 (Changes/PlymouthUseSimpledrm).

Fix

Hibernation-scoped, so nobody else's boot experience changes: while hibernation is configured, keep native GPU drivers out of the initramfs and let Plymouth render the LUKS prompt on simpledrm (EFI framebuffer, native resolution).

  • omarchy-hibernation-setup now writes a drop-in that adds the resume hook, strips kms, and filters the NVIDIA early-KMS modules out of MODULES (dead weight otherwise — the blacklist guarantees they never load); installs a new self-contained omarchy-defer-gpu initcpio hook that bakes an initramfs-only modprobe blacklist into the image (never into host /etc/modprobe.d, which modconf would copy in and which would affect the running system); and appends plymouth.use-simpledrm to the cmdline drop-in, which it now rewrites on every run so a pre-existing file can't pin a stale resume offset. The blacklist also covers the NVIDIA MODULES+= early load (modprobe -qab's -b applies blacklists to explicit names), so install/hardware/nvidia.sh only gains a cross-reference comment. Setup also upgrades old-format installs in place — an existing resume drop-in without the defer-gpu hook reruns the idempotent setup instead of early-exiting, so current hibernation users receive the fix — and aborts cleanly before touching initramfs config if the resume offset can't be determined.
  • omarchy-hibernation-remove now deletes everything setup created — including the resume.conf and rtc-alarm.conf limine-entry-tool drop-ins, before the rebuild. Fixes omarchy hibernation remove leaves /etc/limine-entry-tool.d/resume.conf behind, so the rebuilt UKI still boots with resume= pointing at the deleted swapfile #10037 (removal used to leave resume= pointing at the deleted swapfile in every regenerated boot entry).
  • On normal boots the real root's udev loads the GPU driver right after switch_root (one brief modeset handoff — the trade-off Fedora accepted). On resume boots the restored kernel reclaims the GPU from clean, EFI-posted state — the path its S4 restore code is actually written for.

Testing

On the affected hardware class (iMac17,1, amdgpu Bonaire/CIK, Btrfs+LUKS, Limine/UKI, the machine from #10061):

Open questions for maintainers

  • Existing hibernation users get upgraded when they next run omarchy hibernation setup (old-format drop-ins are detected and rewritten in place). If you'd rather push the upgrade proactively, a migrations/ script can call the same idempotent path — happy to add it.
  • Fedora documented two edge cases that may eventually want an opt-out: docks where the only monitor hangs off a secondary GPU (dark LUKS prompt), and rare AMD laptops needing amdgpu firmware in the initrd for USB-C boot.
  • The kms-strip logic lives in the setup-written drop-in; an alternative is centralizing kms policy in the pacman-owned omarchy_hooks.conf (checking for the resume drop-in's existence). Kept scoped here to avoid touching the always-installed file — your call.
  • The bolder version of this change is Fedora's: drop kms from the initramfs unconditionally (smaller images, faster boots, deletes the NVIDIA kms-drop special case in omarchy_hooks.conf). This PR deliberately stays scoped to hibernation.

P.S. Greetings to @dhh from Max — Omarchy brought this 2015 iMac gloriously back to life; this PR is for the one button that tried to take it back down. ;-)

Analysis and patch machine-authored by Claude Fable 5 via Claude Code, driven and reviewed by the account owner.

🤖 Generated with Claude Code

https://claude.ai/code/session_01K9mJ7cVrfJxovv31CaN7NF

…figured

A GPU driver bound by the boot kernel before the resume hook fires suspends
and ASIC-resets hardware the restored kernel then cannot reclaim, hanging or
faulting resume-from-hibernate (amdgpu CIK, NVIDIA, nouveau). The resume
decision cannot move earlier - the swapfile sits inside LUKS - so the GPU
driver moves later: omarchy-hibernation-setup now strips the kms hook and
bakes an initramfs-only modprobe blacklist into the image via a new
omarchy-defer-gpu initcpio hook, and Plymouth renders the LUKS prompt on
simpledrm (plymouth.use-simpledrm). On normal boots the real root loads the
driver right after switch_root; on resume boots the restored kernel reclaims
the GPU from clean EFI-posted state.

omarchy-hibernation-remove now also deletes the resume.conf and
rtc-alarm.conf limine-entry-tool drop-ins before the rebuild, so removal no
longer leaves resume= pointing at the deleted swapfile (omacom#10037).

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01K9mJ7cVrfJxovv31CaN7NF
- Make the omarchy-defer-gpu initcpio hook self-contained: the blacklist is
  a heredoc inside build(), so the installed hook no longer depends on a
  hardcoded /usr/share/omarchy path that dev-linked checkouts redirect
  elsewhere; the shipped modprobe.d file is gone
- Upgrade old-format installs in place: a resume drop-in without the
  defer-gpu hook no longer early-exits as "already set up" but reruns the
  (idempotent) setup, so existing hibernation users actually receive the fix
- Compute the resume device/offset up front and abort before touching any
  initramfs configuration when btrfs map-swapfile fails, instead of
  deploying a GPU-less image with no resume= parameters
- Rewrite the limine resume.conf drop-in on every setup run so a
  pre-existing file cannot pin a stale offset from an earlier swapfile
- Install the initcpio hook before the drop-in that names it, via
  install -m 644 -o root -g root (cp -p preserved user ownership from
  dev-linked checkouts) with an OMARCHY_PATH fallback and a hard error
- Strip the nvidia early-KMS modules from MODULES in the same drop-in:
  the blacklist guarantees they never load, so they were dead weight on
  the ESP; cross-reference the module list in nvidia.sh both ways

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01K9mJ7cVrfJxovv31CaN7NF
@omarchybot omarchybot added the enhancement New feature or request label Oct 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

2 participants