Skip to content

feat(installer): prepare storage media on Windows - #298

Merged
Developer-Simon merged 33 commits into
prereleasefrom
feat/installer-media-windows
Nov 29, 2026
Merged

Developer-Simon merged 33 commits into
prereleasefrom
feat/installer-media-windows

Conversation

@Developer-Simon

@Developer-Simon Developer-Simon commented Nov 25, 2026 •

Copy link
Copy Markdown
Owner

Squash-merge commit message

The installer mode "Media" now works on Windows with the same scope as on Linux: it finds the Raspberry Pi Imager, lists drives, writes with one administrator prompt, shows progress, cancels, and takes time zone, keyboard and Wi-Fi settings from the PC. macOS follows later.

- Writing runs through an internal helper started with administrator rights. On Windows it runs the imager in a pseudo console with a console shim and a job object, because the imager prints no progress into a pipe
- The drive list never shows the system disk and hides a disk when its boot flags are unknown
- Right before writing, the target is checked again by path, model and size, on every system
- The progress parser removes terminal control sequences, otherwise a successful Windows run would end as failed
- A new CI job runs the installer media tests on Windows
- Used space is read for volumes with a drive letter, and an unknown size is no longer shown as 0 MB
- A cancelled write stays running and says so until the imager has ended, which can take minutes on slow media
- The write screen counts the remaining time down and switches to a running clock when the imager reports nothing new
- The installer ejects the written card on Windows, shows the whole imager error, keeps recently seen Wi-Fi networks, warns about media under 8 GB and closes its own console window

Known limits: acceptance on a real Windows PC covered an earlier build. The fixes made afterwards for cancelling, ejecting, the console window and the error text have not run on Windows yet. The system disk was not tested as a write target, and no PC was booted from a stick written on Windows.

Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>

Highlight translations

Highlights (de):
- Der Installer bereitet Speichermedien jetzt auch unter Windows vor

Tour

none

Summary

The installer mode "Media" now works on Windows with the same scope as on Linux: it finds the Raspberry Pi Imager, lists drives, writes with one administrator prompt, shows progress, cancels, and takes time zone, keyboard and Wi-Fi settings from the PC. macOS follows later.

installer (not elevated)
  list drives again, same path, model and size
  start "installer media-helper" with runas
    media-helper: pseudo console, job object
      media-shim: rpi-imager.exe --cli
  follow the helper log until it ends
  cancel: write the cancel file, never kill the elevated process

Evidence

  • Before: on Windows the Media tab shows "not available". The recorded Windows imager output ends without a done event.
  • After: local Go tests, 595 node tests and 31 e2e tests pass, go vet and build are clean for linux, windows and darwin.

Acceptance on a real PC (Windows 11, build from f850e635, imager 2.0.8)

Passed: missing imager card and winget install, defaults and Wi-Fi password check, drive filter, refused administrator prompt, write with verify, write error after pulling the stick, boot of a Raspberry Pi 3B over LAN and over Wi-Fi only, writing a Debian stick, window mode.

Found and fixed afterwards:

Finding Cause Fix
Used disks looked empty in the erase warning PowerShell 5.1 wraps AccessPaths as {"value":[...],"Count":2} the parser unwraps it, tested with the recorded output
Cancel reported done after 60 s while the imager kept writing wait limit shorter than the buffered writes limit 30 min, job shows "cancelling"
Frozen bar and remaining time the imager reports buffered data countdown, then running clock
Wi-Fi list shrank on the second visit Windows keeps scan results briefly networks of the last 5 minutes are merged
Card stayed mounted, console with token stayed open eject like in Explorer, FreeConsole for a console of its own
Garbled and cut error text, English details OEM code page, first line only UTF-8 console, multi line message

Not tested: system disk as target (VM), boot of a thin client, driver prompt on a fresh PC, SmartScreen on a downloaded exe.

A second run on Windows for cancelling, ejecting, the console window and the error text is still open.

Merge Danger

Door: two-way

Blast Radius: media mode

Linux changes: every write lists the drives a second time right before the imager starts, cancelling and the write screen behave as described above, unknown used space is hidden, and cards under 8 GB get a hint. The other risk is writing to the wrong disk on Windows, guarded by the system disk filter and the target check.

Checks

  • The title is a Conventional Commits subject.
  • scripts/dev/check_tracked_secrets.sh is clean.
  • AI assistance disclosed per AI-DISCLAIMER.md: Claude Sonnet 5.5
  • Suites run locally: go test (installer, webui), go test -race (media, host), npm test and e2e (installer webui), go vet and build for linux, windows and darwin
  • Linked issue: none

@Developer-Simon
Developer-Simon marked this pull request as draft November 25, 2026 22:18
@Developer-Simon
Developer-Simon force-pushed the feat/installer-media-windows branch from ad6a1b4 to 42eba77 Compare November 29, 2026 17:03
Developer-Simon and others added 28 commits November 29, 2026 22:53
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ws imager output

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
zone1970.tab is a copy from tzdata 2026f (public domain). windowszones.txt holds the territory 001 rows of CLDR 48 windowsZones.xml (Unicode license), generated once with a Python one-off: take mapZone other/type pairs with territory=001, rename legacy ids through the tzdata.zi links, map Atlantic/Reykjavik to Etc/UTC and drop zones that are not in zone1970.tab.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…per system

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…of the installer

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Start the installer's media helper with runas so that only the helper
runs elevated. The helper launches the imager and writes its log, which
the installer follows until the exit code is known. Cancelling the
context writes the cancel file. A refused UAC prompt maps to
ErrRightsDenied.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Look for rpi-imager.exe in the known install locations and read its
version from the file's version resource, so the imager is never started
on Windows (that would trigger UAC).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Read disks, partitions and volumes from PowerShell and drop the system
disk. Fail closed: a missing systemDrive is an error, and disks without
known boot or system flags are hidden.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…parsers

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
On Windows the missing-imager card shows the website and a copyable
winget command instead of the Discover link. The card text and the
rights note on the write step carry a platform suffix off Linux.
The fake backend and fakehost gain a platform and an imager-missing flag.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Add an installer-windows job that runs the media, host and installer
command tests on windows-latest and keeps LF line endings in the checkout.
Tests that need Unix mode bits or a Linux shell script skip on Windows.
The installer-cross job also vets each cross-compile target.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The cancel watcher started only after the launcher returned, but the
launcher blocks while the UAC prompt is open. A cancel in that window
could land after the elevated helper had already started the imager.
The watcher now starts before the launch, and a failed launch stops it
before the caller removes the job directory.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…s paths

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…nded

A cancelled write now stays running and reports cancelling until the
imager has actually exited, so the browser does not show a finished
cancel while the stick is still being written. Cancel and rights errors
no longer carry English detail texts. Job folders older than a day are
removed at the start of a write, and the Windows wait limit for a
killed imager is raised to 30 minutes because buffered writes can take
minutes on slow media.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
After a successful write the installer ejects the removable drive itself,
without administrator rights. A failed ejection is only logged.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Developer-Simon and others added 3 commits November 29, 2026 22:53
The imager reports buffered data, so the bar could stand still for
minutes with a frozen remaining time. The estimate now counts down
between two reports, then gives way to a running clock. The bar pulses
while it writes, cancelling is shown, and the administrator note only
stays while the rights step is still open.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@Developer-Simon
Developer-Simon force-pushed the feat/installer-media-windows branch from 2a65337 to b502ec8 Compare November 29, 2026 21:54
@Developer-Simon
Developer-Simon marked this pull request as ready for review November 29, 2026 21:54
@Developer-Simon
Developer-Simon merged commit 96ffa09 into prerelease Nov 29, 2026
24 checks passed
@Developer-Simon
Developer-Simon deleted the feat/installer-media-windows branch November 29, 2026 22:00
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