Skip to content

Commit c9daff0

Browse files
authored
Merge pull request #227 from cgwalters/install-misc
install: Add tracing and error context around re-exec
2 parents 2582ef2 + c9aaecd commit c9daff0

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lib/src/install.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -675,16 +675,17 @@ pub(crate) fn exec_in_host_mountns(args: &[std::ffi::OsString]) -> Result<()> {
675675
let (cmd, args) = args[1..]
676676
.split_first()
677677
.ok_or_else(|| anyhow::anyhow!("Missing command"))?;
678+
tracing::trace!("{cmd:?} {args:?}");
678679
let pid1mountns = std::fs::File::open("/proc/1/ns/mnt")?;
679680
nix::sched::setns(pid1mountns.as_fd(), nix::sched::CloneFlags::CLONE_NEWNS).context("setns")?;
680-
rustix::process::chdir("/")?;
681+
rustix::process::chdir("/").context("chdir")?;
681682
// Work around supermin doing chroot() and not pivot_root
682683
// https://github.com/libguestfs/supermin/blob/5230e2c3cd07e82bd6431e871e239f7056bf25ad/init/init.c#L288
683684
if !Utf8Path::new("/usr").try_exists()? && Utf8Path::new("/root/usr").try_exists()? {
684685
tracing::debug!("Using supermin workaround");
685-
rustix::process::chroot("/root")?;
686+
rustix::process::chroot("/root").context("chroot")?;
686687
}
687-
Err(Command::new(cmd).args(args).exec())?
688+
Err(Command::new(cmd).args(args).exec()).context("exec")?
688689
}
689690

690691
#[context("Querying skopeo version")]

0 commit comments

Comments
 (0)