admin: Drop UNLOCKED flag from instutil set-kargs
authorJoseph Marrero Corchado <jmarrero@redhat.com>
Thu, 2 Jul 2026 18:44:45 +0000 (14:44 -0400)
committerJoseph Marrero Corchado <jmarrero@redhat.com>
Thu, 2 Jul 2026 18:48:35 +0000 (14:48 -0400)
commit0cb8cfe5628d4e9ec5ea8a252cc3ee28dc70f3cc
tree70c276f2681a4f09420008aea744d382a8cac9fa
parent71a6f798e710774463be35799de35c5fc237f0b9
admin: Drop UNLOCKED flag from instutil set-kargs

In bf59d0c6 we added `OSTREE_ADMIN_BUILTIN_FLAG_UNLOCKED` to the
instutil subcommands, including `set-kargs`.  At the time, this flag
only controlled sysroot locking, and the commit message notes these
commands were "only used by Anaconda" so locking was unnecessary.

However, 599ffefe later consolidated mount namespace setup into the
same `if (!UNLOCKED)` block, so `UNLOCKED` now also means "skip
`ostree_sysroot_initialize_with_mount_namespace()`".  Without the
mount namespace, `_ostree_sysroot_ensure_writable()` is a no-op, and
any subsequent write to `/sysroot` fails with EROFS on systems where
the sysroot is mounted read-only (the default since composefs).

The practical symptom is:

  $ ostree admin instutil set-kargs --import-proc-cmdline
  error: mkdir(boot.1.0): Read-only file system

Dropping the flag is safe for the installer case: when not booted
into an ostree-managed system, `initialize_with_mount_namespace()`
returns early (since `root_is_ostree_booted` is FALSE), and the lock
acquisition is harmless on a writable target sysroot.
src/ostree/ot-admin-instutil-builtin-set-kargs.c