diff --git a/bin/box b/bin/box index 24c24bb..6511657 100755 --- a/bin/box +++ b/bin/box @@ -472,7 +472,7 @@ wait_agent() { local n="$1" i echo "box: waiting for instance agent..." for i in $(seq 1 90); do - if incus exec "$n" -- true >/dev/null 2>&1; then return; fi + if incus exec "$n" -- true /dev/null 2>&1; then return; fi [ "$i" -eq 90 ] && die "instance agent never came up (incus console $n to inspect)" sleep 2 done @@ -500,7 +500,7 @@ reset_identity() { systemd-machine-id-setup >/dev/null 2>&1 || dbus-uuidgen > /etc/machine-id ln -sf /etc/machine-id /var/lib/dbus/machine-id test -s /etc/machine-id - ' || die "could not reset the clone's machine-id" + ' &2 echo "box: cloud-init FAILED in $name. What it says:" >&2 - incus exec "$instance" -- cloud-init status --long 2>&1 | sed 's/^/ /' >&2 + incus exec "$instance" -- cloud-init status --long &1 | sed 's/^/ /' >&2 echo >&2 echo "box: the errors, from the box's log:" >&2 incus exec "$instance" -- sh -c \ "grep -iE '^(E:|Err:)|Temporary failure|Could not resolve|Unable to fetch' /var/log/cloud-init-output.log | tail -8" \ - 2>/dev/null | sed 's/^/ /' >&2 + /dev/null | sed 's/^/ /' >&2 echo >&2 echo "box: '$name' is still up — inspect it, then delete it:" >&2 echo " box incus $name -- exec {} -- tail -50 /var/log/cloud-init-output.log" >&2 diff --git a/drill/wipe.sh b/drill/wipe.sh index d16e6d5..e368f5a 100644 --- a/drill/wipe.sh +++ b/drill/wipe.sh @@ -3,11 +3,13 @@ # pre-0.4.0 claudebox, so the next drill run starts from a truly bare host and # its verdict means something. # -# bash drill/wipe.sh # asks first +# bash drill/wipe.sh # asks first; KEEPS cached images (an +# # image is upstream's artifact — wiping +# # it buys nothing but a re-download) # bash drill/wipe.sh --yes # no prompt -# bash drill/wipe.sh --purge-storage # also delete cached images AND the -# # 'default' storage pool, so setup-host -# # exercises its pool bootstrap (#29) +# bash drill/wipe.sh --purge-storage # also delete the 'default' storage +# # pool (and the images inside it), so +# # setup-host exercises its bootstrap (#29) # # What teardown-host.sh does NOT cover, this does: instances the drill names # but never tagged, instances of either tag generation, cached images, and @@ -40,8 +42,8 @@ This wipes EVERY trace of box/claudebox from this host ($(hostname)): · networks boxnet + claudenet, ACLs box-isolate + claude-isolate · profiles box-net + claude-dev · firewall units, scripts and nft tables of BOTH name generations - · every cached Incus image (the next mint re-downloads) -$( [ "$PURGE_STORAGE" = 1 ] && echo " · the 'default' storage pool (--purge-storage)" ) +$( [ "$PURGE_STORAGE" = 1 ] && echo " · the 'default' storage pool AND its cached images (--purge-storage)" \ + || echo " · (cached images are KEPT — the next mint stays fast; --purge-storage removes them with the pool)" ) Uncommitted work inside any box is LOST. Only do this on a drill host. EOF [ -t 0 ] || { echo "wipe: no TTY to confirm on — pass --yes if you mean it." >&2; exit 2; } @@ -79,13 +81,16 @@ if command -v incus >/dev/null; then incus network acl delete "$acl" >/dev/null 2>&1 && say "deleted ACL $acl" done - # --- cached images: the pool's other tenants ------------------------------- - for f in $(incus image list -f csv -c f 2>/dev/null); do - incus image delete "$f" >/dev/null 2>&1 && say "deleted image $f" - done - - # --- the pool itself (opt-in): lets setup-host's bootstrap run for real ---- + # --- cached images: NOT wiped by default ----------------------------------- + # An image is upstream's artifact, content-addressed by fingerprint — not a + # drill artifact. Deleting it buys zero cleanliness and costs the next mint + # a full re-download. It only goes when the pool it lives in goes. if [ "$PURGE_STORAGE" = 1 ]; then + # --- the pool (opt-in): lets setup-host's bootstrap run for real --------- + # Images live in the pool and block its deletion — they go first. + for f in $(incus image list -f csv -c f 2>/dev/null); do + incus image delete "$f" >/dev/null 2>&1 && say "deleted image $f" + done incus profile device remove default root >/dev/null 2>&1 && say "removed default profile's root device" if incus storage delete default >/dev/null 2>&1; then say "deleted storage pool 'default' — setup-host will rebuild it (btrfs where it can)"