Red Hat Bugzilla – Bug 1146550
USB Redirection no longer works: Permission Denied
Last modified: 2015-03-05 02:45:15 EST
+++ This bug was initially created as a clone of Bug #1145968 +++ Description of problem: USB Redirection no longer works. Version-Release number of selected component (if applicable): libvirt-1.2.8-4.fc21.x86_64 How reproducible: Easily. Steps to Reproduce: 1. Create a VM 2. Assign a host USB device (Add Hardware in virt-manager, not the spice redirection) 3. Run the VM, inspect logs Actual results: 2014-09-24 07:02:48.048+0000: starting up LC_ALL=C PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin QEMU_AUDIO_DRV=spice /usr/bin/qemu-kvm -name fedora21 -S -machine pc-i440fx-2.1,accel=kvm,usb=off -cpu Haswell -m 2048 -realtime mlock=off -smp 4,sockets=4,cores=1,threads=1 -uuid db064f7c-81cf-44b8-bf7e-d0085c8e37b9 -no-user-config -nodefaults -chardev socket,id=charmonitor,path=/var/lib/libvirt/qemu/fedora21.monitor,server,nowait -mon chardev=charmonitor,id=monitor,mode=control -rtc base=utc,driftfix=slew -global kvm-pit.lost_tick_policy=discard -no-hpet -no-reboot -global PIIX4_PM.disable_s3=1 -global PIIX4_PM.disable_s4=1 -boot strict=on -device ich9-usb-ehci1,id=usb,bus=pci.0,addr=0x5.0x7 -device ich9-usb-uhci1,masterbus=usb.0,firstport=0,bus=pci.0,multifunction=on,addr=0x5 -device ich9-usb-uhci2,masterbus=usb.0,firstport=2,bus=pci.0,addr=0x5.0x1 -device ich9-usb-uhci3,masterbus=usb.0,firstport=4,bus=pci.0,addr=0x5.0x2 -device virtio-serial-pci,id=virtio-serial0,bus=pci.0,addr=0x6 -drive file=/var/lib/libvirt/images/fedora-unknown.qcow2,if=none,id=drive-ide0-0-0,format=qcow2 -device ide-hd,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,bootindex=2 -drive file=/home/lkundrak/Fedora-Live-Workstation-x86_64-21_Alpha-1.iso,if=none,id=drive-ide0-0-1,readonly=on,format=raw -device ide-cd,bus=ide.0,unit=1,drive=drive-ide0-0-1,id=ide0-0-1,bootindex=1 -netdev tap,fd=24,id=hostnet0 -device rtl8139,netdev=hostnet0,id=net0,mac=52:54:00:08:78:3d,bus=pci.0,addr=0x3 -chardev pty,id=charserial0 -device isa-serial,chardev=charserial0,id=serial0 -chardev spicevmc,id=charchannel0,name=vdagent -device virtserialport,bus=virtio-serial0.0,nr=1,chardev=charchannel0,id=channel0,name=com.redhat.spice.0 -device usb-tablet,id=input0 -spice port=5900,addr=127.0.0.1,disable-ticketing,seamless-migration=on -device qxl-vga,id=video0,ram_size=67108864,vram_size=67108864,bus=pci.0,addr=0x2 -device intel-hda,id=sound0,bus=pci.0,addr=0x4 -device hda-duplex,id=sound0-codec0,bus=sound0.0,cad=0 -chardev spicevmc,id=charredir0,name=usbredir -device usb-redir,chardev=charredir0,id=redir0 -chardev spicevmc,id=charredir1,name=usbredir -device usb-redir,chardev=charredir1,id=redir1 -chardev spicevmc,id=charredir2,name=usbredir -device usb-redir,chardev=charredir2,id=redir2 -chardev spicevmc,id=charredir3,name=usbredir -device usb-redir,chardev=charredir3,id=redir3 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x7 -msg timestamp=on char device redirected to /dev/pts/2 (label charserial0) main_channel_link: add main channel client main_channel_handle_parsed: net test: latency 0.292000 ms, bitrate 17066666666 bps (16276.041666 Mbps) inputs_connect: inputs channel client create red_dispatcher_set_cursor_peer: main_channel_handle_parsed: agent start ehci warning: guest updated active QH libusb: error [_get_usbfs_fd] libusb couldn't open USB device /dev/bus/usb/002/003: Permission denied libusb: error [_get_usbfs_fd] libusb requires write access to USB device nodes. libusb: error [_get_usbfs_fd] libusb couldn't open USB device /dev/bus/usb/002/003: Permission denied libusb: error [_get_usbfs_fd] libusb requires write access to USB device nodes. libusb: error [_get_usbfs_fd] libusb couldn't open USB device /dev/bus/usb/002/003: Permission denied libusb: error [_get_usbfs_fd] libusb requires write access to USB device nodes. Expected results: World peace. Additional info: Worked fine in Fedora 20. --- Additional comment from Jan Tomko on 2014-09-24 08:41:50 EDT --- I don't see any usb-host device on the command line. Is there a <hostdev> in the domain XML? --- Additional comment from Lubomir Rintel on 2014-09-24 08:48:12 EDT --- (In reply to Jan Tomko from comment #1) > I don't see any usb-host device on the command line. Is there a <hostdev> in > the domain XML? Yep, it is there. My guess was that libvirt attaches the device via usb_add in the qemu console prior to starting the guest cpu? --- Additional comment from Cole Robinson on 2014-09-24 11:40:24 EDT --- I can reproduce, it's a libvirt regression. I've pinpointed the issue, patch forthcoming --- Additional comment from Cole Robinson on 2014-09-24 11:52:05 EDT --- Patch posted: http://www.redhat.com/archives/libvir-list/2014-September/msg01472.html --- Additional comment from Fedora Update System on 2014-09-24 13:07:34 EDT --- libvirt-1.2.8-6.fc21 has been submitted as an update for Fedora 21. https://admin.fedoraproject.org/updates/libvirt-1.2.8-6.fc21 --- Additional comment from Fedora Update System on 2014-09-24 14:27:09 EDT --- Package libvirt-1.2.8-6.fc21: * should fix your issue, * was pushed to the Fedora 21 testing repository, * should be available at your local mirror within two days. Update it with: # su -c 'yum update --enablerepo=updates-testing libvirt-1.2.8-6.fc21' as soon as you are able to. Please go to the following url: https://admin.fedoraproject.org/updates/FEDORA-2014-11310/libvirt-1.2.8-6.fc21 then log in and leave karma (feedback).
Reproduced this bug with libvirt-1.2.8-3.el7.x86_64. Not find the usb device in guest. In host: # lsusb ... Bus 001 Device 006: ID 8644:8303 # virsh start a Domain a started # virsh dumpxml a | grep hostdev -A8 <hostdev mode='subsystem' type='usb' managed='yes'> <source> <vendor id='0x8644'/> <product id='0x8303'/> <address bus='1' device='6'/> </source> <alias name='hostdev0'/> </hostdev> ... # vim /var/log/libvirt/qemu/a.log ... RHEL-6 compat: ich9-usb-uhci1: irq_pin = 3 libusbx: error [op_open] libusbx couldn't open USB device /dev/bus/usb/001/006: Permission denied. libusbx: error [op_open] libusbx requires write access to USB device nodes. main_channel_link: add main channel client main_channel_handle_parsed: net test: latency 0.115000 ms, bitrate 23813953488 bps (22710.755814 Mbps) red_dispatcher_set_cursor_peer: inputs_connect: inputs channel client create libusbx: error [op_open] libusbx couldn't open USB device /dev/bus/usb/001/006: Permission denied. libusbx: error [op_open] libusbx requires write access to USB device nodes. libusbx: error [op_open] libusbx couldn't open USB device /dev/bus/usb/001/006: Permission denied. libusbx: error [op_open] libusbx requires write access to USB device nodes. In guest: # lsusb Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 002 Device 002: ID 0627:0001 Adomax Technology Co., Ltd <== can not find the usb device. ----------------------------------- Verify it as follows. Can find the usb device in guest. This result is expected. Version: libvirt-1.2.8-7.el7.x86_64 qemu-kvm-rhev-2.1.2-8.el7.x86_64 qemu-kvm-1.5.3-79.el7.x86_64 Steps: In host: # virsh start a Domain a started # virsh dumpxml a | grep hostdev -A8 <hostdev mode='subsystem' type='usb' managed='yes'> <source> <vendor id='0x8644'/> <product id='0x8303'/> <address bus='1' device='6'/> </source> <alias name='hostdev0'/> </hostdev> ... In guest: # lsusb Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 001 Device 003: ID 8644:8303 <== can find the usb device. Bus 002 Device 002: ID 0627:0001 Adomax Technology Co., Ltd
Additional test: libvirt-1.2.8-8.el7.x86_64 qemu-kvm-rhev-2.1.2-12.el7.x86_64 Scenario 1: Hot-plug/hot-unplug usb device 1. Hot-plug usb device on host. # lsusb ... Bus 001 Device 004: ID 0951:1656 Kingston Technology DataTraveler Ultimate G2 # cat usb.xml <hostdev mode='subsystem' type='usb' managed='yes'> <source> <vendor id='0x0951'/> <product id='0x1656'/> </source> <alias name='hostdev0'/> </hostdev> # virsh start r7 Domain r7 started # virsh attach-device r7 usb.xml Device attached successfully # virsh dumpxml r7 | grep hostdev -A10 <hostdev mode='subsystem' type='usb' managed='yes'> <source> <vendor id='0x0951'/> <product id='0x1656'/> <address bus='1' device='4'/> </source> <alias name='hostdev0'/> </hostdev> 2. The usb device exists in guest and works well. # lsusb Bus 001 Device 002: ID 0627:0001 Adomax Technology Co., Ltd Bus 001 Device 003: ID 0409:55aa NEC Corp. Hub Bus 001 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 001 Device 004: ID 0951:1656 Kingston Technology DataTraveler Ultimate G2 3. Hot-unplug usb device on host. # virsh detach-device r7 usb.xml Device detached successfully 4. Check usb device on guest. # lsusb Bus 001 Device 002: ID 0627:0001 Adomax Technology Co., Ltd Bus 001 Device 003: ID 0409:55aa NEC Corp. Hub Bus 001 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Scenario 2: Hot-plug/hot-unplug scsi device 1. Hot-plug scsi device on host. # cat scsi.xml <hostdev mode='subsystem' type='scsi' managed='no'> <source protocol='iscsi' name='iqn.yy:server.target1/1'> <host name='10.66.100.101' port='3260'/> </source> <alias name='hostdev0'/> <address type='drive' controller='0' bus='0' target='0' unit='0'/> </hostdev> # virsh start r7 Domain r7 started # virsh attach-device r7 scsi.xml Device attached successfully 2. The scsi device exists in guest and works well. # fdisk -l Disk /dev/vda: 9663 MB, 9663676416 bytes, 18874368 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk label type: dos Disk identifier: 0x0009764c Device Boot Start End Blocks Id System /dev/vda1 * 2048 1026047 512000 83 Linux /dev/vda2 1026048 18874367 8924160 8e Linux LVM Disk /dev/mapper/rhel-root: 8166 MB, 8166309888 bytes, 15949824 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk /dev/mapper/rhel-swap: 968 MB, 968884224 bytes, 1892352 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk /dev/sda: 21.5 GB, 21474836480 bytes, 41943040 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes 3. Hot-unplug scsi device on host. # virsh detach-device r7 scsi.xml Device detached successfully 4. Check scsi device on guest. # fdisk -l Disk /dev/vda: 9663 MB, 9663676416 bytes, 18874368 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk label type: dos Disk identifier: 0x0009764c Device Boot Start End Blocks Id System /dev/vda1 * 2048 1026047 512000 83 Linux /dev/vda2 1026048 18874367 8924160 8e Linux LVM Disk /dev/mapper/rhel-root: 8166 MB, 8166309888 bytes, 15949824 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk /dev/mapper/rhel-swap: 968 MB, 968884224 bytes, 1892352 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Scenario 3: 1. Start a guest with scsi device. # virsh start r7 Domain r7 started # virsh dumpxml r7 | grep hostdev -A10 <hostdev mode='subsystem' type='scsi' managed='no'> <source protocol='iscsi' name='iqn.yy:server.target1/1'> <host name='10.66.100.101' port='3260'/> </source> <alias name='hostdev0'/> <address type='drive' controller='0' bus='0' target='0' unit='0'/> </hostdev> ... 2. The usb device exists in guest and works well. # fdisk -l Disk /dev/vda: 9663 MB, 9663676416 bytes, 18874368 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk label type: dos Disk identifier: 0x0009764c Device Boot Start End Blocks Id System /dev/vda1 * 2048 1026047 512000 83 Linux /dev/vda2 1026048 18874367 8924160 8e Linux LVM Disk /dev/mapper/rhel-root: 8166 MB, 8166309888 bytes, 15949824 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk /dev/mapper/rhel-swap: 968 MB, 968884224 bytes, 1892352 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk /dev/sda: 21.5 GB, 21474836480 bytes, 41943040 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://rhn.redhat.com/errata/RHSA-2015-0323.html