Qemu-guest-agent: Difference between revisions
(→Installation: agent needs two dashes) |
|||
(15 intermediate revisions by 4 users not shown) | |||
Line 4: | Line 4: | ||
to exchange information between the host and guest, and to execute command in the guest. | to exchange information between the host and guest, and to execute command in the guest. | ||
In Proxmox VE, the qemu-guest-agent is used for mainly | In Proxmox VE, the qemu-guest-agent is used for mainly three things: | ||
# To properly shutdown the guest, instead of relying on ACPI commands or windows policies | # 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). | # To freeze the guest file system when making a backup/snapshot (on windows, use the volume shadow copy service VSS). If the guest agent is enabled and running, it calls ''guest-fsfreeze-freeze'' and ''guest-fsfreeze-thaw'' to improve consistency. | ||
# In the phase when the guest (VM) is resumed after pause (for example after shapshot) it immediately synchronizes its time with the hypervisor using qemu-guest-agent (as first step). | |||
== Installation == | == Installation == | ||
Line 12: | Line 13: | ||
=== Host === | === Host === | ||
You have to | You have to install guest-agent in each VM and then enable it, you can do that in the Proxmox VE Webinterface (GUI) | ||
[[File: | [[File:Proxmox VE - QEMU Guest Agent Option.png|QEMU Guest Agent Option]] | ||
or via CLI: | or via CLI: <code>qm set VMID --agent 1</code> | ||
=== Guest === | === Guest === | ||
Line 35: | Line 34: | ||
yum install qemu-guest-agent | yum install qemu-guest-agent | ||
Depending on the distribution, the guest agent might not start automatically after the installation. | |||
Start it either directly with | |||
systemctl start qemu-guest-agent | |||
Then enable the service to autostart (permanently) if not auto started, with | |||
systemctl enable qemu-guest-agent | |||
(should work for most distributions) or reboot the guest. | |||
==== Windows ==== | ==== Windows ==== | ||
Line 49: | Line 62: | ||
# Go to the mounted ISO in explorer | # Go to the mounted ISO in explorer | ||
# Execute the installer with double click (either qemu-ga- | # The guest agent installer is in the directory '''guest-agent''' | ||
# Execute the installer with double click (either '''qemu-ga-x86_64.msi''' (64-bit) or '''qemu-ga-i386.msi''' (32-bit) | |||
After that the qemu-guest-agent should be up and running. You can validate this in the list of Window Services, or in a PowerShell with: | After that the qemu-guest-agent should be up and running. You can validate this in the list of Window Services, or in a PowerShell with: | ||
Line 62: | Line 76: | ||
</pre> | </pre> | ||
If it is not running, you can use the '''Services''' control panel to start it and make sure that it will start automatically on the next boot. | |||
=== Testing that the communication with the guest agent is working === | === Testing that the communication with the guest agent is working === | ||
Line 77: | Line 91: | ||
http://wiki.qemu.org/Features/GuestAgent | http://wiki.qemu.org/Features/GuestAgent | ||
https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/virtualization_deployment_and_administration_guide/chap-kvm_guest_timing_management | |||
[[Category: HOWTO]] [[Category: Installation]] | [[Category: HOWTO]] [[Category: Installation]] |
Latest revision as of 08:28, 16 June 2023
Introduction - What is qemu-guest-agent
The qemu-guest-agent is a helper daemon, which is installed in the guest. It is used to exchange information between the host and guest, and to execute command in the guest.
In Proxmox VE, the qemu-guest-agent is used for mainly three things:
- To properly shutdown the guest, instead of relying on ACPI commands or windows policies
- To freeze the guest file system when making a backup/snapshot (on windows, use the volume shadow copy service VSS). If the guest agent is enabled and running, it calls guest-fsfreeze-freeze and guest-fsfreeze-thaw to improve consistency.
- In the phase when the guest (VM) is resumed after pause (for example after shapshot) it immediately synchronizes its time with the hypervisor using qemu-guest-agent (as first step).
Installation
Host
You have to install guest-agent in each VM and then enable it, you can do that in the Proxmox VE Webinterface (GUI)
or via CLI: qm set VMID --agent 1
Guest
Linux
On Linux you have to simply install the qemu-guest-agent, please refer to the documentation of your system.
We show here the commands for Debian/Ubuntu and Redhat based systems:
on Debian/Ubuntu based systems (with apt-get) run:
apt-get install qemu-guest-agent
and on Redhat based systems (with yum):
yum install qemu-guest-agent
Depending on the distribution, the guest agent might not start automatically after the installation.
Start it either directly with
systemctl start qemu-guest-agent
Then enable the service to autostart (permanently) if not auto started, with
systemctl enable qemu-guest-agent
(should work for most distributions) or reboot the guest.
Windows
First you have to download the virtio-win driver iso (see Windows VirtIO Drivers).
Then install the virtio-serial driver:
- Attach the ISO to your windows VM (virtio-*.iso)
- Go to the windows Device Manager
- Look for "PCI Simple Communications Controller"
- Right Click -> Update Driver and select on the mounted iso in DRIVE:\vioserial\<OSVERSION>\ where <OSVERSION> is your Windows Version (e.g. 2k12R2 for Windows 2012 R2)
After that, you have to install the qemu-guest-agent:
- Go to the mounted ISO in explorer
- The guest agent installer is in the directory guest-agent
- Execute the installer with double click (either qemu-ga-x86_64.msi (64-bit) or qemu-ga-i386.msi (32-bit)
After that the qemu-guest-agent should be up and running. You can validate this in the list of Window Services, or in a PowerShell with:
PS C:\Users\Administrator> Get-Service QEMU-GA Status Name DisplayName ------ ---- ----------- Running QEMU-GA QEMU Guest Agent
If it is not running, you can use the Services control panel to start it and make sure that it will start automatically on the next boot.
Testing that the communication with the guest agent is working
The communication with the guest agent takes place over a unix socket located in /var/run/qemu-server/<my_vmid>.qga You can test the communication qm agent:
qm agent <vmid> ping
if the qemu-guest-agent is correctly runnning in the VM, it will return without an error message.