Activation Process
This page describes the full sequence of steps that occur when avocadoctl runtime activate <ID> is called.
Activation Flow
Step 1: Resolve Runtime
The provided ID (or prefix) is matched against staged runtimes. If the prefix matches multiple runtimes, an AmbiguousRuntimeId error is returned with the list of candidates.
Step 2: Check for OS Change
If the target runtime includes an os_bundle with an os_build_id, it is compared against the running system's AVOCADO_OS_BUILD_ID (read from /etc/os-release). If they differ, an OS update is required.
Step 3a: OS Update Path
When an OS change is needed:
- The OS bundle
.rawimage is extracted and itsbundle.jsonparsed. - The current boot slot is detected (using uboot-env, command, or sdboot-efi strategy).
- Artifacts are written to the inactive slot's partitions with SHA-256 verification.
- Boot activation actions are executed to mark the new slot as bootable.
- A
pending-update.jsonmarker is written containing the runtime ID. - The system must be rebooted to boot into the new OS.
- On next boot, the pending update is verified and the runtime is activated.
See OS Bundle Update Process for full details.
Step 3b: Extension-Only Path
When no OS change is needed:
- The
/var/lib/avocado/activesymlink is atomically switched to point to the target runtime. - Extensions are refreshed: all existing extensions are unmerged, then the new runtime's extensions are merged.
- During merge, extensions are ordered deterministically based on their position in the manifest.
depmodis run to update kernel module dependencies.
Extension Refresh During Activation
The extension refresh process during activation:
- Scan enabled extensions for the current OS release version.
- Detect sysext vs confext types from extension metadata.
- Apply deterministic ordering (extensions listed in manifest get merge index prefixes).
- Execute
systemd-sysext mergefor system extensions. - Execute
systemd-confext mergefor configuration extensions. - Run
depmodto rebuild kernel module dependency information.
Atomicity
The symlink switch from the old runtime to the new runtime is atomic on Linux (a single rename system call). If the process crashes between the symlink switch and extension refresh, the active runtime is correct but extensions may need a manual refresh with avocadoctl refresh.