Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

[Software] [Virt Manager] [Solved] QEMU guest agent not working in VMs

If none of the specific sub-forums seem right for your thread, ask here.
Post Reply
Message
Author
Enigma83
Posts: 93
Joined: 2024-01-03 08:03
Location: Deep space
Been thanked: 3 times

[Software] [Virt Manager] [Solved] QEMU guest agent not working in VMs

#1 Post by Enigma83 »

I'm running Debian Bookworm, with LXQT as my desktop environment. Which i installed from scratch about a week ago, then gradually added softwares as needed. Eventually, I needed Virt Manager, I've been using it to run VMs for Windows 11, Manjaro, and a few other OSes, so I dont have to dualboot for real. Earlier today I was installing Windows 11, all seemed fine. So far, I've been using the following guide for this, and it has worked well, up until now:

https://sysguides.com/install-a-windows ... ine-on-kvm

I followed all the prerequisite steps before installing the OS (mainly, the Virt Manager installation steps, and getting the required VirtIO drivers iso that must be fed to Windows after it is installed). After 11 was booted, I mounted the iso onto a virtual CDROM, then installed it in the guest. However, after rebooting the guest, I couldnt enable the "autoresize VM with window" button in the Virt Manager GUI, and a small message was displayed "guest agent is not available" when mousing over it. Then I remembered that in the past, doing:

sudo apt install qemu-guest-agent

Had been enough to fix it. But not this time. Even after rebooting host and guest multiple times, I cant enable the option. I have previously used the guide above for Windows 10 and Windows 11, on an older Debian 12 install, and had no issues.

Attempting to run commands like:
sudo systemctl status qemu-guest-agent
sudo systemctl start qemu-guest-agent
sudo systemctl restart qemu-guest-agent

Have not yielded any results. But I did get a dependency error message. Not sure what to do at this point, or even how to work toward finding the cause and solving this. I do need this to work, since it's affecting my productivity. I can boot the VMs fine, but without the guest agent running they are sluggish, not very usable in a meaningful way.

From what I can tell so far, I've what what I can on both the host and guest to try to resolve this, but I'm at a standstill. Help appreciated.
Last edited by Enigma83 on 2024-04-17 05:03, edited 3 times in total.

Enigma83
Posts: 93
Joined: 2024-01-03 08:03
Location: Deep space
Been thanked: 3 times

Re: [Software] [Virt Manager] QEMU guest agent not working in VMs

#2 Post by Enigma83 »

This is part of what I get. But it only seems to happen after I've booted the VM, then shut it down and closed all Virt Manager Windows:

steve@enigmadebianpc:~$ sudo systemctl status qemu-guest-agent.service
[sudo] password for steve:
○ qemu-guest-agent.service - QEMU Guest Agent
Loaded: loaded (/lib/systemd/system/qemu-guest-agent.service; static)
Active: inactive (dead)

Apr 16 19:27:55 enigmadebianpc systemd[1]: qemu-guest-agent.service: Job qemu-guest-agent.service/start failed with result 'dependency'.
Apr 16 19:29:07 enigmadebianpc systemd[1]: qemu-guest-agent.service: Bound to unit dev-virtio\x2dports-org.qemu.guest_agent.0.device, but unit isn't active.
Apr 16 19:29:07 enigmadebianpc systemd[1]: Dependency failed for qemu-guest-agent.service - QEMU Guest Agent.
Apr 16 19:29:07 enigmadebianpc systemd[1]: qemu-guest-agent.service: Job qemu-guest-agent.service/start failed with result 'dependency'.
Apr 16 19:29:17 enigmadebianpc systemd[1]: qemu-guest-agent.service: Bound to unit dev-virtio\x2dports-org.qemu.guest_agent.0.device, but unit isn't active.
Apr 16 19:29:17 enigmadebianpc systemd[1]: Dependency failed for qemu-guest-agent.service - QEMU Guest Agent.
Apr 16 19:29:17 enigmadebianpc systemd[1]: qemu-guest-agent.service: Job qemu-guest-agent.service/start failed with result 'dependency'.
Apr 16 19:31:06 enigmadebianpc systemd[1]: qemu-guest-agent.service: Bound to unit dev-virtio\x2dports-org.qemu.guest_agent.0.device, but unit isn't active.
Apr 16 19:31:06 enigmadebianpc systemd[1]: Dependency failed for qemu-guest-agent.service - QEMU Guest Agent.
Apr 16 19:31:06 enigmadebianpc systemd[1]: qemu-guest-agent.service: Job qemu-guest-agent.service/start failed with result 'dependency'.

CwF
Global Moderator
Global Moderator
Posts: 2741
Joined: 2018-06-20 15:16
Location: Colorado
Has thanked: 45 times
Been thanked: 206 times

Re: [Software] [Virt Manager] QEMU guest agent not working in VMs

#3 Post by CwF »

It is easier to read in code tags...

The guest agent is socket activated IIRC, or automagic.
I can't tell where you're trying this but it is not required in host or guest, and the package is only required by the linux guest.

CwF
Global Moderator
Global Moderator
Posts: 2741
Joined: 2018-06-20 15:16
Location: Colorado
Has thanked: 45 times
Been thanked: 206 times

Re: [Software] [Virt Manager] QEMU guest agent not working in VMs

#4 Post by CwF »

Enigma83 wrote: 2024-04-17 02:56 I can boot the VMs fine, but without the guest agent running they are sluggish, not very usable in a meaningful way.
No idea what you mean?
This package provides a daemon (agent) to run inside qemu-system
guests (full system emulation). It communicates with the host using
a virtio-serial channel org.qemu.guest_agent.0, and allows one to perform
some functions in the guest from the host, including:
- 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.

Enigma83
Posts: 93
Joined: 2024-01-03 08:03
Location: Deep space
Been thanked: 3 times

Re: [Software] [Virt Manager] QEMU guest agent not working in VMs

#5 Post by Enigma83 »

CwF wrote: 2024-04-17 03:59 It is easier to read in code tags...

The guest agent is socket activated IIRC, or automagic.
I can't tell where you're trying this but it is not required in host or guest, and the package is only required by the linux guest.
I was getting the "guest agent is not available" message from Virt Manager even before I installed the qemu-guest-agent package. And it has continued after installing it. Either way, all i know it, it was working before on a previous Bookworm install, and with this package installed.

I get that it's supposed to be happen automagically.....except when it doesnt work. There is a difference between "supposed to" and "does".

Speaking of Linux guests, I've tried enabling the guest agent while Manjaro is running, but it doesnt seem to work there either, even though it did before.

About the code tags, not sure how to use them, so I just copy/pasted directly.

If you dont know what I mean, then I cant think of anything else to say that would bring more clarification. I've stated the situation as best I can.

CwF
Global Moderator
Global Moderator
Posts: 2741
Joined: 2018-06-20 15:16
Location: Colorado
Has thanked: 45 times
Been thanked: 206 times

Re: [Software] [Virt Manager] QEMU guest agent not working in VMs

#6 Post by CwF »

check nc

Code: Select all

$  apt policy netcat-*
make sure one is installed in the host, openbsd version preferred.
Enigma83 wrote: 2024-04-17 04:09 I was getting the "guest agent is not available" message from Virt Manager even before I installed the qemu-guest-agent package.
This doesn't make sense - Virt-manager is on the host and does not require the package.

The needless systemctl actions could be killing the service - It is never required for the user to enable or start.

Code tag icon looks like a little prompt icon </>

lindi
Debian Developer
Debian Developer
Posts: 463
Joined: 2022-07-12 14:10
Has thanked: 1 time
Been thanked: 88 times

Re: [Software] [Virt Manager] QEMU guest agent not working in VMs

#7 Post by lindi »

You have a Windows guest and Debian host? And you installed the guest agent on the Debian host?

Enigma83
Posts: 93
Joined: 2024-01-03 08:03
Location: Deep space
Been thanked: 3 times

Re: [Software] [Virt Manager] QEMU guest agent not working in VMs

#8 Post by Enigma83 »

CwF wrote: 2024-04-17 04:34 check nc

Code: Select all

$  apt policy netcat-*
make sure one is installed in the host, openbsd version preferred.
Enigma83 wrote: 2024-04-17 04:09 I was getting the "guest agent is not available" message from Virt Manager even before I installed the qemu-guest-agent package.
This doesn't make sense - Virt-manager is on the host and does not require the package.

The needless systemctl actions could be killing the service - It is never required for the user to enable or start.

Code tag icon looks like a little prompt icon </>
I never said that Virt Manager itself required the package. But the VMs seem to need it. Virt Manager is little more than a GUI frontend.

Enigma83
Posts: 93
Joined: 2024-01-03 08:03
Location: Deep space
Been thanked: 3 times

Re: [Software] [Virt Manager] QEMU guest agent not working in VMs

#9 Post by Enigma83 »

lindi wrote: 2024-04-17 04:35 You have a Windows guest and Debian host? And you installed the guest agent on the Debian host?
Correct.

Enigma83
Posts: 93
Joined: 2024-01-03 08:03
Location: Deep space
Been thanked: 3 times

Re: [Software] [Virt Manager] QEMU guest agent not working in VMs

#10 Post by Enigma83 »

I'm going to tag this thread as solved, because I've figured it out. CwF, I think you may be right, Linux guests may not need the package. When I booted Manjaro from a live ISO, I was getting the 'guest agent is not available" message, it couldnt be ticked, and things that are supposed to work when the agent is doing its' thing, were not working. But after installing it into a qcow2 disk image, I was able to enable the option on the first boot. Immediately, I noticed that the lagginess went away (especially the slow mouse cursor), and I was able to adjust the VM resolution to something closer to my monitor's highest supported resolution.

As for Windows 11, I think whatever VirtIO drivers ISO i used must be borked. I dug up an older ISO from an external hard drive, uninstalled the drivers, then reinstalled them from the archived ISO. On the next boot, I was able to tick the box immediately. Similar results as Manjaro.

Enigma83
Posts: 93
Joined: 2024-01-03 08:03
Location: Deep space
Been thanked: 3 times

Re: [Software] [Virt Manager] QEMU guest agent not working in VMs

#11 Post by Enigma83 »

CwF wrote: 2024-04-17 03:59 It is easier to read in code tags...
Can you go into more detail on HOW to use the code tags?

Click the ... icon at the top right and review this edit to see it.

Code: Select all

this is code tags

CwF
Global Moderator
Global Moderator
Posts: 2741
Joined: 2018-06-20 15:16
Location: Colorado
Has thanked: 45 times
Been thanked: 206 times

Re: [Software] [Virt Manager] [Solved] QEMU guest agent not working in VMs

#12 Post by CwF »

I edited your post, edit it again to see the tags.
Hover over the icons immediately above the edit box, they'll tell you.

lindi
Debian Developer
Debian Developer
Posts: 463
Joined: 2022-07-12 14:10
Has thanked: 1 time
Been thanked: 88 times

Re: [Software] [Virt Manager] QEMU guest agent not working in VMs

#13 Post by lindi »

Enigma83 wrote: 2024-04-17 04:51
lindi wrote: 2024-04-17 04:35 You have a Windows guest and Debian host? And you installed the guest agent on the Debian host?
Correct.
qemu-guest-agent should be used on the host:

Code: Select all

$ apt-cache show qemu-guest-agent
...
Install this package on a system which is running as guest inside
qemu virtual machine.  It is not used on the host.

lindi
Debian Developer
Debian Developer
Posts: 463
Joined: 2022-07-12 14:10
Has thanked: 1 time
Been thanked: 88 times

Re: [Software] [Virt Manager] [Solved] QEMU guest agent not working in VMs

#14 Post by lindi »

Here are my notes on how to get good performance from a Windows virtual machine and without having to play around as root:
  1. Download virtio-win-0.1.229.iso (sha256 c88a0dde34605eaee6cf889f3e2a0c2af3caeb91b5df45a125ca4f701acbbbe0)
  2. Download Win10_22H2_EnglishInternational_x64.iso (sha256 3ac5522f9db9f4f432a1aade69fef268c8c0b5fd3f22d3a6987719752f8a7108)
  3. Start virt-manager, connect to "QEMU/KVM User session"
  4. Create new VM
  5. Select "Local install media"
  6. Select Win10_22H2_EnglishInternational_x64.iso
  7. Select Forward
  8. Set "Memory" to 8192
  9. Set "CPUs" to "4"
  10. Select Forward
  11. Set disk image size to 100 GiB
  12. Select Forward
  13. Select "Customize configuration before install"
  14. Select Finish
  15. Select Add Hardware/Storage/CD-ROM and choose virtio-win-0.1.229.iso
  16. Select Finish
  17. Select existing "NIC" and set model to "virtio"
  18. Select Apply
  19. Select existing "SATA Disk 1" and set bus to "virtio" and cache to "writeback"
  20. Select Apply
  21. Select "Boot options" and make both CD drives bootable
  22. Select Apply
  23. Select "Begin installation"
  24. Set "Language to install" to "English (United Kingdom)"
  25. Set "Time and currency format" to "English (United Kingdom)"
  26. Set "Keyboard or input method" to "Finnish"
  27. Select Next
  28. Click "Install now"
  29. Select "I don't have a product key"
  30. Select "Windows 10 Pro" and Next
  31. Select "I accept the license agreement" and Next
  32. Select Custom
  33. Select load drivers and load drivers for viostor/w10/amd64, NetKVM/w10/amd64 and qxldod/w10/amd64
  34. Select New, Apply, OK and Next
  35. Select New, Apply, OK and Next
  36. Select "Finnish" as the keyboard layout and Yes
  37. Select Add layout and add English (Finland) and Next
  38. Select Finnish and Add layout
  39. Select "set up for personal use"
  40. Select "Offline account"
  41. Select limited experience
  42. Enter TEMPLATE_USERNAME as username and Next
  43. Enter TEMPLATE_PASSWORD as password
  44. Set security question answers
  45. Select No
  46. Select No
  47. Select Send Required diagnostic data
  48. Select No
  49. Select No
  50. Select No
  51. Select Skip
  52. Run e:\virtio-win-guest-tools.exe
  53. Configure automatic login:
  54. Run reg.exe ADD "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v AutoAdminLogon /t REG_SZ /d 1 /f
  55. Run REG.exe ADD "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon" /v DefaultUserName /t REG_SZ /d TEMPLATE_USERNAME /f
  56. Run REG.exe ADD "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon" /v DefaultPassword /t REG_SZ /d TEMPLATE_PASSWORD /f

Enigma83
Posts: 93
Joined: 2024-01-03 08:03
Location: Deep space
Been thanked: 3 times

Re: [Software] [Virt Manager] QEMU guest agent not working in VMs

#15 Post by Enigma83 »

lindi wrote: 2024-04-17 07:24
Enigma83 wrote: 2024-04-17 04:51
lindi wrote: 2024-04-17 04:35 You have a Windows guest and Debian host? And you installed the guest agent on the Debian host?
Correct.
qemu-guest-agent should be used on the host:

Code: Select all

$ apt-cache show qemu-guest-agent
...
Install this package on a system which is running as guest inside
qemu virtual machine.  It is not used on the host.
This is very contradictory..."should be used on the host", and then apt-cache's description "it is not used on the host". My understanding is that it's meant to be installed on the host, to facilitate guest agent communication between the host (Debian) and guest (whatever OS it might be). Like a translator, helping 2 people to communicate even though they don't understand the same language. Either way, it's already installed, I don't think it will hurt anything.

Enigma83
Posts: 93
Joined: 2024-01-03 08:03
Location: Deep space
Been thanked: 3 times

Re: [Software] [Virt Manager] [Solved] QEMU guest agent not working in VMs

#16 Post by Enigma83 »

lindi wrote: 2024-04-17 07:35 Here are my notes on how to get good performance from a Windows virtual machine and without having to play around as root:
  1. Download virtio-win-0.1.229.iso (sha256 c88a0dde34605eaee6cf889f3e2a0c2af3caeb91b5df45a125ca4f701acbbbe0)
  2. Download Win10_22H2_EnglishInternational_x64.iso (sha256 3ac5522f9db9f4f432a1aade69fef268c8c0b5fd3f22d3a6987719752f8a7108)
  3. Start virt-manager, connect to "QEMU/KVM User session"
  4. Create new VM
  5. Select "Local install media"
  6. Select Win10_22H2_EnglishInternational_x64.iso
  7. Select Forward
  8. Set "Memory" to 8192
  9. Set "CPUs" to "4"
  10. Select Forward
  11. Set disk image size to 100 GiB
  12. Select Forward
  13. Select "Customize configuration before install"
  14. Select Finish
  15. Select Add Hardware/Storage/CD-ROM and choose virtio-win-0.1.229.iso
  16. Select Finish
  17. Select existing "NIC" and set model to "virtio"
  18. Select Apply
  19. Select existing "SATA Disk 1" and set bus to "virtio" and cache to "writeback"
  20. Select Apply
  21. Select "Boot options" and make both CD drives bootable
  22. Select Apply
  23. Select "Begin installation"
  24. Set "Language to install" to "English (United Kingdom)"
  25. Set "Time and currency format" to "English (United Kingdom)"
  26. Set "Keyboard or input method" to "Finnish"
  27. Select Next
  28. Click "Install now"
  29. Select "I don't have a product key"
  30. Select "Windows 10 Pro" and Next
  31. Select "I accept the license agreement" and Next
  32. Select Custom
  33. Select load drivers and load drivers for viostor/w10/amd64, NetKVM/w10/amd64 and qxldod/w10/amd64
  34. Select New, Apply, OK and Next
  35. Select New, Apply, OK and Next
  36. Select "Finnish" as the keyboard layout and Yes
  37. Select Add layout and add English (Finland) and Next
  38. Select Finnish and Add layout
  39. Select "set up for personal use"
  40. Select "Offline account"
  41. Select limited experience
  42. Enter TEMPLATE_USERNAME as username and Next
  43. Enter TEMPLATE_PASSWORD as password
  44. Set security question answers
  45. Select No
  46. Select No
  47. Select Send Required diagnostic data
  48. Select No
  49. Select No
  50. Select No
  51. Select Skip
  52. Run e:\virtio-win-guest-tools.exe
  53. Configure automatic login:
  54. Run reg.exe ADD "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v AutoAdminLogon /t REG_SZ /d 1 /f
  55. Run REG.exe ADD "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon" /v DefaultUserName /t REG_SZ /d TEMPLATE_USERNAME /f
  56. Run REG.exe ADD "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon" /v DefaultPassword /t REG_SZ /d TEMPLATE_PASSWORD /f
I'm using Windows 11 Enterprise edition, but I'm sure the steps between 10 and 11 are nearly identical.

I'm using the VirtIO iso tagged 0.1.240. I had tried a newer version, but had issues getting the guest agent working, with or without the Debian package installed. I guess newer releases of the iso aren't always better.

My QEMU runs as QEMU/system rather than QEMU/user, so basically running with system authority. But I don't have to type in root password every time I open Virt Manager. And i can run virsh without su/sudo. Just a simple little change in .bashrc accomplished this.

In the link I gave in first post, it is recommended to set cache mode to none rather than write back. I've been using that setting, no issues. What's your reasoning for setting cache mode to write back?

https://sysguides.com/install-a-windows ... he-storage

He also advises using VirtIO for the disk mode, rather than SATA, claiming that it is superior for performance. The downside seems to be that the Windows installer won't natively recognize a disk using VirtIO, so a driver from the VirtIO iso must be manually installed before the disk is recognized. Once that's done, it no longer seems to be an issue.

lindi
Debian Developer
Debian Developer
Posts: 463
Joined: 2022-07-12 14:10
Has thanked: 1 time
Been thanked: 88 times

Re: [Software] [Virt Manager] QEMU guest agent not working in VMs

#17 Post by lindi »

Enigma83 wrote: 2024-04-17 08:27
lindi wrote: 2024-04-17 07:24
Enigma83 wrote: 2024-04-17 04:51

Correct.
qemu-guest-agent should not be used on the host:

Code: Select all

$ apt-cache show qemu-guest-agent
...
Install this package on a system which is running as guest inside
qemu virtual machine.  It is not used on the host.
This is very contradictory..."should be used on the host", and then apt-cache's description "it is not used on the host". My understanding is that it's meant to be installed on the host, to facilitate guest agent communication between the host (Debian) and guest (whatever OS it might be). Like a translator, helping 2 people to communicate even though they don't understand the same language. Either way, it's already installed, I don't think it will hurt anything.

lindi
Debian Developer
Debian Developer
Posts: 463
Joined: 2022-07-12 14:10
Has thanked: 1 time
Been thanked: 88 times

Re: [Software] [Virt Manager] QEMU guest agent not working in VMs

#18 Post by lindi »

Enigma83 wrote: 2024-04-17 08:27 This is very contradictory..."should be used on the host", and then apt-cache's description "it is not used on the host". My understanding is that it's meant to be installed on the host, to facilitate guest agent communication between the host (Debian) and guest (whatever OS it might be). Like a translator, helping 2 people to communicate even though they don't understand the same language. Either way, it's already installed, I don't think it will hurt anything.
It should be used on the guest, my post had a missing "not" in it.

Enigma83
Posts: 93
Joined: 2024-01-03 08:03
Location: Deep space
Been thanked: 3 times

Re: [Software] [Virt Manager] QEMU guest agent not working in VMs

#19 Post by Enigma83 »

lindi wrote: 2024-04-17 09:02
Enigma83 wrote: 2024-04-17 08:27 This is very contradictory..."should be used on the host", and then apt-cache's description "it is not used on the host". My understanding is that it's meant to be installed on the host, to facilitate guest agent communication between the host (Debian) and guest (whatever OS it might be). Like a translator, helping 2 people to communicate even though they don't understand the same language. Either way, it's already installed, I don't think it will hurt anything.
It should be used on the guest, my post had a missing "not" in it.
Then if it's really not meant to be installed on the host, then its' only use case would be if the guest system were Debian or a Debian derivative (Ubuntu, Mint, etc). It cant be assumed that all non-Debian based distros will be guaranteed to have an installable package called "qemu-guest-agent". Some may, some may not.

lindi
Debian Developer
Debian Developer
Posts: 463
Joined: 2022-07-12 14:10
Has thanked: 1 time
Been thanked: 88 times

Re: [Software] [Virt Manager] QEMU guest agent not working in VMs

#20 Post by lindi »

Enigma83 wrote: 2024-04-17 09:08

Then if it's really not meant to be installed on the host, then its' only use case would be if the guest system were Debian or a Debian derivative (Ubuntu, Mint, etc). It cant be assumed that all non-Debian based distros will be guaranteed to have an installable package called "qemu-guest-agent". Some may, some may not.
I don't think anyone is assuming that. You do not need to install qemu-guest-agent at all. I don't use it at all since spice gives me enough features and qemu-guest-agent increases attack surface unnecessarily in that case.

Post Reply