Skip to content

ibss: accept verified idle DFU after a lost clear reply - #65

Merged
henrikklee merged 1 commit into
OrchardLinux:mainfrom
theChristopher16:fix/dfu-idle-after-gaster
Dec 5, 2026
Merged

henrikklee merged 1 commit into
OrchardLinux:mainfrom
theChristopher16:fix/dfu-idle-after-gaster

Conversation

@theChristopher16

@theChristopher16 theChristopher16 commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Change

  • Read DFU status after Gaster and preserve an already idle, Gaster-marked session instead of sending another CLRSTATUS.
  • If the host loses a CLRSTATUS reply, reopen the marked device and proceed only when a fresh status read reports status 0 and dfuIDLE.
  • Keep the existing clear-and-reset path for a non-idle session whose clear request is acknowledged.

Evidence

On a J85 iPad mini 2 attached to an Intel Mac's native USB-A port, Orchard 0.3.2 stopped at DFU clear status: unknown (error 0xe00002ed) after Gaster succeeded. A subsequent DFU status read reported status 0, state 2 (dfuIDLE), while the Gaster mark remained.

With this patch, one separately approved, guarded launch passed that handoff, uploaded patched iBSS and iBEC, started m1n1, and sent the installed system's boot-entry command. After a delay at m1n1's splash, the host enumerated Omarchy Linux USB and serial interfaces. The owner observed the PIN screen, photographed the unlocked desktop, and confirmed opening its settings panel by touch. Read-only SSH through that USB link confirmed apple,j85, kernel 7.3.0-rc1-orchard-apple-4k, / on internal ext4 /dev/asp0n1p2, /boot on internal vfat /dev/asp0n1p1, and active greetd/Labwc. This is one J85 cold return to the installed desktop with touch. A second independent cold boot is still needed to establish repeatability. The current installed device tree marks the GPU disabled, so this PR does not claim GPU acceleration.

Merged tools main 49d38a01 (v0.3.7) into this branch. cargo test -p orchard-runtime --lib --offline --locked: 71 passed, 1 ignored, including the three handoff tests. A macOS x86_64 candidate built from this head and passed a read-only devices query; no second physical J85 boot has been run with it.

This changes host DFU state handling only. It does not change boot images or write device storage.

@Etienne-T

Copy link
Copy Markdown
Contributor

A second J85 (iPad mini 2 Wi-Fi) got through with this PR, from Linux this time.

Host: Ubuntu 26.04.1, kernel 7.0.0-44-generic, Intel xHCI, direct root-hub port. orchard tools main at b9afb85 (0.3.16) with this branch merged on top. The merge was clean, and cargo test -p orchard-runtime --lib gave 100 passed, including the three handoff tests. iPadOS was removed beforehand (empty GPT).

Without this PR: 6 runs, each from a fresh DFU entry: 3 on Linux with 0.3.16, 2 on an Intel Mac with 0.3.16, 1 on the Mac with 0.3.14. All of them stopped at DFU clear status right after gaster. On Linux the error was hardware fault or protocol violation; on macOS it was unknown (error 0xe00002ed). Details are in #151.

With it: one run from a fresh DFU entry.

  • The first attempt still failed the same way.
  • The installer's automatic retry then logged The boot ROM is already idle in DFU. It sent the patched iBSS and iBEC, the device tree, the trust cache and m1n1.
  • The Install payload came up as 05ac:4146.

One thing was left: the installer screen stayed on "Put it in DFU mode again" and logged nothing more after put kernel package. I followed docs/bring-up/j85m.md: I stopped it and started orchard install again. The new run attached ("Linux is running") and wrote Omarchy A v0.4.8 to asp0n1p1/asp0n1p2: 765 MB root, verified on the device, in 50 s. It then reported "Omarchy A is ready". The installed desktop came up, and the screen rotated with the iPad.

So a second J85 passed the handoff from a cold DFU, on Linux this time rather than macOS. I haven't tested orchard launch of the installed system after a restart yet.

@cDurham

cDurham commented Dec 4, 2026

Copy link
Copy Markdown
Contributor

A third J85 (iPad mini 2 Wi-Fi) with this PR, from Linux. It shows no regression; it does not exercise the new path.

Host: Nobara 44, kernel 7.3.1, Intel xHCI, direct root-hub port, USB-A to Lightning. orchard tools main at 751a5dd (0.3.16) with this branch (d2fcf89) merged on top. The merge conflicted in crates/runtime/src/ibss.rs, only because tools#150 and this PR each add a test module at the same place; I kept both. cargo test -p orchard-runtime --lib handoff passed its three tests. usbcore had old_scheme_first=Y, initial_descriptor_timeout=10000 and autosuspend=-1, as docs/bring-up/j85m.md says. iPadOS was removed beforehand.

With this PR: 4 of 4 --ibss runs got through, each from a fresh DFU entry: two RAM boots with orchard run (17.7 s and 15.6 s in total) and two orchard launch starts of the installed system.

What that does and does not show: the three runs I kept logs of all printed The boot ROM started a new DFU session, which is the path that existed before this PR. So the idle handling this PR adds was not reached on this unit. I did not try stock 0.3.16 --ibss on this host, so I cannot say it fails here.

checkra1n, for comparison: 4 of 4 runs ended in Pongo did not appear on USB on this unit, on two root ports, with fwupd, ModemManager and usbmuxd inactive. With iPadOS removed that is expected (docs/bring-up/j85m.md).

No device identifiers are included.

After gaster, the hand-over to the iBSS clears the DFU status and resets
USB. On an iPad mini 2 (J85) on an Intel Mac, the clear went unanswered
with IOKit's kIOReturnNotResponding (0xe00002ed), which reaches Orchard
as Kind::Other, and the run stopped there, although the device had taken
the request and sat idle in DFU.

On such an error, which is neither a disconnect nor a fault (those keep
their handling), open the device again once, still requiring gaster's
mark, and read its status once. Go on if it reads OK and dfuIDLE;
otherwise fail with the original error. The normal hand-over (clear,
then USB reset) is unchanged for every device; no new loop, and the
reopen uses the existing reconnect deadline.

Assisted-by: LLM
[Orchard: rebased onto main after OrchardLinux#166; narrowed: dropped the status read
 before every clear, which skipped the clear and the USB reset whenever
 the device read idle, for every device; kept only the check after an
 unanswered clear; replaced the tests with ones for that decision; added
 the changelog line and the commit message.]
@henrikklee
henrikklee force-pushed the fix/dfu-idle-after-gaster branch from 42e0d41 to 61ebfff Compare December 5, 2026 01:19
@henrikklee
henrikklee merged commit 4dd6723 into OrchardLinux:main Dec 5, 2026
11 checks passed
@henrikklee

Copy link
Copy Markdown
Contributor

Thank you, Christopher! This is merged. Your Intel-Mac iPad mini 2 report is what found it: on a Mac, the device can take the request that ends the old DFU session without its answer ever arriving (IOKit's 0xe00002ed, "not responding"), and Orchard stopped there although the iPad was ready.

What we changed on your branch before merging:

  • Rebased it onto main. Since you opened this, ibss: take a protocol error as the boot ROM's new DFU session #166/usb: a broken transfer can be a lost reply on a pwned boot ROM #170 landed: on Linux the same moment now shows up as a disconnect or a protocol fault, and main already goes on there. So this pull request is now about the Mac case only.
  • Narrowed it. We took out the status read before every clear. When the device read idle, it skipped the clear and the USB reset for every device on this route, on both hosts, and that had only been tried on the J85. The normal hand-over (clear, then USB reset) stays exactly as on main for every device.
  • Kept the part that fixes your case: when the clear fails with any other error (on a Mac, 0xe00002ed), Orchard connects to the device again once, still requiring it to be the same prepared device, and reads its status once. If it is OK and idle, the install goes on; otherwise it stops with the original error. No new loop: the reconnect uses the existing reconnect deadline.
  • Replaced the tests with ones for that decision, gave the commit a message and added a changelog line. The commit still carries you as the author, with an [Orchard: …] note of what we changed.

It reaches people with the next tools release. When it is out, a run of orchard install on your Intel Mac with the iPad mini 2 would tell us whether it really gets past that point now; a report here or in a new issue (the terminal output around "DFU clear status") would be great.

@henrikklee henrikklee mentioned this pull request Dec 5, 2026
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.

4 participants