Recording image preparation: EFI and packages in one reference
Four exact plans, closed state-directory and current history verification without server writes or bypassing reboot requirements.
UEFI order is prepared, signed packages are installed and the future administrator still does not exist. We now need to connect those results so the next stage can verify a specific completed setup. We added a separate local image-preparation reference and tested it on a fresh isolated Debian VM.
A prepared state directory has its own contract
Ordinary clean-image admission expects /var/lib/deploy-cli to be absent. Initial APT preparation creates that directory, so the mere presence of state files does not allow clean setup to continue. Deleting journals would hide completed actions and break their connection to the original plans.
The new reader accepts only a specific initial inventory: package-initialization and packages, original intents and completions, two package-operation logs, the current history record and exactly the objects referenced by the two initial records. Foreign entries, an incomplete record, a symlink or an orphan history object stop verification.
Select four exact original plans
The private PREPARATION_INPUTS file references the EFI, initial APT prerequisite, index refresh and cloud-kernel/tool installation plans. The document structure is shown below. /private/image is an illustrative absolute private path; replace angle-bracket values with the checked SHA256 values of those exact files. Retain the complete document fingerprint as INPUTS_SHA256.
{
"schema_version": 1,
"efi": {
"file": "/private/image/efi.plan.json",
"sha256": "<EFI_PLAN_SHA256>"
},
"initialization": {
"file": "/private/image/init.plan.json",
"sha256": "<INITIALIZATION_PLAN_SHA256>"
},
"refresh": {
"file": "/private/image/refresh.plan.json",
"sha256": "<REFRESH_PLAN_SHA256>"
},
"kernel": {
"file": "/private/image/kernel.plan.json",
"sha256": "<KERNEL_PLAN_SHA256>"
}
}
Each action has its own plan and completion. The first package record must be the initial signed refresh and the second the approved fixed package installation. The reference neither invents a missing record nor accepts arbitrary current history in place of this sequence.
Capture a local reference without writing to the server
ROOT_ENV and CURRENT_CONSOLE_REQUEST are the same private root inputs used for preparation: an explicit key or password file, verified SSH trust and independent console evidence of the machine and current boot. NEW_REFERENCE is a new private local file path outside Git.
deploy-cli host image preparation capture \
--env-file "$ROOT_ENV" --request-file "$CURRENT_CONSOLE_REQUEST" \
--inputs-file "$PREPARATION_INPUTS" --inputs-sha256 "$INPUTS_SHA256" \
--reference-file "$NEW_REFERENCE" --approve-local-write
The CLI verifies initial directories and lock files, current package versions and two real history records. A separate EFI reader uses the original plan and live firmware state. BootOrder, other entries and attributes must match the completed operation. Reading a prepared namespace uses a separate path; ordinary EFI verification retains its absent-CLI-directory requirement.
In our run, capture created only one local file. Selected fields from the actual response, with the private file fingerprint omitted:
{
"status": "passed",
"preparation_verified": true,
"image_ready": false,
"whole_host_ready": false,
"host_write_performed": false,
"local_write_performed": true,
"no_pending_reboot": "blocked"
}
Revalidate the exact retained result
REFERENCE is the created file and REFERENCE_SHA256 its retained, checked fingerprint. Revalidation neither creates another reference nor rewrites the original:
deploy-cli host image preparation verify \
--env-file "$ROOT_ENV" --request-file "$CURRENT_CONSOLE_REQUEST" \
--inputs-file "$PREPARATION_INPUTS" --inputs-sha256 "$INPUTS_SHA256" \
--reference-file "$REFERENCE" --reference-sha256 "$REFERENCE_SHA256"
Verify completed successfully without a local or server write. All 24 checked state-directory entries remained exact across capture and verify: file contents, owners, permissions, inodes and modification times were unchanged. SSH connections themselves can leave normal system records; this comparison covers the selected state directories.
Refuse a foreign file while retaining journals
For a negative example, we separately created a controlled foreign file in the isolated fixture state directory. The next verify refused that state. The CLI did not remove the file, change the original 24 entries, repeat installation or write EFI. Ordinary clean-image admission and ordinary EFI verify also remained closed to this prepared namespace.
This separation matters when handing state between stages: an existing file, journal or passed status does not itself grant new authority. Changes to the root key, trust, console request, versions, original plans or directory inventory require explicit investigation.
Check image readiness separately
Verified preparation does not waive the running-kernel check. The retained result contained these selected diagnostic fields:
{
"prepared_namespace": "passed",
"efi_policy_ready": "passed",
"two_kernel_pairs_present": "passed",
"running_default_kernel": "blocked",
"no_pending_reboot": "blocked"
}
Kernel/initrd pairs are present and EFI matches the approved state, but the running kernel differs from the default and the system requires rebooting. Therefore preparation_verified=true coexists with image_ready=false. This read has not tested the new kernel or fallback boot.
This reference is bound to the original current boot. It does not become postboot authority or constitute wizard completion. Next come a separate controlled boot, fresh independent console evidence and explicit integration of preparation with subsequent utility and runtime history. This run dispatched neither reboot nor wizard; the VM was gracefully powered off after verification. The installed E-01 and production sites were unchanged.