Type: usb

Note

The usb device type is supported for both containers and VMs. It supports hotplugging for both containers and VMs.

USB devices make the specified USB device appear in the instance. For performance issues, avoid using devices that require high throughput or low latency.

For containers, only libusb devices (at /dev/bus/usb) are passed to the instance. This method works for devices that have user-space drivers. For devices that require dedicated kernel drivers, use a unix-char device or a unix-hotplug device instead.

For virtual machines, the entire USB device is passed through, so any USB device is supported. When a device is passed to the instance, it vanishes from the host.

Device options

usb devices have the following device options:

busnum

The bus number of which the USB device is attached

Key: busnum
Type:

int

devnum

The device number of the USB device

Key: devnum
Type:

int

gid

GID of the device owner in the container

Key: gid
Type:

integer

Default:

0

Condition:

container

mode

Mode of the device in the container

Key: mode
Type:

integer

Default:

0660

Condition:

container

productid

Product ID of the USB device

Key: productid
Type:

string

required

Whether this device is required to start the instance

Key: required
Type:

bool

Default:

false

The default is false, which means that all devices can be hotplugged.

serial

The serial number of the USB device

Key: serial
Type:

string

uid

UID of the device owner in the container

Key: uid
Type:

integer

Default:

0

Condition:

container

vendorid

Vendor ID of the USB device

Key: vendorid
Type:

string

Configuration examples

Add a usb device to an instance by specifying its vendor ID and product ID:

lxc config device add <instance_name> <device_name> usb vendorid=<vendor_ID> productid=<product_ID>

To determine the vendor ID and product ID, you can use lsusb, for example.

See Configure devices for more information.