Skip to content

Commit c73831e

Browse files
committed
ephemeral: Avoid double mounting
This may fix a failure Robert was seeing with a submount in `/usr`. But in general this is just cleaner anyways to avoid a double mount. Signed-off-by: Colin Walters <walters@verbum.org>
1 parent 24dc739 commit c73831e

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

crates/kit/scripts/entrypoint.sh

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,11 @@ fi
1111

1212
# Shell script library
1313
init_tmproot() {
14-
if test -d /run/tmproot; then return 0; fi
15-
mkdir /run/tmproot
14+
if test -d /run/inner-shared; then return 0; fi
15+
# Should have been created by podman when initializing
16+
# the bind mount
1617
cd /run/tmproot
1718

18-
# Bind mount host /usr to our hybrid root
19-
mkdir usr
20-
mount --bind /run/hostusr usr
2119
# Create essential symlinks
2220
ln -sf usr/bin bin
2321
ln -sf usr/lib lib

crates/kit/src/run_ephemeral.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,11 @@ fn prepare_run_command_with_temp(
454454
cmd.args(vhost_dev);
455455
cmd.args([
456456
"-v",
457-
"/usr:/run/hostusr:ro", // Bind mount host /usr as read-only
457+
// The core way things work here is we run the host as a nested container
458+
// inside an outer container. The rest of /run/tmproot will be populated
459+
// in the entrypoint script, but we just grab the host's `/usr`.
460+
// (We don't want all of `/` as that would scope in a lot more)
461+
"/usr:/run/tmproot/usr:ro",
458462
"-v",
459463
&format!("{}:{}", entrypoint_path, ENTRYPOINT),
460464
"-v",

0 commit comments

Comments
 (0)