Device in /dev does not appear on reboot

hi @hgaiser1 what I believe happens is that the container only has a snapshot of the devices available in the hostOS at container startup time - so when the /dev/hailo0 device appears in the hostOS after the driver load, the copy of the devices in the containers is not updated.

If you only need hotplug support, you can make your container replace tmpfs at /dev with a devtmpfs by running a privileged (or at least CAP_SYS_ADMIN) container and doing the following on its startup script:

#!/bin/sh
newdev='/tmp/dev'
mkdir -p "$newdev"
mount -t devtmpfs none "$newdev"
mount --move /dev/console "$newdev/console"
mount --move /dev/mqueue "$newdev/mqueue"
mount --move /dev/pts "$newdev/pts"
mount --move /dev/shm "$newdev/shm"
umount /dev
mount --move "$newdev" /dev
ln -sf /dev/pts/ptmx /dev/ptmx

Be aware that enabling hotplugging of devices might be a security risk as the kernel might just enable HID like keyboards that can be used to exploit the system. I would explore maybe having a one-off service that loads the driver and then does not run again, and then have a lower privileged container start after using a dependency, like an inotify event.

Let us know if that works for you.

2 Likes