From 3b6daddfdde82dae905782cb1b5f8ee39af6a4f8 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Tue, 18 Nov 2025 10:23:01 -0500 Subject: [PATCH] ephemeral: Add an option to override the entrypoint The goal is to make it easier to debug entrypoint failures as one can do e.g. ``` $ bcvk ephemeral run -ti --debug-entrypoint bash -K --name mytestvm2 quay.io/fedora/fedora-bootc:42 ``` (And also e.g. interactively inspect the state of the container before bwrap and qemu is launched etc.) Signed-off-by: Colin Walters --- crates/kit/src/run_ephemeral.rs | 8 +++++++- crates/kit/src/to_disk.rs | 1 + docs/src/man/bcvk-ephemeral-run-ssh.md | 4 ++++ docs/src/man/bcvk-ephemeral-run.md | 4 ++++ 4 files changed, 16 insertions(+), 1 deletion(-) diff --git a/crates/kit/src/run_ephemeral.rs b/crates/kit/src/run_ephemeral.rs index e28111a..aec01a1 100644 --- a/crates/kit/src/run_ephemeral.rs +++ b/crates/kit/src/run_ephemeral.rs @@ -240,6 +240,11 @@ pub struct RunEphemeralOpts { #[clap(flatten)] pub podman: CommonPodmanOptions, + /// Do not run the default entrypoint directly, but + /// instead invoke the provided command (e.g. `bash`). + #[clap(long)] + pub debug_entrypoint: Option, + #[clap( long = "bind", value_name = "HOST_PATH[:NAME]", @@ -520,7 +525,8 @@ fn prepare_run_command_with_temp( cmd.args(["-e", &format!("BOOTC_DISK_FILES={}", disk_specs)]); } - cmd.args([&opts.image, ENTRYPOINT]); + let entrypoint = opts.debug_entrypoint.as_deref().unwrap_or(ENTRYPOINT); + cmd.args([&opts.image, entrypoint]); Ok((cmd, td)) } diff --git a/crates/kit/src/to_disk.rs b/crates/kit/src/to_disk.rs index b2f3ce4..486d8a2 100644 --- a/crates/kit/src/to_disk.rs +++ b/crates/kit/src/to_disk.rs @@ -453,6 +453,7 @@ pub fn run(opts: ToDiskOpts) -> Result<()> { opts.additional.format.as_str() )], // Attach target disk kernel_args: Default::default(), + debug_entrypoint: None, }; // Phase 5: SSH-based VM configuration and execution diff --git a/docs/src/man/bcvk-ephemeral-run-ssh.md b/docs/src/man/bcvk-ephemeral-run-ssh.md index 0a4cee1..ea7e084 100644 --- a/docs/src/man/bcvk-ephemeral-run-ssh.md +++ b/docs/src/man/bcvk-ephemeral-run-ssh.md @@ -89,6 +89,10 @@ Run ephemeral VM and SSH into it Set environment variables in the container (key=value) +**--debug-entrypoint**=*DEBUG_ENTRYPOINT* + + Do not run the default entrypoint directly, but instead invoke the provided command (e.g. `bash`) + **--bind**=*HOST_PATH[:NAME]* Bind mount host directory (RW) at /run/virtiofs-mnt- diff --git a/docs/src/man/bcvk-ephemeral-run.md b/docs/src/man/bcvk-ephemeral-run.md index 91b29a9..800fe7d 100644 --- a/docs/src/man/bcvk-ephemeral-run.md +++ b/docs/src/man/bcvk-ephemeral-run.md @@ -115,6 +115,10 @@ This design allows bcvk to provide VM-like isolation and boot behavior while lev Set environment variables in the container (key=value) +**--debug-entrypoint**=*DEBUG_ENTRYPOINT* + + Do not run the default entrypoint directly, but instead invoke the provided command (e.g. `bash`) + **--bind**=*HOST_PATH[:NAME]* Bind mount host directory (RW) at /run/virtiofs-mnt-