]> git.ipfire.org Git - thirdparty/systemd.git/commit
shutdown: do not delay VM shutdown
authorLuca Boccassi <luca.boccassi@gmail.com>
Sat, 30 May 2026 18:40:51 +0000 (19:40 +0100)
committerLuca Boccassi <luca.boccassi@gmail.com>
Mon, 1 Jun 2026 17:41:17 +0000 (18:41 +0100)
commit7b62f9b4f5afd8323aa1dc5dc9d93da5e2bbe320
treed5cd689aeee7673bff3a7da18b40dbd57492ab20
parent414fc6e3b200eea45ee97eddb79c7496e01db16c
shutdown: do not delay VM shutdown

Since this was introduced I constantly find myself waiting for VMs to
shut down at the end of a test. This not only happens with mkosi integration
tests, but with other VM-based tests like for example autopkgtest. In this
example, this dracut test suite runtime is tripled due to the artificial delay:

[    5.813234] systemd-shutdown[1]: Syncing filesystems and block devices.
[    5.814635] systemd-shutdown[1]: Delaying shutdown for 9s, in order to reach minimum uptime of 15s.
[    8.816855] systemd-shutdown[1]: Delaying shutdown for 6s, in order to reach minimum uptime of 15s.
[   11.819747] systemd-shutdown[1]: Delaying shutdown for 3s, in order to reach minimum uptime of 15s.
[   14.822660] systemd-shutdown[1]: Delaying shutdown for 601ms, in order to reach minimum uptime of 15s.
[   15.427777] systemd-shutdown[1]: Powering off.
[   15.429681] sd 0:0:0:0: [sda] Synchronizing SCSI cache
[   15.433620] ACPI: PM: Preparing to enter system sleep state S5
[   15.435148] reboot: Power down
TEST: root filesystem on a ext4 filesystem with systemd and extensions   [OK]
autopkgtest [19:39:12]: test 46-systemd-sysext: -----------------------]
autopkgtest [19:39:13]: test 46-systemd-sysext:  - - - - - - - - - - results - - - - - - - - - -
46-systemd-sysext    PASS

Contrary to what the comment claimed, the scrollback of a VM is _not_
cleared, EDK2 just prints many pages, and one can just scroll up (a lot).

Do not delay by default on VMs. Move the check so that in both containers
and VMs users can override and force a delay with the env var.

Follow-up for 0874eea302d0ba2d436dcce0b992cdc957190ff4
src/shutdown/shutdown.c