Fix two disk-setup bugs: byte/gigabyte size mix-up, wrong ownership
1. truncate -s treats a bare number as bytes, not gigabytes - typing "50" at the size prompt (instead of "50G") silently made a 50-byte file, which then failed mkfs.ext4 with "Device size reported to be zero." Added normalize-size: a bare integer answer now gets a "G" suffix appended (matching what the prompts' own defaults imply), anything with an existing suffix passes through unchanged. 2. Every disk-creation step runs through `priv` (sudo/root), so subvolumes and disk images always ended up root-owned - but hermes-vm.service runs as the unprivileged hermes-vm account, which only had read access via the "other" bits. QEMU failed to open system.raw for read-write. Added explicit `chown hermes-vm:hermes-vm` after every creation point (both make-subvol branches, and after each truncate/mkfs) - also self-heals already-existing wrongly-owned disks on a re-run, not just fresh ones. Both confirmed live on hl-fwdesk during tonight's incident. Verified with a unit test of normalize-size and a full sandboxed interactive dry run of `setup` (fake sudo/btrfs/truncate/chown/mkfs.ext4) showing the correct truncate -> chown ordering for both disks. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
1239ea0148
commit
5ea64e88d5
2 files changed
+21
-8
No files matched your search
@@ -806,12 +806,6 @@ in
|
||||
};
|
||||
};
|
||||
|
||||
# =====================================================================
|
||||
# Host GC is now safe: the guest has its own store and shares nothing.
|
||||
# =====================================================================
|
||||
nix.gc.automatic = lib.mkDefault true;
|
||||
nix.gc.options = lib.mkDefault "--delete-older-than 30d";
|
||||
|
||||
environment.systemPackages = [
|
||||
(pkgs.writeShellScriptBin "hermes-vm" ''
|
||||
set -euo pipefail
|
||||
|
||||
Reference in new issue
Block a user