installer 1.38.0 on main (NOT tagged): an appliance install stops on a system disk below 200 GB; --accept-small-disk for the operator (D83, R-1370); R-1398 filed

Claude-Session: https://claude.ai/code/session_0159rPz1ZhFKsS53msqPYxtS
This commit is contained in:
admin committed 2026-11-15 14:32:13 +01:00
1 parent 44715fb38b
commit 92853bed2c
6 files changed
+370 -5

No files matched your search

@@ -415,7 +415,7 @@ below 200 GB — refuse, or warn (R-1370). demo-hp (128 GB) stays as a test box.
| The smallest disk is ruled (200 GB, `09` §3 decision 295). Nothing enforces it: what the installer does below 200 GB is a written design with a pick (refuse, with one flag for the operator) — §14.5; it waits for the operator's yes | R-1370 |
| What to do by hand when a disk is full | `runbooks/disk-full.md` (R-1369) |
### 14.5 What the installer does on a system disk below 200 GB `[DESIGN — proposed, not built]` (the open point of D75, `09` §3 decision 295, R-1370; written 2026-11-14)
### 14.5 What the installer does on a system disk below 200 GB `[FACT — built, not released: installer v1.38.0 on `main`, not tagged, 2026-11-15]` (D75 and D83 = option A, `09` §3 decisions 295 and 308, R-1370; designed 2026-11-14)
**The ruling.** The smallest system disk is 200 GB, with or without a backup drive. Open: what the installer does
below it — refuse, or warn.
@@ -462,7 +462,40 @@ by a person who was told.
refused machine is exactly as it was. One test per row above in `scripts/test_hostinstall.py`, the sizes fed through a
seam (no real disk).
**If nothing is decided:** the installer accepts any disk, as today; the 200 GB is a sentence in a document.
**Ruled 2026-11-15 (D83): option A, with the flag.**
**As built (installer v1.38.0, `check_system_disk`; not tagged, not run on a machine).**
| Row of the table above | Built | Test (`scripts/test_hostinstall.py`) |
|---|---|---|
| An appliance below 200 × 10⁹ bytes | stops, first thing in the preflight; only `pvs`, `lsblk` and one `/sys/block` file were read | `test_small_disk_appliance_is_refused_before_anything_changes`, `…_check_is_wired_first_in_the_preflight_and_recorded` |
| Exactly 200 GB by the label; a virtual disk of 200G | pass; one sector less does not | `…_the_line_is_200_times_ten_to_the_nine_bytes` |
| The flag `--accept-small-disk` | goes on, prints the cost, `small_disk: true` and `system_disk_bytes` in the install state, `"small_disk":true` in the enrolment request | `…_flag_goes_on_prints_the_cost_and_marks_it`, `…_is_told_to_the_hub_at_the_enrolment` |
| A BYO host | a warning, never a stop — also when the size cannot be read | `…_byo_host_is_warned_never_refused` |
| A reinstall of a box that was accepted earlier | the same rule: the check reads no earlier record | the same tests (no state is read by the check) |
| The size cannot be read (no `pve` group, two physical volumes, a RAID, no size) | appliance: stops and names the flag; with the flag it goes on, recorded as small with size „unknown” | `…_size_that_cannot_be_read_refuses_and_names_the_flag` |
| A small system disk and a large second one | the system disk decides, in both directions | `…_a_large_second_disk_does_not_help` |
| The existing 120 GiB pool warning | stays | `test_lvm_minimum_is_named_as_what_it_does` |
| The public image, nobody watching | **NOT built — R-1398.** The first-boot unit runs the installer again until it succeeds, so a refused machine prints the refusal on its own screen every 30 seconds; the hub is not told why, and the hub does not read `small_disk` | — |
**The sentences, as built (the installer's output, English only — the installer has no Hungarian text):**
- The refusal: „This machine's system disk is 128 GB. Felhom needs 200 GB. Nothing was changed. (An operator can
install a small test box with --accept-small-disk.)”
- The size cannot be read: „Cannot read the system disk's size (no single disk under the 'pve' volume group). Felhom
needs a system disk of 200 GB. Nothing was changed. An operator can go on with --accept-small-disk.”
- With the flag: „--accept-small-disk: this machine's system disk (/dev/sda) is 128 GB, below the 200 GB that Felhom
needs.” and „The cost: the guest gets less space than a household is promised, and the box's local copies can stop
when the disk fills. Recorded as small_disk.”
- A BYO host: „this machine's system disk (/dev/sda) is 128 GB. Felhom needs 200 GB: with less, the local copies of
the box can stop when the disk fills. The install goes on (this host is yours).”
**For the release session — how the two small machines are installed after this.** demo-hp (128 GB): a reinstall
needs `--accept-small-disk`; the box that runs today is not touched by the rule (the check runs only in an install).
The fresh-install proof VM (64 GiB on 2026-11-15): make its first disk 200G — on a `dir` storage the file is sparse,
so it costs what is written, not 200 GB — and it then proves the path a household takes, with no flag. One more
proof for that session: the same VM with a 64G disk and `--preflight-only` must stop with the sentence above, and a
`qm config` and a disk listing before and after must be equal.
## Decisions in code no section records [DESIGN — confirmed by the operator 2026-10-25 (D44 = all picks, R-1265)]
@@ -0,0 +1,61 @@
== MUTATION: the appliance refusal is a warning
RED on the mutant: 3 failing line(s)
FAIL test_small_disk_a_large_second_disk_does_not_help -- [WARN] This machine's system disk is 128 GB. Felhom needs 200 GB. Nothing was changed. (An operator can install a small test box with --accept-small-disk.)
FAIL test_small_disk_appliance_is_refused_before_anything_changes -- a 128 GB appliance install went on: rc=0 [WARN] This machine's system disk is 128 GB. Felhom needs 200 GB. Nothing was changed. (An operator can install a small
FAIL test_small_disk_the_line_is_200_times_ten_to_the_nine_bytes -- 199999999488 bytes: passes=True wanted False: [WARN] This machine's system disk is 199 GB. Felhom needs 200 GB. Nothing was changed. (An operator can install a sm
== MUTATION: the line is 200 GiB, not 200 x 10^9
*** NOT A RED-PROOF ***: 0 failing line(s)
== MUTATION: the compare lets one sector less pass (-gt against min-512)
RED on the mutant: 1 failing line(s)
FAIL test_small_disk_the_line_is_200_times_ten_to_the_nine_bytes -- 199999999488 bytes: passes=True wanted False: [INFO] system disk: /dev/sda, 199 GB (the minimum is 200 GB)
== MUTATION: a byo host is refused like an appliance
RED on the mutant: 1 failing line(s)
FAIL test_small_disk_byo_host_is_warned_never_refused -- a byo host was stopped: [ERROR] This machine's system disk is 128 GB. Felhom needs 200 GB. Nothing was changed. (An operator can install a small test box with --accept-small
== MUTATION: the flag goes on without marking small_disk
RED on the mutant: 1 failing line(s)
FAIL test_small_disk_flag_goes_on_prints_the_cost_and_marks_it -- [WARN] --accept-small-disk: this machine's system disk (/dev/sda) is 128 GB, below the 200 GB that Felhom needs.
== MUTATION: the cost is not printed
RED on the mutant: 1 failing line(s)
FAIL test_small_disk_flag_goes_on_prints_the_cost_and_marks_it -- the cost is not printed: [WARN] --accept-small-disk: this machine's system disk (/dev/sda) is 128 GB, below the 200 GB that Felhom needs.
== MUTATION: an unreadable size passes on an appliance
*** NOT A RED-PROOF ***: 0 failing line(s)
== MUTATION: two physical volumes: the first one is taken
RED on the mutant: 1 failing line(s)
FAIL test_small_disk_size_that_cannot_be_read_refuses_and_names_the_flag -- two physical volumes: the install went on: [INFO] system disk: /dev/sda, 200 GB (the minimum is 200 GB)
== MUTATION: a RAID's size is taken as a disk's
RED on the mutant: 1 failing line(s)
FAIL test_small_disk_size_that_cannot_be_read_refuses_and_names_the_flag -- a RAID under the group: the install went on: [INFO] system disk: /dev/md0, 200 GB (the minimum is 200 GB)
== MUTATION: the largest disk is read, not the system disk
RED on the mutant: 2 failing line(s)
FAIL test_small_disk_a_large_second_disk_does_not_help -- [INFO] system disk: /dev/sda, 2000 GB (the minimum is 200 GB)
FAIL test_small_disk_size_that_cannot_be_read_refuses_and_names_the_flag -- no size file: the install went on: [INFO] system disk: /dev/sda, 200 GB (the minimum is 200 GB)
== MUTATION: the check runs at the END of the preflight
RED on the mutant: 1 failing line(s)
FAIL test_small_disk_check_is_wired_first_in_the_preflight_and_recorded -- step_preflight no longer calls check_system_disk
== MUTATION: the state does not record small_disk
RED on the mutant: 1 failing line(s)
FAIL test_small_disk_check_is_wired_first_in_the_preflight_and_recorded -- the preflight does not record small_disk in the install state
== MUTATION: the flag is not parsed
RED on the mutant: 1 failing line(s)
FAIL test_small_disk_check_is_wired_first_in_the_preflight_and_recorded -- the flag is not parsed
== MUTATION: the hub is not told
RED on the mutant: 1 failing line(s)
FAIL test_small_disk_is_told_to_the_hub_at_the_enrolment -- the enrolment does not tell the hub: curl -sS -w
== MUTATION: every enrolment says small_disk
RED on the mutant: 1 failing line(s)
FAIL test_small_disk_is_told_to_the_hub_at_the_enrolment -- curl -sS -w
the real file: 0 failing line(s)
15 mutations, 2 not a red-proof
## two mutants redone
== MUTATION: the line is 200 GiB, not 200 x 10^9 (redone: the test set the number itself; it reads the installer's now)
RED on the mutant: 2 failing line(s)
FAIL test_small_disk_flag_goes_on_prints_the_cost_and_marks_it -- [WARN] --accept-small-disk: this machine's system disk (/dev/sda) is 200 GB, below the 200 GB that Felhom needs.
FAIL test_small_disk_the_line_is_200_times_ten_to_the_nine_bytes -- 200049647616 bytes: passes=False wanted True: [ERROR] This machine's system disk is 200 GB. Felhom needs 200 GB. Nothing was changed. (An operator can install a s
== MUTATION: an unreadable size passes on an appliance (redone: the mutant fell through to the other refusal; the test now asks for the right one)
RED on the mutant: 1 failing line(s)
FAIL test_small_disk_size_that_cannot_be_read_refuses_and_names_the_flag -- no pve volume group: the refusal is not the 'cannot read' one: [WARN] Cannot read the system disk's size (no single disk under the 'pve' volume group). Fe
the real file: 0 failing line(s)
2 mutations, 0 not a red-proof
+1
View File
@@ -283,6 +283,7 @@ stopping line that lies.
| **R-1368** | Box system & updates | P3 | **Five places on the host's system disk only grow: nothing deletes them and no rule says how many to keep.** MEASURED 2026-11-10 on demo-hp, demo-felhom and Tester 1 (the space list, `documentation/audits/space-list-2026-11-10/TABLE.md` places H5, H6, H9, H12, H13). (1) **Old kernels** (`/lib/modules`, `/boot`): 8 / 8 / 3 kernels = 8.15 / 8.15 / 3.05 GB. The ring-0 boxes got 7 kernels in 37 days and no kernel was ever removed: the update wrapper refuses a plan that removes a package (`11-os-updates.md` rule R4), and nothing runs `apt autoremove` (searched: architecture folder, both registers, runbooks, three source trees — 0 hits). The N100's system disk grew 4.6 GiB in 26 days, about a kernel a week. (2) **The agent's self-update folder** `/var/lib/felhom-agent/selfupdate`: 49 / 48 / 33 binaries = 740 / 724 / 509 MB, one for each agent version the box ever got; no document names the folder. (3) **Guest template archives** `vzdump-lxc-9100-*` in `/var/lib/vz/dump`: 1 / 4 / 1 = 0.65 / 2.56 / 0.65 GB. (4) **Old agent binary copies** `/usr/local/bin/felhom-agent.bak-*`: 1 / 11 / 0 files, up to 155 MB. (5) **Logs of failed whole-guest backup runs** in the dump folder (small; 9 on demo-hp). **Members (answers marked N):** H5-3, H5-4, H6-3, H9-3, H9-4, H9-8, H12-3, H12-4, H13-3, H13-4. | NARROWED — **2026-11-15 06:35 — the FIRST real night removal: the N100, by itself, at 05:58 CET.** 8 kernels before, 2 after (it kept 7.0.14-26 and 7.0.14-28, the running one), 6 packages purged in 35 s, 6.81 GB gained (the wrapper's own figure; 65.1 GB free after), 0 left-over paths; the default kernel and the pinned file are unchanged (the file's time is still 2026-11-08); the hub's „Kernel step” cell reads „cleaned”; 0 failed units, 9 of 9 containers healthy, clock +0.06 s to DooPlex. demo-hp had a QUIET night (2 installed, nothing to remove) — it does not count; its 6 old kernels went on 2026-11-10 at 13:51, by day. **D82 count: the N100 1 of 2, demo-hp 0 of 2.** demo-hp can count only after two more kernels arrive (it holds 2 and keeps 2). Evidence: `audits/night-build-2026-11-14/E/`. Earlier: NARROWED — **2026-11-14 16:06 — RULED (D82, `09` §3 decision 307): a household's box may remove its old kernels, after two REAL night removals on each ring-0 box (the N100 and demo-hp); quiet nights do not count. Count so far: the N100 0, demo-hp 0 (the Tester 1 removal of 2026-11-14 was started by hand and is not a night). It needs a later agent release to switch it on.** Earlier: NARROWED — **2026-11-14 (release 2a): the old-kernel part is BUILT — agent 0.174.0, vouched 15:21 CET (`11` §5.11.1 `[FACT — built]`).** A ring-0 box removes its old kernels at night by the wrapper's own rule. On boxes: a real removal on Tester 1 (3 → 2 kernels, 1.12 GB, 8.5 s; the default, the pinned file, the generators and the state file unchanged; a second run removed nothing; one clean restart) — started by hand with a ring-0 mark set for the test on the operator's yes, because a night cannot be started by day (R-1394); dry runs on demo-hp (nothing to remove; refusals P1, P2, P3) and the N100 (6 of 8 will go). **LEFT for this part: the step by the agent at night — read the N100's and demo-hp's night of 2026-11-15; then a ruling for ring-1 boxes (D82).** Evidence `audits/release-2a-2026-11-14/`. The other four places of this row are unchanged. Earlier: OPEN — filed 2026-11-10 (space list) **2026-11-10 12:22 — RULED (D67 = yes, as a separate step; `09` §3 decision 286):** the box may remove old kernels by itself; rule R4 stays as it is for update plans; the clean-up is its own step with its own narrow rule (old kernel packages only, only after a good boot on the newest kernel). **2026-11-10:** the endings list leans on this row (`documentation/audits/endings-list-2026-11-10/TABLE.md` EA01-4, EA23-4, EA24-4, EA26-4). **2026-11-10 — the kernel part's fix shape is PROVEN by hand on demo-hp** (`documentation/audits/kernel-cleanup-spike-2026-11-10/`; design `11-os-updates.md` §5.11.1, not built): the rule removed 6 of 8 kernels and nothing else, 6.4 GB gained, boot settings unchanged, one orderly reboot back on the same kernel, a second run removed nothing. Not proven: a box whose running kernel is not its newest; a boot of the kept old kernel. **2026-11-10 — part (2) FIXED IN SOURCE, NOT RELEASED** (felhom-agent `776025c8`): after an update that ended well the agent removes every staged binary but the running version's; nothing is removed while an update is pending. `TestPrune_*` (6 tests, one runs the wrapper's real commit and rollback verbs), red seen three times. A box cleans its folder at the first good update after the release that carries it. Part (4), the `.bak-*` copies, is not reached (root-owned, made by a person). Parts (1), (3), (5) stay open. **2026-11-10 14:46 UTC — the kept old kernel boots:** on demo-hp the one-shot flag booted 7.0.14-26-pve to a healthy Line truncated
| **R-1369** | Box system & updates | P3 | **When a disk is full there is no written way out: no runbook and no self-repair, for the host system disk, the thin pool, the guest disks or a data drive.** Found 2026-11-10 (the space list, `documentation/audits/space-list-2026-11-10/TABLE.md`, question 7). One missing runbook, seen from 21 places; the search of the runbooks folder for a disk-full procedure gave 0 hits (`evidence/searches.txt` S6). The alarms exist (hub: 90 / 95 % host disk, 85 / 90 % thin pool; controller: 85 / 95 % on the data volume and each drive) but they end in a mail, not in a step. For three small places nobody wrote what fails when they are full (EFI partition, host and guest temp folders). **Members (answers marked N):** H1-7, H2-7, H5-7, H9-7, H10-5, H10-7, H12-7, H13-7, H15-5, G1-7, G2-7, G7-7, G12-7, G13-7, G14-7, G17-5, D1-7, D2-7, D3-7, D6-7, D7-7, D8-7, D9-7, D10-7. | OPEN — filed 2026-11-10 (space list) **2026-11-10 (afternoon) — the runbook is written:** `documentation/runbooks/disk-full.md`, five parts, each hand step marked PROVEN (date and evidence; all on demo-hp) or NOT PROVEN. Still open: one rehearsal of the whole runbook on demo-hp; the NOT PROVEN steps (copies on a former target, template archives, the `.bak-*` binaries, the guest root disk); what fails when the EFI partition or a temp folder is full. | — | Docs: one runbook „a disk is full” with one section per disk (host system disk, thin pool, guest root, data volume, data drive): what to look at first, what is safe to delete (the places of R-1368 and R-1367), what is never deleted by hand (household data, the kept-data rulings). Rehearse it once on demo-hp. | CC |
| **R-1370** | Box system & updates | P3 | **The host's system disk has no space budget: no document says how much the host's own files may take, and the installer's sizing rule covers the guest only.** Found 2026-11-10 (the space list, `documentation/audits/space-list-2026-11-10/TABLE.md` place H1, answer H1-3; search S5 — 0 hits). Today: demo-hp 58 % of 41 GB, N100 38 % of 101 GB, Tester 1 34 % of 63 GB — and the parts that grow are the journal (R-1367), old kernels and agent binaries (R-1368), old backup copies (R-1087) and the local whole-guest copy (R-548). Second half, known but with no row until now: on a small disk the guest's own guards read the guest's 70 GiB while the thin pool behind it holds 54 GiB (demo-hp: 102 GiB promised on a 53.9 GiB pool, 70.67 % used), so only the hub's thin-pool alarm stands before a full pool. **Member:** H1-3. | OPEN — **2026-11-15 12:49 — RULED (D83 = refuse, with one named flag; `09` §3 decision 308).** Fix shape: the installer reads the size of the disk that holds the `pve` volume group before any change; below 200 × 10⁹ bytes an appliance install stops with the designed sentence; `--accept-small-disk` goes on, prints the cost, records `small_disk: true`; a BYO host is warned only; a size that cannot be read refuses on an appliance and names the flag (`16` §14.5). Earlier: OPEN — **2026-11-14 (night build):** the open point of D75 has a written design with a pick, not built: `16-storage-physical-identity.md` §14.5 — refuse below 200 GB on an appliance install, with one named flag for the operator; warn only on a BYO host; 8 edge cases. It waits for the operator's yes. OPEN — filed 2026-11-10 (space list) **2026-11-10 12:22 — RULED (D69 = yes; `09` §3 decision 288):** the section goes inside `16-storage-physical-identity.md`, no new document. **2026-11-10 (afternoon) — the section is written:** `16-storage-physical-identity.md` §14 (45 places, the list „no limit, by ruling”, the budget, the open design points); `PROMPT-TEMPLATE.md` §N.5 keeps it true. The budget from measured numbers: the root needs about 14 GB when the whole-box copies go to a backup drive, and 28–54 GB at keep 3 when they do not. **D75 (for the operator):** the smallest system disk Felhom accepts. CC's pick: 128 GB only with a backup drive, 200 GB without one. The other option, 128 GB always, lets a box with many apps and no backup drive stop its local copies. With no ruling the installer accepts any disk. Open after the ruling: the installer's refusal. **2026-11-10 15:19 — RULED (D75 = one number, 200 GB, with or without a backup drive; `09` §3 decision 295).** This replaces CC's two-step pick. **Open, not ruled:** what the installer does below 200 GB — refuse, or warn. demo-hp (128 GB) stays as a test box. `16` §14.3 carries the ruling. | — | Design first: what the installer does below 200 GB (refuse, or warn) — a later session. Then the installer. | CC |
| **R-1398** | Box system & updates | P3 | **A machine that the installer refuses for a small system disk tells nobody but its own screen, and the hub does not read the „small disk” mark.** Found 2026-11-15 while building D83 (installer v1.38.0, not tagged). (1) On the public image the first-boot unit (`scripts/iso/felhom-bootstrap.sh`, „retry until success”) runs the installer again every 30 seconds: a refused 128 GB machine prints the refusal on its screen for ever, and the hub shows a bound appliance that never installs, with no reason. (2) An install that went on with `--accept-small-disk` sends `"small_disk":true` in its enrolment request; the hub ignores the field, so no page shows which boxes were accepted small (`16-storage-physical-identity.md` §14.5, the last row of the built table). | OPEN — filed 2026-11-15 | the next installer ISO for (1) | (1) a final exit code for a refusal that no retry can cure; the first-boot unit stops retrying on it, shows the sentence once, and tells the hub the reason; (2) the hub stores `small_disk` at the enrolment and shows it on the box's page | CC |
| **R-984** | Box system & updates | P4 | **Host and agent hardening, low risk each: the backup-target route has no role check; the unsigned guest spec has no size bounds; signed ops have no maximum validity; the guarded mkfs does not refuse LVs, zvols or RAID devices; the local API is reachable from the LAN by a static route; a sudoers inspect pattern is wider than needed; install passes secrets on the command line; guest settings files are world-readable; the host offers rpcbind and DNS on the LAN.** Fix each in its own small change. Security review 2026-10-12 (`audits/security-review-2026-10-12/`); detail held off-git for the operator (`/mnt/5_hdd/felhom.eu/evidence/security-review-2026-10-12-PRIVATE/`). | OPEN | — | Batch into hardening work | CC |
| **R-979** | Box system & updates | P3 | **Controller updates are trusted by registry tag alone (no digest, no signature), and the Update button offers any newer tag, even an unvouched one; the built-in traefik, cloudflared and FileBrowser images are also pinned by tag only.** Whoever can push to the registry decides what runs. Fix: pin by digest from the hub's vouched list; offer only vouched versions. Security review 2026-10-12 (`audits/security-review-2026-10-12/`); detail held off-git for the operator (`/mnt/5_hdd/felhom.eu/evidence/security-review-2026-10-12-PRIVATE/`). | OPEN — design-proposal | — | Design note, then build | CC |
| **R-974** | Box system & updates | P3 | **A compromised host agent can likely become root on the host through the root wrapper that applies PBS settings: the wrapper accepts a folder path inside the agent's own writable tree and then acts on it as root.** Static (the symlink behaviour was reasoned, not run). Same class as R-861. Fix: a fixed root-owned folder, and refuse symlinks before any root action. Security review 2026-10-12 (`audits/security-review-2026-10-12/`); detail held off-git for the operator (`/mnt/5_hdd/felhom.eu/evidence/security-review-2026-10-12-PRIVATE/`). | OPEN | — | Fix the wrapper with a test on a throwaway box | CC |
+18
View File
@@ -1,3 +1,21 @@
## Unreleased (2026-11-15) — felhom-host-install.sh v1.38.0 on `main`, NOT tagged, so NOT published: an appliance install stops on a system disk below 200 GB (D83, R-1370)
- **`check_system_disk`, first thing in the preflight, before anything is changed** (`09` §3 decision 308; design
`16-storage-physical-identity.md` §14.5). The system disk is the ONE whole disk under the `pve` volume group
(`pvs`, `lsblk`); its size is the kernel's sector count (`/sys/block/<disk>/size` × 512). Below 200 × 10⁹ bytes an
appliance install stops: „This machine's system disk is 128 GB. Felhom needs 200 GB. Nothing was changed.” A size
that cannot be read (no `pve` group, two physical volumes, a RAID, no size) stops too and names the flag.
- **`--accept-small-disk` (operator only):** goes on, prints the cost, records `small_disk: true` and
`system_disk_bytes` in the install state, and adds `"small_disk":true` to the enrolment request. **The hub does not
read that field yet** (R-1398).
- **A byo host is warned only**, with or without a readable size; so is a `--preflight-only` run with no `--mode`.
- The 120 GiB pool warning stays as the second check.
- **Known gap, R-1398:** on the public image the first-boot unit runs the installer again until it succeeds, so a
refused machine prints the refusal on its screen every 30 seconds and the hub is not told why.
- `test_hostinstall.py`: eight tests, one per row of the design's table that can be tested, with stubs for `pvs` and
`lsblk` and a folder in place of `/sys/block`; 15 mutations seen red, 2 of them only after the test was made real
(`documentation/audits/build-release-4-2026-11-15/B/redproof-installer-small-disk.txt`). **Not run on a machine.**
## felhom-host-install.sh v1.37.0 (2026-11-15) — a new box trusts Proxmox by a copy of its own root CA (R-1380, D80) — TAGGED `installer-v1.37.0` at `6174944f` and published on the operator's yes (2026-11-15), after one fresh install with this file (`documentation/tests/golden-0.353.0-2026-11-15/fresh-install/`)
- `SCRIPT_VERSION` 1.36.1 → 1.37.0 (2026-11-15), so the file a fresh install proves is the file the tag will name.
+82 -3
View File
@@ -80,6 +80,10 @@
#
# Required:
# --customer-id ID Customer (must already exist in the hub)
# --accept-small-disk OPERATOR ONLY. An appliance install stops when the system disk (the disk
# that holds the `pve` volume group) is below 200 GB, or when its size cannot
# be read. This flag goes on, prints the cost and records small_disk in the
# install state. A byo host is only warned and needs no flag (D83).
# --mode appliance|byo Install profile (REQUIRED for install/--resume — no default):
# appliance a Felhom-owned/managed box. Full Day-0 incl. the
# break-glass root@pam credential (step 4b).
@@ -194,7 +198,7 @@
set -euo pipefail
SCRIPT_VERSION="1.37.0" # the SINGLE version source (F-1): -h and the run banners follow it.
SCRIPT_VERSION="1.38.0" # the SINGLE version source (F-1): -h and the run banners follow it.
# The hub used to carry a copy for its Setup tab; R-94 DELETED it
# (2026-08-02) because the hub cannot know which version a box runs —
# the Setup command fetches this script at run time. scripts/
@@ -280,6 +284,7 @@ PRESERVE_FROM=""
PRESERVE_STATE_FROM="" # dir holding a prior local-api.{crt,key} + local-tokens.log to carry over (keeps the pin stable across a reinstall)
ALLOW_NEW_LEAF=false # opt-in to intentionally regenerate the agent leaf on a populated host (else the guard refuses)
FORCE=false
ACCEPT_SMALL_DISK=false # --accept-small-disk (D83, `16` §14.5): the operator's named way past the 200 GB rule
FORCE_GITEA_GOLDEN=false
SKIP_PROVISION=false
DRY_RUN=false
@@ -370,6 +375,11 @@ AGENT_CONFIG="" # resolved in preflight
# old name called it a hard floor while the check only warned. No measured floor exists. Pinned by
# scripts/test_hostinstall.py (test_lvm_minimum_is_named_as_what_it_does).
RECOMMENDED_MIN_LVM_GIB=120
# D83 (operator, 2026-11-15; felhom.eu `09` §3 decision 308; `16-storage-physical-identity.md` §14.5): the smallest
# system disk is 200 GB — 200 × 10^9 bytes, so a disk sold as "200 GB" (200,049,647,616 bytes) and a virtual disk
# made as "200G" (200 GiB) both pass, and a 128 GB or 180 GB disk does not.
SYSTEM_DISK_MIN_BYTES=200000000000
SYS_BLOCK_DIR="${SYS_BLOCK_DIR:-/sys/block}" # where the kernel says a disk's size (a test points it elsewhere)
# Runtime carriers (never logged)
PASSPHRASE=""
@@ -1760,6 +1770,7 @@ while [[ $# -gt 0 ]]; do
--preserve-state-from) PRESERVE_STATE_FROM="$2"; shift 2 ;;
--allow-new-leaf) ALLOW_NEW_LEAF=true; shift ;;
--force) FORCE=true; shift ;;
--accept-small-disk) ACCEPT_SMALL_DISK=true; shift ;;
--force-gitea-golden) FORCE_GITEA_GOLDEN=true; shift ;;
--skip-provision) SKIP_PROVISION=true; shift ;;
--uninstall) UNINSTALL=true; shift ;;
@@ -2143,6 +2154,9 @@ step_preflight() {
command -v curl >/dev/null || die "curl not found"
command -v python3>/dev/null || die "python3 not found"
# D83: the system disk's size, before anything is changed (a refused machine is exactly as it was).
check_system_disk
local pvever; pvever=$(pveversion | head -1)
# GL-2 PVE-major gate: byo installs are validated on PVE 9.x ONLY — on a host we don't own, an
# unvalidated major is a refusal, not a warning. Appliance keeps the historical warn-only.
@@ -2394,6 +2408,8 @@ step_preflight() {
if ! $PREFLIGHT_ONLY; then
_state_put customer_id "$CUSTOMER_ID"
_state_put mode "$MODE"
_state_put small_disk "${SMALL_DISK:-false}"
_state_put system_disk_bytes "${SYSTEM_DISK_BYTES:-unknown}"
_state_mark preflight
fi
log_success "pre-flight passed"
@@ -2571,10 +2587,13 @@ step_enroll() {
log_dry "curl -fsS -X POST $HUB_URL/api/v1/host-enroll -H 'X-Retrieval-Password: <pass>' -d '{\"customer_id\":\"$CUSTOMER_ID\"}'"
HOST_ID="<dry-run-host-id>"; HOST_API_KEY="<dry-run-key>"; _state_mark enroll; return 0
fi
local resp code body
local resp code body small_json=""
# D83: an install that went on with --accept-small-disk says so to the hub (on a resume the flag is read from
# the state record the preflight wrote). An older hub ignores the field.
if [[ "${SMALL_DISK:-$(_state_get small_disk || true)}" == "true" ]]; then small_json=',"small_disk":true'; fi
resp=$(curl -sS -w $'\n%{http_code}' -X POST "$HUB_URL/api/v1/host-enroll" \
-H "X-Retrieval-Password: $PASSPHRASE" -H 'Content-Type: application/json' \
-d "{\"customer_id\":\"$CUSTOMER_ID\"}")
-d "{\"customer_id\":\"$CUSTOMER_ID\"${small_json}}")
code=$(tail -n1 <<<"$resp"); body=$(sed '$d' <<<"$resp")
case "$code" in
201) log_success " host MINTED (first enroll)" ;;
@@ -2591,6 +2610,66 @@ step_enroll() {
_state_mark enroll
}
# system_disk_bytes — print "<disk> <bytes>" for the ONE whole disk that holds the `pve` volume group, or print
# nothing when that cannot be read (no `pve` group, two physical volumes, a RAID or another layer under it, no size).
# READS ONLY: pvs, lsblk and one file under /sys/block. The size is the kernel's count of 512-byte sectors.
system_disk_bytes() {
local pvs_out n pv pk kind sectors
pvs_out=$(pvs --noheadings -o pv_name -S vg_name=pve 2>/dev/null | awk 'NF {print $1}' || true)
n=$(awk 'NF' <<<"$pvs_out" | wc -l)
[[ "$n" -eq 1 ]] || return 0
pv="$pvs_out"
pk=$(lsblk -dno PKNAME "$pv" 2>/dev/null | awk 'NF {print $1; exit}' || true)
[[ -n "$pk" ]] || return 0
kind=$(lsblk -dno TYPE "/dev/$pk" 2>/dev/null | awk 'NF {print $1; exit}' || true)
[[ "$kind" == "disk" ]] || return 0
sectors=$(cat "$SYS_BLOCK_DIR/$pk/size" 2>/dev/null || true)
[[ "$sectors" =~ ^[0-9]+$ && "$sectors" -gt 0 ]] || return 0
echo "$pk $((sectors * 512))"
}
# check_system_disk — D83: runs in the preflight, BEFORE anything is changed. Sets SMALL_DISK (true|false) and
# SYSTEM_DISK_BYTES (a number, or "unknown") for the state record that step_preflight writes after its checks.
# appliance, below 200 GB → stop (exit 1), nothing changed; --accept-small-disk goes on and prints the cost
# appliance, size cannot be read → stop and name the flag; with the flag: go on, recorded as small
# byo (the owner's own Proxmox) → a warning only, never a stop
# no --mode (--preflight-only) → a warning only (the mode-specific rule needs the mode)
check_system_disk() {
local got disk bytes gb
SMALL_DISK=false; SYSTEM_DISK_BYTES="unknown"
got=$(system_disk_bytes)
if [[ -z "$got" ]]; then
if [[ "$MODE" != "appliance" ]]; then
log_warn " could not read the system disk's size (no single disk under the 'pve' volume group). Felhom needs a system disk of 200 GB."
return 0
fi
if $ACCEPT_SMALL_DISK; then
SMALL_DISK=true
log_warn " --accept-small-disk: the system disk's size cannot be read; the install goes on. Recorded as small_disk."
return 0
fi
die "Cannot read the system disk's size (no single disk under the 'pve' volume group). Felhom needs a system disk of 200 GB. Nothing was changed. An operator can go on with --accept-small-disk."
fi
disk=${got%% *}; bytes=${got##* }
SYSTEM_DISK_BYTES="$bytes"
gb=$(( bytes / 1000000000 ))
if [[ "$bytes" -ge "$SYSTEM_DISK_MIN_BYTES" ]]; then
log_info " system disk: /dev/$disk, ${gb} GB (the minimum is 200 GB)"
return 0
fi
if [[ "$MODE" != "appliance" ]]; then
log_warn " this machine's system disk (/dev/$disk) is ${gb} GB. Felhom needs 200 GB: with less, the local copies of the box can stop when the disk fills. The install goes on (this host is yours)."
return 0
fi
if $ACCEPT_SMALL_DISK; then
SMALL_DISK=true
log_warn " --accept-small-disk: this machine's system disk (/dev/$disk) is ${gb} GB, below the 200 GB that Felhom needs."
log_warn " The cost: the guest gets less space than a household is promised, and the box's local copies can stop when the disk fills. Recorded as small_disk."
return 0
fi
die "This machine's system disk is ${gb} GB. Felhom needs 200 GB. Nothing was changed. (An operator can install a small test box with --accept-small-disk.)"
}
#-------------------------------------------------------------------------------
# STEP 5 — agent install: fetch+verify the binary, ensure the service user, sudoers, unit
#-------------------------------------------------------------------------------
+173
View File
@@ -851,6 +851,179 @@ def test_pve_trust_is_wired_into_the_agent_config():
assert '%s = "%s"' % (name, path) in wrapper and path in func("resolve_pve_trust"), "the installer and the agent's root step disagree on %s" % name
# ── D83 (R-1370, `16` §14.5): the system disk below 200 GB ───────────────────────────────────────
# The disk is the one under the `pve` volume group; its size is the kernel's sector count. The stubs
# stand for pvs and lsblk, and SYS_BLOCK_DIR for /sys/block — no real disk is read.
GB200_LABEL = 200049647616 # a disk sold as "200 GB"
GIB200 = 200 * 1024 ** 3 # a virtual disk made as "200G"
def _disk_sandbox(disks, pvs_lines=("/dev/sda3",), parent="sda", kind="disk"):
"""disks: {name: bytes}. pvs prints pvs_lines; lsblk says the PV's parent and the parent's type."""
sb = Sandbox()
for name, size in disks.items():
os.makedirs(sb.path("sys", name))
with open(sb.path("sys", name, "size"), "w") as f:
f.write("%d\n" % (size // 512))
sb.stub("pvs", "\n".join('echo " %s"' % l for l in pvs_lines) if pvs_lines else "exit 0")
sb.stub("lsblk", 'case "$*" in *PKNAME*) echo "%s";; *TYPE*) echo "%s";; esac' % (parent, kind))
return sb
def _min_bytes_line():
"""The installer's OWN minimum, read from the script — a test that sets the number itself cannot see it change."""
m = re.search(r"^SYSTEM_DISK_MIN_BYTES=\d+$", SRC, re.M)
assert m, "SYSTEM_DISK_MIN_BYTES not found in the installer"
return m.group(0)
def _disk_run(sb, mode, accept=False):
return sb.run("set -euo pipefail\n" + one_liners() + func("system_disk_bytes") + func("check_system_disk") +
_min_bytes_line() + '; SYS_BLOCK_DIR="$SB/sys"\n'
'MODE="%s"; ACCEPT_SMALL_DISK=%s\ncheck_system_disk\n'
'echo "WENT-ON small=$SMALL_DISK bytes=$SYSTEM_DISK_BYTES"\n' % (mode, "true" if accept else "false"))
def test_small_disk_appliance_is_refused_before_anything_changes():
sb = _disk_sandbox({"sda": 128 * 10 ** 9})
try:
rc, out = _disk_run(sb, "appliance")
assert rc == 1 and "WENT-ON" not in out, "a 128 GB appliance install went on: rc=%s %s" % (rc, out)
assert "This machine's system disk is 128 GB. Felhom needs 200 GB." in out and "Nothing was changed" in out, out
assert "--accept-small-disk" in out, "the refusal does not name the flag: %s" % out
# the check only READS: pvs and lsblk, nothing else was called
called = {l.split()[0] for l in sb.logged().splitlines() if l.strip()}
assert called == {"pvs", "lsblk"}, "the disk check ran more than its two reads: %s" % sorted(called)
finally:
sb.close()
def test_small_disk_the_line_is_200_times_ten_to_the_nine_bytes():
for size, passes in ((GB200_LABEL, True), (200 * 10 ** 9, True), (GIB200, True),
(200 * 10 ** 9 - 512, False), (180 * 10 ** 9, False)):
sb = _disk_sandbox({"sda": size})
try:
rc, out = _disk_run(sb, "appliance")
assert (rc == 0 and "WENT-ON small=false bytes=%d" % size in out) == passes, \
"%d bytes: passes=%s wanted %s: %s" % (size, rc == 0, passes, out)
finally:
sb.close()
def test_small_disk_flag_goes_on_prints_the_cost_and_marks_it():
sb = _disk_sandbox({"sda": 128 * 10 ** 9})
try:
rc, out = _disk_run(sb, "appliance", accept=True)
assert rc == 0 and "WENT-ON small=true bytes=128000000000" in out, out
assert "128 GB" in out and "The cost:" in out and "local copies can stop" in out, "the cost is not printed: %s" % out
finally:
sb.close()
# the flag on a disk that is large enough marks nothing
sb = _disk_sandbox({"sda": GB200_LABEL})
try:
rc, out = _disk_run(sb, "appliance", accept=True)
assert rc == 0 and "WENT-ON small=false" in out, out
finally:
sb.close()
def test_small_disk_byo_host_is_warned_never_refused():
sb = _disk_sandbox({"sda": 128 * 10 ** 9})
try:
rc, out = _disk_run(sb, "byo")
assert rc == 0 and "WENT-ON small=false" in out, "a byo host was stopped: %s" % out
assert "[WARN]" in out and "128 GB" in out and "200 GB" in out, out
finally:
sb.close()
# no --mode (the mode-agnostic --preflight-only): a warning too
sb = _disk_sandbox({"sda": 128 * 10 ** 9})
try:
rc, out = _disk_run(sb, "")
assert rc == 0 and "[WARN]" in out, out
finally:
sb.close()
def test_small_disk_size_that_cannot_be_read_refuses_and_names_the_flag():
cases = {
"no pve volume group": dict(disks={"sda": GB200_LABEL}, pvs_lines=()),
"two physical volumes": dict(disks={"sda": GB200_LABEL, "sdb": GB200_LABEL}, pvs_lines=("/dev/sda3", "/dev/sdb1")),
"a RAID under the group": dict(disks={"md0": GB200_LABEL}, parent="md0", kind="raid1"),
"no parent disk": dict(disks={"sda": GB200_LABEL}, parent=""),
"no size file": dict(disks={"sdb": GB200_LABEL}),
}
for name, kw in cases.items():
sb = _disk_sandbox(**kw)
try:
rc, out = _disk_run(sb, "appliance")
assert rc == 1 and "WENT-ON" not in out, "%s: the install went on: %s" % (name, out)
assert "Cannot read the system disk's size" in out and "--accept-small-disk" in out and "Nothing was changed" in out, "%s: %s" % (name, out)
assert "[ERROR] Cannot read" in out and "system disk is" not in out, "%s: the refusal is not the 'cannot read' one: %s" % (name, out)
rc, out = _disk_run(sb, "appliance", accept=True)
assert rc == 0 and "WENT-ON small=true bytes=unknown" in out, "%s with the flag: %s" % (name, out)
rc, out = _disk_run(sb, "byo")
assert rc == 0 and "[WARN]" in out, "%s on a byo host: %s" % (name, out)
finally:
sb.close()
def test_small_disk_a_large_second_disk_does_not_help():
# the rule reads the SYSTEM disk (the one under `pve`), not the largest disk in the machine
sb = _disk_sandbox({"sda": 128 * 10 ** 9, "sdb": 2000 * 10 ** 9})
try:
rc, out = _disk_run(sb, "appliance")
assert rc == 1 and "128 GB" in out, out
finally:
sb.close()
# and the other way round: a small second disk does not refuse a large system disk
sb = _disk_sandbox({"sda": 512 * 10 ** 9, "sdb": 16 * 10 ** 9})
try:
rc, out = _disk_run(sb, "appliance")
assert rc == 0 and "WENT-ON small=false" in out, out
finally:
sb.close()
def test_small_disk_check_is_wired_first_in_the_preflight_and_recorded():
body = func("step_preflight")
at = body.find("\n check_system_disk\n")
assert at > 0, "step_preflight no longer calls check_system_disk"
for later in ("pveversion | head", "_state_put", "_state_mark", "pvesh get", "systemctl cat", "apt-get", "_byo_disclosure_ack", "mkdir", "curl -"):
first = body.find(later)
assert first == -1 or at < first, "check_system_disk runs AFTER %r — a refused machine may already be changed" % later
assert '_state_put small_disk "${SMALL_DISK:-false}"' in body and '_state_put system_disk_bytes' in body, \
"the preflight does not record small_disk in the install state"
# the flag reaches the variable, and the help names it
assert re.search(r"--accept-small-disk\)\s+ACCEPT_SMALL_DISK=true; shift ;;", SRC), "the flag is not parsed"
assert "# --accept-small-disk" in SRC, "the help does not name the flag"
# the existing pool warning stays as the second check
assert "RECOMMENDED_MIN_LVM_GIB" in body
def _enroll_run(small_state, small_var):
sb = Sandbox()
sb.stub("curl", 'printf \'{"host_id":"h1","api_key":"k1"}\\n201\'')
os.makedirs(sb.path("state"))
with open(sb.path("state", "state.json"), "w") as f:
json.dump({"completed": [], "small_disk": small_state}, f)
rc, out = sb.run("set -euo pipefail\n" + prelude() + func("_state_mark") + func("_state_get") + func("step_enroll") +
'die_live_box() { exit 9; }\nPREFLIGHT_ONLY=false\nSTATE_DIR="$SB/state"; STATE_FILE="$SB/state/state.json"\n'
'HUB_URL=http://hub.invalid; PASSPHRASE=p; CUSTOMER_ID=c1\n%sstep_enroll\n' % small_var)
logged = sb.logged()
sb.close()
return rc, out, logged
def test_small_disk_is_told_to_the_hub_at_the_enrolment():
rc, out, logged = _enroll_run("true", "") # a resume: the flag comes from the state record
assert rc == 0, out
assert '{"customer_id":"c1","small_disk":true}' in logged, "the enrolment does not tell the hub: %s" % logged
rc, out, logged = _enroll_run("false", "SMALL_DISK=true\n") # this run's own check wins
assert rc == 0 and '"small_disk":true' in logged, logged
rc, out, logged = _enroll_run("false", "") # the control: an ordinary box says nothing
assert rc == 0 and '{"customer_id":"c1"}' in logged and "small_disk" not in logged, logged
def main():
tests = [(n, f) for n, f in sorted(globals().items()) if n.startswith("test_") and callable(f)]
fails = 0