Correctly installing / configuring locally built qemu / libvirt

On Ubuntu 18.04, the default installation of qemu is something like version 3, and I needed virtiofs which has built-in support in later versions. So I uninstalled the qemu and related packages, downloaded the qemu 5.0 sources and complied it locally.

All worked well, including make install, which put the binaries in /usr/local/ which I guess is the correct default unless told otherwise.

Most things are working OK, but I’m now trying to get graceful shutdown / restart of guests working when the host is restarted, and have hit 2 snags so far.

  1. On host startup, I would see /usr/local/libexec/libvirt-guests.sh: 29: .: Can't open /usr/local/bin/gettext.sh. Of course, that’s not where getttext.sh normally lives, but I can get round that by ln -s /usr/bin/gettext.sh /usr/local/bin/gettext.sh
  2. No failure message there now, but later in the host boot logs I see libvirt-guests.sh[2166]: touch: cannot touch '/usr/local/var/lock/subsys/libvirt-guests': No such file or directory

I could go on symlinking things so they appear accessible to libvirt, but I’m wondering if the correct fix is actually to install qemu where it expects to be.

So, first question, is reinstalling the right approach, or have I just missed some basic configuration which would leave the local package where it is, but allow everything to work as expected?

If not, I guess I will have to run ./configure --prefix=/usr and rebuild, but how could I remove the currently installed version in /usr/local/ cleanly first? And, I’d ideally like to keep my current VM configurations. Searching for an XML file for a particular domain, I see 2 versions:

# find / -name 07x2.xml
/usr/local/var/run/libvirt/qemu/07x2.xml
/usr/local/etc/libvirt/qemu/07x2.xml

I’m not sure why there are 2, but I guess I could just virsh dumpxml before removing anything.

Go to Source
Author: dsl101