A recent migrant from LXD to Incus here. Have been unsuccessful trying to share a USB device from Incus host to an instance & looking for help how to setup.
incus info --resources shows the specific device I want to allow access to from an instance
Device 2:
Vendor: Philips & Lite-ON Digital Solutions Corporation
Vendor ID: 1c6b
Product: Mass Storage Device
Product ID: a220
Bus Address: 3
Device Address: 20
What do I have to do on either the host or the instance to allow this?
p.s. forgot to mention both host and instance are running Ubuntu 24.04
I have a USB thumb drive passed to a VM. I configured this with a profile. Here is my device section:
devices:
eth0:
name: eth0
network: incusbr0
type: nic
root:
path: /
pool: nvme
type: disk
sandisk:
productid: "5581"
required: "false"
type: usb
vendorid: "0781"
I mount the USB drive manually from inside the VM.
sudo mount /dev/disk/by-uuid/6654-5002 /mnt/
So for this to work, I need to know the product ID, vendor ID, and the UUID of my drive. I am sure there are other ways of doing this and I think the process for system containers might be different.
It’s possible that the USB device is already in use at the time, and cannot be detached from the host. On a typical GUI on Linux, a USB storage device is connected/mounted/in-use, or disconnected/powered off. You would need to use a utility like gnome-disks to unmount the device but not power it off/disconnect it. Therefore, check whether your are affected by this issue.
Thanks. From what I can see, Incus handles instances (containers) differently to the way it handles Virtual Machines.
For example in my instances there is no /dev/disk path.
I have also tried creating a new udev rule on the instance, but that does not work either and when I run udevadm control --reload-rules and then udevadm trigger I get nothing but endless Permission denied messages, hence wondering if this is because of inherent permission restrictions for Incus instances restricting/tightly controlling instance access to host resources.
Yeah the terminology is very confusing at the moment as for example when I run incus list I have “CONTAINER” types and “VIRTUAL-MACHINE” types.
I found this page About instances - Incus documentation that unravels the terminology and explains that they refer to “instances” as three different types:
Systems Containers
Application containers
Virtual machines
Whereas I was thinking instances just referred to “Systems Containers”, so finally getting to understand the terminology.
I haven’t yet tried working with Incus and Docker, so not sure what “Type” would be displayed by incus list.
However, some good news with the problem at hand. Your clue about use of a profile was spot on and have made some progress adding the following to a profile file:
devices:
cdrom:
path: /dev/sr0
readonly: "true"
source: /dev/sr0
type: disk
I am still working on all the issues to get it fully working the way I would like, and still experimenting with host permissions on /dev/sr0 as well as mount/umount requirements, as early testing seems to indicate that non-intuitively, the block device needs to be mounted on the host before it can be mounted in a container.