qemu guest agent shutdown

Having issues with your DietPi installation or found a bug? Post it here.
jollyrogr
Posts: 13
Joined: Mon Jul 13, 2020 7:52 pm

qemu guest agent shutdown

Post by jollyrogr »

Is there a way to fix the shutdown on dietpi so that qemu guest agent can shut down a dietpi guest?

I'm running multiple dietpi instances as guests on a proxmox host. This worked well in buster, but after upgrading to bullseye, the dietpi guests do not seem to work with the guest agent "shutdown" command so the guest agent can't shutdown the VM.

Thanks
rpopken
Posts: 3
Joined: Wed Nov 10, 2021 1:15 pm

Re: qemu guest agent shutdown

Post by rpopken »

Same problem here.
Virtual Environment 7.0-14 (patched today)
Command does arrive in the VM, but does not get executed.
Plain Debian Bullseye has no problems and shuts down immediately.

Output in Dietpi-VM:

Code: Select all

root@DietPi-Docker-Test-109:~# systemctl status qemu-guest-agent
● qemu-guest-agent.service - QEMU Guest Agent
     Loaded: loaded (/lib/systemd/system/qemu-guest-agent.service; static)
     Active: active (running) since Wed 2021-11-10 11:49:01 CET; 1h 28min ago
   Main PID: 363 (qemu-ga)
      Tasks: 2 (limit: 4787)
     Memory: 2.5M
        CPU: 3.541s
     CGroup: /system.slice/qemu-guest-agent.service
             └─363 /usr/sbin/qemu-ga

nov 10 11:49:01 DietPi-Docker-Test-109 systemd[1]: Started QEMU Guest Agent.
nov 10 11:50:39 DietPi-Docker-Test-109 qemu-ga[363]: info: guest-ping called
nov 10 11:50:42 DietPi-Docker-Test-109 qemu-ga[363]: info: guest-shutdown called, mode: (null)
nov 10 11:50:50 DietPi-Docker-Test-109 qemu-ga[363]: info: guest-ping called
nov 10 11:51:00 DietPi-Docker-Test-109 qemu-ga[363]: info: guest-ping called
nov 10 11:51:11 DietPi-Docker-Test-109 qemu-ga[363]: info: guest-ping called
nov 10 11:51:21 DietPi-Docker-Test-109 qemu-ga[363]: info: guest-ping called
nov 10 13:17:37 DietPi-Docker-Test-109 qemu-ga[363]: info: guest-ping called
nov 10 13:17:40 DietPi-Docker-Test-109 qemu-ga[363]: info: guest-shutdown called, mode: (null)
nov 10 13:17:48 DietPi-Docker-Test-109 qemu-ga[363]: info: guest-ping called
User avatar
MichaIng
Site Admin
Posts: 3514
Joined: Sat Nov 18, 2017 6:21 pm

Re: qemu guest agent shutdown

Post by MichaIng »

It is an x86_64 host and guest? Do the OS/QEMU versions in host and guest match? The qemu-guest-agent package received 2 major version bumps from Buster to Bullseye, hence some incompatibility might be included.
jollyrogr
Posts: 13
Joined: Mon Jul 13, 2020 7:52 pm

Re: qemu guest agent shutdown

Post by jollyrogr »

MichaIng wrote: Wed Nov 10, 2021 9:32 pm It is an x86_64 host and guest? Do the OS/QEMU versions in host and guest match? The qemu-guest-agent package received 2 major version bumps from Buster to Bullseye, hence some incompatibility might be included.
I had this thought as well. I'm currently running proxmox 6 (buster) host and the guests are dietpi 7 (bullseye). I'm thinking the problem will resolve itself when I get proxmox upgraded to 7 (bullseye).
rpopken
Posts: 3
Joined: Wed Nov 10, 2021 1:15 pm

Re: qemu guest agent shutdown

Post by rpopken »

My Proxmox server Virtual Environment 7.0-14 is bullseye based and has the issues. It runs on a X86_64 host (Ryzen 2400GE).
I run a OpenMediaVault server as guest (Buster) and it shuts down fine.

It's just as if the Bullseye version of DietPi prohibits the shutdown because of some security policy or the shutdown signal doesn't get picked up by the system.

qemu-ga: info: guest-ping called give the Proxmox interface a status update of the guest. This seems to be working fine.
User avatar
Joulinar
Posts: 6441
Joined: Sat Nov 16, 2019 12:49 am

Re: qemu guest agent shutdown

Post by Joulinar »

just to avoid a misunderstanding. DietPi themselves don't have any security policies. Could it be an issue of Debian Bullseye? Did someone tried a plain Debian install?
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
User avatar
MichaIng
Site Admin
Posts: 3514
Joined: Sat Nov 18, 2017 6:21 pm

Re: qemu guest agent shutdown

Post by MichaIng »

@rpopken
So you mean Bullseye host + Buster guest works, Bullseye host + Bullseye guest does not work in your case? Indeed looks like a change in Bullseye then. But as stated, we do not apply any security policy, I don't have any experience with the QEMU agent, and we do not create Bullseye images any different than Buster images in any of those regards. It happened here and there that on Bullseye some packages got dependencies removed or degraded to recommendations, while other apps, depending on them, still required those previously pulled in dependencies. Basically it would be an idea to compare the package lists between the Buster and Bullseye host, respectively reviewing the autoremoved packages after the upgrade.

Another test could be to upgrade the package on the Buster system to the new version via backports:

Code: Select all

apt install -t buster-backports qemu-guest-agent
This version matches the one from Bullseye, so if the issue is related to his, it should be seen.

And finally, I'm not sure how communication is done, but often such things require dbus and/or logind, especially for shutdown actions. At least worth a try:

Code: Select all

systemctl unmask systemd-logind
apt install dbus
systemctl start systemd-logind
Through, if this was really the issue, there should be some "bus not found" like errors :?.
jollyrogr
Posts: 13
Joined: Mon Jul 13, 2020 7:52 pm

Re: qemu guest agent shutdown

Post by jollyrogr »

MichaIng wrote: Fri Nov 12, 2021 3:28 pm
And finally, I'm not sure how communication is done, but often such things require dbus and/or logind, especially for shutdown actions. At least worth a try:

Code: Select all

systemctl unmask systemd-logind
apt install dbus
systemctl start systemd-logind
Through, if this was really the issue, there should be some "bus not found" like errors :?.
This works for me. Have verified on 4 dietpi bullseye guests. I would just add to reboot the guest after those 3 commands otherwise that first shutdown command you give will take awhile.
User avatar
MichaIng
Site Admin
Posts: 3514
Joined: Sat Nov 18, 2017 6:21 pm

Re: qemu guest agent shutdown

Post by MichaIng »

Okay, good to know. Strange that this obviously wasn't required on Buster, but the package didn't add the dbus package or systemd to the dependency list: https://packages.debian.org/bullseye/qemu-guest-agent

If you both can verify, then I'll report this to the Debian bug tracker, also to check back whether there is another solution: ... ah, it's there already: https://bugs.debian.org/cgi-bin/bugrepo ... bug=951781
The symptoms fit, right? Looks like we can add our solution and the info that it is still present on latest v5.2. Buster is v3.1, so v4.2 was either from backports or during Bullseye testing phase.
jollyrogr
Posts: 13
Joined: Mon Jul 13, 2020 7:52 pm

Re: qemu guest agent shutdown

Post by jollyrogr »

I don't think the issue is the same. Issuing a shutdown command from the host would simply timeout and doesn't seem to do anything on the guest.
Post Reply