[plug] Systemd in VMs

Gregory Orange home at oranges.id.au
Tue Nov 19 22:43:05 AWST 2024


On 19/11/24 16:10, Brad Campbell wrote:
> Due to "legacy" on shutdown the host iteratively sshs into each VM and performs an '/sbin/poweroff' to cleanly stop the VMs before putting a virtual axe through them. This has been the way it's worked for >10 or so years. The Ubuntu VMs are "relatively" new. With those, '/sbin/poweroff' shuts the VM down, but does it by forcibly and unceremoniously terminating all running processes. This makes for a nice quick shutdown, but leaves databases in various states of "broken" because nothing has a chance to shut down "cleanly".
> These needed their shutdown command changed from '/sbin/poweroff' to 'systemctl poweroff' to prevent them corrupting stuff on shutdown.

So many quirks of habit that we have, subtly different to each other.
I've long run `halt -p`, I think because `halt` (or was it shutdown
without -h?) on FreeBSD $version at $job[x] shutdown the OS but didn't
power off.

You've prompted me to look at an Ubuntu 22.04 machine...
ubuntu at dev22:~$ ls -l `which poweroff`
lrwxrwxrwx 1 root root 14 Nov 22  2023 /usr/sbin/poweroff -> /bin/systemctl
ubuntu at dev22:~$ ls -l /sbin/poweroff
lrwxrwxrwx 1 root root 14 Nov 22  2023 /sbin/poweroff -> /bin/systemctl

Interesting.
The manpage talks about preserving compatibility with SysV commands.
I wonder if you're on Ubuntu 24.04.

Also, are you talking about a KVM host? From memory I tend to run `virsh
shutdown $id` and that does things cleanly. I can `destroy` if I want to
be brutal.



More information about the plug mailing list