I am trying to automount USB devices inside a torizon/arm64v8-debian-base Docker container. So far, I have been struggling to even manually mount usb devices. Binding the /devdirectory:
docker run -it --rm -v /dev:/dev torizon/arm64v8-debian-base
mount /dev/sda .
Results in mount: /: permission denied.. I have to start the container with --privileged flag to make manually mounting work. Next, I tried to install udev for automounting. This results in:
The group `input' already exists and is not a system group. Exiting.
I assume your end goal here is to install udev in a container and then create some kind of udev rule to perform the auto-mount? (Correct me if I’m wrong)
As a suggestion perhaps it would be easier to create a udev rule to auto-mount your USB device on the base TorizonCore system (outside of the container). Then from there you could bind-mount whatever directory you mounted the USB to, inside the container.
Unless there is a specific reason you want to auto-mount in the container itself?
Thanks for the response. What I was actually trying to achieve, was to install udiskie to handle automounting, and udev is a dependency for udiskie and udisks2. I am not familiar with udev at all so this would have simplified the process for me.
We are developing a prototype device to be used by customers and the idea would be to offer easy and simple updates for these devices. The reason I wanted to keep everything within a Docker container was to simplify the whole update process by just updating a container if we want to deliver a new version of udiskie, for example. Additionally, the container has the apt package manager for installing udiskie.
If there is no other way, I may then need to get more familiar with udev, and handle things at host OS level.
I guess I have some further questions I might have that would help narrow down a solution.
Are there any other features of udiskie that you require or is it just the auto-mounting of USB drives that you need?
During the use of your product will USB drives be removed and inserted through it’s use or is it just one time at the start?
Either way though I think it’d be best to handle the mounting of the USB drives outside of the container. Though it probably is still possible from within the container if the situation truly requires it.
During normal use, users may insert and remove USB drives anytime.
I was already able to implement a simple udev rule to automount USB drives and that is probably good enough for us. I am still new to Toradex and Torizon, so the only thing to consider is how to deliver and apply updates to files outside the container in a simple and predictable way. I am sure this is possible, so handling mounting outside the container seems like the right way to go.