On Thu, Aug 6, 2020 at 4:21 PM Andrea Bolognani <abologna@redhat.com> wrote:
On Thu, 2020-08-06 at 15:45 +0200, Marc Hartmayer wrote:
> On Tue, Aug 04, 2020 at 11:39 PM +0200, Andrea Bolognani <abologna@redhat.com> wrote:
> > This patch broke libvirt in Debian for certain setups.
> >
> > With AppArmor enabled (the default), the error is
> >
> >   $ virsh start cirros
> >   error: Failed to start domain cirros
> >   error: internal error: Process exited prior to exec: libvirt:
> >   error : Cannot delete directory '/run/libvirt/qemu/1-cirros.dev':
> >   Device or resource busy
> >
> > If I disable AppArmor by passing security='' on the kernel command
> > line, the error message changes to
> >
> >   $ virsh start cirros
> >   error: Failed to start domain cirros
> >   error: internal error: Process exited prior to exec: libvirt:
> >   QEMU Driver error : Unable to get devmapper targets for
> >   /var/lib/libvirt/images/cirros.qcow2: Success
> >
> > An effective workaround is to set namespaces=[] in qemu.conf, but
> > that's of course not something that we want users doing :)
> >
> > The underlying issue seems to be caused by the fact that, on a Debian
> > installation that uses plain partitions instead of LVM, /proc/devices
> > doesn't contain an entry for device-mapper right after boot, which...
> > ... this code expects.
> >
> > Running
> >
> >   $ sudo dmsetup info
> >   No devices found
>
> We see the same problem as mentioned by Andrea. The host kernel
> configuration used:
>
> …
> CONFIG_BLK_DEV_DM_BUILTIN=y
> CONFIG_BLK_DEV_DM=m
> …
>
> As soon as we load the kernel module ‘dm-mod‘ everything works because
> then ‘device-mapper‘ is listed in /proc/devices.

Thanks Marc! I have confirmed that Debian also uses the same kernel
configuration as the one you have reported above, and that running
dmsetup(8) causes the dm-mod kernel module to be loaded.

For comparison Fedora, where everything works fine, uses

  CONFIG_BLK_DEV_DM_BUILTIN=y
  CONFIG_BLK_DEV_DM=y

FYI even having the module loaded isn't the ultimate workaround as there is a further twist of the same issue.

Ubuntu has:
  CONFIG_BLK_DEV_DM_BUILTIN=y
  CONFIG_BLK_DEV_DM=y

And there is an entry in devices (in host and in the container)
  $ cat /proc/devices | grep map
  253 device-mapper

But libvirt 6.6 in this case running in a LXD system container (working before) now fails related to this with what seems to be the same high level symptom.

# virsh start kvmguest-groovy-normal3
error: Failed to start domain kvmguest-groovy-normal3
error: internal error: Process exited prior to exec: libvirt: QEMU Driver error : Unable to get devmapper targets for /var/lib/uvtool/libvirt/images/kvmguest-groovy-normal3.qcow: No such file or directory
 
--
Andrea Bolognani / Red Hat / Virtualization



--
Christian Ehrhardt
Staff Engineer, Ubuntu Server
Canonical Ltd