Hello,

I'm running TurnKey LAMP 15.1 Virtual machine in Proxmox. Everything is just great (Thanks TurnKey!) except it does not shutdown from Proxmox.

That I tried is:

1. Installed qemu-guest-agent on TurnKey

2. Installed acpi-support on TurnKey

3. Installed acpi-support-base on TurnKey

4. Quemu agent in Proxmox on TurnKey VM is enabled

None of these helped me. Here is one line from TurnKey user.log after I press Shutdown button in Proxmox

lamp qemu-ga: info: guest-shutdown called, mode: (null)

Strangely I have also running OpenMediaVault VM on the same Proxmox and it does shutdown, no problem. Also tried to install fresh Debian and it also shuts down after qemu-guest-agent package was installed.

Please help me to solve this.

 

Forum: 
Jeremy Davis's picture

Apologies on my slow response, but I've been having a little time off and was snowed under in the week prior and didn't get time to address your post.

Can you share what version of Proxmox you are using?

Out of interest, I am running PVE 5.4 and all of my TurnKey VMs (installed from ISOs - plus Containers too FWIW) shut down fine, with no additional software packages installed or config tweaks!? I simply click the "Shutdown" (or "Stop") buttons and the VM (and/or container) just stops...

It is interesting that you've tested OpenMediaVault and vanilla Debian and they work ok. That would certainly suggest an issue specific to this VM, but as I noted above, my personal experience with TurnKey on Proxmox is very different - It "just works" OOTB.

A quick google turned up a similar sounding thread on the Proxmox forums (albeit related to CentOS & Fedora, rather than TurnKey) noting that this particular issue was caused by SELinux. However, unless you have installed/configured SELinux (or the similar alternate tool, App Amour) then that shouldn't be the issue here. If you have setup SELinux (or AppAmour, or ...), then that may well be the issue?! Perhaps the SELinux Debian wiki page (or insert link to AppAmour, etc docs) may help?

If you can rule that out (e.g. if you didn't do anything re SELinux/AppAmour/etc) then there must be something else going on. I recommend one thing worth trying would be to see if you can shut the VM down from within. E.g. log in via SSH and run "poweroff" (or "shutdown -h now", or "systemctl poweroff") and see what happens. It should shutdown.

If shutdown internally works ok, but it's still not working from the host, then perhaps the QEMU agent itself is part of the issue? That possibility only occurred to me when Google turned up a similar issue for another Debian based OS. The relevant comment states:

[...] Disable quemu-guest-agent in the vm options. It then shuts down the machine via acpi event which seems to work...

So as a test, perhaps try installing and launching a fresh TurnKey instance and test if it "just works" OOTB? At least that will enable us to see if that's the issue.

If there is some other reason why you need the QEMU agent, then perhaps that isn't a suitable workaround? But at least it might assist us to understand where the issue is occurring?!

Hope You had a good time J

I am using Proxmox

Kernel Version --> Linux 5.0.15-1-pve #1 SMP PVE 5.0.15-1 (Wed, 03 Jul 2019 10:51:57 +0200)

PVE Manager Version --> pve-manager/6.0-4/2a719255

OK, so I tried a fresh TurnKey ISO install on Proxmox and shutdown works OOTB (with qemu agent disabled in proxmox settings).

I realy messed up something... 

poweroff

command sends TurnKey to Halt (not poweroff), I then have manualy STOP TurnKey from Proxmox.

Now I removed qemu-guest-agent, acpi-support, acpi-support-base and no success.

No I have nothing with SELinux.

And I installed qemu according to this https://pve.proxmox.com/wiki/Qemu-guest-agent

Jeremy Davis's picture

I'm still on the previous major Proxmox version (v5.4) so perhaps there have been some changes in Proxmox (or it's Debian base) that have caused this?

FWIW, in my TurnKey VM, I have 2 ACPI related packages installed by default; they are: acpid & acpi-support-base. So I reckon that you'd need at least those packages to support triggering a shutdown via ACPI (although as I note below, it seems that the qemu-guest-agent doesn't use ACPI to shutdown the system).

Considering that your server doesn't properly shutdown from the commandline, I'm inclined to think that it's not related to the ACPI functions per se. AFAIK the Proxmox "shutdown" command triggers an ACPI "power button event" (i.e. it acts as if you pressed the power button on physical hardware). The power button event should run the command:

/sbin/shutdown -h -P now "Power button pressed"

See /etc/acpi/events/powerbtn-acpi-support; which notes the "action" /etc/acpi/powerbtn-acpi-support.sh; which in turn should run the above command.

If I run that command on my TurnKey server (from an SSH session) the terminal appears to hang. However, on inspection of the Proxmox dashboard, I can see that the server has stopped (so the "hang" behaviour is just the SSH session exiting uncleanly). If you run the above command and the server doesn't completely stop, then perhaps that's the root issue?

My thoughts seem to be consistent with the notes on the Proxmox Qemu-guest-agent page:

In Proxmox VE, the qemu-guest-agent is used for mainly [...]: To properly shutdown the guest, instead of relying on ACPI commands or windows policies

So it sounds like the guest agent should be triggering the shutdown too (although not via ACPI). I've done a bit of searching and I can't work out exactly how the qemu-guest-agent actually performs the shutdown, but I assume that it also leverages the shutdown command (similar to what ACPI should do, but not via the ACPI mechanism).

So to summarise, considering what you've posted, it seems likely to me that it's NOT related to ACPI at all, but is instead related to the shutdown command not working as it should.

Although having said that, that suggests that the behaviour of clicking "Shutdown" within Proxmox (with or without the qemu-guest-agent installed; i.e. either via ACPI or qemu-guest-agent) should be identical to running "/sbin/shutdown -h -P now" (which should be the same as "poweroff"). Re-reading your OP, I'm not completely sure that that is your experience though?! Whilst you didn't explicitly state it, I get the impression that the Proxmox "Shutdown" button does nothing; whereas from within the server it just does a "halt" (not full "poweroff"). Is that correct?

Jeremy Davis's picture

On re-reading, I just realised that you note:

I tried a fresh TurnKey ISO install on Proxmox and shutdown works OOTB (with qemu agent disabled in proxmox settings).

Sorry for any confusion I caused in my previous post by misinterpreting that...

So I suggest that on your old server, that you (re)install those 2 ACPI packages that I noted in my earlier post (acpid & acpid-support-base) and either remove the qemu-guest-agent (or don't reinstall it if you've already removed it), or disable it in proxmox settings - doing both is almost certainly redundant...

Add new comment