Skip to content
Log In Sign Up info@muvcloud.com

Install It

Inside the virtual machine, on Debian and Ubuntu:

sudo apt install qemu-guest-agent
sudo systemctl start qemu-guest-agent

On AlmaLinux and Rocky Linux:

sudo dnf install qemu-guest-agent
sudo systemctl enable --now qemu-guest-agent

On some distributions the service has no install section and starts by itself when the virtual device for the agent appears, so systemctl enable may print a notice instead of enabling it. That is expected. Check the state with:

systemctl status qemu-guest-agent
ls /dev/virtio-ports/

If the second command shows nothing, the virtual machine has no agent channel yet: the hypervisor side must be switched on, as described below.

What It Does

  • Reports IP addresses: the host and its management interface can show the guest's addresses without logging in.
  • Clean shutdown and reboot: the host asks the agent to shut down the system properly, instead of relying on an ACPI power button event the guest may ignore.
  • File system freeze: before a snapshot or backup, the agent flushes and freezes the file systems, then thaws them after the snapshot. The copy is consistent instead of looking like a sudden power loss.
  • Time correction: after a VM was paused or restored, the host can set the guest clock again (in Proxmox VE an option that is off by default).
  • Information: operating system, users, file systems, and other details for the management tools.

The agent talks to the host over a VirtIO serial channel, not over the network, so no firewall rule is needed. VirtIO devices are explained in what VirtIO is.

Switch It On in Proxmox VE

In the web interface, open the virtual machine, then Options, QEMU Guest Agent, and tick Use QEMU Guest Agent. From the shell of the host:

qm set 100 --agent enabled=1

The documentation says a fresh start of the virtual machine is needed for the change to take effect: shut it down and start it again, since a reboot from inside the guest keeps the running virtual hardware. Then test from the host:

qm agent 100 ping
qm guest cmd 100 network-get-interfaces

No output from the ping means the agent answered. An error that the agent is not running means the service inside the guest is stopped or the channel is missing. More about the platform in what Proxmox VE is.

With libvirt

On a KVM host managed with libvirt (see how to install KVM on Ubuntu), the virtual machine needs a channel device of the guest agent type. Machines created with virt-install on current versions usually have it. Test it with:

virsh qemu-agent-command vm1 '{"execute":"guest-ping"}'
virsh domifaddr vm1 --source agent

Freeze Hooks for Databases

A file system freeze makes the disk consistent, but a database may still hold data in memory. The agent can run hook scripts before the freeze and after the thaw, so a database flushes its tables first. The agent's --fsfreeze-hook option points to a script, on distribution packages usually /etc/qemu/fsfreeze-hook, that is called with freeze and thaw; whether the option is switched on and where extra scripts go depends on the distribution's package, so check its documentation. For important databases, also keep a dump made with the database's own tool, as described in how to back up a Linux server.

Troubleshooting

  • Agent not running: check systemctl status qemu-guest-agent in the guest and the journal for errors.
  • No device: the hypervisor option is off, or the VM was only rebooted after switching it on.
  • Freeze takes long or fails: a stuck process writing to disk, or a file system on a network share; check the guest's journal.
  • Shutdown hangs: a service inside the guest does not stop; the agent only starts the shutdown.

On a Rented Cloud Server

When you rent a KVM cloud server, only the guest side is yours: install and start the package inside your server. Whether the host uses the agent, for example for backups or for showing your addresses in a control panel, is your provider's decision. Installing it does no harm either way.

Updated:

Linux VPS with Full Root Access

MUVCloud cloud servers run on KVM with Enterprise NVMe SSD storage and full root access, in Turkey, the Netherlands, and the USA.

Cloud VPS Plans Starting at2.99 $/mo Cheap Linux VPS

No Limits on Service or Support

You are not on your own as your projects grow. Our support engineers are ready 24/7, on several channels, whenever you need them.

Support specialist
  • 100% customer satisfaction goal
  • Our own hardware
  • 24/7 ticket and email support
  • 4 countries with locations