Ubuntu 12.04 LTS KVM host with a OpenBSD 5.4 guest, `virsh shutdown` not working / freezing guest

kvm-virtualizationopenbsdUbuntuubuntu-12.04

I have Ubuntu 12.04 LTS KVM host with a OpenBSD 5.4 guest.

I am having an issue with virsh shutdown not working / freezing guest.

After calling shutdown, guest freezes and is unresponsive. Any ssh sessions freeze, and any vnc consoles are unresponsive. Nothing in the client logs at time of freeze.

Only resolution is to destroy guest in vish.


The issue appears similar to:
http://comments.gmane.org/gmane.os.openbsd.misc/200982


Shutdown From Host

  • From host:


$ sudo virsh list --all
...
15 ssh2 running
...


$ sudo virsh shutdown ssh2
Domain ssh2 is being shutdown


$ sudo virsh list --all
...
15 ssh2 running
...

  • After waiting 5 min, no status change.

Shutdown From Guest

  • Wathcing log during hist shutdown request:


sudo tail -F /var/log/messages

  • No additional values logged as result of shutodwn request.
  • Terminal (ssh) and console (via vnc) both become unresponsive.
  • Terminal (ssh) eventaully errors with Write failed: Broken pipe.

Host Details

  • Host:


$ uname -a
Linux kvm2 3.2.0-51-generic #77-Ubuntu SMP Wed Jul 24 20:18:19 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=12.04
DISTRIB_CODENAME=precise
DISTRIB_DESCRIPTION="Ubuntu 12.04.2 LTS"

  • Host kvm version:


$ virsh version
Compiled against library: libvir 0.9.8
Using library: libvir 0.9.8
Using API: QEMU 0.9.8
Running hypervisor: QEMU 1.0.0

  • Host kvm dominfo on guest:


$ virsh dominfo ssh2
Id: -
Name: ssh2
UUID: 7bb1977e-7268-f40a-32d4-5ae972be7e5f
OS Type: hvm
State: shut off
CPU(s): 2
Max memory: 524288 kB
Used memory: 524288 kB
Persistent: yes
Autostart: disable
Managed save: no
Security model: apparmor
Security DOI: 0

Guest Install Steps


sudo qemu-img create -f qcow2 -o preallocation=metadata /vm/ssh2-disk0.qcow2 2G

  • Run virt-install:


sudo virt-install \
--name ssh2 \
--ram 512 \
--vcpus=1 \
--os-variant=openbsd4 \
--hvm \
--cdrom /vm/install/install54-amd64.iso \
--network bridge:br0,model=virtio \
--graphics vnc \
--disk path=/vm/ssh2-disk0.qcow2,bus=virtio,size=2

  • Note: Used br0 instead of virbr0, as host uses br0.

  • From kvm:


sudo virsh vncdisplay ssh2

  • From desktop:


ssh -L 5910:127.0.0.1:5909 kvm2

  • Connect over vnc to localhost 5910, continue install.

  • Did not install game54.tgz or any x packages:


-game*
-x*

Best Answer

Qemu makes assumptions about ACPI that OpenBSD does not. Over the course of multiple OpenBSD and multiple Qemu/KVM versions, I have found the only way to effectively shut an OpenBSD guest down is with

halt -p

in the guest itself.