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)
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

index 21b3d7632e055f7e45d9e73bb0fec23802fbe2b6..0fe4746ad9c1e3f8523503f4d0463bda54add2c9 100644 (file)
@@ -58,9 +58,8 @@ ot_admin_instutil_builtin_set_kargs (int argc, char **argv, OstreeCommandInvocat
   context = g_option_context_new ("ARGS");
 
   if (!ostree_admin_option_context_parse (context, options, &argc, &argv,
-                                          OSTREE_ADMIN_BUILTIN_FLAG_SUPERUSER
-                                              | OSTREE_ADMIN_BUILTIN_FLAG_UNLOCKED,
-                                          invocation, &sysroot, cancellable, error))
+                                          OSTREE_ADMIN_BUILTIN_FLAG_SUPERUSER, invocation, &sysroot,
+                                          cancellable, error))
     goto out;
 
   deployments = ostree_sysroot_get_deployments (sysroot);