FS#80030 - libvirt-guests.service fails in suspending/resuming VM

Attached to Project: Arch Linux
Opened by RK (keoz) - Friday, 20 October 2023, 13:09 GMT
Last edited by Toolybird (Toolybird) - Friday, 20 October 2023, 19:34 GMT
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To No-one
Architecture x86_64
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Hi,

I'm trying to set up libvirt-guests.service to correctly suspend my KVM/QEMU VM (containing a Home Assistant instance) when rebooting the host (an Intel NUC running Archlinux). I'm trying to do this following this page: https://wiki.archlinux.org/title/libvirt#Manage_a_domain

Now, the problem is that on host shutdown (and then on booting) I'm getting errors. Here is the relevant part from:
# journalctl -u libvirt-guests.service
[...]
oct. 19 15:50:19 kdomserv systemd[1]: Stopping Suspend/Resume Running libvirt Guests...
oct. 19 15:50:19 kdomserv libvirt-guests.sh[10340]: Running guests on default URI:
oct. 19 15:50:19 kdomserv libvirt-guests.sh[10320]: linux2022
oct. 19 15:50:19 kdomserv libvirt-guests.sh[10427]: Suspending guests on default URI...
oct. 19 15:50:19 kdomserv libvirt-guests.sh[10320]: Suspending linux2022: ...
oct. 19 15:50:24 kdomserv libvirt-guests.sh[10320]: Suspending linux2022: ...
oct. 19 15:50:25 kdomserv libvirt-guests.sh[10450]: error: Disconnected from qemu:///system due to end of file
oct. 19 15:50:25 kdomserv libvirt-guests.sh[10450]: error: Failed to save domain '6fe4edf8-a076-406a-a4b2-9c6fa04f2f28' state
oct. 19 15:50:25 kdomserv libvirt-guests.sh[10450]: error: End of file while reading data: Input/output error
oct. 19 15:50:26 kdomserv systemd[1]: libvirt-guests.service: Control process exited, code=exited, status=1/FAILURE
oct. 19 15:50:26 kdomserv systemd[1]: libvirt-guests.service: Failed with result 'exit-code'.
oct. 19 15:50:26 kdomserv systemd[1]: Stopped Suspend/Resume Running libvirt Guests.
-- Boot 93de70129dca4d3bb40f934bf9282069 --
oct. 19 15:50:41 kdomserv systemd[1]: Starting Suspend/Resume Running libvirt Guests...
oct. 19 15:50:41 kdomserv libvirt-guests.sh[421]: Resuming guests on default URI...
oct. 19 15:50:42 kdomserv libvirt-guests.sh[428]: Resuming guest linux2022:
oct. 19 15:50:42 kdomserv libvirt-guests.sh[434]: error: Failed to start domain 'linux2022'
oct. 19 15:50:42 kdomserv libvirt-guests.sh[434]: error: erreur interne : le processus s'est arrêté pendant la connexion au moniteur: 2023-10-19T13:50:41.914772Z qemu-system-x86_64: warning: Spice: ../spice-0.15.2/server/reds.cpp:2551:r>
oct. 19 15:50:42 kdomserv libvirt-guests.sh[434]: 2023-10-19T13:50:41.914872Z qemu-system-x86_64: warning: Spice: ../spice-0.15.2/server/reds.cpp:3441:do_spice_init: Failed to open SPICE sockets
oct. 19 15:50:42 kdomserv libvirt-guests.sh[434]: 2023-10-19T13:50:41.915428Z qemu-system-x86_64: failed to initialize spice server
oct. 19 15:50:42 kdomserv systemd[1]: libvirt-guests.service: Main process exited, code=exited, status=1/FAILURE

After some exploration, it looks like the libvirt-guests.service conflicts with some other systemd service/unit. The service fails right after some QEMU shutdown messages. Here is the relevant part in journalctl:
oct. 20 12:04:11 kdomserv systemd[1]: machine-qemu\x2d1\x2dlinux2022.scope: Deactivated successfully.
oct. 20 12:04:11 kdomserv systemd[1]: Stopped Virtual Machine qemu-1-linux2022.
oct. 20 12:04:11 kdomserv systemd[1]: machine-qemu\x2d1\x2dlinux2022.scope: Consumed 2min 18.295s CPU time.
oct. 20 12:04:11 kdomserv systemd[1]: Stopping Virtualization daemon...
oct. 20 12:04:11 kdomserv libvirt-guests.sh[1120]: erreur : Déconnecté de qemu:///system en raison de la fin du fichier
oct. 20 12:04:11 kdomserv libvirt-guests.sh[1120]: erreur : Échec de la sauvegarde de l'état du domaine '6fe4edf8-a076-406a-a4b2-9c6fa04f2f28'
oct. 20 12:04:11 kdomserv libvirt-guests.sh[1120]: erreur : Fin du fichier pendant la lecture des données: Erreur d'entrée/sortie

Any idea what's going on ?
This task depends upon

Closed by  Toolybird (Toolybird)
Friday, 20 October 2023, 19:34 GMT
Reason for closing:  Not a bug
Additional comments about closing:  Please use the support channels as per comments
Comment by RK (keoz) - Friday, 20 October 2023, 19:21 GMT
I did some further exploration on this. Thinking that the service file was maybee missing some dependencies, I added the line "After=libvirtd.service" in /usr/lib/systemd/system/libvirt-guests.service.

That solves the first part of the problem (suspending the VM):
# journalctl -u libvirt-guests.service
[...]
oct. 20 16:30:58 kdomserv systemd[1]: Stopping Suspend/Resume Running libvirt Guests...
oct. 20 16:30:58 kdomserv libvirt-guests.sh[895]: Exécution des invités sur default URI :
oct. 20 16:30:58 kdomserv libvirt-guests.sh[870]: linux2022
oct. 20 16:30:59 kdomserv libvirt-guests.sh[981]: Suspendre les invités sur default URI...
oct. 20 16:30:59 kdomserv libvirt-guests.sh[870]: Suspendre linux2022 : ...
oct. 20 16:31:04 kdomserv libvirt-guests.sh[870]: Suspendre linux2022 : ...
oct. 20 16:31:05 kdomserv libvirt-guests.sh[870]: Suspendre linux2022 : terminé
oct. 20 16:31:05 kdomserv systemd[1]: libvirt-guests.service: Deactivated successfully.
oct. 20 16:31:05 kdomserv systemd[1]: Stopped Suspend/Resume Running libvirt Guests.
[...]

But: the service still fails in resuming the VM on boot.
Comment by Toolybird (Toolybird) - Friday, 20 October 2023, 19:34 GMT
> Any idea what's going on

None whatsoever. But this kind of thing is more appropriate for the Arch support channels (Forum/IRC/Mailing Lists/Reddit/etc). There is no indication here of an Arch packaging issue. If something does come up, please come back here and share the details. It might even be an upstream issue in which case you will need to report upstream.

PS - log files etc need to be posted in English.

Loading...