Skip to content

Reap abandoned build volumes and clarify stale-volume errors#178

Open
jetm wants to merge 2 commits into
mainfrom
jtia/reap-abandoned-avo-volumes
Open

Reap abandoned build volumes and clarify stale-volume errors#178
jetm wants to merge 2 commits into
mainfrom
jtia/reap-abandoned-avo-volumes

Conversation

@jetm

@jetm jetm commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Problem

Each project gets a per-project Docker volume (avo-<uuid>) recorded in its .avocado-state file. Deleting a project directory by hand drops the folder but not the volume, so avo-* volumes accumulate unbounded. Worse, a stale or half-populated volume makes avocado build fail during runtime build dev with a cryptic grep: .../rootfs-work/etc/passwd: No such file, naming neither the cause nor the fix.

Solution

Reclaim provably-abandoned avo-* volumes at the moment a fresh volume is minted, and guard the rootfs build so a half-populated sysroot fails fast with an actionable message instead of the grep noise.

Key changes

  • Auto-reap abandoned avo-* volumes in get_or_create_volume (the natural GC point, and the only path already holding a container-tool handle, so init and the pure-filesystem commands stay docker-free). Best-effort: a daemon-down or held-volume failure is swallowed and never blocks a build.
  • Share one classifier, avo_abandonment_reason, between the reap and avocado prune so the two paths cannot drift on what "abandoned" means.
  • Guard the rootfs build: if rootfs-work lacks /etc/passwd after the sysroot copy, exit with a message pointing at avocado clean and avocado prune.
  • Tests: 5 classifier cases plus generated-script assertions (guard present and ordered before user creation).

Reviewer notes

  • Behavior change: install/build now delete provably-dead avo-* volumes (source dir gone, no .avocado-state, or state pointing at a different volume). Active project volumes are never touched.
  • Verified against the QEMU getting-started flow: a clean build still succeeds, and the guard fires with the actionable message on a simulated half-populated sysroot.
  • Companion docs troubleshooting note is a separate peridio/docs PR.

jetm added 2 commits July 8, 2026 09:28
Each project gets a per-project docker volume (avo-<uuid>) recorded in
its .avocado-state file. Deleting the project directory by hand drops
the folder but not the volume, so the volumes pile up unbounded: nothing
reclaimed them short of a user knowing to run `avocado prune`.

Sweep provably-abandoned avo-* volumes at the moment a fresh volume is
minted in get_or_create_volume. That is the natural GC point (a new
project is starting) and the only path already holding a container-tool
handle, so init and the other pure-filesystem commands stay docker-free.
The sweep is best-effort: a daemon-down or held-volume failure is
swallowed so it can never block a build. Reuse a single classifier,
avo_abandonment_reason, from both the reap and `avocado prune` so the two
paths cannot drift on what "abandoned" means.
The rootfs build copies the sysroot into rootfs-work and immediately
runs the user-creation step, which greps /etc/passwd. When a build
volume is stale or a prior install was interrupted, the sysroot can
carry /usr but not /etc/passwd; the copy then also lacks it, and the
user surfaced a cryptic `grep: .../rootfs-work/etc/passwd: No such
file` with no hint at the cause or the fix.

Check for the base rootfs /etc/passwd right after the copy, before the
user-creation step, and exit with a message that names the stale-volume
cause and the recovery. Point at both `avocado clean` and `avocado
prune`: clean drops the active project's volume, but a reporter found
clean alone insufficient and needed prune to clear an abandoned volume
that was shadowing the build.

Signed-off-by: Javier Tia <javier@peridio.com>
@jetm

jetm commented Jul 10, 2026

Copy link
Copy Markdown
Contributor Author

@lee-reinhardt could you take a look at this one when you get a chance?

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