In this tutorial I will show you how to install the qemu-guest-agent package on Ubuntu 20.04.
1. What is qemu-guest-agent?
The qemu-guest-agent is a helper daemon, which is installed in a guest VM. It is used to exchange information between the host and guest, and to execute commands in the guest machine.
For example, when using Proxmox VE, the qemu-guest-agent is used for the following major features:
- To properly shutdown the guest, instead of relying on ACPI commands or windows policies.
- To freeze the guest file system when making a backup (on windows, use the volume shadow copy service VSS).
It is a good practice to install the qemu-guest-agent on all VM’s for the above reasons but also for various other stability tweaks and features.
2. Enable qemu-guest-agent in Proxmox for VM
The first step is to enable the qemu-guest-agent option for your VM. In Proxmox VE you can do this as follows.
Firstly, connect to your Proxmox server web interface (by default this is https://proxmox_ip:8006).
Important: Make sure the VM is shutdown before continuing. If the VM is currently running, shut it down now.
- Select the VM in the Proxmox interface, and then click on the “options” tab.
- Click on the “QEMU Guest Agent” row.
- Click on the “Edit” button.
- Check the “Use QEMU Guest Agent” checkbox.
- Click “OK”.
- Boot the VM / turn it on.
3. Install QEMU guest agent package on Ubuntu VM
Login to your Ubuntu VM via SSH and issue the following commands:
sudo apt -y install qemu-guest-agent sudo systemctl enable qemu-guest-agent sudo systemctl start qemu-guest-agent
Note: if you get a message saying “The unit files have no installation config” you can safely ignore it.
The qemu-guest-agent is now installed! You can check if the service is running with this command:
sudo systemctl status qemu-guest-agent
This command should give the following output:
● qemu-guest-agent.service - QEMU Guest Agent Loaded: loaded (/lib/systemd/system/qemu-guest-agent.service; static; vendor preset: enabled) Active: active (running) since Mon 2021-11-22 19:52:07 CET; 19min ago Main PID: 464 (qemu-ga) Tasks: 1 (limit: 4637) Memory: 1.0M CGroup: /system.slice/qemu-guest-agent.service └─464 /usr/sbin/qemu-ga
4. Check if guest agent is succesfully running in Proxmox webinterface
An easy way to check if the qemu-guest-agent is running, is to look at the “summary” tab of your VM in Proxmox. It should now show the IP address(es) currently in use by the VM:
That’s it. Your VM is now running the qemu-guest-agent! I hope this guide helped you.