Skip to content

Commit

Permalink
Add a work around for FreeBSD not shutting down properly.
Browse files Browse the repository at this point in the history
FreeBSD ought to shut down when it receives the ACPI power-off event
from QEMU, but for some reason does not.  For now, work around this by
ssh'ing in and running the poweroff command explicitly.

Signed-off-by: David Chisnall <github@theravensnest.org>
  • Loading branch information
davidchisnall committed Oct 7, 2023
1 parent 824a197 commit 7fbdbab
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkg/machine/qemu/machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -1019,6 +1019,12 @@ func (v *MachineVM) stopLocked() error {
return nil
}

// FreeBSD doesn't seem to respond to the power down events here, so prod it via SSH.
// This is probably a FreeBSD bug, so this work around can go away at some point.
if v.GuestOS == machine.FreeBSD {
return v.SSH("", machine.SSHOptions{Args: []string{"-q", "--", "/sbin/poweroff"}, Username: "root"})
}

qmpMonitor, err := qmp.NewSocketMonitor(v.QMPMonitor.Network, v.QMPMonitor.Address.GetPath(), v.QMPMonitor.Timeout)
if err != nil {
return err
Expand Down

0 comments on commit 7fbdbab

Please sign in to comment.