interplane.Get Omega
Read in your language

aienux

Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately.

Brought by drakestapleton

branch main Branches Tags History

aienux / docs / NATIVE_BOOT_ONE_TIME.md

122 lines · 7953 bytes Raw Blame History Rendered
1# Machine 1 Native Boot Qualification Procedure: Attended, One-Time, Secure Boot OFF for development (as of 2026-10-01), ON for release
2
3This document defines the safe, operator-attended qualification procedure for one-time native candidate boots of AIENOS on NVIDIA DGX Spark ("Machine 1").
4
5---
6
7## 1. Current Qualification Status
8
9```text
10HARDWARE_QUALIFICATION_BLOCKED_BY_TRUST_CHAIN
11```
12
13> [!NOTE]
14> **Update 2026-10-01 (owner decision):** Secure Boot is OFF on Machine 1 for development, by Drake's decision. The TPM stores were relocked with PCR 7 measured under Secure Boot off (recovery procedure: `~/handoffs/secure-boot-off/after-restart.sh`). Gates now report Secure Boot state as an observed fact and do not fail on it. Any production or release gate must still require Secure Boot ON. The historical warning below describes the 2026-09-24 state and the PCR 7 sealing risk when the setting is flipped.
15
16> [!CAUTION]
17> **HISTORICAL (2026-09-24): do not flip Secure Boot without re-sealing the TPM stores.**
18> On Machine 1, turning Secure Boot off alters TPM PCR 7. On the historical 2026-09-24 first-boot test, changing PCR 7 prevented the TPM from unsealing the volume encryption keys for `atlas-private-storage` and `atlas-forgejo-storage`, locking the filesystem and causing severe service restart loops (`evidence/machine1_core_baseline_2026-09-24.md`). Secure Boot was restored then; as of 2026-10-01 it is OFF for development by owner decision (see note above).
19>
20> The native AIENOS boot images (`aienos-handoff.efi`, `aienos-boot.efi`) are not currently signed by a key enrolled in Machine 1's UEFI database (`db`). Direct execution under Secure Boot will fail with `Secure Boot Violation` (`evidence/gate1_machine1_selftest_2026-09-24.md`).
21>
22> Physical hardware native boots remain **BLOCKED** until the owner-controlled boot trust chain (ADR 0007 / TRUST-1 implementation) is enrolled in firmware. **Do not attempt to bypass this boundary by turning Secure Boot off.** All rollback semantics must be validated in QEMU (`scripts/qemu_native_rollback_test.sh`).
23
24---
25
26## 2. Hard Invariants & Safety Constraints
27
281. **Secure Boot (release only):** a release gate requires `SecureBoot enabled`; during development (OFF since 2026-10-01, owner decision) the state is only recorded. For a release, Machine 1 must report `SecureBoot enabled` (`/sys/firmware/efi/efivars/SecureBoot-*` byte 4 == 1). Any tool or procedure attempting to disable Secure Boot fails closed.
292. **Permanent BootOrder Immutable:** `BootOrder` must not be modified. Linux (Ubuntu GRUB/shim, `Boot0001`) remains the permanent, unchallengeable default.
303. **One-Time Staging Only:** Candidates are invoked strictly via UEFI `BootNext`. Firmware deletes `BootNext` upon boot.
314. **Zero Persistent Storage Mutation:** Candidate execution must not write to Linux root (`/dev/nvme0n1p2`) or alter the EFI System Partition (`/dev/nvme0n1p1`) outside of the staging scratch directory `\EFI\AIENOS`.
325. **Attended Execution Only:** No autonomous or unattended physical hardware reboots are permitted. Operator must be present at physical console with recovery media attached.
33
34---
35
36## 3. Preparation & Pre-Flight Verification
37
38Ensure the operator is present at the physical machine with:
391. **Recovery Media:** Dedicated `AIENOSRECOV` USB stick inserted into Machine 1 (`Boot0004`), tested and proved per `docs/RECOVERY_MEDIA_MACHINE1.md`.
402. **Physical Display & Keyboard:** Attached directly to DGX Spark console.
413. **Service Quiescence:** Non-core services stopped per `evidence/machine1_core_baseline_2026-09-24.md`.
42
43---
44
45## 4. Execution Workflow (When Trust Chain is Enrolled)
46
47### Step 1: Pre-Boot Baseline Capture
48Capture the complete pre-boot state into `evidence/pre_boot_capture.json`:
49```bash
50sudo scripts/verify_native_rollback.sh --capture-pre evidence/pre_boot_capture.json
51```
52This records:
53- Secure Boot status (`enabled`)
54- Active and permanent boot configuration (`BootCurrent`, `BootOrder`, no `BootNext`)
55- Partition UUIDs:
56 - Root: `d27bfd26-ff30-400e-9eca-9cdf73de9406` (ext4, mounted at `/`)
57 - ESP: `9DA2-3597` (vfat, mounted at `/boot/efi`)
58- Kernel release (`uname -r`)
59
60### Step 2: One-Time Candidate Staging
61Under lease hold (`aien-proof hold --resource machine-1`):
62```bash
63# Verify working tree is clean and map to exact commit
64commit=$(git rev-parse HEAD)
65
66# Build signed native candidate (requires owner signing key)
67scripts/sign_efi_binary.sh target/aarch64-unknown-uefi/release/aienos-handoff.efi
68
69# Stage image to ESP and set BootNext
70sudo bash scripts/stage_one_time_boot.sh --apply
71```
72The staging script:
731. Copies the authenticated binary to `/boot/efi/EFI/AIENOS/aienos-handoff.efi`.
742. Verifies that `BootOrder` is preserved unchanged.
753. Creates/verifies non-default boot entry `Boot0000 "AIENOS handoff (one-time)"`.
764. Sets `BootNext = 0000`.
77
78#### Step 2 (C kernel variant, L6 / L6-C): `scripts/stage_one_time_boot_ck.sh`
79For the C kernel infer image plus `MODEL.MAP` (the yardstick model read through the firmware's Block I/O, aienos#34 lane 6), with its console mirrored on the GOP framebuffer (CHANDOF3) and held on screen for 120 s before the reset:
80```bash
81scripts/stage_one_time_boot_ck.sh --dry-run # prints every command, touches nothing
82scripts/stage_one_time_boot_ck.sh --apply # operator only, attended boot follows
83```
84One of the two flags is required. `--apply` stops before touching anything if the tree is dirty, the model or the ESP is not on `/dev/nvme0n1`, Secure Boot is on, `BootNext` is already set, or `Boot0004 AIENOSRECOV` is absent. In order it: builds the image (`CK_INFER_LIB`, `CK_FB_HOLD_S=120`) and `ck_model_map`; `chattr +i` on the model (first, so its blocks cannot move after the map is made); `ck_model_map make --fiemap --part-start auto --disk /dev/nvme0n1`, then `ck_model_map check` (re-reads every extent by LBA and recomputes the SHA-256) and requires the pinned model hash; `verify_native_rollback.sh --capture-pre`; copies `aienos-ck.efi`, `MODEL.MAP` and `STAGED-CK.TXT` to `\EFI\AIENOS`; creates a create-only boot entry, restores `BootOrder` if it changed, checks `Boot0004 AIENOSRECOV` is still present, and sets `BootNext` once. It never reboots. After the return to Linux: `--capture-post`, then `sudo chattr -i` on the model.
85
86### Step 3: Candidate Boot & Observation
871. Reboot the machine:
88 ```bash
89 sudo reboot
90 ```
912. **Observe Physical Screen:**
92 - Firmware starts and evaluates `BootNext`.
93 - If firmware accepts signature: AIENOS banner, memory map validation, `kernel: alive` on screen.
94 - Candidate counts down 30 seconds and calls cold reset via PSCI.
95 - **If firmware reports `Secure Boot Violation`:** This is an expected STOP condition if keys are missing. Do not bypass. The machine will fall back to `BootOrder` (Linux).
963. **If Machine Hangs:**
97 - Wait 60 seconds.
98 - Power-cycle using the chassis power button.
99 - Because firmware consumed `BootNext` prior to launching the image, the reset will boot Linux (`BootOrder[0] = 0001`).
100
101### Step 4: Out-of-Band Fallback (If Linux Fails to Boot)
102If Linux does not automatically load:
1031. Press `F11` (or firmware BBS hotkey) during startup.
1042. Select `Boot0004` (`AIENOSRECOV` USB recovery stick).
1053. In the recovery environment, verify root and ESP integrity read-only per `docs/RECOVERY_MEDIA_MACHINE1.md`.
106
107### Step 5: Post-Return Capture & Automated Verification
108Once returned to Linux:
109```bash
110sudo scripts/verify_native_rollback.sh \
111 --pre evidence/pre_boot_capture.json \
112 --post evidence/post_boot_capture.json \
113 --verify
114```
115The automated verifier evaluates all 10 invariants:
116- Secure Boot state: unchanged (`enabled`)
117- `BootOrder`: identical to pre-boot
118- `BootCurrent`: returns to `0001` (Linux)
119- `BootNext`: consumed / empty
120- Root partition UUID & mount (`/`, `rw`): unchanged
121- ESP partition UUID & mount (`/boot/efi`, `rw`): unchanged
122- No boot loop created