5

I am trying to build some machine vision software inside docker containers, it has worked previously, but now both devices are not able to access the camera.

It seems to be a configuration/update problem, as it has worked previously. I am not sure which of the updates could be the culprit.

Either calling "raspistill -i test.jpg" never returns (freeze) or this error appears:

mmal: mmal_vc_shm_init: could not initialize vc shared memory service
mmal: mmal_vc_component_create: failed to initialise shm for 'vc.camera_info' (7:EIO)
mmal: mmal_component_create_core: could not create component 'vc.camera_info' (7)
mmal: Failed to create camera_info component

As it has previously worked in the container, access to the device, and hardware-challenges are ruled out.

Any hints are appreciated.

2 Answers2

2

Looking at the error message, you probably don't have the correct permissions. Try adding privileged: true to your docker-compose.yml file (or something like --privileged=true if you are using docker run).

(I assume there was a typo when you posted your command. To test, it should be raspistill -o test.jpg.)

Mark Grimes
  • 121
  • 2
0

I found it's a problem with the udev rules. There's a file

/etc/udev/rules.d/99-com.rules

that seems to come with the os.

This file contains udev rules for the camera device so that even if you create a 99-camera.rules file it does not seem to apply. So what I did to solve the problem was just to add/modify these lines:

SUBSYSTEM=="vchiq", GROUP="video", MODE="0666"
KERNEL=="vcsm-cma", GROUP="video", MODE="0666"
SUBSYSTEM=="dma_heap", GROUP="video", MODE="0666"

Notice the MODE='0666', so you do not need to remove the group as some guides say.