VMmanager Knowledge Base
en En
es Es

Virtual machines with connected USB devices do not boot after the hypervisor reboot

Problem

Virtual machines (VMs) with connected USB devices do not start automatically after the hypervisor reboot. They can be started only after physically reconnecting the devices to the server USB ports.

Cause

The configuration uses a strict binding of the USB device to a specific device ID. For example, bus='1' device='6'. After a reboot or reconnection, the device gets a new identifier. Libvirt cannot find the device by the old ID and blocks the VM start.

Diagnostics

To confirm the cause:

  1. Connect to the target cluster node via SSH. For more information about SSH connection, see the article Workstation setup.
  2. Open the USB device configuration XML file that you created when attaching the device. For example, /opt/USB/usb_device.xml:
    cat /opt/USB/usb_device.xml
    Example output
    <source> <address bus='1' device='6'/> </source>
    In the example, the device is strictly bound to a specific device ID. This means that libvirt will look for the USB device with exactly this identifier.
  3. Reboot the cluster node or reconnect the USB device.
  4. Determine the current USB device parameters:
    lsusb
    Example output
    Bus 001 Device 003: ID 1234:5678 Some_USB_Device

    If the device ID identifiers do not match, this confirms the cause. In the example, after reboot the device received a new device ID (device='3'), while the configuration specifies device='6'.

Solution

To solve the issue, replace the binding by device ID with binding by vendor ID and product ID. These parameters remain unchanged after reboot:

  1. Connect to the target cluster node via SSH. For more information about SSH connection, see the article Workstation setup.
  2. Get the device vendor ID and product ID:
    lsusb
    Example output
    Bus 001 Device 003: ID 1234:5678 Some_USB_Device

    Command notes:

    • 1234 — Vendor ID;
    • 5678 — Product ID.
  3. Open the USB device configuration XML file in edit mode. For example, /opt/USB/usb_device.xml.
  4. Replace the block
    <source>
        <address bus='1' device='6'/>
    </source>

    with

    <source>
        <vendor id='0x1234'/>
        <product id='0x5678'/>
    </source>
  5. Determine the VM internal name:
    sudo virsh list --all

    In the output, find the line for the required VM. The internal name usually has the format ID VM_VM_name.

  6. Detach the device with the old configuration:
    virsh detach-device <vm_name> /opt/USB/usb_device.xml

    Command notes:

    • <vm_name> — the VM internal name.
  7. Attach the device with the new configuration:
    virsh attach-device <vm_name> /opt/USB/usb_device.xml --config --persistent

    Command notes:

    • <vm_name> — the VM internal name.
  8. Start the VM.
Useful tips