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
Capability
Without the agent
With the agent
Backup consistency
Crash consistent
Filesystem consistent, via fsfreeze-freeze and fsfreeze-thaw
Shutdown
ACPI power button, and hope the guest is listening
A real shutdown request to the guest OS
IP address in the interface
Read from the VM configuration only
Actual addresses as configured inside the guest
Guest OS and hostname
Not available
Reported by the guest
Trim after a disk move
Freed blocks stay allocated on thin storage
fstrim can be issued automatically
Running a command in a guest
Not possible
qm 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.
Whether fstrim runs after moving a disk or migrating the VM
type
virtio
The channel transport. virtio for everything modern; isa exists for guests that cannot do virtio
Configuration changethe settings, stated explicitly— Writing all four out means the next person sees a decision instead of a default. The channel device appears at the next cold start, not at a reboot.
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— Run inside the guest, not on the host. The service must be enabled as well as installed - a stopped service is the commonest half-configuration.
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— An empty JSON object is success. An error here means the agent is not answering, whatever the VM configuration claims.
# qm guest cmd 118 ping
{}
Illustrative output
Read-only / Safethe read-only agent commands worth knowing— All of these inspect the guest and change nothing. They are the fastest way to answer questions about a guest you do not have a shell on.
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— Executes as root inside the guest. This is a real administrative action taken without SSH and without an audit trail 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— Read-only throughout. Each rung rules out one cause, in order of how cheap it is to check.
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
Symptom
Cause
Fix
agent absent from qm config
Never enabled
qm set --agent enabled=1, then cold start
agent present, no channel in qm showcmd
Enabled but never cold started
qm shutdown then qm start. A reboot is not enough
Channel present, ping fails
Package missing or service stopped in the guest
Install and systemctl enable --now qemu-guest-agent
ping fails, guest appears hung, disks idle
Filesystems left frozen by an interrupted backup
qm guest cmd VMID fsfreeze-thaw
Works, then stops after a guest upgrade
Service masked or package removed by the upgrade
Re-enable; add it to the guest configuration baseline
Knowledge check
Knowledge check · 4 questions
Q1. You run qm set 118 --agent enabled=1, then reboot the guest from inside it. The agent still does not answer. Why?
Q2. Which are accurate statements about qm guest exec? Select all that apply.
Q3. A guest left frozen by an interrupted backup looks like a hung VM, and thawing it is worth trying before resetting.
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.