]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
vmspawn: enforce minimum uptime with --console=gui 42396/head
authorLuca Boccassi <luca.boccassi@gmail.com>
Mon, 1 Jun 2026 17:44:52 +0000 (18:44 +0100)
committerLuca Boccassi <luca.boccassi@gmail.com>
Mon, 1 Jun 2026 17:59:20 +0000 (18:59 +0100)
When using --console=gui the QEMU window closes immediately when the VM
has stopped, so any console output at shutdown is lost, which makes
debugging difficult. Ensure the VM stays booted for a minimum of 15s.

src/vmspawn/vmspawn.c

index 015d35023f6ec542fbe91d45b6f1cc62c14d77af..f7cbb9c72d0ff2c2a7bf24c5879554aeea8f57dc 100644 (file)
@@ -3049,6 +3049,13 @@ static int run_virtual_machine(int kvm_device_fd, int vhost_device_fd) {
                 if (r < 0)
                         return r;
 
+                /* When using --console=gui the QEMU window closes immediately when the VM has stopped, so
+                 * any console output at shutdown is lost, which makes debugging difficult. Ensure the VM
+                 * stays booted for a minimum of 15s. */
+                r = strv_prepend(&arg_kernel_cmdline_extra, "systemd.minimum_uptime_sec=15");
+                if (r < 0)
+                        return log_oom();
+
                 break;
 
         case CONSOLE_HEADLESS: