Getting "Auto resize VM with window" working in virt-manager with a Linux guest
This is weirdly undocumented and difficult to figure out.
You might encounter a grayed-out "Auto resize VM with window" option in the View > Scale Display menu in Virtual Machine Manager (virt-manager) with a Linux VM. Hovering over this option tells you, "Guest agent is not running"

If you're using Virtual Machine Manager (virt-manager) on Linux with a Linux guest, there are some steps to get automatic resizing of your VM working:
- Ensure you use the Virtio video model (VM settings > Video > Virtio)
- In the guest, install the
qemu-guest-agent
and the spice guest agentspice-vdagent
.
The error message just says it can't find the "guest agent," but it doesn't tell you which one. You might assume the qemu-guest-agent is what's needed, but it is insufficient.
e.g.:sudo apt install qemu-guest-agent spice-vdagent
- Restart the VM.
- You should now be able to see the "Auto resize VM with window" under View > Scale Display as not grayed-out, and be able to check it.
- If you're using Gnome, then it should just work. Try resizing the window.
If you're using xfce4 as your guest window manager, you need an additional step, because spice-vdagent
helpfully stopped doing this automatically, preferring to throw out an event for the window manager to handle—and then didn't coordinate with the window managers to actually finish the job. Communication in open source is hard, amiright?
Anyway: install this helpful third-party little service that listens for that event and does the right thing for xfce4: https://gitlab.com/apteryks/x-resize – and if so inclined, advocate for xfce4 to fix this here.
Now, excuse me while I submit a PR to virt-manager to fix the copy on that hover message.