[Pkg-libvirt-maintainers] Bug#846173: libvirt-daemon: Fails to locate existing usb device

David Gilmour david at gilmour.net
Mon Nov 28 22:56:33 UTC 2016


Package: libvirt-daemon
Version: 2.4.0-1+b1
Severity: important

Dear Maintainer,

I have a custom udev rule used to implement usb-hotplug support for the a guest, whose name is dgw.

This is the contents of /etc/udev/rules.d/91-hotplug.rules:
---
ACTION=="add", \
    SUBSYSTEM=="usb", \
    ENV{ID_VENDOR_ID}=="18ec", \
    ENV{ID_MODEL_ID}=="3399", \
    RUN+="/usr/bin/virsh attach-device dgw /home/david/udev/david-webcam-dgw.xml"

ACTION=="remove", \
    SUBSYSTEM=="usb", \
    ENV{ID_VENDOR_ID}=="18ec", \
    ENV{ID_MODEL_ID}=="3399", \
    RUN+="/usr/bin/virsh detach-device dgw /home/david/udev/david-webcam-dgw.xml"
---

This is the content of david-webcam-dgw.xml:
---
<hostdev mode='subsystem' type='usb'>
  <source>
    <vendor id='0x18ec'/>
    <product id='0x3399'/>
  </source>
</hostdev>
---

The rule is correctly activated when the device is plugged in, but with udev logging set to debug level, the syslog trace is as follows:

---
Nov 26 14:48:27 dgh systemd-udevd[8692]: Process 'mtp-probe
/sys/devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3.1 1 67' succeeded.
Nov 26 14:48:27 dgh systemd-udevd[8692]: RUN '/usr/bin/virsh attach-device dgw /home/david/udev/david-webcam-dgw.xml' /etc/udev/rules.d/91-dg-webcam-dgw-hotplug.rules:10
Nov 26 14:48:27 dgh systemd-udevd[8692]: handling device node '/dev/bus/usb/001/067', devnum=c189:66, mode=0664, uid=0, gid=100 Nov 26 14:48:27 dgh systemd-udevd[8692]: set permissions /dev/bus/usb/001/067, 020664, uid=0, gid=100 Nov 26 14:48:27 dgh systemd-udevd[8692]:
creating symlink '/dev/char/189:66' to '../bus/usb/001/067'
Nov 26 14:48:27 dgh systemd-udevd[8692]: created db file '/run/udev/data/c189:66' for '/devices/pci0000:00/0000:00:14.0/usb1/1-3/1-3.1'
Nov 26 14:48:27 dgh systemd-udevd[8694]: starting '/usr/bin/virsh attach-device dgw /home/david/udev/david-webcam-dgw.xml'
Nov 26 14:48:27 dgh libvirtd[3841]: internal error: unable to execute QEMU command 'device_add':
failed to find host usb device 1:67 Nov 26 14:48:27 dgh systemd-udevd[8692]: '/usr/bin/virsh attach- device dgw /home/david/udev/david-webcam-dgw.xml'(err) 'error: '
Nov 26 14:48:27 dgh systemd-udevd[8692]: '/usr/bin/virsh attach-device dgw /home/david/udev/david-
webcam-dgw.xml'(err) 'Failed to attach device from /home/david/udev/david-webcam-dgw.xml'
Nov 26 14:48:27 dgh systemd-udevd[8692]: '/usr/bin/virsh attach-device dgw /home/david/udev/david-
webcam-dgw.xml'(err) 'error: internal error: unable to execute QEMU command 'device_add': failed to find host usb device 1:67'
Nov 26 14:48:27 dgh systemd-udevd[8692]: '/usr/bin/virsh attach-device dgw /home/david/udev/david-
webcam-dgw.xml'(out) ''
Nov 26 14:48:27 dgh systemd-udevd[8692]: Process '/usr/bin/virsh attach-device dgw /home/david/udev/david-webcam-dgw.xml' failed with exit code 1.
---

As you can see, the error is that QEMU device_add fails, complaining it cannot find the usb device that was indeed created.

Additional detail: The above log was generated after the addition of another rules file Thinking it might be a permission problem,I added another rules file 50-myusb.rules as follows:
---
SUBSYSTEMS=="usb", GROUP="users", MODE="0666"
---
but with or without this rules file the error reported is the same.

Intrestingly, the commands

virsh attach-devcice dgw /home/david/udev/david-webcam-dgw.xml
and
virsh detach-devcice dgw /home/david/udev/david-webcam-dgw.xml

both work and successfully attach the device to the guest if the device is connected - but the udev script fails.

USB hotplug on this host was working normally as recently as a couple of months ago; possibly a stretch update caused a regression. As of now, I am unable to make USB hotplug to guests work.

Thanks so much for looking into this.

-- System Information:
Debian Release: stretch/sid
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.8.0-1-amd64 (SMP w/8 CPU cores)
Locale: LANG=en_US.utf8, LC_CTYPE=en_US.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages libvirt-daemon depends on:
ii  libapparmor1        2.10.95-6
ii  libaudit1           1:2.6.7-1
ii  libavahi-client3    0.6.32-1
ii  libavahi-common3    0.6.32-1
ii  libblkid1           2.29-1
ii  libc6               2.24-5
ii  libcap-ng0          0.7.7-3
ii  libdbus-1-3         1.10.12-1
ii  libdevmapper1.02.1  2:1.02.136-1
ii  libfuse2            2.9.7-1
ii  libgnutls30         3.5.6-4
ii  libnetcf1           1:0.2.8-1+b1
ii  libnl-3-200         3.2.27-1
ii  libnl-route-3-200   3.2.27-1
ii  libnuma1            2.0.11-2
ii  libparted2          3.2-16+b1
ii  libpcap0.8          1.8.1-3
ii  libpciaccess0       0.13.4-1
ii  librados2           0.80.11-1.1
ii  librbd1             0.80.11-1.1
ii  libsasl2-2          2.1.27~72-g88d82a3+dfsg-1
ii  libselinux1         2.6-3
ii  libssh2-1           1.7.0-1
ii  libudev1            232-3
ii  libvirt0            2.4.0-1+b1
ii  libxen-4.8          4.8.0~rc5-1
ii  libxenstore3.0      4.8.0~rc5-1
ii  libxml2             2.9.4+dfsg1-2.1
ii  libyajl2            2.1.0-2

Versions of packages libvirt-daemon recommends:
ii  libxml2-utils   2.9.4+dfsg1-2.1
ii  netcat-openbsd  1.105-7
ii  qemu-kvm        1:2.7+dfsg-3+b1

Versions of packages libvirt-daemon suggests:
ii  libvirt-daemon-system  2.4.0-1+b1

-- no debconf information
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/pkg-libvirt-maintainers/attachments/20161128/15e69948/attachment.html>


More information about the Pkg-libvirt-maintainers mailing list