Bug 1293710 - Virt-Manager: The USB passthrough does not work
Virt-Manager: The USB passthrough does not work
Status: CLOSED DUPLICATE of bug 1323501
Product: Fedora
Classification: Fedora
Component: virt-manager (Show other bugs)
23
x86_64 Linux
unspecified Severity unspecified
: ---
: ---
Assigned To: Cole Robinson
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2015-12-22 14:13 EST by marcioadriano.sistemas
Modified: 2016-07-05 11:12 EDT (History)
5 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2016-05-17 21:02:08 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Log of the virtual machine (3.33 KB, text/plain)
2016-01-04 13:38 EST, marcioadriano.sistemas
no flags Details
Output of: ausearch -m avc (9.24 KB, text/plain)
2016-01-29 07:55 EST, marcioadriano.sistemas
no flags Details

  None (edit)
Description marcioadriano.sistemas 2015-12-22 14:13:39 EST
Description of problem:
Good afternoon everyone(excuse my translation for your language),

The USB passthrough in virt-manager not working.

I initially tried to "give" to virtual machines(Windows 8.1, OpenBSD 5.8, Fedora 23, Debian 8.2) a USB keyboard and mouse without success, then tried to do the same with USB flash drive also without success: none of the virtualized operating systems are able to detect the presence of USB device or recognize it.

In Fedora 22 it was functioning normally(USB mouse, keyboard and flash drive).



Version-Release number of selected component (if applicable):
Virtual Machine Manager 1.2.1, release 3.fc23



How reproducible:
Try to "give" a USB device to a virtual machine that is using any operating system.

Actual results:
None of the virtualized operating systems are able to detect the presence of a USB device or it recognizes.

Expected results:
It is expected that USB devices delivered to the virtual machines are recognized and properly used as occurred in Fedora 22 and earlier editions.

Additional info:
Using pure QEMU there is apparently no problem with USB passtrough, which can be a problem actually of the virt-manager.
Comment 1 Cole Robinson 2015-12-24 11:44:26 EST
Thanks for the report, it seems to work for me though, but I'm using virt-manager 1.3.1 from updates-testing (sudo yum --enablerepo=updates-testing update virt-manager)

How are you trying to attach the USB device... via the File->Redirect USB Device option, or via 'Add Hardware' ?

Can you provide the output of virt-manager --debug when reproducing?
Comment 2 marcioadriano.sistemas 2015-12-29 01:41:54 EST
Good evening everyone,

I generally try to add the USB device via the "Add Hardware", below is my attempt at creating a virtual machine Fedora 23 x86("Customize configuration before install"):
================================================================
[Ter, 29 Dez 2015 02:43:17 virt-manager 14048] DEBUG (addhardware:125) Showing addhw
[Ter, 29 Dez 2015 02:43:28 virt-manager 14048] DEBUG (connection:635) There are 2 node devices with vendorId: 0x046d, productId: 0xc05a
[Ter, 29 Dez 2015 02:43:28 virt-manager 14048] DEBUG (addhardware:1319) Running setup() for device=<virtinst.devicehostdev.VirtualHostDevice object at 0x7f1b64305bd0>
[Ter, 29 Dez 2015 02:43:28 virt-manager 14048] DEBUG (addhardware:1321) Device setup() complete
[Ter, 29 Dez 2015 02:43:28 virt-manager 14048] DEBUG (addhardware:1334) Adding device:
<hostdev mode="subsystem" type="usb" managed="yes">
  <source>
    <vendor id="0x046d"/>
    <product id="0xc05a"/>
    <address bus="8" device="2"/>
  </source>
</hostdev>

[Ter, 29 Dez 2015 02:43:28 virt-manager 14048] DEBUG (libvirtobject:74) Redefining <vmmDomainVirtinst name=Fedora23x86> with XML diff:
--- Original XML
+++ New XML
@@ -70,6 +70,13 @@
     <video>
       <model type="qxl"/>
     </video>
+    <hostdev mode="subsystem" type="usb" managed="yes">
+      <source>
+        <vendor id="0x046d"/>
+        <product id="0xc05a"/>
+        <address bus="8" device="2"/>
+      </source>
+    </hostdev>
     <redirdev bus="usb" type="spicevmc"/>
     <redirdev bus="usb" type="spicevmc"/>
   </devices>

[Ter, 29 Dez 2015 02:43:29 virt-manager 14048] DEBUG (addhardware:135) Closing addhw
[Ter, 29 Dez 2015 02:47:35 virt-manager 14048] DEBUG (addhardware:125) Showing addhw
[Ter, 29 Dez 2015 02:47:52 virt-manager 14048] DEBUG (connection:635) There are 1 node devices with vendorId: 0x046d, productId: 0xc31c
[Ter, 29 Dez 2015 02:47:52 virt-manager 14048] DEBUG (addhardware:1319) Running setup() for device=<virtinst.devicehostdev.VirtualHostDevice object at 0x7f1b6441bcd0>
[Ter, 29 Dez 2015 02:47:52 virt-manager 14048] DEBUG (addhardware:1321) Device setup() complete
[Ter, 29 Dez 2015 02:47:52 virt-manager 14048] DEBUG (addhardware:1334) Adding device:
<hostdev mode="subsystem" type="usb" managed="yes">
  <source>
    <vendor id="0x046d"/>
    <product id="0xc31c"/>
  </source>
</hostdev>

[Ter, 29 Dez 2015 02:47:53 virt-manager 14048] DEBUG (libvirtobject:74) Redefining <vmmDomainVirtinst name=Fedora23x86> with XML diff:
--- Original XML
+++ New XML
@@ -77,6 +77,12 @@
         <address bus="8" device="2"/>
       </source>
     </hostdev>
+    <hostdev mode="subsystem" type="usb" managed="yes">
+      <source>
+        <vendor id="0x046d"/>
+        <product id="0xc31c"/>
+      </source>
+    </hostdev>
     <redirdev bus="usb" type="spicevmc"/>
     <redirdev bus="usb" type="spicevmc"/>
   </devices>

[Ter, 29 Dez 2015 02:47:53 virt-manager 14048] DEBUG (addhardware:135) Closing addhw
================================================================





Virtual machine results starting for the first time (with USB mouse and keyboard not working):
================================================================
[Ter, 29 Dez 2015 02:49:58 virt-manager 14048] DEBUG (details:655) Closing VM details: <vmmDomainVirtinst object at 0x7f1b6445c140 (virtManager+domain+vmmDomainVirtinst at 0x55e54e5fb320)>
[Ter, 29 Dez 2015 02:49:59 virt-manager 14048] DEBUG (create:1806) User finished customize dialog, starting install
[Ter, 29 Dez 2015 02:49:59 virt-manager 14048] DEBUG (create:1872) Starting background install process
[Ter, 29 Dez 2015 02:49:59 virt-manager 14048] DEBUG (storage:765) Creating storage volume 'Fedora23x86.qcow2' with xml:
<volume>
  <name>Fedora23x86.qcow2</name>
  <capacity>10737418240</capacity>
  <allocation>0</allocation>
  <target>
    <format type="qcow2"/>
    <features>
      <lazy_refcounts/>
    </features>
  </target>
</volume>

[Ter, 29 Dez 2015 02:49:59 virt-manager 14048] DEBUG (storage:798) Using vol create flags=1
[Ter, 29 Dez 2015 02:50:00 virt-manager 14048] DEBUG (storage:805) Storage volume 'Fedora23x86.qcow2' install complete.
[Ter, 29 Dez 2015 02:50:01 virt-manager 14048] DEBUG (guest:460) Generated install XML: 
<domain type="kvm">
  <name>Fedora23x86</name>
  <uuid>dcbfce0c-991b-40c2-b025-eb5cb7c15b84</uuid>
  <memory>1048576</memory>
  <currentMemory>1048576</currentMemory>
  <vcpu>1</vcpu>
  <os>
    <type arch="x86_64">hvm</type>
    <boot dev="cdrom"/>
    <boot dev="hd"/>
  </os>
  <features>
    <acpi/>
    <apic/>
    <pae/>
    <vmport state="off"/>
  </features>
  <cpu mode="custom" match="exact">
    <model>Opteron_G4</model>
  </cpu>
  <clock offset="utc">
    <timer name="rtc" tickpolicy="catchup"/>
    <timer name="pit" tickpolicy="delay"/>
    <timer name="hpet" present="no"/>
  </clock>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>destroy</on_reboot>
  <on_crash>destroy</on_crash>
  <pm>
    <suspend-to-mem enabled="no"/>
    <suspend-to-disk enabled="no"/>
  </pm>
  <devices>
    <emulator>/usr/bin/qemu-kvm</emulator>
    <disk type="file" device="disk">
      <driver name="qemu" type="qcow2"/>
      <source file="/zen/virtuais/hdd/Fedora23x86.qcow2"/>
      <target dev="vda" bus="virtio"/>
    </disk>
    <disk type="file" device="cdrom">
      <driver name="qemu" type="raw"/>
      <source file="/zen/virtuais/iso/Fedora-Workstation-netinst-i386-23.iso"/>
      <target dev="hda" bus="ide"/>
      <readonly/>
    </disk>
    <controller type="usb" index="0" model="ich9-ehci1"/>
    <controller type="usb" index="0" model="ich9-uhci1">
      <master startport="0"/>
    </controller>
    <controller type="usb" index="0" model="ich9-uhci2">
      <master startport="2"/>
    </controller>
    <controller type="usb" index="0" model="ich9-uhci3">
      <master startport="4"/>
    </controller>
    <interface type="network">
      <source network="default"/>
      <mac address="52:54:00:24:3b:3f"/>
      <model type="virtio"/>
    </interface>
    <input type="tablet" bus="usb"/>
    <graphics type="spice" port="-1" tlsPort="-1" autoport="yes">
      <image compression="off"/>
    </graphics>
    <console type="pty"/>
    <channel type="unix">
      <source mode="bind"/>
      <target type="virtio" name="org.qemu.guest_agent.0"/>
    </channel>
    <channel type="spicevmc">
      <target type="virtio" name="com.redhat.spice.0"/>
    </channel>
    <sound model="ich6"/>
    <video>
      <model type="qxl"/>
    </video>
    <hostdev mode="subsystem" type="usb" managed="yes">
      <source>
        <vendor id="0x046d"/>
        <product id="0xc05a"/>
        <address bus="8" device="2"/>
      </source>
    </hostdev>
    <hostdev mode="subsystem" type="usb" managed="yes">
      <source>
        <vendor id="0x046d"/>
        <product id="0xc31c"/>
      </source>
    </hostdev>
    <redirdev bus="usb" type="spicevmc"/>
    <redirdev bus="usb" type="spicevmc"/>
  </devices>
</domain>

[Ter, 29 Dez 2015 02:50:01 virt-manager 14048] DEBUG (guest:461) Generated boot XML: 
<domain type="kvm">
  <name>Fedora23x86</name>
  <uuid>dcbfce0c-991b-40c2-b025-eb5cb7c15b84</uuid>
  <memory>1048576</memory>
  <currentMemory>1048576</currentMemory>
  <vcpu>1</vcpu>
  <os>
    <type arch="x86_64">hvm</type>
    <boot dev="hd"/>
  </os>
  <features>
    <acpi/>
    <apic/>
    <pae/>
    <vmport state="off"/>
  </features>
  <cpu mode="custom" match="exact">
    <model>Opteron_G4</model>
  </cpu>
  <clock offset="utc">
    <timer name="rtc" tickpolicy="catchup"/>
    <timer name="pit" tickpolicy="delay"/>
    <timer name="hpet" present="no"/>
  </clock>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <pm>
    <suspend-to-mem enabled="no"/>
    <suspend-to-disk enabled="no"/>
  </pm>
  <devices>
    <emulator>/usr/bin/qemu-kvm</emulator>
    <disk type="file" device="disk">
      <driver name="qemu" type="qcow2"/>
      <source file="/zen/virtuais/hdd/Fedora23x86.qcow2"/>
      <target dev="vda" bus="virtio"/>
    </disk>
    <disk type="block" device="cdrom">
      <target dev="hda" bus="ide"/>
      <readonly/>
    </disk>
    <controller type="usb" index="0" model="ich9-ehci1"/>
    <controller type="usb" index="0" model="ich9-uhci1">
      <master startport="0"/>
    </controller>
    <controller type="usb" index="0" model="ich9-uhci2">
      <master startport="2"/>
    </controller>
    <controller type="usb" index="0" model="ich9-uhci3">
      <master startport="4"/>
    </controller>
    <interface type="network">
      <source network="default"/>
      <mac address="52:54:00:24:3b:3f"/>
      <model type="virtio"/>
    </interface>
    <input type="tablet" bus="usb"/>
    <graphics type="spice" port="-1" tlsPort="-1" autoport="yes">
      <image compression="off"/>
    </graphics>
    <console type="pty"/>
    <channel type="unix">
      <source mode="bind"/>
      <target type="virtio" name="org.qemu.guest_agent.0"/>
    </channel>
    <channel type="spicevmc">
      <target type="virtio" name="com.redhat.spice.0"/>
    </channel>
    <sound model="ich6"/>
    <video>
      <model type="qxl"/>
    </video>
    <hostdev mode="subsystem" type="usb" managed="yes">
      <source>
        <vendor id="0x046d"/>
        <product id="0xc05a"/>
        <address bus="8" device="2"/>
      </source>
    </hostdev>
    <hostdev mode="subsystem" type="usb" managed="yes">
      <source>
        <vendor id="0x046d"/>
        <product id="0xc31c"/>
      </source>
    </hostdev>
    <redirdev bus="usb" type="spicevmc"/>
    <redirdev bus="usb" type="spicevmc"/>
  </devices>
</domain>

[Ter, 29 Dez 2015 02:50:03 virt-manager 14048] DEBUG (connection:722) domain lifecycle event: domain=Fedora23x86 event=4 reason=0
[Ter, 29 Dez 2015 02:50:03 virt-manager 14048] DEBUG (connection:722) domain lifecycle event: domain=Fedora23x86 event=2 reason=0
[Ter, 29 Dez 2015 02:50:03 virt-manager 14048] DEBUG (guest:491) XML fetched from libvirt object:
<domain type='kvm' id='1'>
  <name>Fedora23x86</name>
  <uuid>dcbfce0c-991b-40c2-b025-eb5cb7c15b84</uuid>
  <memory unit='KiB'>1048576</memory>
  <currentMemory unit='KiB'>1048576</currentMemory>
  <vcpu placement='static'>1</vcpu>
  <resource>
    <partition>/machine</partition>
  </resource>
  <os>
    <type arch='x86_64' machine='pc-i440fx-2.4'>hvm</type>
    <boot dev='cdrom'/>
    <boot dev='hd'/>
  </os>
  <features>
    <acpi/>
    <apic/>
    <pae/>
    <vmport state='off'/>
  </features>
  <cpu mode='custom' match='exact'>
    <model fallback='allow'>Opteron_G4</model>
  </cpu>
  <clock offset='utc'>
    <timer name='rtc' tickpolicy='catchup'/>
    <timer name='pit' tickpolicy='delay'/>
    <timer name='hpet' present='no'/>
  </clock>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>destroy</on_reboot>
  <on_crash>destroy</on_crash>
  <pm>
    <suspend-to-mem enabled='no'/>
    <suspend-to-disk enabled='no'/>
  </pm>
  <devices>
    <emulator>/usr/bin/qemu-kvm</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source file='/zen/virtuais/hdd/Fedora23x86.qcow2'/>
      <backingStore/>
      <target dev='vda' bus='virtio'/>
      <alias name='virtio-disk0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
    </disk>
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <source file='/zen/virtuais/iso/Fedora-Workstation-netinst-i386-23.iso'/>
      <backingStore/>
      <target dev='hda' bus='ide'/>
      <readonly/>
      <alias name='ide0-0-0'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>
    <controller type='usb' index='0' model='ich9-ehci1'>
      <alias name='usb'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x7'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci1'>
      <alias name='usb'/>
      <master startport='0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0' multifunction='on'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci2'>
      <alias name='usb'/>
      <master startport='2'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x1'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci3'>
      <alias name='usb'/>
      <master startport='4'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x2'/>
    </controller>
    <controller type='pci' index='0' model='pci-root'>
      <alias name='pci.0'/>
    </controller>
    <controller type='ide' index='0'>
      <alias name='ide'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
    </controller>
    <controller type='virtio-serial' index='0'>
      <alias name='virtio-serial0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
    </controller>
    <interface type='network'>
      <mac address='52:54:00:24:3b:3f'/>
      <source network='default' bridge='virbr0'/>
      <target dev='vnet0'/>
      <model type='virtio'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>
    <serial type='pty'>
      <source path='/dev/pts/5'/>
      <target port='0'/>
      <alias name='serial0'/>
    </serial>
    <console type='pty' tty='/dev/pts/5'>
      <source path='/dev/pts/5'/>
      <target type='serial' port='0'/>
      <alias name='serial0'/>
    </console>
    <channel type='unix'>
      <source mode='bind' path='/var/lib/libvirt/qemu/channel/target/Fedora23x86.org.qemu.guest_agent.0'/>
      <target type='virtio' name='org.qemu.guest_agent.0' state='disconnected'/>
      <alias name='channel0'/>
      <address type='virtio-serial' controller='0' bus='0' port='1'/>
    </channel>
    <channel type='spicevmc'>
      <target type='virtio' name='com.redhat.spice.0' state='disconnected'/>
      <alias name='channel1'/>
      <address type='virtio-serial' controller='0' bus='0' port='2'/>
    </channel>
    <input type='tablet' bus='usb'>
      <alias name='input0'/>
    </input>
    <input type='mouse' bus='ps2'/>
    <input type='keyboard' bus='ps2'/>
    <graphics type='spice' port='5900' autoport='yes' listen='127.0.0.1'>
      <listen type='address' address='127.0.0.1'/>
      <image compression='off'/>
    </graphics>
    <sound model='ich6'>
      <alias name='sound0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
    </sound>
    <video>
      <model type='qxl' ram='65536' vram='65536' vgamem='16384' heads='1'/>
      <alias name='video0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    </video>
    <hostdev mode='subsystem' type='usb' managed='yes'>
      <source>
        <vendor id='0x046d'/>
        <product id='0xc05a'/>
        <address bus='8' device='2'/>
      </source>
      <alias name='hostdev0'/>
    </hostdev>
    <hostdev mode='subsystem' type='usb' managed='yes'>
      <source>
        <vendor id='0x046d'/>
        <product id='0xc31c'/>
        <address bus='8' device='3'/>
      </source>
      <alias name='hostdev1'/>
    </hostdev>
    <redirdev bus='usb' type='spicevmc'>
      <alias name='redir0'/>
    </redirdev>
    <redirdev bus='usb' type='spicevmc'>
      <alias name='redir1'/>
    </redirdev>
    <memballoon model='virtio'>
      <alias name='balloon0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
    </memballoon>
  </devices>
  <seclabel type='dynamic' model='selinux' relabel='yes'>
    <label>system_u:system_r:svirt_t:s0:c433,c973</label>
    <imagelabel>system_u:object_r:svirt_image_t:s0:c433,c973</imagelabel>
  </seclabel>
</domain>

[Ter, 29 Dez 2015 02:50:03 virt-manager 14048] DEBUG (create:1874) Install completed
[Ter, 29 Dez 2015 02:50:03 virt-manager 14048] DEBUG (connection:722) domain lifecycle event: domain=Fedora23x86 event=0 reason=0
[Ter, 29 Dez 2015 02:50:03 virt-manager 14048] DEBUG (connection:1005) domain=Fedora23x86 status=Executando added
[Ter, 29 Dez 2015 02:50:03 virt-manager 14048] DEBUG (create:167) Closing new vm wizard
[Ter, 29 Dez 2015 02:50:04 virt-manager 14048] DEBUG (details:619) Showing VM details: <vmmDomain object at 0x7f1b64384320 (virtManager+domain+vmmDomain at 0x55e551476620)>
[Ter, 29 Dez 2015 02:50:04 virt-manager 14048] DEBUG (engine:357) window counter incremented to 2
[Ter, 29 Dez 2015 02:50:04 virt-manager 14048] DEBUG (console:650) Starting connect process for proto=spice trans= connhost=127.0.0.1 connuser= connport= gaddr=127.0.0.1 gport=5900 gtlsport=None gsocket=None
[Ter, 29 Dez 2015 02:50:05 virt-manager 14048] DEBUG (connection:999) New domain=Fedora23x86 requested, but it's already tracked.
[Ter, 29 Dez 2015 02:50:05 virt-manager 14048] DEBUG (connection:999) New domain=Fedora23x86 requested, but it's already tracked.
[Ter, 29 Dez 2015 02:50:05 virt-manager 14048] DEBUG (console:771) Viewer connected
================================================================




The option "File->Redirect USB Device" it is apparently working correctly with USB keyboard and flash drive.
Comment 3 Cole Robinson 2015-12-30 15:37:40 EST
Can you attach /var/log/libvirt/qemu/YOUR-VM-NAME.log ?

Also, can you try reproducing with latest virt-manager from updates-testing: sudo yum --enablerepo=updates-testing update virt-manager
Comment 4 marcioadriano.sistemas 2016-01-04 13:38 EST
Created attachment 1111556 [details]
Log of the virtual machine
Comment 5 marcioadriano.sistemas 2016-01-04 13:39:13 EST
Good afternoon everyone,

The virt-manager was recently updated to version 1.3.2 (regular Fedora updates, unfortunately it is a production machine).

This attached log file represents my attempt to add USB Flash Drive, Keyboard and Mouse when creating a virtual machine. Secondly I tried to remove the USB Flash Drive and add it again without success.
Comment 6 Cole Robinson 2016-01-11 20:32:33 EST
Are you running virt-manager and the VMs on the same physical machine, or connecting to a remote machine?

Also provide these bits on the virt host:

- genenforce
- getsebool virt_use_usb
- after reproducing, attach the output of: ausearch -m avc
Comment 7 marcioadriano.sistemas 2016-01-29 07:55 EST
Created attachment 1119422 [details]
Output of: ausearch -m avc

Good Morning,

I am running on the same physical machine.

# genenforce
bash: genenforce: command not found...

# getenforce 
Enforcing

# getsebool virt_use_usb
virt_use_usb --> on
Comment 8 Cole Robinson 2016-05-17 21:02:08 EDT
Thanks for the info, it looks like this is another case of bug 1323501. So duping to that because it has more info

*** This bug has been marked as a duplicate of bug 1323501 ***

Note You need to log in before you can comment on or make changes to this bug.