geerlingguy/pi-timelapse

Getting error "could not open vchiq service"

geerlingguy opened this issue · 8 comments

On the latest version of Raspbian/pi-camera/etc.:

mmalipc: mmal_vc_init_fd: could not open vchiq service
mmal: mmal_vc_component_create: failed to initialise mmal ipc for 'vc.camera_info' (7:EIO)
mmal: mmal_component_create_core: could not create component 'vc.camera_info' (7)
Exception in thread Thread-2:
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
    self.run()
  File "/usr/lib/python2.7/threading.py", line 1073, in run
    self.function(*self.args, **self.kwargs)
  File "timelapse.py", line 66, in capture_image
    camera = PiCamera()
  File "/usr/lib/python2.7/dist-packages/picamera/camera.py", line 367, in __init__
    with mo.MMALCameraInfo() as camera_info:
  File "/usr/lib/python2.7/dist-packages/picamera/mmalobj.py", line 2346, in __init__
    super(MMALCameraInfo, self).__init__()
  File "/usr/lib/python2.7/dist-packages/picamera/mmalobj.py", line 633, in __init__
    prefix="Failed to create MMAL component %s" % self.component_type)
  File "/usr/lib/python2.7/dist-packages/picamera/exc.py", line 184, in mmal_check
    raise PiCameraMMALError(status, prefix)
PiCameraMMALError: Failed to create MMAL component vc.camera_info: I/O error

From this SE answer.

sudo usermod -a -G video $(whoami)

Might work, but seems odd to have to be added to the video group to be able to access the camera. This wasn't the case before :-/

I just tried running sudo apt-get update && sudo apt-get upgrade, found that both raspberrypi-bootloader and raspberrypi-kernel needed updates. So after the upgrade was finished, I did a sudo reboot and logged back in.

That didn't fix the issue. Trying the usermod trick to add myself to video.

Nope, still getting the PiCameraMMALError: Failed to create MMAL component vc.camera_info: I/O error.

Aha! I had set the GPU memory split to 16 MB RAM instead of keeping the default 64 MB split. Now that I set that value back to 64 using sudo raspi-config, I am getting a new error:

PiCameraError: Camera is not enabled. Try running 'sudo raspi-config' and ensure that the camera has been enabled.

This one's a bit easier. Run sudo raspi-config, then go to 'Interfacing Options', then 'Camera', and enable it:

screen shot 2018-09-19 at 9 33 01 pm

Also got the following today:

mmal: mmal_vc_port_enable: failed to enable port vc.null_sink:in:0(OPQV): ENOSPC
mmal: mmal_port_enable: failed to enable connected port (vc.null_sink:in:0(OPQV))0xb56067f0 (ENOSPC)
mmal: mmal_connection_enable: output port couldn't be enabled
Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
    self.run()
  File "/usr/lib/python2.7/threading.py", line 1073, in run
    self.function(*self.args, **self.kwargs)
  File "timelapse.py", line 66, in capture_image
    camera = PiCamera()
  File "/usr/lib/python2.7/dist-packages/picamera/camera.py", line 433, in __init__
    self._init_preview()
  File "/usr/lib/python2.7/dist-packages/picamera/camera.py", line 513, in _init_preview
    self, self._camera.outputs[self.CAMERA_PREVIEW_PORT])
  File "/usr/lib/python2.7/dist-packages/picamera/renderers.py", line 558, in __init__
    self.renderer.inputs[0].connect(source).enable()
  File "/usr/lib/python2.7/dist-packages/picamera/mmalobj.py", line 2212, in enable
    prefix="Failed to enable connection")
  File "/usr/lib/python2.7/dist-packages/picamera/exc.py", line 184, in mmal_check
    raise PiCameraMMALError(status, prefix)
PiCameraMMALError: Failed to enable connection: Out of resources

I'm running on Debian/Raspbian Buster now, though, maybe it's something in the version I downloaded... trying a sudo apt-get update && sudo apt-get upgrade -y now.

In my case it was not a software issue at all. I set the interval to 2 seconds for the timelapse... and apparently the hardware couldn't keep up on the Pi Zero W for more than two or three shots. On a faster Pi maybe, but the Zero would not do it. I changed the interval to 3 and it was mostly okay, then 5 and it had no problems at all.