churchers / vm-bhyve

Shell based, minimal dependency bhyve manager
BSD 2-Clause "Simplified" License
827 stars 175 forks source link

Double ACPI poweroff incompatible with illumos guests #350

Open jblachly opened 4 years ago

jblachly commented 4 years ago

Illumos ACPI driver in kernel interprets a second poweroff even within a timeout period as a "cancel" request.

Thus, vm stop <guestname> won't shutdown an illumos guest:

Feb  1 13:37:34 omniosce power: [ID 199196 kern.notice] NOTICE: Power Button pressed 2 times, cancelling all requests

However, if we modify vm-core to remove the second signal, it works fine:

root@freebsd:~ # diff vm-core.original /usr/local/lib/vm-bhyve/vm-core
656,657d655
<                 sleep 1
<                 kill "${_pid}" >/dev/null 2>&1

leads to proper shutdown.

If there is an important reason to keep the second SIGTERM, could we at least make it configurable?

churchers commented 4 years ago

Originally I was unable to get a Windows guest to shut down with a single call. I have no real idea why but Windows would just act like nothing happened. Two calls produced a fairly consistent poweroff. Could of just been something weird with my test machine of course.

I'll test again and see if I still have the same problem. Would be interesting if someone else running Windows tried to see if they get the same result.

janbiedermann commented 4 months ago

@churchers thats documented behavior for Windows, see: https://www.tenforums.com/tutorials/107875-add-enable-forced-button-lid-shutdown-power-options-windows.html