Skip to content

Commit 27a5d42

Browse files
Kabuki94claude
andcommitted
feat(driver): bootc switch + reboot at end so MiOS-DEV ≡ MiOS
Operator's contract (cap-locks earned by my prior partial implementations): > "podman-MiOS-DEV includes EVERYTHING all MiOS images contain -- I said > fucking everything!!! MiOS is self replicating and needs EVERYTHING > in all Deployment types -- ESPECIALLY THE DEVELOPMENT ENVIRONMENT > FOR MIOS!!!!!!!!! podman-MiOS-DEV!!!!!" Codified as durable feedback memory (feedback_mios_dev_equals_mios.md): podman-MiOS-DEV is MiOS. Same image, same packages, same containers, same flatpaks, same models, same units. The only thing that distinguishes MiOS-DEV from a deployed MiOS host is its role as the *development substrate* for the project itself. Symptom that surfaced this gap: operator inside MiOS-DEV ran `epiphany` and `nautilus` (canonical SSOT toml/html editor + file manager); both fell through to `/usr/libexec/mios/flatpak-launch` which exec'd `flatpak` -- which isn't installed on the bare podman-machine-os base. The MiOS file overlay is in place (operator confirmed `ls /` showed the full MiOS root + dashboard banner rendered correctly), but the package layer, the flatpak layer, the container-image-pulled layer, and the model-baked layer are all missing. This commit closes the self-replication loop in the build-driver: After `podman build -t localhost/mios:latest ...` succeeds: sudo bootc switch --transport containers-storage \ localhost/mios:latest sudo systemctl reboot The bootc switch consumes the image directly from local podman storage (no registry round-trip, no signature ceremony for a local build). After reboot, MiOS-DEV reboots INTO the just-built MiOS image -- every layered RPM, every flatpak runtime+app (incl. Epiphany for SSOT editing), every Quadlet container image pulled, every ollama model baked, every systemd unit registered. Three branches by capability detection: bootc present + switch succeeds: * stages the switch * shows a summary box * prompts operator to press Enter to reboot now bootc present + switch fails: * logs the failure with WARN * shows a summary box noting parity is NOT yet applied * preserves the just-built OCI image for re-attempts bootc not installed (bare podman-machine-os never had it): * logs WARN * shows a summary box with the recovery recipe: sudo rpm-ostree install bootc sudo systemctl reboot # re-invoke /usr/libexec/mios/mios-build-driver The third branch is what the operator will hit on the FIRST run of the driver against a fresh MiOS-DEV (because the bare podman-machine- os doesn't ship bootc). After they install bootc + reboot + re-run, the driver closes the loop and MiOS-DEV becomes MiOS for keeps. A subsequent migration chunk will make Phase 3's quadlet-overlay auto-install bootc + run mios-build-driver itself, so the operator doesn't need a manual rpm-ostree dance on first ignition. For now, documenting the recovery path in the summary box keeps the contract visible to anyone hitting this state. Bash syntax validated with `bash -n`: 0 errors. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent c1b7693 commit 27a5d42

1 file changed

Lines changed: 81 additions & 11 deletions

File tree

usr/libexec/mios/mios-build-driver

Lines changed: 81 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -134,15 +134,85 @@ else
134134
_fail "podman build failed -- see $LOG_FILE"
135135
fi
136136

137+
# ── Self-replication closure: MiOS-DEV becomes MiOS ──────────────────────────
138+
# Per feedback_mios_dev_equals_mios.md, podman-MiOS-DEV must contain
139+
# EVERYTHING that any MiOS deployment contains -- every package, every
140+
# Quadlet container image, every flatpak runtime + app, every ollama
141+
# model, every systemd unit. The cleanest way to achieve full feature
142+
# parity is `bootc switch` the running dev distro to the OCI image we
143+
# JUST built, then reboot. After reboot, MiOS-DEV is bit-for-bit MiOS.
144+
#
145+
# Why this is the right shape:
146+
# * The MiOS OCI image (localhost/mios:latest) IS the canonical
147+
# source of truth for "what MiOS contains". Anything that's in the
148+
# image gets into the dev distro automatically. No separate
149+
# dev-distro install path; no drift between "MiOS" and "MiOS-DEV".
150+
# * `bootc switch --transport containers-storage` consumes the image
151+
# directly from the local podman storage we just built into. No
152+
# registry round-trip, no signature ceremony for a local build.
153+
# * The reboot is required because bootc-style image-mode systems
154+
# apply layered changes on next boot. WSL2 distros support
155+
# `wsl --terminate <distro>` from the Windows side, OR
156+
# `systemctl reboot` from inside (depending on systemd's WSL
157+
# support). The latter is cleaner; the former is the fallback.
158+
#
159+
# This also closes the feature gap the operator hit when `epiphany`
160+
# /`nautilus` failed with "flatpak: not found" -- post-bootc-switch,
161+
# flatpak + every flatpak app the production image carries is in
162+
# place, and Epiphany works for SSOT toml/html editing via WSLg.
163+
_log ""
164+
_log "── Self-replication closure: bootc switch to localhost/mios:latest ──"
165+
_log "MiOS-DEV will reboot into the just-built MiOS image. After reboot,"
166+
_log "podman-MiOS-DEV IS MiOS -- every package, container, flatpak, model,"
167+
_log "and systemd unit, identical to a freshly-deployed MiOS host."
168+
169+
if command -v bootc >/dev/null 2>&1; then
170+
_log "running: sudo bootc switch --transport containers-storage localhost/mios:latest"
171+
if sudo bootc switch --transport containers-storage localhost/mios:latest 2>&1 | tee -a "$LOG_FILE"; then
172+
_log "bootc switch staged successfully -- new image will activate on reboot"
173+
echo
174+
echo " +-- MiOS build complete -- self-replication closure ready --+"
175+
echo " | OCI image: localhost/mios:latest (just built) |"
176+
echo " | Build log: $LOG_FILE"
177+
echo " | |"
178+
echo " | bootc switch is staged. The next reboot of MiOS-DEV will |"
179+
echo " | activate the new image -- after that, MiOS-DEV IS MiOS |"
180+
echo " | with every package, container, flatpak, and model in |"
181+
echo " | place (Epiphany / Nautilus / GNOME runtime / mios-forge / |"
182+
echo " | mios-ai / mios-ollama / mios-searxng / mios-hermes / |"
183+
echo " | mios-webui / etc). |"
184+
echo " +------------------------------------------------------------+"
185+
echo
186+
echo " Press Enter to reboot MiOS-DEV now (recommended), or Ctrl-C to defer."
187+
read -r _ || true
188+
_log "rebooting MiOS-DEV to activate the new image..."
189+
sudo systemctl reboot 2>/dev/null || {
190+
_log "systemctl reboot failed -- run \`wsl --terminate podman-MiOS-DEV\` from Windows then \`wsl -d podman-MiOS-DEV\` to reactivate"
191+
}
192+
else
193+
_log "WARN: bootc switch failed -- the OCI image was built successfully but isn't applied to the running distro"
194+
_log "WARN: full feature parity (flatpak + every package + every container) is NOT yet in podman-MiOS-DEV"
195+
_log "WARN: re-run this driver once the bootc switch issue is resolved, OR rebuild the WSL distro from the freshly-built image"
196+
echo
197+
echo " +-- MiOS build complete -- bootc switch failed -------------+"
198+
echo " | OCI image: localhost/mios:latest (built) |"
199+
echo " | Build log: $LOG_FILE"
200+
echo " | Status: switch FAILED -- runtime parity not yet |"
201+
echo " | applied to MiOS-DEV. See log for details. |"
202+
echo " +------------------------------------------------------------+"
203+
fi
204+
else
205+
_log "WARN: bootc binary not found -- MiOS-DEV's base image lacks bootc"
206+
_log "WARN: cannot close the self-replication loop on this run"
207+
_log "WARN: install bootc into the dev distro (rpm-ostree install bootc + reboot) and re-run this driver"
208+
echo
209+
echo " +-- MiOS build complete -- bootc not installed -------------+"
210+
echo " | OCI image: localhost/mios:latest (built) |"
211+
echo " | Build log: $LOG_FILE"
212+
echo " | Status: bootc not present in MiOS-DEV; run |"
213+
echo " | 'sudo rpm-ostree install bootc' + reboot, |"
214+
echo " | then re-invoke /usr/libexec/mios/ |"
215+
echo " | mios-build-driver to close the loop. |"
216+
echo " +------------------------------------------------------------+"
217+
fi
137218
_log "build-driver complete"
138-
echo
139-
echo " +-- MiOS build complete -----------------------------------+"
140-
echo " | OCI image: localhost/mios:latest |"
141-
echo " | Build log: $LOG_FILE"
142-
echo " | |"
143-
echo " | Next chunks will produce: WSL2/g .tar, Hyper-V .vhdx, |"
144-
echo " | QEMU qcow2, Live-CD/USB ISO, USB installer, RAW image. |"
145-
echo " +----------------------------------------------------------+"
146-
echo
147-
echo " Press Enter to close this terminal, or run \`bash\` to drop into a shell..."
148-
read -r _ || true

0 commit comments

Comments
 (0)