You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add journaling for image finalization and firstboot #452
It'd be useful for auditing purposes for us to emit journal messages on at least the first time a particular deployment is booted, including substantial metadata (basically at least all the image stuff: pull spec, digest, version, etc.).
We might as well also do this as part of ostree-finalize-staged.service. Today these services run C code from libostree which is unaware of the container bits, so to fix this we could either patch that code to be aware of the container refs (or call into ostree container commands if available, i.e. we put the logic in ostree-ext?). But this conflicts a bit with us doing the podman pull backend, so instead we could add units here (triggered by our new generator?) that "hook" ostree-boot-complete.service and ostree-finalize-staged.service via drop-ins say.
We'd like to implement this and want to agree on the shape first.
Use case. We run composefs-backend nodes that never update or switch; we reinstall them instead. Nothing is ever staged on those nodes, so a hook in bootc-finalize-staged.service would never fire. bootc install also logs to the installer environment's journal, not the target's. Today the installed system has no journal record of the image it booted.
Proposal. Record the image at boot, once per deployment:
A new unit (name TBD, e.g. bootc-record-boot.service), enabled by the generator next to the status units. It runs a new bootc internals record-boot after local-fs.target.
The command reads the booted deployment through the existing status code, so it works on both backends.
If /var/lib/bootc/booted/<deployment-id> doesn't exist, it emits one journal entry and creates that marker. /var is shared across deployments, so the entry fires after an install and again after each update. The same run removes markers for deployments that no longer exist.
The entry gets a new MESSAGE_ID and structured fields that follow the existing bootc.* convention: image reference with transport, image digest, version, build timestamp, architecture, backend, and deployment ID.
We'd leave the finalize-time entry from the original description for a follow-up.
Questions.
Does a marker in /var/lib/bootc work for you? The deployment state directory sits under /sysroot, which is mounted read-only at that point.
Should the first PR cover both backends, or composefs first?
To move this forward, we'll start with the composefs backend and open a draft PR. One change from my proposal above: drop the marker and log on every boot.
Why every boot. A once-per-deployment entry is the least durable record. On our nodes it would fire once after install and then rotate out of the journal. An entry per boot keeps a recent record whatever the retention, and it removes the marker and its cleanup. It still answers "first boot" for anyone with enough history: take the earliest entry for a deployment ID.
First PR.
bootc internals log-boot (name TBD) reads the booted deployment through get_composefs_status and emits one entry with a new MESSAGE_ID. Fields: image reference with transport, manifest digest, version, build timestamp, architecture, backend, and deployment ID (the composefs verity digest).
A oneshot unit, enabled by the generator on native composefs boots only, runs it after local-fs.target. It stays off the critical path, and a failure doesn't fail the boot.
ostree follows in a second PR. The command doesn't depend on the backend, so that PR widens the generator gate and adds tests.
The finalize-time entry from the original description stays out of scope.
The composefs part landed in #2681. Every composefs boot now writes one entry with MESSAGE_ID=66797517e29842bfa048064146ec92c2; man bootc-log-boot.service lists the fields.
What's left:
ostree. I'll send this as a follow-up PR. One correction to my plan above: log-boot reads composefs state directly, so ostree needs its own read path, not only a wider generator gate. BootedStorage::new on ostree also remounts /sysroot read-write and takes the sysroot lock, which a boot-time unit should avoid.
Finalize-time entry. The entry in bootc-finalize-staged.service from the original description is still out of scope for us. Should it stay on this issue, or move to its own?
Separately, #2682 tracks the existing entries (rollback, switch, and so on): they write F_MESSAGE_ID instead of MESSAGE_ID. The new entry doesn't have that problem because it bypasses tracing.
Activity
fcuny commentedon Nov 19, 2026
We'd like to implement this and want to agree on the shape first.
Use case. We run composefs-backend nodes that never update or switch; we reinstall them instead. Nothing is ever staged on those nodes, so a hook in
bootc-finalize-staged.servicewould never fire.bootc installalso logs to the installer environment's journal, not the target's. Today the installed system has no journal record of the image it booted.Proposal. Record the image at boot, once per deployment:
bootc-record-boot.service), enabled by the generator next to the status units. It runs a newbootc internals record-bootafterlocal-fs.target./var/lib/bootc/booted/<deployment-id>doesn't exist, it emits one journal entry and creates that marker./varis shared across deployments, so the entry fires after an install and again after each update. The same run removes markers for deployments that no longer exist.MESSAGE_IDand structured fields that follow the existingbootc.*convention: image reference with transport, image digest, version, build timestamp, architecture, backend, and deployment ID.We'd leave the finalize-time entry from the original description for a follow-up.
Questions.
/var/lib/bootcwork for you? The deployment state directory sits under/sysroot, which is mounted read-only at that point.fcuny commentedon Nov 23, 2026
To move this forward, we'll start with the composefs backend and open a draft PR. One change from my proposal above: drop the marker and log on every boot.
Why every boot. A once-per-deployment entry is the least durable record. On our nodes it would fire once after install and then rotate out of the journal. An entry per boot keeps a recent record whatever the retention, and it removes the marker and its cleanup. It still answers "first boot" for anyone with enough history: take the earliest entry for a deployment ID.
First PR.
bootc internals log-boot(name TBD) reads the booted deployment throughget_composefs_statusand emits one entry with a newMESSAGE_ID. Fields: image reference with transport, manifest digest, version, build timestamp, architecture, backend, and deployment ID (the composefs verity digest).local-fs.target. It stays off the critical path, and a failure doesn't fail the boot.The finalize-time entry from the original description stays out of scope.
systemd: Add bootc-log-boot.service to journal the booted image
systemd: Add bootc-log-boot.service to journal the booted image
fcuny commentedon Nov 25, 2026
The composefs part landed in #2681. Every composefs boot now writes one entry with
MESSAGE_ID=66797517e29842bfa048064146ec92c2;man bootc-log-boot.servicelists the fields.What's left:
log-bootreads composefs state directly, so ostree needs its own read path, not only a wider generator gate.BootedStorage::newon ostree also remounts/sysrootread-write and takes the sysroot lock, which a boot-time unit should avoid.bootc-finalize-staged.servicefrom the original description is still out of scope for us. Should it stay on this issue, or move to its own?Separately, #2682 tracks the existing entries (rollback, switch, and so on): they write
F_MESSAGE_IDinstead ofMESSAGE_ID. The new entry doesn't have that problem because it bypassestracing.