rfc/spec/kernel-arguments-and-cli.md

4.4 KiB

Kernel arguments and installed-host CLI presentation

Approval and scope

D-096 records the user's 2026-11-09 request for kernel-argument management and human-first CLI with explicit debug/JSON modes. This additive implementation uses D-092/D-093 authorization, durable transactions and staged deployment rules. Implementation and normal-pipeline acceptance are separate from feature approval.

Kernel arguments

archipelago kargs reads the effective next-boot argument vector: the staged deployment when present, otherwise the booted deployment. JSON also exposes the booted and retained deployments separately. This is deployment configuration, not a claim that the running kernel command line already changed.

Edits accept ordered --append, --append-if-missing, --delete, --delete-if-present, and --replace options, either --option=value or --option value. Native libostree handles repeated keys, quoting and strict replacement/deletion ambiguity. Replacement supports KEY=VALUE or KEY=OLD=NEW. ostree= is generated by OSTree and cannot be overridden. Requests are bounded to 256 edits/64 KiB. Kernel argument keys use ASCII alphanumeric, dot, dash and underscore; values must not contain NUL/newlines.

The daemon serializes edits under the shared host lock, checks a context hash and pending ownership, journals the intended argument vector, then stages the same image commit as a new deployment. No live boot entry is edited. Booted and rollback deployments are retained; activation requires an explicit reboot. A foreign or non-staged pending deployment must be activated/reconciled first. No automatic reboot, generic shell execution, global boot-loader edits or editor RPC is added.

Update and Host Extension staging inherit the effective pending/booted vector; Desktop quiet/splash defaults are supplied by installation, not reapplied over user choices on every update. Crash recovery compares both deployment serial identity and the retained kernel-argument vector; same commit alone is insufficient.

Manager API major 1, minor 2 adds:

  • GetKernelArguments() -> a{sv}: context_id, selected, deployments; each deployment includes deployment_id, checksum, booted, staged, arguments: as. The automatic OSTree selector is omitted.
  • ChangeKernelArguments(aa{sv} changes, s context_id, a{sv} options) -> o: each change is {op: s, argument: s}. request_id is mandatory and durable; Polkit action org.archipelago.system.kernel-arguments is checked before admission. Result is staged or no-change; errors use the existing transaction contract.

CLI output contract

Installed-host commands are human-readable by default. TTY progress redraws a single line; non-TTY output emits phase changes without animation. Admission, retry tokens and intermediate JSON plans are private diagnostic events rather than ordinary progress. Russian/English follow LC_ALL/LC_MESSAGES/LANG.

  • --json: stdout is exactly one JSON result, or {error: {...}} on failure; progress is suppressed. Existing result keys remain stable and untranslated.
  • --debug: no animation; timestamped structured diagnostic events on stderr, including request/operation identity, changed snapshots and authorized service log pages; technical result on stdout.
  • Combined --debug --json retains clean JSON stdout and debug stderr.
  • Nonzero exit status remains mandatory on failure. Structured service error codes map to the protocol's documented exit statuses.
  • Private diagnostic logs are written with mode 0600; archipelago logs can read them. Interactive authorization is allowed for terminal users unless explicitly disabled; machine callers use explicit --interactive only when desired.

Machine acceptance consumes explicit JSON, never translated messages, phase text, implicit JSON defaults or removed legacy generation-marker files. Human output is tested separately. Native GUI clients continue to use typed D-Bus, not CLI parsing.

Required evidence

Normal pipeline tests native parsing and Rust request/wire behavior before images. Core, GNOME and KDE acceptance exercises human/JSON/debug JSON, invalid kargs rejection, append/replace/idempotence, pending deployment ownership, activation after reboot and persistence across extension staging. Full old-image upgrade, authorization denial/reconnect/crash injection remain distinct evidence; do not infer them solely from successful boot/extension tests.