Upgrade from 6.9.2 -> 6.10.RC4 USB in VM problem


Recommended Posts

Hi All

 

UPDATE: Known problem from 6.10.RC1 - still a problem in RC4

 

I took the plunge and upgraded to 6.10.rc4 and I am getting this in the logfile

(My hope was to get my UI up on my local monitor again if I upgraded, - This actually resolved the local UI is now working!) 

 

But the error I have after reboot is this:

kernel: usb 1-1: usbfs: process 17779 (qemu-system-x86) did not claim interface 1 before use

Its filling up and have been running since my reboot

 

I found that my Hassio VM - running Home assistant was the cause of this since its using the USB

After stopping this VM it stopped complaining about the USB

 

Apr 13 14:38:27 SERVER kernel: br0: port 2(vnet0) entered disabled state
Apr 13 14:38:27 SERVER kernel: device vnet0 left promiscuous mode
Apr 13 14:38:27 SERVER kernel: br0: port 2(vnet0) entered disabled state
Apr 13 14:38:27 SERVER avahi-daemon[15666]: Withdrawing address record for fe80::fc27:ebff:feb8:e5c9 on vnet0.
Apr 13 14:38:27 SERVER kernel: usb 1-11: reset full-speed USB device number 4 using xhci_hcd
Apr 13 14:38:27 SERVER kernel: cdc_acm 1-11:1.0: ttyACM0: USB ACM device
Apr 13 14:38:28 SERVER kernel: usb 1-1: reset full-speed USB device number 10 using xhci_hcd
Apr 13 14:38:28 SERVER kernel: cdc_acm 1-1:1.0: ttyACM1: USB ACM device
Apr 13 14:38:28 SERVER usb_manager: Info: rc.usb_manager  vm_action Hassio 1 stopped end -
Apr 13 14:38:28 SERVER usb_manager: Info: rc.usb_manager VM Shutdown dresden_elektronik_ingenieurtechnik_GmbH_ConBee_II_DE2421314 vm: Hassio 1 
Apr 13 14:38:28 > usb_manager: Info: rc.usb_manager VM Shutdown 0658_0200 vm: Hassio 1 

 

I am only using the USB manager plugin to control them in the VM (So I think thats the cause of the bug)

 

[Plugin] USB_Manager - Plugin Support - Unraid

 

 

I have included my diag. file here.

 

Diagnostics-20220413-1450.zip

Edited by casperse
  • Upvote 1
Link to comment

I can confirm that the USB problem is not related to the USB manager (I removed the plugin) and after a reboot I selected the USB from the VM:

image.thumb.png.9cf050585b206da507492189ca749d10.png

 

And then afterwards I get the log running forever:

Apr 13 16:45:09 UNRAID kernel: usb 1-1: usbfs: process 19810 (qemu-system-x86) did not claim interface 1 before use

 

Anyone have any way to fix this? - Would really like to keep the 6.10.rc4 but I need Home assistant to run the smart house 🙂

 

 

Link to comment

I did the insert this in the XML for Home assistant if using the Conbee2 stick!

    </memballoon> placed under this line:
	
    <serial type='dev'>
      <source path='/dev/serial/by-id/usb-0000_0000-if00'/>
      <target type='usb-serial' port='1'>
        <model name='usb-serial'/>
      </target>
      <alias name='serial1'/>
      <address type='usb' bus='0' port='4'/>
    </serial>

 

Get USB ID by console:

ls /dev/serial/by-id/

 

But even if I got the VM started then Home assistant cant access the Conbee stick?

image.png.0aad32a08a85ea8eaac92321426a9bba.png

  • Thanks 1
Link to comment
  • casperse changed the title to Upgrade from 6.9.2 -> 6.10.RC4 USB in VM problem
12 hours ago, casperse said:

Hi All

 

UPDATE: Known problem from 6.10.RC1 - still a problem in RC4

 

I took the plunge and upgraded to 6.10.rc4 and I am getting this in the logfile

(My hope was to get my UI up on my local monitor again if I upgraded, - This actually resolved the local UI is now working!) 

 

But the error I have after reboot is this:

kernel: usb 1-1: usbfs: process 17779 (qemu-system-x86) did not claim interface 1 before use

Its filling up and have been running since my reboot

 

I found that my Hassio VM - running Home assistant was the cause of this since its using the USB

After stopping this VM it stopped complaining about the USB

 

Apr 13 14:38:27 SERVER kernel: br0: port 2(vnet0) entered disabled state
Apr 13 14:38:27 SERVER kernel: device vnet0 left promiscuous mode
Apr 13 14:38:27 SERVER kernel: br0: port 2(vnet0) entered disabled state
Apr 13 14:38:27 SERVER avahi-daemon[15666]: Withdrawing address record for fe80::fc27:ebff:feb8:e5c9 on vnet0.
Apr 13 14:38:27 SERVER kernel: usb 1-11: reset full-speed USB device number 4 using xhci_hcd
Apr 13 14:38:27 SERVER kernel: cdc_acm 1-11:1.0: ttyACM0: USB ACM device
Apr 13 14:38:28 SERVER kernel: usb 1-1: reset full-speed USB device number 10 using xhci_hcd
Apr 13 14:38:28 SERVER kernel: cdc_acm 1-1:1.0: ttyACM1: USB ACM device
Apr 13 14:38:28 SERVER usb_manager: Info: rc.usb_manager  vm_action Hassio 1 stopped end -
Apr 13 14:38:28 SERVER usb_manager: Info: rc.usb_manager VM Shutdown dresden_elektronik_ingenieurtechnik_GmbH_ConBee_II_DE2421314 vm: Hassio 1 
Apr 13 14:38:28 > usb_manager: Info: rc.usb_manager VM Shutdown 0658_0200 vm: Hassio 1 

 

I am only using the USB manager plugin to control them in the VM (So I think thats the cause of the bug)

 

[Plugin] USB_Manager - Plugin Support - Unraid

 

 

I have included my diag. file here.

 

Diagnostics-20220413-1450.zip 306.19 kB · 0 downloads

Hi I am away at present but will look when back home around 23rd. Did you fix the issue?

Link to comment
  • 2 weeks later...
On 4/14/2022 at 12:59 PM, casperse said:

Yes thanks!

I had to do the XML changes to get the serial USB device added in the VM - and then the HA process above to change the Zigbee HA path and keeping the DB for all my existing devices 🙂 - so I am really happy to now be on 6.10.rc4 

Are you running on RC4 now? can provide output of cat /etc/libvirt/hooks/qemu and ls /etc/libvirt/hooks/qemu.d/

 

I think I am missing removal of the 6.9.2 vers updates during upgrade to 6.10 vers

 

Just checked should be removing.

Edited by SimonF
Link to comment
On 4/22/2022 at 4:59 PM, SimonF said:

Are you running on RC4 now? can provide output of cat /etc/libvirt/hooks/qemu and

 

On 4/22/2022 at 4:59 PM, SimonF said:

 

I think I am missing removal of the 6.9.2 vers updates during upgrade to 6.10 vers

 

Just checked should be removing.

Yes of course, anything to help

 

#!/usr/bin/env php

<?php
#begin USB_MANAGER
if ($argv[2] == 'prepare' || $argv[2] == 'stopped'){
  shell_exec("/usr/local/emhttp/plugins/usb_manager/scripts/rc.usb_manager vm_action '{$argv[1]}' {$argv[2]} {$argv[3]} {$argv[4]}  >/dev/null 2>&1 & disown") ;
}
#end USB_MANAGER
if (!isset($argv[2]) || $argv[2] != 'start') {
        exit(0);
}

$strXML = file_get_contents('php://stdin');

$doc = new DOMDocument();
$doc->loadXML($strXML);

$xpath = new DOMXpath($doc);

$args = $xpath->evaluate("//domain/*[name()='qemu:commandline']/*[name()='qemu:arg']/@value");

for ($i = 0; $i < $args->length; $i++){
        $arg_list = explode(',', $args->item($i)->nodeValue);

        if ($arg_list[0] !== 'vfio-pci') {
                continue;
        }

        foreach ($arg_list as $arg) {
                $keypair = explode('=', $arg);

                if ($keypair[0] == 'host' && !empty($keypair[1])) {
                        vfio_bind($keypair[1]);
                        break;
                }
        }
}

exit(0); // end of script



function vfio_bind($strPassthruDevice) {
        // Ensure we have leading 0000:
        $strPassthruDeviceShort = str_replace('0000:', '', $strPassthruDevice);
        $strPassthruDeviceLong = '0000:' . $strPassthruDeviceShort;

        // Determine the driver currently assigned to the device
        $strDriverSymlink = @readlink('/sys/bus/pci/devices/' . $strPassthruDeviceLong . '/driver');

        if ($strDriverSymlink !== false) {
                // Device is bound to a Driver already

                if (strpos($strDriverSymlink, 'vfio-pci') !== false) {
                        // Driver bound to vfio-pci already - nothing left to do for this device now regarding vfio
                        return true;
                }

                // Driver bound to some other driver - attempt to unbind driver
                if (file_put_contents('/sys/bus/pci/devices/' . $strPassthruDeviceLong . '/driver/unbind', $strPassthruDeviceLong) === false) {
                        file_put_contents('php://stderr', 'Failed to unbind device ' . $strPassthruDeviceShort . ' from current driver');
                        exit(1);
                        return false;
                }
        }

        // Get Vendor and Device IDs for the passthru device
        $strVendor = file_get_contents('/sys/bus/pci/devices/' . $strPassthruDeviceLong . '/vendor');
        $strDevice = file_get_contents('/sys/bus/pci/devices/' . $strPassthruDeviceLong . '/device');

        // Attempt to bind driver to vfio-pci
        if (file_put_contents('/sys/bus/pci/drivers/vfio-pci/new_id', $strVendor . ' ' . $strDevice) === false) {
                file_put_contents('php://stderr', 'Failed to bind device ' . $strPassthruDeviceShort . ' to vfio-pci driver');
                exit(1);
                return false;
        }

        return true;
}

 

could do the list
/bin/ls: cannot access '/etc/libvirt/hooks/qemu.d/': No such file or directory?

Link to comment
On 4/26/2022 at 6:36 PM, casperse said:

/bin/ls: cannot access '/etc/libvirt/hooks/qemu.d/': No such file or directory?

This is fine as you are not on 6.10rc.

 

When you upgrade the entries should be removed from the qemu file and a new file created in qemu.d

Link to comment
On 5/1/2022 at 2:04 PM, SimonF said:

This is fine as you are not on 6.10rc.

 

When you upgrade the entries should be removed from the qemu file and a new file created in qemu.d

I  was on RC4 I am now on RC5

Do you need anymore info or additional running commands from me? :--)

Link to comment
1 hour ago, casperse said:

I  was on RC4 I am now on RC5

Do you need anymore info or additional running commands from me? :--)

I dont think so. Are you seeing any issues? 

 

cat /etc/libvirt/hooks/qemu and ls /etc/libvirt/hooks/qemu.d/

 

There should be no entries in the qemu file and a file in qemu.d dir called usb_manager.

Link to comment
  • 2 weeks later...
  • 2 weeks later...

This is definitely still an issue -- currently reading through past threads after upgrading to 6.10.2 and being flooded with the following messages and an unusable ConBee II:

May 29 10:32:30 Unraid kernel: usb 2-1.4: usbfs: process 32050 (qemu-system-x86) did not claim interface 1 before use


Solution as posted in this thread (and others) was to obtain the proper device path for the ConBee II and manually add this in to the virtual machine XML as per https://community.home-assistant.io/t/unraid-vm-conbee-ii-stick-dev-path-change-configuration-problem/411424.

 

 

Edited by nmethod
Link to comment

I just tried upgrading to Unraid 6.10.2 but experiencing the same issue. Also with the USB Manager plugin. IMHO editing the XML for device mapping is quite a poor solution. I hope the Unraid developers can provide a real bug fix.

 

Luckily downgrading Unraid is a breeze, so thanks for that.

Link to comment
  • 2 weeks later...

I was able to find a solution that worked for me.

 

https://community.home-assistant.io/t/solved-conbee-2-fails-to-connect-to-zha-ha-in-unraid-vm/431276/2#final-edit-my-solution-1

 

The post is by maxistviews (marked as Solution)

 

Note:

You will need to remove and readd the the ZHA integration. During the initial configuration of ZHA the Conbee showed up as: /dev/serial/by-id/usb-QEMU_QEMU_USB_SERIAL.....

 

Link to comment
3 hours ago, fgy41 said:

I was able to find a solution that worked for me.

 

https://community.home-assistant.io/t/solved-conbee-2-fails-to-connect-to-zha-ha-in-unraid-vm/431276/2#final-edit-my-solution-1

 

The post is by maxistviews (marked as Solution)

 

Note:

You will need to remove and readd the the ZHA integration. During the initial configuration of ZHA the Conbee showed up as: /dev/serial/by-id/usb-QEMU_QEMU_USB_SERIAL.....

 

Do you still pass thru the usb device or just the serial entry.

Link to comment
2 minutes ago, SimonF said:

Do you still pass thru the usb device or just the serial entry.

This solution has so far worked for me as well, with just the serial entry.  I feel like going from 10.1 to 10.2 broke it again and I had to redo it and I was nervous going to 10.3, but it went smoothly.  I do wish just adding the usb device would work as expected (or as I expect it to), but I guess if the serial way works for now, I'll go with it.

  • Like 1
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.