diff --git a/src/runtime/virtcontainers/qemu.go b/src/runtime/virtcontainers/qemu.go index 761bdd2fc0..11b779eb81 100644 --- a/src/runtime/virtcontainers/qemu.go +++ b/src/runtime/virtcontainers/qemu.go @@ -515,7 +515,7 @@ func (q *qemu) CreateVM(ctx context.Context, id string, network Network, hypervi NoDefaults: true, NoGraphic: true, NoReboot: true, - Daemonize: true, + Daemonize: false, MemPrealloc: q.config.MemPrealloc, HugePages: q.config.HugePages, IOMMUPlatform: q.config.IOMMUPlatform, @@ -936,6 +936,11 @@ func (q *qemu) StartVM(ctx context.Context, timeout int) error { // Wait for it to exit to assume that the QEMU daemon was // actually started. qemuCmd.Wait() + } else { + // Ensure the QEMU process is reaped after termination + go func() { + qemuCmd.Wait() + }() } err = q.waitVM(ctx, qmpConn, timeout)