TorizonCore Container Problem

Hi Community,

I want to use Apalis with TorizonCore image for drive an USB Camera. I have already deployed an debian:2-bullseye image as a container. I had to install the driver with apt or dpkg so debian:2-bullseye was the most logical image for my project.

But then when i gave permissions (Runtime & Resources devices → dev/video0) the deployed and run the container using by portainer the container didn’t run. Always crashed.

I tried the

docker run -v /home/torizon:/torizon torizon/debian:$CT_TAG_DEBIAN ls -la /torizon

this command and container worked but the file system was “Read Only”.

root@apalis-imx6-05064237:/home# dpkg -i libimager-armhf.deb 
(Reading database ... 21498 files and directories currently installed.)
Preparing to unpack libimager-armhf.deb 
Unpacking libimager...
Setting up libimager...
Reloading udev rules ...
Failed to write 'change' to '/sys/devices/armv7_cortex_a9/uevent': Read-only file system

Then i read the article that:

docker run -d --rm --name=wayland-app --user=torizon \
             -v /dev:/dev -v /tmp:/tmp -v /sys:/sys \
             --device-cgroup-rule='c 226:* rmw' \
             torizon/weston:$CT_TAG_WESTON weston-terminal

I tried the install my dpkg package but it didn’t worked.

ERROR [UdevHelper.cpp:88] @ 0.0548469s :Try opening video device /dev/video11 ... failed
libusb: error [get_usbfs_fd] libusb couldn't open USB device /dev/bus/usb/001/006, errno=1
ERROR [IRDeviceUSB.cpp:79] @ 0.084949s :Cannot open USB Bulk device with serial 0
ERROR [IRImager.cpp:406] @ 1.59496s :udev device is NULL
Error: Image streams not available or wrongly configured. Check connection of camera and config file.

Could you please orient me?

Apalis iMX6D 1GB IT
Ixora v1.1A
TorizonCore Upstream 5.4.0+build.10

Greetings @erdemkahraman,

We have an article about a demo here that may be interesting: How to Execute Models Tuned by SageMaker Neo using DLR Runtime, Gstreamer and OpenCV on TorizonCore | Toradex Developer Center

The demo itself isn’t important what’s important is that the demo runs a container that uses a camera. Comparing your docker run statement to the one in the article I see one difference: --device-cgroup-rule='c 81:* rmw'

This argument adds a crgoup rule that can affect hardware permissions. I beleive “c 81” is the group for video capture devices. You can try adding this to your docker run command and see if it helps.

Another thing you can do is just add --privileged to your docker run command. This will add blanket permissions to that container, similar to sudo. Though it’s not recommended to run a container with such heightened privileges it can be useful to see if the issue is permission-related to begin with.

Best Regards,
Jeremias

Hi @jeremias.tx thanks for your reply.

I visited the link which you sent. I tried to run that docker command with

docker run -e ACCEPT_FSL_EULA=1 --rm -d --name=dlr-example --device-cgroup-rule='c 81:* rmw' -v /dev/galcore:/dev/galcore -v /run/udev/:/run/udev/ -v /sys:/sys -v /dev:/dev -v /tmp:/tmp --network host torizonextras/arm64v8-sample-dlr-gstreamer-vivante:${CT_TAG_WAYLAND_BASE_VIVANTE}

But my Apalis’s storage was not enough for this image.

Then i decided the use my old command with c 81.

docker run -d --rm --name=wayland-app --user=torizon \
             -v /dev:/dev -v /tmp:/tmp -v /sys:/sys \
             --device-cgroup-rule='c 81:* rmw' \
             torizon/weston:$CT_TAG_WESTON weston-terminal

I created a container with ur orient cgroup-rule=‘c 81:* rmw’. It looks ok for /dev/video0 but,

root@1fdbc5f09837:/home/share/doc/libirimager/examples/opengl/build# ./irimager_show c.xml 
libusb: error [get_usbfs_fd] libusb couldn't open USB device /dev/bus/usb/001/009, errno=1
ERROR [IRDeviceUSB.cpp:79] @ 0.202789s :Cannot open USB Bulk device with serial 0
Available optics for camera with serial 0

ERROR [IRImager.cpp:406] @ 1.71249s :udev device is NULL
Exiting application

I cannot open the usb device for now. What do you think about that error? Is there any cgroup-rule for USB?

also, one more thing,
during deb packet installation

Reloading udev rules ...
Failed to send reload request: No such file or directory

I get this error
I have checked and it’s related to this command

root@1fdbc5f09837:/home# udevadm control --reload-rules
Failed to send reload request: No such file or directory

First let’s back up a bit. What is your end goal here with the USB camera? Are you trying to capture images? Video stream? Or something else?

I did a quick test with this demo container here: GitHub - leograba/motion-docker: Docker images for https://motion-project.github.io/

This worked for my USB camera. So basic functionality for USB camera should work. Also I just realized you’ve been trying to access video0. Are you sure this corresponds to your USB camera? There’s multiple /dev/video* entries even with no camera attached.

Best Regards,
Jeremias