VM nimmt sich ungewollt USB-Device bei Start


Go to solution Solved by SimonF,

Recommended Posts

Hallo,

ich habe einen ZigBee-USB-Stick.

Diesen hatte ich testweise in einer VM, nutze ihn aber jetzt im Docker (Zigbee2MQTT).

 

Obwohl in den Eigenschaften der VM den Stick nicht mehr aktiviert habe, "nimmt" sich die VM bei jedem Neustart wieder den Stick und der Docker funktionniert nicht mehr.

Muss dann immer manuell auf "VM detach" klicken.

Jmd eine Idee, wie ich den Stick dauerhaft dem Docker zuweisen kann?

Bzw. was muss ich tun, damit nicht die VM bei jedem Neustart sich das Stick "nimmt"?

 

Danke euch.

 

Gruß Thomas

Bildschirmfoto 2022-02-20 um 15.40.50.jpeg

Bildschirmfoto 2022-02-21 um 21.08.48.png

Link to comment
27 minutes ago, jeuser said:

Bzw. was muss ich tun, damit nicht die VM bei jedem Neustart sich das Stick "nimmt"?

 

schau mal in deiner VM config im xml mode, sollte ganz unten der passende Eintrag sein, in der Art wie

 

    <hostdev mode='subsystem' type='usb' managed='no'>
      <source>
        <vendor id='0x10c4'/>
        <product id='0xe60'/>
      </source>
      <address type='usb' bus='0' port='2'/>
    </hostdev>

 

und diesen komplett entfernen, dann sollte das erledigt sein ...

  • Thanks 1
Link to comment

Hallo,

 

solch einen Eintrag gibt es nicht, aber könnte es evtl. hierwas von sein und wenn ja, woher weiß ich denn, welchen Eintrag ich da nehmen müsste?

 

Danke und Gruß

 

   <controller type='usb' index='0' model='ich9-ehci1'>
      <alias name='usb'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' 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='0x07' 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='0x07' 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='0x07' function='0x2'/>
    </controller>

 

Link to comment

Hallo,

sorry, wußte nicht das das relevant sein könnte, sonst hätte ich das natürlich direkt geschrieben, mea culpa. 🙂

Anbei auch noch ein Screenshot von den Einstellungen des Plugins

 

Als Unraid 6.9.2 und das Plugin heißt "USB Manager" aktuelle Version 2022.3.13

 

Danke!!

 

Bildschirmfoto 2022-03-17 um 07.23.01.png

Link to comment
4 hours ago, jeuser said:

und das Plugin heißt "USB Manager" aktuelle Version 2022.3.13

 

wird wohl sicher daran liegen, da gibt es sicherlich noch mehr Einstellungen (schau mal in den settings von dem plugin zu den USB Devices etc ...)

 

@SimonF may a hint where to set previous attached devices to not reattach on VM Start ? looks like a previous device always gets reattached as soon his VM starts.

Link to comment
22 hours ago, jeuser said:

Hallo,

ich habe einen ZigBee-USB-Stick.

Diesen hatte ich testweise in einer VM, nutze ihn aber jetzt im Docker (Zigbee2MQTT).

 

Obwohl in den Eigenschaften der VM den Stick nicht mehr aktiviert habe, "nimmt" sich die VM bei jedem Neustart wieder den Stick und der Docker funktionniert nicht mehr.

Muss dann immer manuell auf "VM detach" klicken.

Jmd eine Idee, wie ich den Stick dauerhaft dem Docker zuweisen kann?

Bzw. was muss ich tun, damit nicht die VM bei jedem Neustart sich das Stick "nimmt"?

 

Danke euch.

 

Gruß Thomas

Bildschirmfoto 2022-02-20 um 15.40.50.jpeg

Bildschirmfoto 2022-02-21 um 21.08.48.png

Connected outside means not connected by my plugin.

 

Do you have any historical devices?

 

like image.thumb.png.69a6bcfcb373858a954b79af9143e238.png

Link to comment

Hi @SimonF thanks for your support.

 

I now updated to Unraid 6.10.0-rc3.

I try to explain the issue in english.

In the past the marked device was attached to a VM. Now I attached the device to a Docker.

But everytime when I restart the VM (for making backups) the VM "grabs" the device and the docker will stop.

 

Here are some screenshots. It would be great when you can have a look on it. Perhaps you have an hint or idea what I can try.

 

Thanks in advance.

 

Thomas

 

 

Bildschirmfoto 2022-03-17 um 16.26.00.png

Bildschirmfoto 2022-03-17 um 16.08.14.png

Bildschirmfoto 2022-03-17 um 16.08.31.png

Link to comment

My plugin is not mapping as far as I can see, and I believe that you do not have defined in VM Template. You should be able to remove my plugin to confirm you still have the issue.

 

are you able to post results for 

 

virsh dumpxml "VM Name"

Edited by SimonF
  • Like 1
Link to comment

@SimonF seems that you're right. I deinstalled your plugin but still have the same behaviour.

 

Here's the output:

 

root@Tower:~# virsh dumpxml "loxberry"
<domain type='kvm' id='5'>
  <name>loxberry</name>
  <uuid>b04d98f6-826b-0cf2-1054-255882d7c9ec</uuid>
  <metadata>
    <vmtemplate xmlns="unraid" name="Debian" icon="debian.png" os="debian"/>
  </metadata>
  <memory unit='KiB'>2097152</memory>
  <currentMemory unit='KiB'>2097152</currentMemory>
  <memoryBacking>
    <nosharepages/>
  </memoryBacking>
  <vcpu placement='static'>1</vcpu>
  <cputune>
    <vcpupin vcpu='0' cpuset='0'/>
  </cputune>
  <resource>
    <partition>/machine</partition>
  </resource>
  <os>
    <type arch='x86_64' machine='pc-q35-5.1'>hvm</type>
  </os>
  <features>
    <acpi/>
    <apic/>
  </features>
  <cpu mode='host-passthrough' check='none' migratable='on'>
    <topology sockets='1' dies='1' cores='1' threads='1'/>
    <cache mode='passthrough'/>
  </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>
  <devices>
    <emulator>/usr/local/sbin/qemu</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw' cache='writeback'/>
      <source file='/mnt/cache/domains/loxberry/loxberry-disc.img' index='1'/>
      <backingStore/>
      <target dev='hdc' bus='virtio'/>
      <boot order='1'/>
      <alias name='virtio-disk2'/>
      <address type='pci' domain='0x0000' bus='0x03' slot='0x00' function='0x0'/>
    </disk>
    <controller type='pci' index='0' model='pcie-root'>
      <alias name='pcie.0'/>
    </controller>
    <controller type='pci' index='1' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='1' port='0x10'/>
      <alias name='pci.1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0' multifunction='on'/>
    </controller>
    <controller type='pci' index='2' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='2' port='0x11'/>
      <alias name='pci.2'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x1'/>
    </controller>
    <controller type='pci' index='3' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='3' port='0x12'/>
      <alias name='pci.3'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x2'/>
    </controller>
    <controller type='pci' index='4' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='4' port='0x13'/>
      <alias name='pci.4'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x3'/>
    </controller>
    <controller type='pci' index='5' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='5' port='0x14'/>
      <alias name='pci.5'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x4'/>
    </controller>
    <controller type='virtio-serial' index='0'>
      <alias name='virtio-serial0'/>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x00' function='0x0'/>
    </controller>
    <controller type='sata' index='0'>
      <alias name='ide'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x1f' function='0x2'/>
    </controller>
    <controller type='usb' index='0' model='ich9-ehci1'>
      <alias name='usb'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' 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='0x07' 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='0x07' 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='0x07' function='0x2'/>
    </controller>
    <interface type='bridge'>
      <mac address='52:54:00:15:af:fe'/>
      <source bridge='br0'/>
      <target dev='vnet4'/>
      <model type='virtio-net'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
    </interface>
    <serial type='pty'>
      <source path='/dev/pts/2'/>
      <target type='isa-serial' port='0'>
        <model name='isa-serial'/>
      </target>
      <alias name='serial0'/>
    </serial>
    <console type='pty' tty='/dev/pts/2'>
      <source path='/dev/pts/2'/>
      <target type='serial' port='0'/>
      <alias name='serial0'/>
    </console>
    <channel type='unix'>
      <source mode='bind' path='/var/lib/libvirt/qemu/channel/target/domain-5-loxberry/org.qemu.guest_agent.0'/>
      <target type='virtio' name='org.qemu.guest_agent.0' state='connected'/>
      <alias name='channel0'/>
      <address type='virtio-serial' controller='0' bus='0' port='1'/>
    </channel>
    <input type='tablet' bus='usb'>
      <alias name='input0'/>
      <address type='usb' bus='0' port='1'/>
    </input>
    <input type='mouse' bus='ps2'>
      <alias name='input1'/>
    </input>
    <input type='keyboard' bus='ps2'>
      <alias name='input2'/>
    </input>
    <graphics type='vnc' port='5902' autoport='yes' websocket='5702' listen='0.0.0.0' keymap='de'>
      <listen type='address' address='0.0.0.0'/>
    </graphics>
    <audio id='1' type='none'/>
    <video>
      <model type='qxl' ram='65536' vram='65536' vgamem='16384' heads='1' primary='yes'/>
      <alias name='video0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
    </video>
    <hostdev mode='subsystem' type='usb' managed='no'>
      <source>
        <vendor id='0x10c4'/>
        <product id='0xea60'/>
        <address bus='1' device='3'/>
      </source>
      <alias name='hostdev0'/>
      <address type='usb' bus='0' port='2'/>
    </hostdev>
    <memballoon model='virtio'>
      <alias name='balloon0'/>
      <address type='pci' domain='0x0000' bus='0x04' slot='0x00' function='0x0'/>
    </memballoon>
  </devices>
  <seclabel type='dynamic' model='dac' relabel='yes'>
    <label>+0:+100</label>
    <imagelabel>+0:+100</imagelabel>
  </seclabel>
</domain>

 

Link to comment
  • Solution

Edit XML in VM Manager and remove

 

    <hostdev mode='subsystem' type='usb' managed='no'>
      <source>
        <vendor id='0x10c4'/>
        <product id='0xea60'/>
        <address bus='1' device='3'/>
      </source>
      <alias name='hostdev0'/>
      <address type='usb' bus='0' port='2'/>
    </hostdev>

 

  • Like 1
  • Thanks 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.