[SOLVED] libvirt: libvirtd often takes ~45 seconds to start
SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
libvirt: libvirtd often takes ~45 seconds to start
Hi,
libvirt version: 3.0.0.
libvirtd often takes ~45 seconds to start, where normally it should be around 2 seconds (on my machine). It happens very often, but sometimes it starts quickly as it should.
I actually debugged /etc/rc.d/rc.libvirt and know that it hangs here:
Code:
/usr/sbin/libvirtd -d -l $LIBVIRTD_OPTS
I tried disabling network auto-start with no change.
Also, the log does not say much:
Code:
2017-02-03 01:31:09.668+0000: 1277: info : libvirt version: 3.0.0
2017-02-03 01:31:09.668+0000: 1277: info : hostname: andtel.ddns.net
2017-02-03 01:31:09.668+0000: 1277: error : qemuMonitorJSONCheckError:387 : internal error: unable to execute QEMU command 'query-cpu-definitions': The command query-cpu-definitions has not been found
2017-02-03 01:31:09.670+0000: 1277: warning : virQEMUCapsLogProbeFailure:4624 : Failed to probe capabilities for /usr/bin/qemu-system-alpha: internal error: unable to execute QEMU command 'query-cpu-definitions': The command query-cpu-definitions has not been found
2017-02-03 01:31:09.767+0000: 1277: error : qemuMonitorJSONCheckError:387 : internal error: unable to execute QEMU command 'query-cpu-definitions': The command query-cpu-definitions has not been found
2017-02-03 01:31:09.768+0000: 1277: warning : virQEMUCapsLogProbeFailure:4624 : Failed to probe capabilities for /usr/bin/qemu-system-cris: internal error: unable to execute QEMU command 'query-cpu-definitions': The command query-cpu-definitions has not been found
2017-02-03 01:31:09.866+0000: 1277: error : qemuMonitorJSONCheckError:387 : internal error: unable to execute QEMU command 'query-cpu-definitions': The command query-cpu-definitions has not been found
2017-02-03 01:31:09.867+0000: 1277: warning : virQEMUCapsLogProbeFailure:4624 : Failed to probe capabilities for /usr/bin/qemu-system-lm32: internal error: unable to execute QEMU command 'query-cpu-definitions': The command query-cpu-definitions has not been found
2017-02-03 01:31:09.983+0000: 1277: error : qemuMonitorJSONCheckError:387 : internal error: unable to execute QEMU command 'query-cpu-definitions': The command query-cpu-definitions has not been found
2017-02-03 01:31:09.983+0000: 1277: warning : virQEMUCapsLogProbeFailure:4624 : Failed to probe capabilities for /usr/bin/qemu-system-m68k: internal error: unable to execute QEMU command 'query-cpu-definitions': The command query-cpu-definitions has not been found
2017-02-03 01:31:10.078+0000: 1277: error : qemuMonitorJSONCheckError:387 : internal error: unable to execute QEMU command 'query-cpu-definitions': The command query-cpu-definitions has not been found
2017-02-03 01:31:10.078+0000: 1277: warning : virQEMUCapsLogProbeFailure:4624 : Failed to probe capabilities for /usr/bin/qemu-system-microblaze: internal error: unable to execute QEMU command 'query-cpu-definitions': The command query-cpu-definitions has not been found
2017-02-03 01:31:10.167+0000: 1277: error : qemuMonitorJSONCheckError:387 : internal error: unable to execute QEMU command 'query-cpu-definitions': The command query-cpu-definitions has not been found
2017-02-03 01:31:10.167+0000: 1277: warning : virQEMUCapsLogProbeFailure:4624 : Failed to probe capabilities for /usr/bin/qemu-system-microblazeel: internal error: unable to execute QEMU command 'query-cpu-definitions': The command query-cpu-definitions has not been found
2017-02-03 01:31:10.281+0000: 1277: error : qemuMonitorJSONCheckError:387 : internal error: unable to execute QEMU command 'query-cpu-definitions': The command query-cpu-definitions has not been found
2017-02-03 01:31:10.281+0000: 1277: warning : virQEMUCapsLogProbeFailure:4624 : Failed to probe capabilities for /usr/bin/qemu-system-mips: internal error: unable to execute QEMU command 'query-cpu-definitions': The command query-cpu-definitions has not been found
2017-02-03 01:31:10.394+0000: 1277: error : qemuMonitorJSONCheckError:387 : internal error: unable to execute QEMU command 'query-cpu-definitions': The command query-cpu-definitions has not been found
2017-02-03 01:31:10.394+0000: 1277: warning : virQEMUCapsLogProbeFailure:4624 : Failed to probe capabilities for /usr/bin/qemu-system-mipsel: internal error: unable to execute QEMU command 'query-cpu-definitions': The command query-cpu-definitions has not been found
2017-02-03 01:31:10.509+0000: 1277: error : qemuMonitorJSONCheckError:387 : internal error: unable to execute QEMU command 'query-cpu-definitions': The command query-cpu-definitions has not been found
2017-02-03 01:31:10.509+0000: 1277: warning : virQEMUCapsLogProbeFailure:4624 : Failed to probe capabilities for /usr/bin/qemu-system-mips64: internal error: unable to execute QEMU command 'query-cpu-definitions': The command query-cpu-definitions has not been found
2017-02-03 01:31:10.625+0000: 1277: error : qemuMonitorJSONCheckError:387 : internal error: unable to execute QEMU command 'query-cpu-definitions': The command query-cpu-definitions has not been found
2017-02-03 01:31:10.625+0000: 1277: warning : virQEMUCapsLogProbeFailure:4624 : Failed to probe capabilities for /usr/bin/qemu-system-mips64el: internal error: unable to execute QEMU command 'query-cpu-definitions': The command query-cpu-definitions has not been found
2017-02-03 01:31:10.714+0000: 1277: error : qemuMonitorJSONCheckError:387 : internal error: unable to execute QEMU command 'query-cpu-definitions': The command query-cpu-definitions has not been found
2017-02-03 01:31:10.714+0000: 1277: warning : virQEMUCapsLogProbeFailure:4624 : Failed to probe capabilities for /usr/bin/qemu-system-or32: internal error: unable to execute QEMU command 'query-cpu-definitions': The command query-cpu-definitions has not been found
2017-02-03 01:31:10.834+0000: 1277: error : qemuMonitorJSONCheckError:387 : internal error: unable to execute QEMU command 'query-cpu-definitions': The command query-cpu-definitions has not been found
2017-02-03 01:31:10.834+0000: 1277: warning : virQEMUCapsLogProbeFailure:4624 : Failed to probe capabilities for /usr/bin/qemu-system-sh4: internal error: unable to execute QEMU command 'query-cpu-definitions': The command query-cpu-definitions has not been found
2017-02-03 01:31:10.942+0000: 1277: error : qemuMonitorJSONCheckError:387 : internal error: unable to execute QEMU command 'query-cpu-definitions': The command query-cpu-definitions has not been found
2017-02-03 01:31:10.942+0000: 1277: warning : virQEMUCapsLogProbeFailure:4624 : Failed to probe capabilities for /usr/bin/qemu-system-sh4eb: internal error: unable to execute QEMU command 'query-cpu-definitions': The command query-cpu-definitions has not been found
2017-02-03 01:31:11.033+0000: 1277: error : qemuMonitorJSONCheckError:387 : internal error: unable to execute QEMU command 'query-cpu-definitions': The command query-cpu-definitions has not been found
2017-02-03 01:31:11.033+0000: 1277: warning : virQEMUCapsLogProbeFailure:4624 : Failed to probe capabilities for /usr/bin/qemu-system-sparc: internal error: unable to execute QEMU command 'query-cpu-definitions': The command query-cpu-definitions has not been found
2017-02-03 01:31:11.140+0000: 1277: error : qemuMonitorJSONCheckError:387 : internal error: unable to execute QEMU command 'query-cpu-definitions': The command query-cpu-definitions has not been found
2017-02-03 01:31:11.140+0000: 1277: warning : virQEMUCapsLogProbeFailure:4624 : Failed to probe capabilities for /usr/bin/qemu-system-sparc64: internal error: unable to execute QEMU command 'query-cpu-definitions': The command query-cpu-definitions has not been found
2017-02-03 01:31:11.229+0000: 1277: error : qemuMonitorJSONCheckError:387 : internal error: unable to execute QEMU command 'query-cpu-definitions': The command query-cpu-definitions has not been found
2017-02-03 01:31:11.229+0000: 1277: warning : virQEMUCapsLogProbeFailure:4624 : Failed to probe capabilities for /usr/bin/qemu-system-unicore32: internal error: unable to execute QEMU command 'query-cpu-definitions': The command query-cpu-definitions has not been found
2017-02-03 01:31:11.320+0000: 1277: error : qemuMonitorJSONCheckError:387 : internal error: unable to execute QEMU command 'query-cpu-definitions': The command query-cpu-definitions has not been found
2017-02-03 01:31:11.321+0000: 1277: warning : virQEMUCapsLogProbeFailure:4624 : Failed to probe capabilities for /usr/bin/qemu-system-xtensa: internal error: unable to execute QEMU command 'query-cpu-definitions': The command query-cpu-definitions has not been found
2017-02-03 01:31:11.410+0000: 1277: error : qemuMonitorJSONCheckError:387 : internal error: unable to execute QEMU command 'query-cpu-definitions': The command query-cpu-definitions has not been found
2017-02-03 01:31:11.410+0000: 1277: warning : virQEMUCapsLogProbeFailure:4624 : Failed to probe capabilities for /usr/bin/qemu-system-xtensaeb: internal error: unable to execute QEMU command 'query-cpu-definitions': The command query-cpu-definitions has not been found
2017-02-03 01:32:12.885+0000: 1249: error : qemuMonitorJSONCheckError:387 : internal error: unable to execute QEMU command 'query-cpu-definitions': The command query-cpu-definitions has not been found
2017-02-03 01:32:12.885+0000: 1249: warning : virQEMUCapsLogProbeFailure:4624 : Failed to probe capabilities for /usr/bin/qemu-system-alpha: internal error: unable to execute QEMU command 'query-cpu-definitions': The command query-cpu-definitions has not been found
2017-02-03 01:32:12.964+0000: 1249: error : qemuMonitorJSONCheckError:387 : internal error: unable to execute QEMU command 'query-cpu-definitions': The command query-cpu-definitions has not been found
2017-02-03 01:32:12.964+0000: 1249: warning : virQEMUCapsLogProbeFailure:4624 : Failed to probe capabilities for /usr/bin/qemu-system-cris: internal error: unable to execute QEMU command 'query-cpu-definitions': The command query-cpu-definitions has not been found
2017-02-03 01:32:13.044+0000: 1249: error : qemuMonitorJSONCheckError:387 : internal error: unable to execute QEMU command 'query-cpu-definitions': The command query-cpu-definitions has not been found
2017-02-03 01:32:13.044+0000: 1249: warning : virQEMUCapsLogProbeFailure:4624 : Failed to probe capabilities for /usr/bin/qemu-system-lm32: internal error: unable to execute QEMU command 'query-cpu-definitions': The command query-cpu-definitions has not been found
2017-02-03 01:32:13.132+0000: 1249: error : qemuMonitorJSONCheckError:387 : internal error: unable to execute QEMU command 'query-cpu-definitions': The command query-cpu-definitions has not been found
2017-02-03 01:32:13.132+0000: 1249: warning : virQEMUCapsLogProbeFailure:4624 : Failed to probe capabilities for /usr/bin/qemu-system-m68k: internal error: unable to execute QEMU command 'query-cpu-definitions': The command query-cpu-definitions has not been found
2017-02-03 01:32:13.212+0000: 1249: error : qemuMonitorJSONCheckError:387 : internal error: unable to execute QEMU command 'query-cpu-definitions': The command query-cpu-definitions has not been found
2017-02-03 01:32:13.212+0000: 1249: warning : virQEMUCapsLogProbeFailure:4624 : Failed to probe capabilities for /usr/bin/qemu-system-microblaze: internal error: unable to execute QEMU command 'query-cpu-definitions': The command query-cpu-definitions has not been found
2017-02-03 01:32:13.293+0000: 1249: error : qemuMonitorJSONCheckError:387 : internal error: unable to execute QEMU command 'query-cpu-definitions': The command query-cpu-definitions has not been found
2017-02-03 01:32:13.293+0000: 1249: warning : virQEMUCapsLogProbeFailure:4624 : Failed to probe capabilities for /usr/bin/qemu-system-microblazeel: internal error: unable to execute QEMU command 'query-cpu-definitions': The command query-cpu-definitions has not been found
2017-02-03 01:32:13.381+0000: 1249: error : qemuMonitorJSONCheckError:387 : internal error: unable to execute QEMU command 'query-cpu-definitions': The command query-cpu-definitions has not been found
2017-02-03 01:32:13.381+0000: 1249: warning : virQEMUCapsLogProbeFailure:4624 : Failed to probe capabilities for /usr/bin/qemu-system-mips: internal error: unable to execute QEMU command 'query-cpu-definitions': The command query-cpu-definitions has not been found
2017-02-03 01:32:13.467+0000: 1249: error : qemuMonitorJSONCheckError:387 : internal error: unable to execute QEMU command 'query-cpu-definitions': The command query-cpu-definitions has not been found
2017-02-03 01:32:13.467+0000: 1249: warning : virQEMUCapsLogProbeFailure:4624 : Failed to probe capabilities for /usr/bin/qemu-system-mipsel: internal error: unable to execute QEMU command 'query-cpu-definitions': The command query-cpu-definitions has not been found
2017-02-03 01:32:13.557+0000: 1249: error : qemuMonitorJSONCheckError:387 : internal error: unable to execute QEMU command 'query-cpu-definitions': The command query-cpu-definitions has not been found
2017-02-03 01:32:13.558+0000: 1249: warning : virQEMUCapsLogProbeFailure:4624 : Failed to probe capabilities for /usr/bin/qemu-system-mips64: internal error: unable to execute QEMU command 'query-cpu-definitions': The command query-cpu-definitions has not been found
2017-02-03 01:32:13.645+0000: 1249: error : qemuMonitorJSONCheckError:387 : internal error: unable to execute QEMU command 'query-cpu-definitions': The command query-cpu-definitions has not been found
2017-02-03 01:32:13.646+0000: 1249: warning : virQEMUCapsLogProbeFailure:4624 : Failed to probe capabilities for /usr/bin/qemu-system-mips64el: internal error: unable to execute QEMU command 'query-cpu-definitions': The command query-cpu-definitions has not been found
2017-02-03 01:32:13.722+0000: 1249: error : qemuMonitorJSONCheckError:387 : internal error: unable to execute QEMU command 'query-cpu-definitions': The command query-cpu-definitions has not been found
2017-02-03 01:32:13.722+0000: 1249: warning : virQEMUCapsLogProbeFailure:4624 : Failed to probe capabilities for /usr/bin/qemu-system-or32: internal error: unable to execute QEMU command 'query-cpu-definitions': The command query-cpu-definitions has not been found
2017-02-03 01:32:13.816+0000: 1249: error : qemuMonitorJSONCheckError:387 : internal error: unable to execute QEMU command 'query-cpu-definitions': The command query-cpu-definitions has not been found
2017-02-03 01:32:13.816+0000: 1249: warning : virQEMUCapsLogProbeFailure:4624 : Failed to probe capabilities for /usr/bin/qemu-system-sh4: internal error: unable to execute QEMU command 'query-cpu-definitions': The command query-cpu-definitions has not been found
2017-02-03 01:32:13.903+0000: 1249: error : qemuMonitorJSONCheckError:387 : internal error: unable to execute QEMU command 'query-cpu-definitions': The command query-cpu-definitions has not been found
2017-02-03 01:32:13.903+0000: 1249: warning : virQEMUCapsLogProbeFailure:4624 : Failed to probe capabilities for /usr/bin/qemu-system-sh4eb: internal error: unable to execute QEMU command 'query-cpu-definitions': The command query-cpu-definitions has not been found
2017-02-03 01:32:13.980+0000: 1249: error : qemuMonitorJSONCheckError:387 : internal error: unable to execute QEMU command 'query-cpu-definitions': The command query-cpu-definitions has not been found
2017-02-03 01:32:13.980+0000: 1249: warning : virQEMUCapsLogProbeFailure:4624 : Failed to probe capabilities for /usr/bin/qemu-system-sparc: internal error: unable to execute QEMU command 'query-cpu-definitions': The command query-cpu-definitions has not been found
2017-02-03 01:32:14.066+0000: 1249: error : qemuMonitorJSONCheckError:387 : internal error: unable to execute QEMU command 'query-cpu-definitions': The command query-cpu-definitions has not been found
2017-02-03 01:32:14.067+0000: 1249: warning : virQEMUCapsLogProbeFailure:4624 : Failed to probe capabilities for /usr/bin/qemu-system-sparc64: internal error: unable to execute QEMU command 'query-cpu-definitions': The command query-cpu-definitions has not been found
2017-02-03 01:32:14.145+0000: 1249: error : qemuMonitorJSONCheckError:387 : internal error: unable to execute QEMU command 'query-cpu-definitions': The command query-cpu-definitions has not been found
2017-02-03 01:32:14.145+0000: 1249: warning : virQEMUCapsLogProbeFailure:4624 : Failed to probe capabilities for /usr/bin/qemu-system-unicore32: internal error: unable to execute QEMU command 'query-cpu-definitions': The command query-cpu-definitions has not been found
2017-02-03 01:32:14.225+0000: 1249: error : qemuMonitorJSONCheckError:387 : internal error: unable to execute QEMU command 'query-cpu-definitions': The command query-cpu-definitions has not been found
2017-02-03 01:32:14.225+0000: 1249: warning : virQEMUCapsLogProbeFailure:4624 : Failed to probe capabilities for /usr/bin/qemu-system-xtensa: internal error: unable to execute QEMU command 'query-cpu-definitions': The command query-cpu-definitions has not been found
2017-02-03 01:32:14.302+0000: 1249: error : qemuMonitorJSONCheckError:387 : internal error: unable to execute QEMU command 'query-cpu-definitions': The command query-cpu-definitions has not been found
2017-02-03 01:32:14.302+0000: 1249: warning : virQEMUCapsLogProbeFailure:4624 : Failed to probe capabilities for /usr/bin/qemu-system-xtensaeb: internal error: unable to execute QEMU command 'query-cpu-definitions': The command query-cpu-definitions has not been found
Running /etc/rc.d/rc.libvirt restart once the system is booted, is fast.
Also, /usr/sbin/libvirtd when run by regular user (i.e. in qemu:///session) starts quickly.
I enabled logging with debug level set and something can be observed, but I'm far from knowing what it means ;-)
The logs are ~20M in size, so I post only the part where the problem occurs. Please note the bold font.
Yes, it was a lack of entropy problem. Using strace I found it was waiting on reading /dev/random.
It's worth a try to test if you also have the lack of entropy problem.
I would also prefer not to use this solution, but I haven't found a better one.
Some cpu's have a hardware random generator, however there are some issue with it
@PhilipH Funny, because when I display the available entropy just before libvirtd, it's around ~40 for both situations, i.e. when libvirtd starts quickly or slowly. Still, I think that entropy is the problem and increasing that is the first thing I want to do, not just because of libvirtd's slow startup.
Quote:
Originally Posted by BratPit
If entropy is a problem go to kernel 4.8.
It may be compiled with GCC plagins ported from Grsecurity.
Are GCC plugins and Grsecurity of any relevance here or just 4.8+ kernel?
I'm not entirely sure, but GCC plugins require greater GCC version than I have (gcc-5.3.0) and I don't intend to upgrade GCC now.
I'm now building kernel 4.9, since 4.8 is EOL.
Quote:
Originally Posted by szboardstretcher
Look into 'haveged' if you need additional entropy.
Well, it's easy enough to test if entropy is the problem.
Put the lines I posted earlier in rc.local and reboot.
If it's fast, it's an lack of entropy problem, if still slow it's something else.
After testing just remove the lines from rc.local and reboot, /dev is a sort of tmpfs and will be rebuild at boot so /dev/urandom will be restored.
If it's not an entropy problem, perhaps it will help to change this line in /etc/rc.d/rc.libvirt:
/usr/sbin/libvirtd -d -l $LIBVIRTD_OPTS
into
strace -f -o /tmp/libvirttrace.log /usr/sbin/libvirtd -d -l $LIBVIRTD_OPTS
Are GCC plugins and Grsecurity of any relevance here or just 4.8+ kernel?
I'm not entirely sure, but GCC plugins require greater GCC version than I have (gcc-5.3.0) and I don't intend to upgrade GCC now.
I'm now building kernel 4.9, since 4.8 is EOL.
CONFIG_GCC_PLUGINS option in kernel config. Gcc-5.3.0 is enough.
4.8 has better entropy seen in
Quote:
/proc/sys/kernel/random/entropy_avail
but in 4.9 is better during boot - Latent entropy patch.
I think all is done by ported gcc plugins from Grsecurity team.
In the end, I managed to increase the entropy availability with 4.4.x kernel, rng-tools and TPM.
I had to disable IOMMU, otherwise TPM is not accessible due to some errors.
That's not a big deal, since I don't have any device to pass to virtual machines.
In this setup my entropy is at around 3k bits.
I decided not to go with haveged and RDRAND/RDSEED due to some concerns mentioned elsewhere on the Internet.
I haven't dug deep enough, so I'm not really sure.
One thing I can say about RDRAND/RDSEED is that it looks to be really fast.
It is surely faster than TPM (but TPM seems to be fast enough).
Code:
$ /usr/sbin/rngd -f --no-drng=1
$ dd if=/dev/random of=/dev/null bs=1024 count=4 iflag=fullblock
4+0 records in
4+0 records out
4096 bytes (4.1 kB, 4.0 KiB) copied, 3.28853 s, 1.2 kB/s
Code:
$ /usr/sbin/rngd -f
$ dd if=/dev/random of=/dev/null bs=1024 count=4 iflag=fullblock
4+0 records in
4+0 records out
4096 bytes (4.1 kB, 4.0 KiB) copied, 0.00631868 s, 648 kB/s
Good to hear you have it working !
My work computer seems to have a tpm module also, now I just have to persuade the people who know the bios password to enable it ;-)
Maybe I will just start libvirt in the background, by the time I have logged in and started the virtual machine manager it probably has enough entropy.
btw, today some more fun with libvirt after upgrading it to 3.0.0.
It won't start the vm if the configured disk is a link, for example /dev/vg01/lvname when using lvm or /dev/disk/by-uuid/<uuid>
It just says: error: An error occurred, but the cause is unknown
More info is in the Arch Linux bugreport in case somebody runs into this...
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.