Public bug reported:
1) The release of Ubuntu you are using, via 'lsb_release -rd' or System
-> About Ubuntu
choix:~$ lsb_release -rd
Description: Ubuntu 20.04 LTS
Release: 20.04
2) The version of the package you are using, via 'apt-cache policy pkgname'
choix:~$ dpkg-query -S /lib/systemd/system/libvirtd.service
libvirt-daemon-system: /lib/systemd/system/libvirtd.service
choix:~$ dpkg -l libvirt-daemon-system
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-=====================-================-============-==================================
ii libvirt-daemon-system 6.0.0-0ubuntu8.1 amd64 Libvirt daemon
configuration files
3) What you expected to happen
Have a manageable and usable libvirtd service after every boot of
Ubuntu.
4) What happened instead
After the installation of libvirt in Ubuntu, and following the reboot of
Ubuntu. Every virsh command or virt-install or virt-manager were
hanged.
5) Diagnostic
It is necessary to restart libvirtd so the programs like virsh can
interact again with the service.
Checking the process list, I found that qemu-system is defunct 'qemu-
system-i386 defunct'.
If I restart libvirtd, then it becomes responsive but if I reboot the
machine, then libvirtd hangs again.
I enabled the debug flag for libvirtd in /etc/libvirt/libvirt.conf
log_level = 1
log_filters="1:qemu"
log_outputs="1:file:/var/log/libvirt/libvirtd.log"
And found that qemu was not finding the kvm device when invoked by
libvirtd during the startup of the service.
qemu-system-x86_64: failed to initialize KVM: No such file or directory.
I could not replicate this on a laptop but happens every single time in
my PC with a Ryzen 3700X, X570 chipset, an NVMe and 32 GB of RAM.
6) Resolution.
There is a race condition happening between qemu-kvm.service and
libvirtd.service. Becase the debug flag of libvirtd pointed that qemu
was not findinf the kvm device, and it is created by qemu-kvm.service.
Therefore the solution was to create a drop-in for the libvirtd.service
to add an After key as follows:
```ini
$ sudo systemctl edit libvirtd
[Unit]
After=qemu-kvm.service
```
This will make the `libvirtd` to wait for `qemu-kvm` to complete before
starting.
** Affects: libvirt (Ubuntu)
Importance: Undecided
Status: New
** Tags: libvirtd qemu-kvm
--
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1887592
Title:
virsh list hangs because of qemu-system-i386 defunct so libvirtd has
to be restarted
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/libvirt/+bug/1887592/+subscriptions
--
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs