- Установка QEMU-агента
- Ubuntu 12.04, 14.04, 16.04
- Ubuntu 18.04
- CentOS 6
- CentOS 7 и 8
- Debian 7
- Debian 8 и выше
- Qemu-guest-agent
- Installation
- Host
- Guest
- Linux
- Windows
- Testing that the communication with the guest agent is working
- Install Proxmox qemu-guest-agent on Ubuntu 20.04
- 1. What is qemu-guest-agent?
- 2. Enable qemu-guest-agent in Proxmox for VM
- 3. Install QEMU guest agent package on Ubuntu VM
- 4. Check if guest agent is succesfully running in Proxmox webinterface
- By Leendert de Borst
- How To Install qemu-guest-agent on Ubuntu 18.04
- What is qemu-guest-agent
- Install qemu-guest-agent Using apt-get
- Install qemu-guest-agent Using apt
- Install qemu-guest-agent Using aptitude
- How To Uninstall qemu-guest-agent on Ubuntu 18.04
- Uninstall qemu-guest-agent And Its Dependencies
- Remove qemu-guest-agent Configurations and Data
- Remove qemu-guest-agent configuration, data, and all of its dependencies
- References
- Summary
Установка QEMU-агента
После перехода на виртуализацию KVM, на ваш сервер необходимо установить программу-демон QEMU Guest Agent . Она запускается внутри виртуальной машины и обеспечивает полноценную работу с сервером в панели управления. При отсутствии QEMU-агента будет невозможно создание резервных копий , а также корректное ведение статистики и ее вывод в ПУ.
Чтобы установить QEMU-агент, подключитесь к серверу по SSH и выполните в консоли приведенные ниже команды, выбрав вариант для вашей операционной системы.
Ubuntu 12.04, 14.04, 16.04
Ubuntu 18.04
apt update && apt install qemu-guest-agent -y;
CentOS 6
yum update -y; \
rpm -ivh https://download.opensuse.org/repositories/home:/aevseev/CentOS6/x86_64/qemu-guest-agent-2.12.1-2.4.el6.x86_64.rpm;
CentOS 7 и 8
yum update -y; \
yum install qemu-guest-agent -y;
Debian 7
wget http://archive.debian.org/debian/pool/main/q/qemu/qemu-guest-agent_2.1+dfsg-12+deb8u5a~bpo70+1_amd64.deb
dpkg -i qemu-guest-agent_2.1+dfsg-12+deb8u5a~bpo70+1_amd64.deb
Debian 8 и выше
apt update; \
apt install qemu-guest-agent -y
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\\ where 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/.qga You can test the communication qm agent:
if the qemu-guest-agent is correctly runnning in the VM, it will return without an error message.
Install Proxmox qemu-guest-agent on Ubuntu 20.04
In this tutorial I will show you how to install the qemu-guest-agent package on Ubuntu 20.04.
1. What is qemu-guest-agent?
The qemu-guest-agent is a helper daemon, which is installed in a guest VM. It is used to exchange information between the host and guest, and to execute commands in the guest machine.
For example, when using Proxmox VE, the qemu-guest-agent is used for the following major features:
- 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).
It is a good practice to install the qemu-guest-agent on all VM’s for the above reasons but also for various other stability tweaks and features.
2. Enable qemu-guest-agent in Proxmox for VM
The first step is to enable the qemu-guest-agent option for your VM. In Proxmox VE you can do this as follows.
Firstly, connect to your Proxmox server web interface (by default this is https://proxmox_ip:8006).
Important: Make sure the VM is shutdown before continuing. If the VM is currently running, shut it down now.
- Select the VM in the Proxmox interface, and then click on the “options” tab.
- Click on the “QEMU Guest Agent” row.
- Click on the “Edit” button.
- Check the “Use QEMU Guest Agent” checkbox.
- Click “OK”.
- Boot the VM / turn it on.
3. Install QEMU guest agent package on Ubuntu VM
Login to your Ubuntu VM via SSH and issue the following commands:
sudo apt -y install qemu-guest-agent sudo systemctl enable qemu-guest-agent sudo systemctl start qemu-guest-agent
Note: if you get a message saying “The unit files have no installation config” you can safely ignore it.
The qemu-guest-agent is now installed! You can check if the service is running with this command:
sudo systemctl status qemu-guest-agent
This command should give the following output:
● qemu-guest-agent.service - QEMU Guest Agent Loaded: loaded (/lib/systemd/system/qemu-guest-agent.service; static; vendor preset: enabled) Active: active (running) since Mon 2021-11-22 19:52:07 CET; 19min ago Main PID: 464 (qemu-ga) Tasks: 1 (limit: 4637) Memory: 1.0M CGroup: /system.slice/qemu-guest-agent.service └─464 /usr/sbin/qemu-ga
4. Check if guest agent is succesfully running in Proxmox webinterface
An easy way to check if the qemu-guest-agent is running, is to look at the “summary” tab of your VM in Proxmox. It should now show the IP address(es) currently in use by the VM:
That’s it. Your VM is now running the qemu-guest-agent! I hope this guide helped you.
By Leendert de Borst
Freelance software architect with 10+ years of experience. Expert in translating complex technical problems into creative & simple solutions.
How To Install qemu-guest-agent on Ubuntu 18.04
In this tutorial we learn how to install qemu-guest-agent on Ubuntu 18.04.
What is qemu-guest-agent
QEMU is a fast processor emulator: currently the package supports ARM, CRIS, i386, M68k (ColdFire), MicroBlaze, MIPS, PowerPC, SH4, SPARC and x86-64 emulation. By using dynamic translation it achieves reasonable speed while being easy to port on new host CPUs.
- querying and setting guest system time
- performing guest filesystem sync operation
- initiating guest shutdown or suspend to ram
- accessing guest files
- freezing/thawing guest filesystem operations
- others.
Install this package on a system which is running as guest inside qemu virtual machine. It is not used on the host.
There are three ways to install qemu-guest-agent on Ubuntu 18.04. We can use apt-get , apt and aptitude . In the following sections we will describe each method. You can choose one of them.
Install qemu-guest-agent Using apt-get
Update apt database with apt-get using the following command.
After updating apt database, We can install qemu-guest-agent using apt-get by running the following command:
sudo apt-get -y install qemu-guest-agent
Install qemu-guest-agent Using apt
Update apt database with apt using the following command.
After updating apt database, We can install qemu-guest-agent using apt by running the following command:
sudo apt -y install qemu-guest-agent
Install qemu-guest-agent Using aptitude
If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Ubuntu. Update apt database with aptitude using the following command.
After updating apt database, We can install qemu-guest-agent using aptitude by running the following command:
sudo aptitude -y install qemu-guest-agent
How To Uninstall qemu-guest-agent on Ubuntu 18.04
To uninstall only the qemu-guest-agent package we can use the following command:
sudo apt-get remove qemu-guest-agent
Uninstall qemu-guest-agent And Its Dependencies
To uninstall qemu-guest-agent and its dependencies that are no longer needed by Ubuntu 18.04, we can use the command below:
sudo apt-get -y autoremove qemu-guest-agent
Remove qemu-guest-agent Configurations and Data
To remove qemu-guest-agent configuration and data from Ubuntu 18.04 we can use the following command:
sudo apt-get -y purge qemu-guest-agent
Remove qemu-guest-agent configuration, data, and all of its dependencies
We can use the following command to remove qemu-guest-agent configurations, data and all of its dependencies, we can use the following command:
sudo apt-get -y autoremove --purge qemu-guest-agent
References
Summary
In this tutorial we learn how to install qemu-guest-agent package on Ubuntu 18.04 using different package management tools: apt, apt-get and aptitude.