Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion crates/lib/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
40 changes: 40 additions & 0 deletions tmt/tests/booted/readonly/054-test-boot-automount.nu
Original file line number Diff line number Diff line change
@@ -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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hardcoded sleeps invite race conditions, most of these should be edge triggered or at least polling loops with a timeout.

In this case I'm pretty sure we can monitor for changes in the unit via the dbus api.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I think this change is right on the face of it, but I don't think it's a complete fix since I think we still have dueling /boot going on. But, that's actually more of an ostree side bug.

Yeah, I think you're right. I've re-opened the issue


# Make sure bootc status works
bootc status

tap ok
Loading