Camera not working - mmal: mmal_vc_component_enable: failed to enable component: ENOSPC

I’ve installed a new camera on my Pi Zero and when I run raspistill I get an error?

Note; I have enable the camera using raspi-config.

pi@raspberrypi:~/Documents/projects/zeroborg $ raspistill -o output.jpg
mmal: mmal_vc_component_enable: failed to enable component: ENOSPC
mmal: camera component couldn’t be enabled
mmal: main: Failed to create camera component
mmal: Failed to run camera app. Please check for firmware updates

Shreyas

I did a firmware update and “raspistill -o output.jpg” is working now. (I did think firmware updates under Raspian were handle by the commands below

sudo apt-get update
sudo apt-get upgrade

I’ve done an explicit “sudo rpi-update” now and “raspistill -o output.jpg” works but when I try and run a video test I get an error as below:

pi@raspberrypi:~/Documents/projects/zeroborg $ python testcam.py
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))0xce6ee0 (ENOSPC)
mmal: mmal_connection_enable: output port couldn’t be enabled
Traceback (most recent call last):
_ File “testcam.py”, line 4, in _
_ camera = PiCamera()_
_ File “/usr/lib/python2.7/dist-packages/picamera/camera.py”, line 417, in init_
_ self.init_preview()
_ File “/usr/lib/python2.7/dist-packages/picamera/camera.py”, line 496, in init_preview
_ self, self.camera.outputs[self.CAMERA_PREVIEW_PORT])
_ File “/usr/lib/python2.7/dist-packages/picamera/renderers.py”, line 512, in init_
_ self.renderer.connect(source)_
_ File “/usr/lib/python2.7/dist-packages/picamera/mmalobj.py”, line 1467, in connect_
_ self.connection = MMALConnection(source, self.inputs[0])
_ File “/usr/lib/python2.7/dist-packages/picamera/mmalobj.py”, line 1280, in init_
_ prefix=“Failed to enable connection”)_
_ File “/usr/lib/python2.7/dist-packages/picamera/exc.py”, line 157, in mmal_check_
_ raise PiCameraMMALError(status, prefix)_
picamera.exc.PiCameraMMALError: Failed to enable connection: Out of resources (other than memory)

testcam.py
from picamera import PiCamera
from time import sleep

camera = PiCamera()

camera.start_preview()
sleep(10)
camera.stop_preview()

It might be your memory split, can you fire up the Raspberry Pi Configuration tool from the menu and see what’s set?

You can also use raspi-config at the terminal.

You shouldn’t ever need to do this, it subverts the normal upgrade process, installing pre-release software and can easily cause more problems than it solves.


  1. memory split is 64
  2. how do I roll back the sudo rpi-update so i’m back on the release branch?

Regards
Shreyas

1 Like

I’m also looking for an answer. Did you ever find out how to do this?

I’m probably too late, but it can’t hurt to have these instructions in as many places as possible.

If you’ve stuffed up your Pi with the insidious rpi-update utility, you can get yourself back on the rails with:

sudo apt-get update
sudo apt-get install --reinstall libraspberrypi0 libraspberrypi-{bin,dev,doc} raspberrypi-bootloader
sudo reboot
1 Like

I have same problem. How to fix this just use camera.close() only.

Hello brother, finally i can solve this problem after a lot of hours troubleshooting.

I already share it in my YouTube (https://youtu.be/on8UlkRvLok)

This problem only occur in camera raspberry pi V2.1 (IMX219) from Element14 . But in camera raspberry pi V2.1 from OKdo , i don’t get this error

So, the solution when error
“mmal: mmal_vc_component_enable: failed to enable component: ENOSPC
mmal: camera component couldn’t be enabled
mmal: main: Failed to create camera component
mmal: Failed to run camera app. Please check for firmware updates”

You need some initialization with a works camera (me camera from OKdo ).
So, the step is
1. Plug your works camera to Raspberry Pi (me using Raspberry Pi 4B)
2. Turn on your Raspberry Pi
3. check "

vcgencmd get_camera

to make sure your hardware is detected the camera
4. capture image using

raspistill -v

and camera will capture the image
5. Then replace the works camera with ENOSPC Error Camera (from Element14 )
6. then try to capture the image

raspistill -v

and the ENOSPC Error will not occur

Notes:

  • But, after the ENOSPC Error Camera works, and then you restart/shutdown the raspberry pi, the error will occur again :(

OS Raspberry Pi 4 Model B (4GB)

  • Linux raspberrypi 5.10.60-v7l+ #1449 SMP Wed Aug 25 15:00:44 BST 2021 armv7l GNU/Linux