Preparing signed packages and a cloud kernel over root SSH

Initial APT prerequisites, an exact archive plan, installation and independent verification on a fresh Debian VM without rebooting.

A protected channel to a server, packages and an approved plan.

Initial server setup needs package tools and usable boot files. We separated this step into a root CLI workflow and ran it on a fresh isolated Debian VM. The future administrator does not exist yet: initial preparation uses explicitly selected root SSH.

Root access before administrator creation

ROOT_ENV is an absolute path to a private environment file selecting exactly one root key or password file. CURRENT_CONSOLE_REQUEST contains the original access request, verified known_hosts and a reference to independent console evidence of the machine and current boot. Credentials stay out of command arguments and Git.

This edition fixes the selection in advance: efibootmgr, linux-image-cloud-amd64 and mokutil. The command offers neither arbitrary package selection nor a full system upgrade. Prepare BootOrder separately while the CLI state directory is still absent; this package run does not write EFI variables.

Create the missing APT prerequisites first

The plan pins an absent /var/lib/deploy-cli and the initial state of four lock files and five acquisition directories for archives and indexes. Existing dpkg lock files are retained. NEW_INIT_PLAN is a new private local file path; planning itself installs no packages.

deploy-cli host image packages init-plan \
  --env-file "$ROOT_ENV" --request-file "$CURRENT_CONSOLE_REQUEST" \
  --plan-file "$NEW_INIT_PLAN" --approve-local-write

The reviewed file is then called INIT_PLAN and its checked fingerprint INIT_SHA256. The same convention applies to REFRESH and KERNEL plans: each NEW_* file is created once, and later commands receive that exact file and retained SHA256.

deploy-cli host image packages init-apply \
  --env-file "$ROOT_ENV" --request-file "$CURRENT_CONSOLE_REQUEST" \
  --plan-file "$INIT_PLAN" --plan-sha256 "$INIT_SHA256" --approve-privileges

deploy-cli host image packages init-verify \
  --env-file "$ROOT_ENV" --request-file "$CURRENT_CONSOLE_REQUEST" \
  --plan-file "$INIT_PLAN" --plan-sha256 "$INIT_SHA256"

Initial writing creates only the absent CLI parent and permitted APT prerequisites. A separate private journal makes intent durable before parent creation and records completion after verification. The CLI reads the resulting state through a new SSH connection. Another init-apply was refused before writing; use init-verify to read. An interrupted prefix is not repaired automatically.

Refresh signed indexes with a separate plan

Every subsequent command requires the exact completed initialization plan. First obtain and review the metadata refresh plan, then authorize its execution. This stage installs no packages.

deploy-cli host image packages refresh-plan \
  --env-file "$ROOT_ENV" --request-file "$CURRENT_CONSOLE_REQUEST" \
  --initialization-plan-file "$INIT_PLAN" --initialization-plan-sha256 "$INIT_SHA256" \
  --plan-file "$NEW_REFRESH_PLAN" --approve-local-write

deploy-cli host image packages refresh \
  --env-file "$ROOT_ENV" --request-file "$CURRENT_CONSOLE_REQUEST" \
  --initialization-plan-file "$INIT_PLAN" --initialization-plan-sha256 "$INIT_SHA256" \
  --plan-file "$REFRESH_PLAN" --plan-sha256 "$REFRESH_SHA256" --approve-privileges

The executor retains normal APT signature verification and immutable operation history. The isolated fixture network explicitly selects IPv4 and disables mirror SRV lookup; signature and TLS checks were not weakened. We do not present that fixture setting as an automatic network change on every VPS.

Review the complete archive selection

deploy-cli host image packages plan \
  --env-file "$ROOT_ENV" --request-file "$CURRENT_CONSOLE_REQUEST" \
  --initialization-plan-file "$INIT_PLAN" --initialization-plan-sha256 "$INIT_SHA256" \
  --plan-file "$NEW_KERNEL_PLAN" --approve-local-write

Three requested names do not mean exactly three newly requested packages. Our image already has mokutil, while the cloud-kernel metapackage adds a concrete kernel dependency. The resulting plan contained three archive actions:

PackageObserved action
efibootmgrinstall 18-2
linux-image-cloud-amd64install 6.12.113-1
linux-image-6.12.113+deb13-cloud-amd64dependency, install 6.12.113-1
mokutilalready installed 0.7.2-1; no new archive action

Before applying, review the entire resolved selection, its versions, sizes and archive fingerprints, as well as the three initial names. Dependencies may require installation or upgrades. Package scripts can restart services and generate initrds and the GRUB menu.

Install once and independently read the result

deploy-cli host image packages apply \
  --env-file "$ROOT_ENV" --request-file "$CURRENT_CONSOLE_REQUEST" \
  --initialization-plan-file "$INIT_PLAN" --initialization-plan-sha256 "$INIT_SHA256" \
  --plan-file "$KERNEL_PLAN" --plan-sha256 "$KERNEL_SHA256" --approve-privileges

deploy-cli host image packages verify \
  --env-file "$ROOT_ENV" --request-file "$CURRENT_CONSOLE_REQUEST" \
  --initialization-plan-file "$INIT_PLAN" --initialization-plan-sha256 "$INIT_SHA256" \
  --plan-file "$KERNEL_PLAN" --plan-sha256 "$KERNEL_SHA256"

Apply performed the approved installation and automatically verified the result through a fresh SSH connection. A separate verify confirmed current selected package versions against the same plan without writing. Below are selected fields from the actual apply response; private fingerprints and other diagnostic fields are omitted:

{
  "status": "passed",
  "write_performed": true,
  "access_verified": true,
  "checks": {
    "pending_package_actions": "0",
    "pending_transaction": "no",
    "reboot_pending": "yes"
  }
}

Of 51 selected configuration and EFI files, /var/lib/dpkg/status and the generated /boot/grub/grub.cfg changed; the other 49 were retained exactly. Package files and private journals were also created. No administrator was created, boot identity stayed unchanged and dpkg --audit reported no problems.

Read the actual two-operation history

deploy-cli host image packages history-read \
  --env-file "$ROOT_ENV" --request-file "$CURRENT_CONSOLE_REQUEST" \
  --initialization-plan-file "$INIT_PLAN" --initialization-plan-sha256 "$INIT_SHA256" \
  --operation-sha256 "$REFRESH_SHA256" --operation-sha256 "$KERNEL_SHA256" \
  --output-file "$NEW_GENESIS_REFERENCE" --approve-local-write

The command read two real immutable records: index refresh and package installation. The first starts the history and the second references it. NEW_GENESIS_REFERENCE is a new private local file referencing those records. Creating it neither rewrites server history nor accepts the entire image.

If a connection is lost during writing or a journal remains incomplete, retain the unknown result for investigation. This command performs no automatic retry, package removal, downgrade, held-package override or rollback.

A genuine VTE terminal summarizing saved results: initial APT preparation, a single installation of approved packages, fresh verification and two package-history records. The system has two kernel/initrd pairs; the new kernel was not booted. Package commands were not repeated during capture.

Two file pairs do not establish a successful boot

After installation, /boot contains complete pairs for 6.12.113+deb13-amd64 and 6.12.113+deb13-cloud-amd64. The system still runs the first kernel. Both packages share the same base version but have different build flavors; filenames alone do not establish a usable fallback boot.

The CLI reported reboot_pending=yes, but no reboot was dispatched. The isolated VM was gracefully powered off after verification. Next comes explicit wizard acceptance of completed preparation and a separate controlled boot: a state directory or journal alone does not bypass clean-image admission. This run did not change the installed E-01 or production sites.

  1. Platform Engineering Private credential input and base utilities in the CLI
  2. Platform Engineering Interactive server setup through the CLI
  3. Platform Engineering Checking a clean Debian image before server setup
  4. Platform Engineering Recording image preparation: EFI and packages in one reference
  5. Platform Engineering Preparing UEFI boot order through the CLI