Skip to content

Retry the ESP unmount in boot-to-esp and name what holds it - #785

Open
joshuaswarren wants to merge 2 commits into
omacom:quattrofrom
joshuaswarren:fix/boot-to-esp-retry-umount
Open

joshuaswarren wants to merge 2 commits into
omacom:quattrofrom
joshuaswarren:fix/boot-to-esp-retry-umount

Conversation

@joshuaswarren

@joshuaswarren joshuaswarren commented Nov 3, 2026 •

Copy link
Copy Markdown
Collaborator

Refs #776.

omarchy-system-boot-to-esp runs a bare umount /boot/efi. When something holds the ESP for a moment, setup step 1 aborts with umount: /boot/efi: target is busy., and the ERR trap then prints the restore instructions for a move that has not started (mv /boot.old /boot, which does not exist yet).

Change: unmount_esp retries the unmount up to five times, two seconds apart. If the ESP stays busy it stops with the umount error and fuser -vm output, and says nothing has been moved. main calls it in place of the bare umount.

Tests (test/shell.d/boot-to-esp-test.sh), written first: before the change the new cases fail with unmount_esp: command not found. After: a briefly busy ESP is unmounted on the third call; an ESP that stays busy stops the move and names its holders.

Not verified: what held the mount in #776 (the reporter did not capture fuser), so the retry is a mitigation for a transient holder, not a proven cure. If it stays busy, the new output names the holder for the next report. I have no Mac to run this on; the checks are the shell tests with umount, sleep and fuser stubbed. test/shell.d/boot-to-esp-test.sh passes; I ran the wider test/shell suite up to its time limit and did not see it finish, so CI is the full run.

Note on the issue text: the reporter says fstab had already been updated, but in this script the unmount comes before any change, so that part does not match the code and I could not explain it.

@greptile-apps

greptile-apps Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; the remaining test gap is non-blocking.

Findings

  1. P2 Wrong restore instructions go unchecked ▶

Summary

Adds unmount_esp before the boot files are copied.

  • The boot-to-ESP migration retries a busy EFI partition before moving boot files.

Reviews (3) · Last reviewed commit: "Test that a busy ESP prints no restore i..." · Reviewed by Greptile

Comment on lines +107 to +111
if output=$(busy_for=99 unmount_run 2>&1); then
fail 'an ESP that stays busy stops the move'
fi
[[ $output == *'target is busy'* && $output == *'udisksd'* && $output == *'nothing has been moved'* ]] ||
fail 'a busy ESP names its holders and says nothing was moved' "$output"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Wrong restore instructions go unchecked

The new busy-ESP tests call unmount_esp directly, without the ERR trap installed by main, and only check for expected text. They would still pass if the failure also printed the incorrect /boot.old restore instructions—the other regression this PR intends to fix. Add a test with the trap installed and assert that the recovery instructions are absent.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

joshuaswarren added a commit to joshuaswarren/omacom-omarchy that referenced this pull request Nov 3, 2026
Greptile on omacom#785: the busy-ESP tests called unmount_esp without the ERR trap main installs, so they would pass even if the failure printed the /boot.old restore instructions for a move that never started. Add a case with trap recovery_note ERR installed that asserts those instructions are absent.
@joshuaswarren

Copy link
Copy Markdown
Collaborator Author

[Joshua's agent] Greptile's P2 addressed in 1fea8297f: a new case installs trap recovery_note ERR as main does, drives a busy ESP through unmount_esp, and asserts the output names the busy mount and does not contain the /boot.old restore instructions. It passes; the behaviour was already right (fail exits, which the ERR trap does not see), so this pins it. Install VM on this head still fails with target not found: hyprtoolkit until #787 merges; the failure is not from this change.

Step 1 of omarchy-mac-setup aborted with "umount: /boot/efi: target is busy" (omacom#776). The unmount is now retried a few times, and if the ESP stays busy the script stops with fuser output and says nothing has been moved, instead of printing the restore instructions for a move that never started. Tests: a briefly busy ESP is unmounted on the third call; an ESP that stays busy stops the move and names its holders.
Greptile on omacom#785: the busy-ESP tests called unmount_esp without the ERR trap main installs, so they would pass even if the failure printed the /boot.old restore instructions for a move that never started. Add a case with trap recovery_note ERR installed that asserts those instructions are absent.
@joshuaswarren
joshuaswarren force-pushed the fix/boot-to-esp-retry-umount branch from 1fea829 to 95d8ab8 Compare November 3, 2026 13:33
@joshuaswarren

Copy link
Copy Markdown
Collaborator Author

🤖 Claude Haiku 5.5 responding on behalf of joshuawarren

Still needed: quattro (default branch, PR base at 7cb792e) still runs a bare umount /boot/efi in boot-to-esp. This PR retries that unmount and names the holders if the ESP stays busy, so the move stops before anything is copied. Checks are green and the PR is mergeable. Could a maintainer review it?

[Joshua's agent]

@joshuaswarren

Copy link
Copy Markdown
Collaborator Author

GREEN at 95d8ab8

[Joshua's agent] Reviewed the unmount helper, its single main caller, failure/trap behavior and added regression cases.

The helper retries ordinary unmount only; it adds no force/lazy unmount or process killing. Persistent failure reports the last error and best-effort holder diagnostics, then exits before copying/moving boot files or rewriting fstab. Its explicit fail exits without printing recovery instructions for a move that never started; the later migration recovery trap remains in place.

The focused shell test passes all 14 checks, including existing boot-layout refusal cases, third-attempt success, permanent-busy refusal/holder output and absence of inappropriate /boot.old restore instructions. Shell syntax passes. No blocking findings.

Limits: no real ESP unmount, boot-file move, filesystem change or hardware test. This is a bounded retry for transient contention, not proof of the original holder's identity or a root-cause fix for persistent contention. fuser diagnostics are best-effort; the safe failure does not depend on their success.

Reviewer: Codex GPT-6.1 Sol as routed by Main (model id unverifiable); implementer model unverified.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant