From 0e5622a0dec89c228181f7dbe48817857ec2a235 Mon Sep 17 00:00:00 2001 From: Pragyan Poudyal Date: Wed, 26 Aug 2026 10:37:36 +0530 Subject: [PATCH 1/2] unshare: Propagate /boot automount to mount ns Pass --propagation=slave so that if systemd gpt-auto-generator has automount for /boot it gets propagated inside the new mount ns for us to be able to access the /boot mount even if it's expired Without this all bootc commands fail with ``` error: Initializing storage: opendir(boot): Operation not permitted ``` Closes: #2402 Signed-off-by: Pragyan Poudyal --- crates/lib/src/cli.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/crates/lib/src/cli.rs b/crates/lib/src/cli.rs index c749b1199..86b4eb999 100644 --- a/crates/lib/src/cli.rs +++ b/crates/lib/src/cli.rs @@ -1033,7 +1033,14 @@ pub(crate) fn ensure_self_unshared_mount_namespace() -> Result<()> { anyhow::bail!("Failed to unshare mount namespace"); } } - bootc_utils::reexec::reexec_with_guardenv(recurse_env, &["unshare", "-m", "--"]) + + // Pass --propagation=slave so that if systemd gpt-auto-generator has + // automount for /boot it gets propagated inside the new mount ns + // for us to be able to access the /boot mount even if it's expired + bootc_utils::reexec::reexec_with_guardenv( + recurse_env, + &["unshare", "-m", "--propagation=slave", "--"], + ) } /// Load global storage state, expecting that we're booted into a bootc system. From ee1582ed0e14ee01c13bde0c8cafb178408f7bf3 Mon Sep 17 00:00:00 2001 From: Pragyan Poudyal Date: Wed, 26 Aug 2026 10:49:50 +0530 Subject: [PATCH 2/2] tmt: Add test for boot.automount expiry Signed-off-by: Pragyan Poudyal --- .../readonly/054-test-boot-automount.nu | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 tmt/tests/booted/readonly/054-test-boot-automount.nu diff --git a/tmt/tests/booted/readonly/054-test-boot-automount.nu b/tmt/tests/booted/readonly/054-test-boot-automount.nu new file mode 100644 index 000000000..593c5303d --- /dev/null +++ b/tmt/tests/booted/readonly/054-test-boot-automount.nu @@ -0,0 +1,40 @@ +use tap.nu + +# Test if we can still access /boot after it has expired + +let automounted = ( + do { ^findmnt --mountpoint /boot --types autofs --noheadings } | complete +).exit_code == 0 + +if not $automounted { + print "/boot is not automounted. Exiting" + exit 0 +} + +$env.SYSTEMD_PAGER = '' + +systemctl cat -l boot.automount + +bootc status + +# Expire boot.autmount +mkdir /etc/systemd/system/boot.automount.d + +echo " +[Automount] +TimeoutIdleSec=1 +" | save --force /etc/systemd/system/boot.automount.d/override.conf + +systemctl daemon-reload +systemctl restart boot.automount + +print "After overriding timeout" +systemctl cat -l boot.automount + +# Wait for automount to expire +sleep 5sec + +# Make sure bootc status works +bootc status + +tap ok