Skip to content

Commit 0a7814e

Browse files
alexlarssoncgwalters
authored andcommitted
ephemeral: Preserve stdin for an interactive console
Bash redirects stdin from a background job to /dev/null when job control is off. Preserve Podman stdin through bwrap so QEMU can receive console input with -it. Assisted-by: AI Signed-off-by: Alexander Larsson <alexl@redhat.com>
1 parent 2f9f69c commit 0a7814e

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

‎crates/kit/scripts/entrypoint.sh‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,9 @@ trap 'kill -TERM $BWRAP_PID 2>/dev/null; exit 0' INT TERM
6767
# Run bwrap in background so we can handle signals; xref
6868
# https://github.com/containers/bubblewrap/pull/586
6969
# But probably really we should switch to systemd
70-
bwrap --as-pid-1 --unshare-pid "${BWRAP_ARGS[@]}" --bind /run /run -- ${SELFEXE} container-entrypoint "$@" &
70+
# Bash normally gives a background command /dev/null on stdin, so
71+
# keep stdin attached so QEMU can receive input.
72+
bwrap --as-pid-1 --unshare-pid "${BWRAP_ARGS[@]}" --bind /run /run -- ${SELFEXE} container-entrypoint "$@" <&0 &
7173
BWRAP_PID=$!
7274

7375
# Wait for bwrap to complete

‎docs/src/man/bcvk-ephemeral-run.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ This design allows bcvk to provide VM-like isolation and boot behavior while lev
6767
**--console**
6868

6969
Connect the QEMU console to the container's stdio (visible via podman logs/attach)
70+
Add **-i -t** to send keyboard input to the guest console.
7071

7172
**--debug**
7273

@@ -216,7 +217,7 @@ run and SSH into one command with automatic cleanup.
216217

217218
**Debugging boot issues**:
218219

219-
bcvk ephemeral run --console --name debugvm localhost/mybootc
220+
bcvk ephemeral run --console -it --name debugvm localhost/mybootc
220221

221222
## Understanding the Flags
222223

0 commit comments

Comments
 (0)