I have been getting the error message below when attempting to use the Raspberry Pi camera

# raspistill -o /tmp/gate_now.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

In researching this, there are a number of reasons that can lead to an ENOSPC message, I thought I would create a question here to catalog the possible causes.

  • Are you also using it with a temperature sensor? I had encountered this issue anytime I ran the modprobe command when setting up the temp sensor. See github.com/raspberrypi/linux/issues/435
    – Anconia
    Commented Apr 4, 2014 at 15:34
  • Getting this issue also on OctoPi images: github.com/guysoft/OctoPi/issues/31
    – GuySoft
    Commented Aug 28, 2014 at 11:59
  • It's 2019, and cannot post a new answer (closed), but I had previously installed raspimjpeg which I was lucky enough to spot using 'ps -ef'. "sudo pkill raspimjpeg" then solved the problem. Commented Feb 17, 2019 at 13:37
  • 1
    I was running octopi which used up the camera. I fixed mine by running sudo service webcamd stop I then checked to see if pidof mjpg_streamer returned a process ID, which now does not. Ran raspstill -o test.jpg and it finally worked!
    – ruralcoder
    Commented Oct 30, 2020 at 5:00

12 Answers 12


I use motion on pi, if I want to run raspistill, I have to stop motion(which also using the camera to detect movement).

pi@raspberrypi ~ $ sudo /etc/init.d/motion stop
[ ok ] Stopping motion detection daemon: motion.
pi@raspberrypi ~ $ /usr/bin/raspistill -o cam2.jpg
pi@raspberrypi ~ $ sudo /etc/init.d/motion start
[ ok ] Starting motion detection daemon: motion.
  • While this might be an answer, it would definitely be improved by some elaboration.
    – Bex
    Commented Feb 13, 2015 at 11:22
  • It wasn't motion that I had running, but I did have another daemon using the camera, and when I stopped that I stopped getting the error.
    – IpsRich
    Commented Oct 31, 2018 at 15:26
  • Yes, the camera seems can only be controlled by one process.
    – schemacs
    Commented Nov 5, 2018 at 2:01

I had the same problem. Comparing it to a number of other posts, the most likely answer is that two processes/applications are trying to access the PiCam at the same time. This can be ffmpeg streaming, motion, raspivid, raspistill, etc.

My $0.02

  • true :)) lost some amount of time , I forgot that I installed motion process is on backend , preventing to access camera
    – soField
    Commented Aug 28, 2016 at 20:34
  • 3
    Or octoprint (as it was for me)
    – Saran
    Commented Feb 19, 2018 at 22:39
  • 1
    I was trying to run both raspivid and a python script that utilize picamera library. They can't run together
    – Dante
    Commented Sep 28, 2018 at 11:52
  • Thanks a lot I too was doing the same mistake but other posts helped me to update my firmware, dist packages etc. problem was still there until I did this sudo service motion stop. And camera started working again.
    – Amit Ray
    Commented Nov 4, 2018 at 10:10
  • 1
    Just offering my situation and solution as well. I had imported picamera in a python script, but it wasn't working so I decided to use raspistill from a command line call inside the script instead. I didn't remove import picamera so that was taking up the camera resource before I could use it with raspistill. Commented Nov 15, 2019 at 3:43

The GitHub project page for the camera software mentions

Error : ENOSPC displayed. Camera is probably running out of GPU memory. Check config.txt in the /boot/ folder. The gpu_mem option should be at least 128.

This issue states that this error can occur due to a conflict with the drivers for 1-Wire (W1) modules if the modules are not loaded in the right order.

This post on the RPi forums says the problem can be fixed by switching the pin used for 1-Wire to pin 18:

dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait bcm2708.w1_gpio_pin=18

As of may 2016, the GPU_MEM=128 is no longer enough. Increasing it from 128 to 144 made the error go away.

  • I think you mean gpu_mem, not gpio_mem. Commented Jan 4, 2018 at 23:31

"In normal circumstances there is NEVER a need to run rpi-update as it always gets you to the leading edge firmware and kernel and because that may be a testing version it could leave your RPi unbootable". https://www.raspberrypi.org/forums/viewtopic.php?p=916911#p916911 Even the rpi-update documentation now warns "Even on Raspbian you should only use this with a good reason. This gets you the latest bleeding edge kernel/firmware."

I had the same problem. A firmware update solved it.

sudo rpi-update
  • This solved it for me, and seemed necessary to make the Raspicam 2.1 work for me (I successfully used the Rapicam 1.3 before the update); the update upgraded me from 4.1.7-v7+ to 4.9.25-v7+, which made the newer model work. Changing from GPIO_MEM=128 to GPIO_MEM=144 was not necessary for me in this case.
    – nh2
    Commented May 3, 2017 at 14:20
  • Can't post as an answer because not enough rep. In my case, the standard raspberry pi camera was working but the high quality raspberry pi camera wasn't. This solved it for me. Hope it helps someone.
    – F Chopin
    Commented Oct 26, 2020 at 17:17

I recently experienced the same problem of an ENOSPEC error. In my case all things was running perfectly until I put my camera into a PiCam housing. I found this housing (even if desinged for the PiCamera) pushes the chip just as far that the connector between cam and board was loosened. Pushing it back in place solved my problem. Its maybe not that easy to see if the connector is properly in place which cause missinterpretation.

I guess this will not be the usual case but as the first post suggested this should enhance the cataloge of possible causes to this error.


I've tried with last RASPBIAN STRETCH LITE (9.4 - 2018-06-27) in a PI3B v1.2 with a PI CAMERA 2.1, all fully upgraded (apt-get upgrade)

If this command doesn't detect the camera with "detected=1" like this:

pi@raspberrypi:~ $ vcgencmd get_camera
supported=1 detected=1

Then there is a connection problem. Check if the cable both ways are with the good side to the pins (and of course connected to the "camera" bus, not the "display" bus that are the same size).

(of course, after enable camera interface with raspi-config and rebooting)

If it didn't work, usually it's a hardware problem with the camera and the quick option is to change the camera with a new one.

If detected=1 but when trying to use raspistill shows this message:

pi@raspberrypi:~ $ raspistill -o test.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

Then the connections are ok, but the problem for sure is a hardware problem with the camera and you have to change the camera for a new one. Don't waste time trying to solve it because it's a defective camera. If you get a new one it will work.

This is not fully correct. If the camera is detected=1 and supported=1 you will get the error, even if one other "holds" that resource. In my case I ran a docker image grabbing the cam. Inside the container it worked fine, outside (on the host) i got the error described.

  • 2
    Even then you cant say that camera is not working. I had all these issues and when I did live streaming using http://{my ip}:8081/?action=stream it was working. This means raspimjpeg was running. This most probably happens when you have one or more process already using the camera because detected=1 means at least it is able to contact with camera.
    – Amit Ray
    Commented Oct 10, 2019 at 15:41
  • I had this happen because I bought the wrong camera - an Arducam HQ camera meant for the Jetson Nano (B0251) instead of the Pi variant I wanted (B0262). It appears that there are driver-level things preventing a full connection. I have previously used a B0262 successfully, so I know it can work.
    – ArtHare
    Commented Mar 22, 2022 at 0:53

In my case it was merely that I hadn't rebooted my pi after attaching the camera.

  • 5
    Never attach a camera to the pi while it's powered! Commented Oct 2, 2019 at 12:17
  • @DmitryGrigoryev why? Commented Feb 14, 2023 at 6:05
  • @IsopycnalOscillation If some pads of the flex cable make contact before the ground/supply pads do, you may end up applying voltages on the camera pins with reverse polarity. Check out a USB connector: it has GND/VCC pads which are made longer to make contact before other pins do. A flex cable has no such protection. Commented Feb 20, 2023 at 15:03

I had the same error message because I had not updated the firmware (via sudo rpi-update) after enabling the camera via raspi-config. I had already updated the firmware a few days before and I thought it would suffice, but since the camera was not enabled back then, it did not help.


in my case, I had to use modprobe to unload the driver: sudo modprobe -r bcm2835-v4l2

Then the red LED on the camera is turned off, and I can use raspivid to re-enable the camera.


I got that error on my AIY Vision Kit (Pi Zero W) because I forgot to stop the camera demo app:

sudo systemctl stop joy_detection_demo

In my case I needed to reseat the cable on the camera. I had disconnected it to feed the cable through a case; it must not have made a good connection.

  • Mine was similar. In my case - after spending hours trying all of the above - and more, I discovered that my remotely mounted Pi had fallen off of its perch. In the process, the camera cable was dislodged (but the power supply was not). As such, I could still remotely access my Pi over WiFi, but had no visibility of its "situation". I only discovered the problem after powering off. When I went to power it back on I thought "where the heck has it gone?". Long story short - it turns out the CSI cable must be plugged in for the camera to work!
    – GMc
    Commented Jan 16, 2021 at 2:44

I solved mine by chmod 666 /dev/video0

Not the answer you're looking for? Browse other questions tagged or ask your own question.