• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
USB Device not plugged in during boot
#1
I am using the hilschernetpi/netpi-nodered:latest.

In advanced container settings I have at Runtime&Resources
Privileg Mode
host /dev/ttyACM0 and container /dev/ttyACM0
I use this for a barcode scanner.

It works fine, but when I don't connect the scanner during boot then  the container wouldn't start. When I try to start the container it comes up with:

Failure linux runtime spec devices: error gathering device information while adding custom device "/dev/ttyACM0": no such file or directory

When I connect the scanner later then I can start it.
How can I get the container to start even when the barcode scanner is not connected?
  Reply
#2
Well in general the Docker engine makes a snapshot of all the USB devices plugged in at the time a container is started and makes them then available in the container. But Docker engine never do this again during runtime of a containers. This means if you unplug a USB device it will never be mapped again into the container.

I described this behaviour in this thread a while ago: https://forum.hilscher.com/thread-439.html
Others are describring this problem too e.g. https://forums.balena.io/t/docker-contai...vices/4277

On an open OS like Raspbian you could write a script (rules) that detects a fresh plugged in USB on the Linux Host and trigger a restart the corresponding container. But this is not possible on netPI since you can't access the netPI OS cause of its security restrictions.

So if you need this feature you need to operate netPI with a standard Raspbian OS on your own SD card. Please keep the original SD card just for future use.

Thx
Armin
You never fail until you stop trying.“, Albert Einstein (1879 - 1955)

  Reply
#3
It’s not the problem of not mapping it. It’s the problem that without the device it doesn’t start.
  Reply
#4
OK understood.

With netPI OS the Docker is more secure than a standard Docker engine and loses some of its properties and its dynamic. The socalled "privileged" mode under netPI OS does not automatically map all "/dev/..." devices into a container like a standard Docker would do it. So with netPI OS you have to specificially map all the devices you need in the container manually with the "add device" feature (as you did it correctly). But in this case all the devices you mapped need to be present at the time the container starts because the Docker engine checks them during the start time. If a device is not present then the engine does not start the container. Under standard Docker you just have to enable the priviledge mode without mapping specific devices and Docker makes no verifications during the start of a container.

Also for this problem I may have the only answer for you: use Raspbian OS and install a standard Docker on top of it, portainer web UI and then you containers. Then the priviledge mode works as you need it and is completely "open" and maps all your present host devices into a container dynamically. But on the other hand the priviledge mode "opens" much more and a container runs as it would be installed natively on the host and gets full access to the host Linux. This is the drawback of using the standard privileged mode of standard Docker.

Thx
Armin
You never fail until you stop trying.“, Albert Einstein (1879 - 1955)

  Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  netPI core as serial device server MGharat 1 374 June-16th-2021, 07:55 AM
Last Post: Armin@netPI
  USB Enumareted Device List IBeRyUS 5 1,910 October-22nd-2019, 12:57 PM
Last Post: Armin@netPI

Forum Jump:


Users browsing this thread: 1 Guest(s)