QEMU Guest Agent Installation in Proxmox VE
If you are running a Proxmox VE server in your home lab or production, there is a component that you will want to know and use with your guest virtual machines in the environment. The QEMU agent is a component that is akin to VMware Tools in VMware vSphere that will help your VMs have the best integration possible with your hypervisor host. Let’s look at the QEMU guest agent installation in Proxmox for performance and integration.
Table of contents
QEMU Guest Agent (QEMU GA) brief overview
First of all, let’s talk about the QEMU agent in Proxmox, what it does, why you need it, and how it can help with your virtualized environment. The QEMU agent is a helper daemon in your virtual machine that passes information back and forth between the guest operating system and the hypervisor.
It does many things related to getting information, backups, proper shutdowns, etc:
- It allows executing commands in the guest OS and is used for proper shutdown of the guest
- It is responsible for freezing the guest file system during backups or snapshot operations
- It allows managing your guest virtual machines and displaying information for your guest environment such as IP addresses, etc.
Proxmox virtual machine management
Note the following benefits specific to the virtual machine qemu agent in Proxmox VE server:
- The QEMU Agent provides a system-level agent via standard QMP commands
- It enables the host to issue commands using libvirt and the guest operating system responds to these commands asynchronously
- The QEMU Agent adds features like guest time management
Installing the QEMU Guest Agent in Proxmox VE Server
If you are running Proxmox, how do you install the QEMU agent in your guest virtual machines? Let’s look at that process.
When you edit the QEMU agent configuration, you can enable:
- Use QEMU agent
- Run guest-trim after a disk move or VM migration
- Freeze/thawing (guest fsfreeze freeze) file systems on backup for consistency
You will see the QEMU agent enabled, but we need to reboot at this point. Note any error message you might receive. However, this process is generally very straightforward.
We choose to reboot the VM to install the qemu agent and so the agent is started on the next boot.
After the VM reboots, like VMware Tools does, we can see the IP address for the guest operating system, showing us the QEMU agent tools are installed.
Install QEMU guest agent in Linux
You can also install the QEMU agent in Linux using the command:
sudo apt install qemu-guest-agent
We can use QEMU agent systemctl commands to enable and start the service. Enable the Service to Start on Boot:
sudo systemctl enable qemu-guest-agent
Start the Service:
sudo systemctl start qemu-guest-agent
Install QEMU agent in Windows
Download the Installer:
- Download the latest VirtIO drivers here: https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/latest-virtio/virtio-win.iso
Install the VirtIO drivers:
- Run the installer and follow the wizard instructions
Verify the Service is started:
- Make sure the QEMU Guest Agent service is running in the Services management console.
Enable QEMU guest agent in Proxmox via the command line
You can enable QEMU guest agent in Proxmox using the command line with the following command with replacing the VMID with your virtual
qm set <VMID> --agent enabled=1
Understanding QEMU Guest Agent Communication
Note the following aspects of the QEMU guest agent communication and how it communicates with the host, protocols used, and guest-sync exchange:
- The QEMU Agent communicates with the host over a Unix socket located in
/var/run/qemu-server/<my_vmid>.qga
- The QEMU Agent protocol uses the same protocol as QMP. It also has some additional aspects for its isa-serial/virtio-serial transport
- The guest-sync request/response exchange is used to make sure of safe communications between the host and guest
Below is a graphical overview of how the QEMU guest agent communicates with the host and protocols used.
Best Practices for Virtual Machine Optimization
There are several best practices for virtual machine optimization when thinking about installing the QEMU agent. Note the following
- You will want to install the QEMU agent on all virtual machines to enable enhanced virtual machine management.
- Start the agent automatically on boot using the command
sudo systemctl enable qemu-guest-agent
. - You can use the QEMU agent to optimize virtual machine performance, including disk usage and clipboard open code
Troubleshooting the QEMU guest agent
You may run into a few issues with the QEMU agent running in guest operating systems in a Proxmox VE server environment. What are some of those?
- The agent is not responding: You may need to restart the agent, using the command
sudo systemctl restart qemu-guest-agent
- You suspect their are issues with the QEMU agent: You may need to take a look at the QEMU agent logs for the service. You can do that with the command:
sudo journalctl -u qemu-guest-agent
. - You can also check the status of the service using the command:
sudo systemctl status qemu-guest-agent
Wrapping up
The QEMU guest agent is an important component to a performant and manageable virtualization platform running on Proxmox. It is easy to install using the Proxmox web UI and the command line and it is an easy win for admins to make sure backups and snapshots are quiesced properly and you have the information you need for guest operating systems at your fingertips.
Making sure you have the QEMU agent installed is an aspect of making sure your Proxmox VE Server environment and the guest virtual machines are running according to best practices and the environment will perform and be stable when running your guest virtual machine workloads.