Hero Image

How to get qemu guest agent working in freebsd

I had some trouble today when trying to get the qemu guest agent working in freebsd and libvirt. Here are the processes to get it working.

  1. ensure that virtio_console driver is working
  2. ensure that you have properly modified your 'channel' to include a necessary qemu channel for serial
  3. ensure that you are installing the native qemu-guest agent from pkg not ports.

Here is the xml file that you need to add to your virtual machine (create new hardware with a channel type)

<channel type="unix">
  <target type="virtio" name="org.qemu.guest_agent.0"/>
  <address type="virtio-serial" controller="0" bus="0" port="2"/>
</channel>

Once that is done startup the vm and ensure that you are loading the proper drivers at boot time in loader.conf:

virtio_console_load="YES"

Once that is done you need to enable it at boot time in rc.conf:

qemu_guest_agent_enable="YES"
qemu_guest_agent_flags="-d -v -l /var/log/qemu-ga.log"

Finally, install qemu-ga package

pkg install qemu-guest-agent

That should be about it. This lets qemu manage freebsd from libvirt.