WireGuard after reboot: startup and new-boot acceptance

Separate startup enablement, controlled server reboot and fresh private-channel checks before postboot acceptance.

A server with a shield and journal inside a reboot ring, linked to a laptop by a bridge.

A working current-boot WireGuard connection does not establish what happens after reboot. I separately enabled server startup, performed a controlled fixture reboot and checked private SSH, sudo and public access again. The new boot needs its own acceptance plan.

Firewall before WireGuard

Server wg-quick depends on the prepared boot firewall. The following standard fragment comes from the actual drop-in: Requires supplies the dependency and After the startup order. Both are needed. Main configuration remains in /etc/wireguard/${WG_IF}.conf with root 0600; the private key is not printed. Merely having that file does not enable the service.

[Unit]
Requires=deploy-cli-firewall-boot.service
After=deploy-cli-firewall-boot.service

Enable has its own plan

After runtime acceptance I created and reviewed startup-plan, then ran startup-enable once. This enables future startup without restarting the active tunnel. Before the boot changes, postboot-plan refuses: enabled alone proves no reboot. The second block selects actual enable response fields.

deploy-cli host wireguard startup-plan \
  --env-file "$ADMIN_ENV" --request-file "$ORIGINAL_REQUEST" \
  --node-file "$SERVER_NODE" --plan-file "$STARTUP_PLAN"
deploy-cli host wireguard startup-enable \
  --env-file "$ADMIN_ENV" --request-file "$ORIGINAL_REQUEST" \
  --node-file "$SERVER_NODE" --plan-file "$STARTUP_PLAN" \
  --plan-sha256 "$STARTUP_PLAN_SHA256" --approve-privileges
deploy-cli host wireguard startup-inspect \
  --env-file "$ADMIN_ENV" --request-file "$ORIGINAL_REQUEST" \
  --node-file "$SERVER_NODE"
{
  "mode": "host-wireguard-startup-enable",
  "status": "passed",
  "action": "startup-enable",
  "write_performed": true,
  "write_state": "changed"
}

Reading a large file on a 1 GiB VM

The first boot-plan attempt stopped before GRUB changes or a reboot request. Selected actual response fields follow. Independent reading found MemoryError: a 1 GiB upper bound was being used as a buffer size for a much smaller kernel file. I fixed the owning CLI reader to bound reading by actual size and reject file growth. A 96 MiB-limit check confirmed this without weakening owner, type or descriptor admission.

{
  "status": "failed",
  "write_performed": false,
  "write_state": "none",
  "error": "boot controller refused operation: internal"
}

Prepare the fallback kernel before binding boot state

After that fix, a separate prerequisite remained: the clean image had one kernel. On the first fixture, a named package plan added only the cloud kernel and its metapackage, preserving 25 original WireGuard/firewall files. Commands from that separate experiment and selected actual change fields follow. There was no global update. Subsequent UEFI reading found BootCurrent different from the first active entry; a separate fresh pair also encountered the default OVMF order with its UiApp first. CLI refused and firmware admission stayed intact.

deploy-cli host packages plan \
  --env-file "$ADMIN_ENV" --request-file "$ORIGINAL_REQUEST" \
  --package linux-image-cloud-amd64 --plan-file "$FALLBACK_KERNEL_PLAN"
# Review the exact resolved changes before applying.
deploy-cli host packages apply \
  --env-file "$ADMIN_ENV" --request-file "$ORIGINAL_REQUEST" \
  --package linux-image-cloud-amd64 --plan-file "$FALLBACK_KERNEL_PLAN" \
  --plan-sha256 "$FALLBACK_KERNEL_PLAN_SHA256" --approve-privileges
deploy-cli host packages verify \
  --env-file "$ADMIN_ENV" --request-file "$ORIGINAL_REQUEST" \
  --package linux-image-cloud-amd64
[
  {
    "name": "linux-image-6.12.113+deb13-cloud-amd64",
    "old_version": "",
    "new_version": "6.12.113-1"
  },
  {
    "name": "linux-image-cloud-amd64",
    "old_version": "",
    "new_version": "6.12.113-1"
  }
]

A complete run with stable prerequisites

For the complete run I prepared a new VM pair with the second kernel installed before initial firewall and boot acceptance. During initial local OVMF preparation I used efibootmgr to put the current disk entry first in normal BootOrder, without BootNext, before any CLI journal. Initial reboot and observation confirmed consistency; I then created fresh keys/configurations and accepted runtime. No prior or foreign journals were copied. The following boot-menu/reboot sequence uses a separately reviewed SHA for every mutation. Request acknowledges dispatch; verification after the node returns establishes its result.

deploy-cli host boot-menu plan \
  --env-file "$ADMIN_ENV" --request-file "$ORIGINAL_REQUEST" \
  --plan-file "$BOOT_MENU_PLAN"
deploy-cli host boot-menu apply \
  --env-file "$ADMIN_ENV" --request-file "$ORIGINAL_REQUEST" \
  --plan-file "$BOOT_MENU_PLAN" --plan-sha256 "$BOOT_MENU_PLAN_SHA256" \
  --approve-privileges
deploy-cli host boot-menu verify \
  --env-file "$ADMIN_ENV" --request-file "$ORIGINAL_REQUEST"

deploy-cli host reboot plan \
  --env-file "$ADMIN_ENV" --request-file "$ORIGINAL_REQUEST" \
  --plan-file "$REBOOT_PLAN"
deploy-cli host reboot request \
  --env-file "$ADMIN_ENV" --request-file "$ORIGINAL_REQUEST" \
  --plan-file "$REBOOT_PLAN" --plan-sha256 "$REBOOT_PLAN_SHA256" \
  --approve-privileges
# Verify after the machine becomes reachable again.
deploy-cli host reboot verify \
  --env-file "$ADMIN_ENV" --request-file "$ORIGINAL_REQUEST"
{
  "status": "passed",
  "action": "boot-verified",
  "write_performed": false,
  "write_state": "none"
}

New console and actual private access

After controlled reboot I independently logged in through serial console, checked the new boot and opened fresh public SSH with password sudo. WireGuard returned without another runtime-start. From the client I repeated private SSH and sudo, verified handshake/bidirectional transfer and the negative HTTP control. The client stayed on: this tests server reboot, not reboot of both ends.

Old runtime does not renew itself

Ordinary runtime-inspect refused the new boot: its retained old runtime stays old. Startup-inspect reads the explicitly enabled role, while postboot-plan binds it to new boot identity and the original reboot checkpoint. The schematic new approval below adds a seventh label, generic_reboot_verified. The other six channel and negative checks also run again.

deploy-cli host wireguard startup-inspect \
  --env-file "$ADMIN_ENV" --request-file "$ORIGINAL_REQUEST" \
  --node-file "$SERVER_NODE"
deploy-cli host wireguard runtime-inspect \
  --env-file "$ADMIN_ENV" --request-file "$ORIGINAL_REQUEST" \
  --node-file "$SERVER_NODE"
# Old runtime reading is expected to refuse the new boot.
deploy-cli host wireguard postboot-plan \
  --env-file "$ADMIN_ENV" --request-file "$ORIGINAL_REQUEST" \
  --node-file "$SERVER_NODE" --plan-file "$POSTBOOT_PLAN"
{
  "schema_version": 1,
  "plan_sha256": "<NEW_POSTBOOT_PLAN_SHA256>",
  "acceptance": {
    "new_wireguard_ssh": true,
    "wireguard_password_sudo": true,
    "new_public_ssh": true,
    "public_password_sudo": true,
    "console": true,
    "negative_controls": true,
    "generic_reboot_verified": true
  },
  "proof_file": "/private/example-new-boot-proof.json",
  "proof_sha256": "<NEW_BOOT_PROOF_SHA256>"
}

Explicit acceptance and a separate verify

After reviewing the new plan I supplied a separate approval to postboot-accept. Its plan_sha256 pins that new postboot-plan, while proof_file and SHA bind new evidence. Old runtime approval cannot substitute. After acceptance, postboot-verify reads the bound state; selected actual reading fields follow separately. There is no second WireGuard start or hidden retry.

deploy-cli host wireguard postboot-accept \
  --env-file "$ADMIN_ENV" --request-file "$ORIGINAL_REQUEST" \
  --node-file "$SERVER_NODE" --plan-file "$POSTBOOT_PLAN" \
  --plan-sha256 "$POSTBOOT_PLAN_SHA256" \
  --acceptance-file "$NEW_BOOT_APPROVAL" --approve-privileges
deploy-cli host wireguard postboot-verify \
  --env-file "$ADMIN_ENV" --request-file "$ORIGINAL_REQUEST" \
  --node-file "$SERVER_NODE"
{
  "mode": "host-wireguard-postboot-verify",
  "status": "passed",
  "action": "postboot-verify",
  "write_performed": false,
  "write_state": "none"
}

From separate commands to one workflow

The server restored its private channel after a new boot. The client stayed on, so client startup needs separate configuration. The next automation step is joining existing commands into a sequential first-root workflow with explicit package, access and boot prerequisites. The teaching VPS backup remains a separate Mirohost panel operation. The terminal frame below shows saved new-boot results.

A genuine VTE frame summarizing saved results: separate enable, one controlled server reboot, new console, repeated private SSH and sudo and separate postboot acceptance. The client stayed on. Commands were not rerun during capture.
  1. Operations & Security WireGuard on Debian: private SSH access and a post-reboot check
  2. Operations & Security Startup and reboot: firewall, ready FPM, then Nginx
  3. Operations & Security WireGuard firewall through CLI: separate acceptance and explicit rollback
  4. Operations & Security A new server boot: separate firewall acceptance through CLI
  5. Operations & Security WireGuard client through CLI: private SSH and sudo