diff --git a/README.md b/README.md index 46d4bbd..8c501bd 100644 --- a/README.md +++ b/README.md @@ -645,12 +645,14 @@ the intended repair, not a last resort. ### Starting completely fresh -`hermenix setup --clean` stops the VM and deletes the existing -`system.raw`/`state.raw`/UEFI vars before walking through setup again — for -when you want a genuinely clean first boot rather than the disk-exists, -skip-ahead path. It leaves the btrfs subvolumes and any snapshots alone -(only the files inside them), and asks you to type `clean` to confirm before -touching anything. +`hermenix setup --clean` stops the VM, deletes the existing +`system.raw`/`state.raw`/UEFI vars, and drops the stale `known_hosts` entry +for the guest (a fresh state disk means a fresh SSH host key on next boot, +so the old entry would otherwise fail with a host-key-mismatch on your next +connect) — then walks through setup again for a genuinely clean first boot, +rather than the disk-exists, skip-ahead path. It leaves the btrfs +subvolumes and any snapshots alone (only the files inside them), and asks +you to type `clean` to confirm before touching anything. --- diff --git a/nu/hermenix.nu b/nu/hermenix.nu index 96e6f6b..0ec7fc0 100644 --- a/nu/hermenix.nu +++ b/nu/hermenix.nu @@ -154,7 +154,12 @@ def "main setup" [ do -i { priv rm "-f" $"($base)/system/system.raw" } | complete | ignore do -i { priv rm "-f" $"($base)/state/state.raw" } | complete | ignore do -i { priv rm "-f" $"($base)/OVMF_VARS.fd" } | complete | ignore - ok "cleaned existing disk images" + # A fresh state disk means a fresh SSH host key on next boot - drop the + # stale known_hosts entry now so the next connect doesn't fail on a + # host-key mismatch. Not run through priv: this is the invoking user's + # own ~/.ssh/known_hosts, not a root-owned path. + do -i { ^ssh-keygen -R hermes } | complete | ignore + ok "cleaned existing disk images and stale known_hosts entry" } let parent = ($base | path dirname)