RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1552127 - qemu-kvm cannot find USB bus
Summary: qemu-kvm cannot find USB bus
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.6
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: pre-dev-freeze
: 7.6
Assignee: Michal Privoznik
QA Contact: lijuan men
URL:
Whiteboard:
Depends On:
Blocks: 1552611
TreeView+ depends on / blocked
 
Reported: 2018-03-06 14:45 UTC by Radek Duda
Modified: 2018-10-30 09:55 UTC (History)
12 users (show)

Fixed In Version: libvirt-4.3.0-1.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1552611 (view as bug list)
Environment:
Last Closed: 2018-10-30 09:53:14 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
qemu.log after vm starts (8.16 KB, text/plain)
2018-03-06 14:45 UTC, Radek Duda
no flags Details
vdsm log after VM starts (43.32 KB, text/plain)
2018-03-06 14:45 UTC, Radek Duda
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 1553162 0 unspecified CLOSED Attaching device to running domain fails with "non unique alias detected: usb" 2021-02-22 00:41:40 UTC
Red Hat Product Errata RHSA-2018:3113 0 None None None 2018-10-30 09:55:20 UTC

Internal Links: 1553162

Description Radek Duda 2018-03-06 14:45:14 UTC
Created attachment 1404856 [details]
qemu.log after vm starts

Description of problem:
VM with USB support enabled cannot be launched.

Version-Release number of selected component (if applicable):
host (rhel7.5):
vdsm-4.20.20-1.el7ev.x86_64
qemu-kvm-rhev-2.9.0-16.el7_4.14.x86_64
libvirt-client-3.9.0-13.el7.x86_64

engine (rhel7.5)
rhv4.2.2.2-0.1.el7
ovirt-engine-4.2.2.2-0.1.el7.noarch

How reproducible:
always

Steps to Reproduce:
1.create some VM in rhv with usb support enabled
2.run VM
3.

Actual results:
VM is shut down immediatelly after start.
In qemu log appears error:
2018-03-06T14:32:36.783360Z qemu-kvm: -device ich9-usb-uhci2,masterbus=ua-b17203da-8498-48ae-9b4e-71e6757fcd68.0,firstport=2,bus=pci.0,addr=0x7.0x1: USB bus 'ua-b17203da-8498-48ae-9b4e-71e6757fcd68.0' not found

Expected results:
VM is running

Additional info:
It worked ok before vdsm and ovirt-engine update

Comment 1 Radek Duda 2018-03-06 14:45:57 UTC
Created attachment 1404857 [details]
vdsm log after VM starts

Comment 2 Michal Skrivanek 2018-03-07 06:16:24 UTC
Seems the USB companion controller's masterbus is not generated correctly? Why does it use alias.0?

Comment 3 Michal Privoznik 2018-03-07 07:21:15 UTC
Yes, this is a libvirt bug. I recall posting some patches for this on the upstream but don't recall their fate right now. Anwyay, I'll look into this.

For QE or anybody else willing to reproduce this: Just try to start domain with the following USB controller:

    <controller type='usb' index='0' model='ich9-uhci2'>
      <alias name='ua-ble'/>
      <master startport='2'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x1'/>
    </controller>

Comment 5 Michal Privoznik 2018-03-07 08:50:07 UTC
Just for housekeeping sake: what is the reason you need to set user alias for this device (which can't be hotplugged anyway)? Because I'm thinking about a fix where I forbid it.

Comment 6 Radek Duda 2018-03-07 10:33:35 UTC
I do not know. This is the default behaviour of rhv4.2

Comment 7 Michal Skrivanek 2018-03-07 11:26:59 UTC
(In reply to Michal Privoznik from comment #5)
> Just for housekeeping sake: what is the reason you need to set user alias
> for this device (which can't be hotplugged anyway)? Because I'm thinking
> about a fix where I forbid it.

it's a generic code for all devices. why forbid? it's not particularly interesting and we can likely easily disable that for usb controllers, but why creating inconsistency in libvirt?

Comment 9 Michal Privoznik 2018-03-08 07:55:05 UTC
(In reply to Michal Skrivanek from comment #7)
> (In reply to Michal Privoznik from comment #5)
> > Just for housekeeping sake: what is the reason you need to set user alias
> > for this device (which can't be hotplugged anyway)? Because I'm thinking
> > about a fix where I forbid it.
> 
> it's a generic code for all devices. why forbid? it's not particularly
> interesting and we can likely easily disable that for usb controllers, but
> why creating inconsistency in libvirt?

Forbid because these aliases are what QEMU sees. I mean, aliases as exposed by libvirt are directly passed to QEMU. And for some devices aliases have special meaning - like in this case, where alias also represents bus the controller is plugged to. And QEMU has these joined devices where we cannot really set them on per device basis (although they are represented separately on the command line).

Comment 10 Michal Skrivanek 2018-03-08 10:31:18 UTC
(In reply to Michal Privoznik from comment #9)

> Forbid because these aliases are what QEMU sees. I mean, aliases as exposed
> by libvirt are directly passed to QEMU. And for some devices aliases have
> special meaning - like in this case, where alias also represents bus the
> controller is plugged to. And QEMU has these joined devices where we cannot
> really set them on per device basis (although they are represented
> separately on the command line).

okay, can you please specify which other devices would behave like that?

Comment 11 Michal Privoznik 2018-03-09 11:57:25 UTC
Patch proposed upstream:

https://www.redhat.com/archives/libvir-list/2018-March/msg00466.html

Comment 12 Michal Privoznik 2018-03-09 12:08:01 UTC
(In reply to Michal Skrivanek from comment #10)
> (In reply to Michal Privoznik from comment #9)
> 
> > Forbid because these aliases are what QEMU sees. I mean, aliases as exposed
> > by libvirt are directly passed to QEMU. And for some devices aliases have
> > special meaning - like in this case, where alias also represents bus the
> > controller is plugged to. And QEMU has these joined devices where we cannot
> > really set them on per device basis (although they are represented
> > separately on the command line).
> 
> okay, can you please specify which other devices would behave like that?

USB controllers are the only ones which come to my mind.

Comment 13 Michal Skrivanek 2018-03-09 12:09:16 UTC
ok, that's easy enough to skip

Comment 14 Radek Duda 2018-03-09 15:21:02 UTC
After update libvirt 3.9.0-13 to libvirt 3.9.0-14 on host
I can start VM with USB support now.

Comment 15 Radek Duda 2018-03-12 09:53:19 UTC
(In reply to Radek Duda from comment #14)
> After update libvirt 3.9.0-13 to libvirt 3.9.0-14 on host
> I can start VM with USB support now.

Sorry for confusion .. I tried now several times today to launch VM with usb support enabled and it seems libvirt 3.9.0-14 have no impact on the bug. Reproducibility is not 100% but around 95%.

Comment 16 jiyan 2018-03-13 04:08:51 UTC
Hi, Michal. I have tried several scenarios in pure libvirt.

Version:
kernel-3.10.0-860.el7.x86_64
qemu-kvm-rhev-2.10.0-21.el7.x86_64
libvirt-3.9.0-14.virtcov.el7.x86_64


Scenarios:
S1: Configure alias for 'ich9-ehci1' model
# virsh domstate test1
shut off

# virsh dumpxml test1 |grep "usb" -A5
    <controller type='usb' index='0' model='ich9-ehci1'>
      <alias name='ua-ble'/> ****
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x7'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci1'>
      <master startport='0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0' multifunction='on'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci2'>
      <master startport='2'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x1'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci3'>
      <master startport='4'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x2'/>
    </controller>

# virsh start test1
error: Failed to start domain test1
error: internal error: process exited while connecting to monitor: i.0,addr=0x7 -msg timestamp=on
2018-03-13T03:52:15.377611Z qemu-kvm: -device ich9-usb-uhci1,masterbus=usb.0,firstport=0,bus=pci.0,multifunction=on,addr=0x5: USB bus 'usb.0' not found


S2: Configure alias for 'ich9-uhci1' model
# virsh domstate test1
shut off

[root@intel-e31225-8-2 ~]# virsh dumpxml test1 |grep "usb" -A5
    <controller type='usb' index='0' model='ich9-ehci1'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x7'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci1'>
      <alias name='ua-ble'/>  ****
      <master startport='0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0' multifunction='on'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci2'>
      <master startport='2'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x1'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci3'>
      <master startport='4'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x2'/>
    </controller>

# virsh start test1
error: Failed to start domain test1
error: internal error: process exited while connecting to monitor: 2018-03-13T03:53:04.572620Z qemu-kvm: -device ich9-usb-uhci1,masterbus=ua-ble.0,firstport=0,bus=pci.0,multifunction=on,addr=0x5: USB bus 'ua-ble.0' not found


S3: Configure alias for 'ich9-uhci2' model
# virsh domstate test1
shut off

# virsh dumpxml test1 |grep "usb" -A5
    <controller type='usb' index='0' model='ich9-ehci1'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x7'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci1'>
      <master startport='0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0' multifunction='on'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci2'>
      <alias name='ua-ble'/>
      <master startport='2'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x1'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci3'>
      <master startport='4'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x2'/>
    </controller>

# virsh start test1
error: Failed to start domain test1
error: internal error: process exited while connecting to monitor: 2018-03-13T03:54:57.294238Z qemu-kvm: -device ich9-usb-uhci2,masterbus=ua-ble.0,firstport=2,bus=pci.0,addr=0x5.0x1: USB bus 'ua-ble.0' not found


S4: Configure alias for 'ich9-uhci3' model
# virsh domstate test1
shut off

# virsh dumpxml test1 |grep usb -A5
    <controller type='usb' index='0' model='ich9-ehci1'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x7'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci1'>
      <master startport='0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0' multifunction='on'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci2'>
      <master startport='2'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x1'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci3'>
      <alias name='ua-ble'/>
      <master startport='4'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x2'/>
    </controller>

# virsh start test1
error: Failed to start domain test1
error: internal error: process exited while connecting to monitor: 2018-03-13T03:56:09.135343Z qemu-kvm: -device ich9-usb-uhci3,masterbus=ua-ble.0,firstport=4,bus=pci.0,addr=0x5.0x2: USB bus 'ua-ble.0' not found


S5: Configure alias for all models
# virsh domstate test1
shut off

# virsh dumpxml test1 |grep usb -A5
    <controller type='usb' index='0' model='ich9-ehci1'>
      <alias name='ua-usb1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x7'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci1'>
      <alias name='ua-usb2'/>
      <master startport='0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0' multifunction='on'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci2'>
      <alias name='ua-usb3'/>
      <master startport='2'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x1'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci3'>
      <alias name='ua-usb4'/>
      <master startport='4'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x2'/>
    </controller>

# virsh start test1
error: Failed to start domain test1
error: internal error: qemu unexpectedly closed the monitor: 2018-03-13T03:57:17.817761Z qemu-kvm: -device ich9-usb-uhci1,masterbus=ua-usb2.0,firstport=0,bus=pci.0,multifunction=on,addr=0x5: USB bus 'ua-usb2.0' not found

In the test scenarios above, guest can not start.
I am not sure whether it is same with the issue in RHV.
And I can also reproduce the issue in RHV.

Version:
libvirt-3.9.0-14.virtcov.el7.x86_64
vdsm-4.20.20-1.el7ev.x86_64
qemu-kvm-rhev-2.10.0-21.el7.x86_64
kernel-3.10.0-860.el7.x86_64

Qemu Log:
# cat /var/log/libvirt/qemu/vm.log
2018-03-13T03:47:18.909782Z qemu-kvm: -device ich9-usb-uhci3,masterbus=ua-5d0ddb79-fed6-465b-807d-839018b74f0a.0,firstport=4,bus=pci.0,addr=0x5.0x2: USB bus 'ua-5d0ddb79-fed6-465b-807d-839018b74f0a.0' not found
2018-03-13 03:47:19.175+0000: shutting down, reason=failed


At last, I wonder whether the scenarios above is same with the issue in RHV, if so, maybe this issue has been found in Bug 1434451. Could you please help to check it? thanks in advance.
https://bugzilla.redhat.com/show_bug.cgi?id=1434451#c31

Comment 17 Michal Privoznik 2018-03-16 15:39:18 UTC
Patch proposed upstream:

https://www.redhat.com/archives/libvir-list/2018-March/msg00963.html

In my testing it fixes issues found in comment 16.

Comment 18 Michal Privoznik 2018-03-16 16:10:01 UTC
Aaand I've just pushed the patch upstream:

commit b133fac356324c3c7992a9cb07c1b5d9eea1e2eb
Author:     Michal Privoznik <mprivozn>
AuthorDate: Fri Mar 16 15:53:32 2018 +0100
Commit:     Michal Privoznik <mprivozn>
CommitDate: Fri Mar 16 16:37:14 2018 +0100

    qemu: Build usb controller command line more wisely
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1552127
    
    When building command line for USB controllers we have to do more
    than just put controller's alias onto the command line. QEMU has
    concept of these joined USB controllers. For instance ehci and
    uhci controllers need to create the same USB bus. To achieve that
    the slave controller needs to refer the master controller. This
    worked until we've introduced user aliases because both master
    and slave had the same alias. With user aliases slave can have
    different alias than master. Therefore, when generating command
    line for slave we need to look up the master's alias.
    
    Signed-off-by: Michal Privoznik <mprivozn>

v4.1.0-192-gb133fac356

Comment 20 lijuan men 2018-07-10 07:24:53 UTC
verify the bug

version:
libvirt-4.5.0-2.el7.x86_64

scenario1:Configure alias for 'ich9-ehci1' model

  <controller type='usb' index='0' model='ich9-ehci1'>
     *** <alias name='ua-usb1'/>***
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x7'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci1'>
      <master startport='0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0' multifunction='on'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci2'>
      <master startport='2'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x1'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci3'>
      <master startport='4'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x2'/>
    </controller>

[root@localhost ~]# virsh destroy test;virsh start test
Domain test destroyed

Domain test started

[root@localhost ~]# ps -ef | grep test | grep usb

-device ich9-usb-ehci1,id=ua-usb1,bus=pci.0,addr=0x5.0x7 
-device ich9-usb-uhci1,masterbus=ua-usb1.0,firstport=0,bus=pci.0,multifunction=on,addr=0x5 
-device ich9-usb-uhci2,masterbus=ua-usb1.0,firstport=2,bus=pci.0,addr=0x5.0x1 
-device ich9-usb-uhci3,masterbus=ua-usb1.0,firstport=4,bus=pci.0,addr=0x5.0x2 


scenario2:Configure alias for 'ich9-uhci1' model

  <controller type='usb' index='0' model='ich9-ehci1'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x7'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci1'>
      ***<alias name='ua-usb2'/>***
      <master startport='0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0' multifunction='on'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci2'>
      <master startport='2'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x1'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci3'>
      <master startport='4'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x2'/>
    </controller>

 [root@localhost ~]# virsh destroy test;virsh start test
Domain test destroyed

Domain test started


[root@localhost ~]# ps -ef | grep test | grep usb

-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 



scenario3: Configure alias for all models

  <controller type='usb' index='0' model='ich9-ehci1'>
    ***  <alias name='ua-usb1'/>***
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x7'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci1'>
    ***  <alias name='ua-usb2'/>***
      <master startport='0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0' multifunction='on'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci2'>
     ***  <alias name='ua-usb3'/>***
      <master startport='2'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x1'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci3'>
    ***  <alias name='ua-usb4'/>***
      <master startport='4'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x2'/>
    </controller>
[root@localhost ~]# virsh destroy test;virsh start test
Domain test destroyed

Domain test started

[root@localhost ~]# ps -ef | grep test | grep usb

-device ich9-usb-ehci1,id=ua-usb1,bus=pci.0,addr=0x5.0x7 
-device ich9-usb-uhci1,masterbus=ua-usb1.0,firstport=0,bus=pci.0,multifunction=on,addr=0x5 
-device ich9-usb-uhci2,masterbus=ua-usb1.0,firstport=2,bus=pci.0,addr=0x5.0x1 
-device ich9-usb-uhci3,masterbus=ua-usb1.0,firstport=4,bus=pci.0,addr=0x5.0x2

Comment 22 errata-xmlrpc 2018-10-30 09:53:14 UTC
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://access.redhat.com/errata/RHSA-2018:3113


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