grep -R 'Working Proxmox QEMU Guest Agent on Alpine Linux' *

Posted on Apr 11, 2020
tl;dr: It works! Getting the QEMU GA up and running only requires changing the /etc/conf.d/qemu-guest-agent file.

Hey Victor,

How about you write a guide for yourself on how to get the QEMU Guest Agent working on Alpine Linux?

  Hold my “No Guest Agent configured” string, I’m going in!  

The problem:

Upon cloning a bunch of Alpine Linux VMs (no, of course I did not follow “best” practices and create a template, I just blindly cloned a working VM), I noticed that the qemu-guest-agent wouldn’t work.

Why?

I don’t know. All I know is that I was greeted with the dreaded status: crashed output from running service qemu-guest-agent status, as well as a /var/log/qemu-ga.log telling me that:

critical: failed to initialize guest agent channel

The fix…

… was in my case was pretty simple, I noticed the /etc/conf.d/qemu-guest-agent file was misconfigured (well, not configured at all). It should work with the default config, but for some reason it didn’t. On any of my 10 VM clones. It worked flawlessly on the original VM, though.

# Specifies the transport method used to communicate to QEMU on the host side
# Default: virtio-serial
#GA_METHOD="virtio-serial"

# Specifies the device path for the communications back to QEMU on the host
# Default: /dev/virtio-ports/org.qemu.guest_agent.0
#GA_PATH="/dev/virtio-ports/org.qemu.guest_agent.0"

Make sure you have enabled QEMU Guest Agent under the VM options.

First, find the device name, in my case it’s /dev/vport2p1. A simple ls /dev/vport* will get you far.
Second, add it to the /etc/conf.d/qemu-guest-agent file:

echo 'GA_PATH="/dev/vport2p1"' >> /etc/conf.d/qemu-guest-agent

OR
Second Second, symlink /dev/virtio-ports/org.qemu.guest_agent.0 to /dev/vportXpY.
Third, make sure qemu-guest-agent runs on boot:

rc-update add qemu-guest-agent

Fourth, reboot.

Note:

There are some false posts/discussions online saying that qemu-guest-agent requires udev in order to function properly. To save yourself some disk space, I can confirm my QEMU Guest Agent is working fine without the udev package installed.