Skip to main content
RunBook Academy

Proxmox VEIX · Virtual MachinesGuest integration

The QEMU guest agent in depth

Intermediate⏱ ~24 minqmqemu-guest-agent

What you'll learn

  • List what the guest agent enables and what silently degrades without it
  • Configure all four agent sub-options deliberately rather than accepting defaults
  • Run commands inside a guest from the host and know the security implications
  • Diagnose a configured agent that is not answering, from the host and from the guest

Prerequisites

Verified against Proxmox VE 9.2.4 · Proxmox Backup Server 4.2.5 · Ceph Squid / Tentacle · Debian 13 (Trixie) · Linux kernel 7.0 (PVE 9.2 default) · 2026-08-12

Not yet marked complete on this device.

The QEMU guest agent is a small daemon inside the guest that listens on a virtual serial channel and answers requests from the hypervisor. It is the only supported way for Proxmox VE to know anything about what is happening inside a virtual machine, and it converts several operations from “hope” to “know”.

It is also the feature most commonly half-configured. Enabling it on the VM and installing it in the guest are two independent acts, and a cluster where one has been done without the other looks correct from the interface while being wrong everywhere it matters.

What the agent enables

CapabilityWithout the agentWith the agent
Backup consistencyCrash consistentFilesystem consistent, via fsfreeze-freeze and fsfreeze-thaw
ShutdownACPI power button, and hope the guest is listeningA real shutdown request to the guest OS
IP address in the interfaceRead from the VM configuration onlyActual addresses as configured inside the guest
Guest OS and hostnameNot availableReported by the guest
Trim after a disk moveFreed blocks stay allocated on thin storagefstrim can be issued automatically
Running a command in a guestNot possibleqm guest exec

The first row is the one that carries the most consequence, and it is covered in xiii-pbs-backup-modes. The rest are conveniences that become important at scale: an estate where the interface shows real guest IP addresses is one where you can find a machine from a network alert in ten seconds.

The four sub-options

agent: [enabled=]<1|0> [,freeze-fs=<1|0>]
       [,fstrim_cloned_disks=<1|0>] [,type=<virtio|isa>]
Sub-optionDefaultWhat it does
enabled0Whether PVE talks to the agent at all
freeze-fs1Whether the filesystems are frozen for a backup
fstrim_cloned_disks0Whether fstrim runs after moving a disk or migrating the VM
typevirtioThe channel transport. virtio for everything modern; isa exists for guests that cannot do virtio
Configuration changethe settings, stated explicitly
set -euo pipefail
VMID=118

qm set "$VMID" --agent enabled=1,freeze-fs=1,fstrim_cloned_disks=1,type=virtio

# The virtio-serial channel is added to the machine definition, so the guest
# only sees it after the QEMU process is replaced.
qm shutdown "$VMID" --timeout 300
qm start "$VMID"

Installing it in the guest

Configuration changeguest-side installation
set -euo pipefail

# Debian and Ubuntu
apt update && apt install -y qemu-guest-agent
systemctl enable --now qemu-guest-agent

# RHEL, Rocky, Alma
# dnf install -y qemu-guest-agent && systemctl enable --now qemu-guest-agent

# Verify from inside the guest that the channel device exists at all. If this
# path is missing, the VM was never cold started after enabling the agent.
ls -l /dev/virtio-ports/org.qemu.guest_agent.0

systemctl is-active qemu-guest-agent

On Windows the agent comes from the VirtIO driver ISO and installs as a service. It is a separate component from the VirtIO storage and network drivers, and installing the drivers does not install the agent — which is why a Windows guest can have perfect VirtIO performance and no agent at all.

Talking to the agent

qm guest cmd sends a single guest-agent command; qm guest exec runs a program inside the guest.

Read-only / Safethe liveness check
# qm guest cmd 118 ping
{}

Illustrative output

Read-only / Safethe read-only agent commands worth knowing
set -euo pipefail
VMID=118

qm guest cmd "$VMID" ping                     # is it answering at all
qm guest cmd "$VMID" get-osinfo               # distribution, version, kernel
qm guest cmd "$VMID" get-host-name            # hostname as the guest knows it
qm guest cmd "$VMID" get-fsinfo               # mounted filesystems and usage
qm guest cmd "$VMID" network-get-interfaces   # real addresses, per interface
qm guest cmd "$VMID" get-time                 # clock, for drift investigations
qm guest cmd "$VMID" fsfreeze-status          # thawed, or stuck frozen
Service impact possiblerunning a command inside the guest
set -euo pipefail
VMID=118

# Synchronous by default: PVE waits for the command and prints its output.
qm guest exec "$VMID" -- /bin/df -h /var

# Give a slow command more room than the default timeout allows.
qm guest exec "$VMID" --timeout 60 -- /usr/bin/systemctl is-active nginx

# Fire and forget, then collect the result by PID with qm guest exec-status.
qm guest exec "$VMID" --synchronous 0 -- /usr/sbin/logrotate -f /etc/logrotate.conf

Diagnosing an agent that is not answering

This is the practical core of the lesson, because “agent configured but not answering” is a silent state that survives for months.

Read-only / Safethe diagnostic ladder, host side first
set -euo pipefail
VMID=118

# 1. Is the agent enabled in the configuration at all?
qm config "$VMID" | grep -E '^agent:' || echo 'agent not configured'

# 2. Does the running QEMU process actually have the channel? If the agent was
#    enabled without a cold start, the configuration says yes and the machine
#    says no.
qm showcmd "$VMID" | tr ' ' '\n' | grep -A1 'org.qemu.guest_agent' || \
echo 'no guest agent channel in the running machine: cold start needed'

# 3. Does it answer?
qm guest cmd "$VMID" ping && echo 'agent OK'

# 4. Is it wedged in a freeze? A guest whose filesystems are frozen will
#    appear hung and will not answer most commands.
qm guest cmd "$VMID" fsfreeze-status
SymptomCauseFix
agent absent from qm configNever enabledqm set --agent enabled=1, then cold start
agent present, no channel in qm showcmdEnabled but never cold startedqm shutdown then qm start. A reboot is not enough
Channel present, ping failsPackage missing or service stopped in the guestInstall and systemctl enable --now qemu-guest-agent
ping fails, guest appears hung, disks idleFilesystems left frozen by an interrupted backupqm guest cmd VMID fsfreeze-thaw
Works, then stops after a guest upgradeService masked or package removed by the upgradeRe-enable; add it to the guest configuration baseline

Knowledge check

Knowledge check · 4 questions

  1. Q1. You run qm set 118 --agent enabled=1, then reboot the guest from inside it. The agent still does not answer. Why?

  2. Q2. Which are accurate statements about qm guest exec? Select all that apply.

  3. Q3. A guest left frozen by an interrupted backup looks like a hung VM, and thawing it is worth trying before resetting.

  4. Q4. Which agent sub-option is off by default but usually worth enabling on thin-provisioned storage?

Passing score: 75%. Answers are checked in this browser.