I have gone further and run gdb.
It seems that the agent actually tries to call /sbin/shutdown with the following parameters:
"-h -P +0 hypervisor initiated shutdown"
But if I run shutdown manually with these parameters, I get an error and the help message shows up:
root@fileserver:/sbin# /sbin/shutdown -h -P +0 hypervisor initiated shutdown
Usage: shutdown [-akrhPHfFnc] [-t sec] time [warning message]
-a: use /etc/shutdown.allow
-k: don't really shutdown, only warn.
-r: reboot after shutdown.
-h: halt after shutdown.
-P: halt action is to turn off power.
can only be used along with -h flag.
-H: halt action is to just halt.
can only be used along with -h flag.
-f: do a 'fast' reboot (skip fsck).
-F: Force fsck on reboot.
-n: do not go through "init" but go down real fast.
-c: cancel a running shutdown.
-q: quiet mode - display fewer shutdown warnings.
-Q: full quiet mode - display only final shutdown warning.
-t secs: delay between warning and kill signal.
** the "time" argument is mandatory! (try "now") **
So it seems that /sbin/shutdown does not like the command line that qemu-agent uses.
It seems that the Devuan shutdown command wants a mandatory "time", so for example
shutdown -h -P now
works.
But the qemu agent uses a syntax that is wrong for the Devuan shutdown binary, while it works fine for the systemd-infested shutdown that is just a link to systemcl (in Debian 11).
A workaroung is to rename /sbin/shutdown and create a script that calls shutdown with a command line that it accepts, like:
/sbin/shutdown -h -P now hypervisor initiated shutdown
Notice the "now" instead of the "+0" in the arguments.
--
Fabio "Kurgan" Muzzi
- IZ4UFQ -
"Il massimo danno con il minimo sforzo"