Raspi cam stopped working

Camera model
Raspi cam v2.1

What is the problem?
After I updated OctoPrint and/or a sudo apt update && sudo apt upgrade, the camera doesn't work anymore. no streaming, no snapshots or whatsoever

What did you already try to solve it?
FIrst I tested with raspistill -o testshot.jpg if the camera still worked. It did. Then I read somewhere here that the OS could be out of sync with OctoPrint, which could be the reason why it wasn't working in OctoPrint anymore. So I resflashed the SD card latest available image from Raspberry Pi imager. So now I'm on Octopi 1.0.0 and Octoprint 1.8.7.

When I now try to shoot a test picture with raspistill I get the following:

mmal: Cannot read camera info, keeping the defaults for OV5647
mmal: mmal_vc_component_create: failed to create component 'vc.ril.camera' (1:ENOMEM)
mmal: mmal_component_create_core: could not create component 'vc.ril.camera' (1)
mmal: Failed to create camera component
mmal: main: Failed to create camera component
mmal: Camera is not detected. Please check carefully the camera module is installed correctly

testing with libcamera-still results in the following:

libcamera-still -n -e png -o test.png
[0:28:21.522750115] [2000]  INFO Camera camera_manager.cpp:299 libcamera v0.0.4+22-923f5d70
ERROR: *** no cameras available ***

I had to fumble a bit with the pi to get the SD card in and out, so I made sure the ribboncable was still properly seated.

Changed octopi.txt a few times to forced use all of the found video devices (see below in webcamd.log), and restarted webcamd but none worked. I got 2 different errors though in Webcamd.log

Logs (/var/log/webcamd.log, syslog, dmesg, ... no logs, no support)
webcamd.log:

Starting up webcamDaemon...

--- Configuration: ----------------------------
cfg_file:      /boot/octopi.txt
camera:        auto
usb options:   -r 1280x720 -fps 10
raspi options: -fps 10
http options:  -w ./www

Explicitly set USB device:
-----------------------------------------------

Found video devices:
/dev/video10
/dev/video11
/dev/video12
/dev/video13
/dev/video14
/dev/video15
/dev/video16
/dev/video18
/dev/video20
/dev/video21
/dev/video22
/dev/video23
/dev/video31
config file='/boot/octopi.txt':USB device was not set in options, starting MJPG-streamer with the first found video device: /dev/video10
<13>May 17 23:18:12 root: Starting USB webcam
Checking for VL805 (Raspberry Pi 4)...
  - It seems that you don't have VL805 (Raspberry Pi 4).
    There should be no problems with USB (a.k.a. select() timeout)
Running ./mjpg_streamer -o output_http.so -w ./www  -i input_uvc.so -r 1280x720 -fps 10 -d /dev/video10
MJPG Streamer Version.: 2.0
 i: Using V4L2 device.: /dev/video10
 i: Desired Resolution: 1280 x 720
 i: Frames Per Second.: 10
 i: Format............: JPEG
 i: TV-Norm...........: DEFAULT
Error opening device /dev/video10: video capture not supported.
Init v4L2 failed !! exit fatal
 i: init_VideoIn failed
Done bringing up all configured video devices
Scanning again in two minutes

other error in webcamd.log

Starting up webcamDaemon...

--- Configuration: ----------------------------
cfg_file:      /boot/octopi.txt
camera:        auto
usb options:   -r 1280x720 -fps 10 -d /dev/video14
raspi options: -fps 10
http options:  -w ./www

Explicitly set USB device: /dev/video14
-----------------------------------------------

Found video devices:
/dev/video10
/dev/video11
/dev/video12
/dev/video13
/dev/video14
/dev/video15
/dev/video16
/dev/video18
/dev/video20
/dev/video21
/dev/video22
/dev/video23
/dev/video31
config file='/boot/octopi.txt':USB device was set in options and found in devices, starting MJPG-streamer with the configured USB video device: /dev/video14
<13>May 17 23:30:52 root: Starting USB webcam
Checking for VL805 (Raspberry Pi 4)...
  - It seems that you don't have VL805 (Raspberry Pi 4).
    There should be no problems with USB (a.k.a. select() timeout)
Running ./mjpg_streamer -o output_http.so -w ./www  -i input_uvc.so -r 1280x720 -fps 10 -d /dev/video14
MJPG Streamer Version.: 2.0
 i: Using V4L2 device.: /dev/video14
 i: Desired Resolution: 1280 x 720
 i: Frames Per Second.: 10
 i: Format............: JPEG
 i: TV-Norm...........: DEFAULT
 i: Could not obtain the requested pixelformat: MJPG , driver gave us: YUYV
    ... will try to handle this by checking against supported formats.
    ... Falling back to YUV mode (consider using -yuv option). Note that this requires much more CPU power
Unable to query that the FPS change is supported
: Inappropriate ioctl for device
UVCIOC_CTRL_ADD - Error at Pan (relative): Inappropriate ioctl for device (25)
UVCIOC_CTRL_ADD - Error at Tilt (relative): Inappropriate ioctl for device (25)
UVCIOC_CTRL_ADD - Error at Pan Reset: Inappropriate ioctl for device (25)
UVCIOC_CTRL_ADD - Error at Tilt Reset: Inappropriate ioctl for device (25)
UVCIOC_CTRL_ADD - Error at Pan/tilt Reset: Inappropriate ioctl for device (25)
UVCIOC_CTRL_ADD - Error at Focus (absolute): Inappropriate ioctl for device (25)
UVCIOC_CTRL_MAP - Error at Pan (relative): Inappropriate ioctl for device (25)
UVCIOC_CTRL_MAP - Error at Tilt (relative): Inappropriate ioctl for device (25)
UVCIOC_CTRL_MAP - Error at Pan Reset: Inappropriate ioctl for device (25)
UVCIOC_CTRL_MAP - Error at Tilt Reset: Inappropriate ioctl for device (25)
UVCIOC_CTRL_MAP - Error at Pan/tilt Reset: Inappropriate ioctl for device (25)
UVCIOC_CTRL_MAP - Error at Focus (absolute): Inappropriate ioctl for device (25)
UVCIOC_CTRL_MAP - Error at LED1 Mode: Inappropriate ioctl for device (25)
UVCIOC_CTRL_MAP - Error at LED1 Frequency: Inappropriate ioctl for device (25)
UVCIOC_CTRL_MAP - Error at Disable video processing: Inappropriate ioctl for device (25)
UVCIOC_CTRL_MAP - Error at Raw bits per pixel: Inappropriate ioctl for device (25)
 o: www-folder-path......: ./www/
 o: HTTP TCP port........: 8080
 o: HTTP Listen Address..: (null)
 o: username:password....: disabled
 o: commands.............: enabled
Done bringing up all configured video devices
 i: select() timeout
 i: cleaning up resources allocated by input thread
/root/bin/webcamd: line 103: kill: (1726) - No such process

Goodbye...

Additional information about your setup (OctoPrint version, OctoPi version, ...)
OctoPi 1.0.0 and OctoPrint 1.8.7

** New Info **
I updated boot/config.txt. commented start_x=1 out and added camera_auto_detect=1
and then rebooted.
When I then run libcamera-hello --list-cameras, I get No cameras available!

Run sudo raspi-config and enable legacy camera

Thank you for your suggestion!

I just did that and then rebooted the pi.
this is what I got afterwards:

username@octopi:~ $ vcgencmd get_camera
supported=1 detected=0, libcamera interfaces=0
username@octopi:~ $ libcamera-hello --list-cameras
No cameras available!

Then I did a cat /boot/config.txt and noticed that start_x=1 was added again and camera_auto_detect=1 was commented. So the raspi-config tool reversed the manual changes I did before.

so unfortunately, your suggestion didn't help.

Did some further testing, to see if all the hardware is OK.

I have another Pi lying around. I flashed a vanilla Pi OS image to a SD-card and connected the camera to it.

First I enabled legacy camera support, rebooted and installed Picamera2 on it.
When I ran the mjpeg_server example, it told me to disable the legacy camera, so I went back to raspi-config, disabled legacy camera support and reboot the Pi.
Then ran the mjpeg_server example again, and the camer worked fine.
So I ruled out (camera)hardware failure.

One thing is solved: It turned out that the ribbon cable I used in my octoprint setup was defective. I've replaced it since and now the camera is detected by libcamera. However, still nothing too see when using webcamd.

Since I messed around a lot with the octopi image, I reflashed the SD card and started from scratch.
Here's what I changed in config.txt:

# Checked if set correctly 230519
camera_auto_detect=0

# Added 230519
dtoverlay=imx219

# disabled 230519
# start_x=1

Then rebooted. When I stop the webcamd service, I can make a picture with libcamera-still -n -e png -o test.png So the camera is working on this pi, with this image.
However, when I (re)start webcamd, with an untouched octopi.txt, I stille won't get an image in octoprint.

here's the logging output:

username@octopi:~ $ sudo systemctl restart webcamd && journalctl -fu webcamd.service
-- Journal begins at Thu 2022-09-22 02:23:40 CEST. --
May 19 14:12:39 octopi mjpg_streamer[1322]: MJPG-streamer [1322]: commands.............: disabled
May 19 14:12:39 octopi mjpg_streamer[1322]: MJPG-streamer [1322]: starting input plugin input_uvc.so
May 19 14:12:39 octopi mjpg_streamer[1322]: MJPG-streamer [1322]: starting output plugin: output_http.so (ID: 00)
May 19 14:12:39 octopi mjpg_streamer[1322]: MJPG-streamer [1322]: Can't enable video in first time
May 19 14:12:39 octopi mjpg_streamer[1322]: MJPG-streamer [1322]: cleaning up resources allocated by input thread
May 19 14:21:32 octopi systemd[1]: Stopping the OctoPi webcam daemon with the user specified config...
May 19 14:21:32 octopi systemd[1]: webcamd.service: Killing process 1350 (mjpg_streamer) with signal SIGKILL.
May 19 14:21:32 octopi systemd[1]: webcamd.service: Succeeded.
May 19 14:21:32 octopi systemd[1]: Stopped the OctoPi webcam daemon with the user specified config.
May 19 14:21:32 octopi systemd[1]: Started the OctoPi webcam daemon with the user specified config.
May 19 14:21:32 octopi root[1479]: Starting USB webcam
May 19 14:21:32 octopi mjpg_streamer[1480]: MJPG-streamer [1480]: starting application
May 19 14:21:32 octopi mjpg_streamer[1480]: MJPG-streamer [1480]: MJPG Streamer Version.: 2.0
May 19 14:21:32 octopi mjpg_streamer[1480]: MJPG-streamer [1480]: Using V4L2 device.: /dev/video0
May 19 14:21:32 octopi mjpg_streamer[1480]: MJPG-streamer [1480]: Desired Resolution: 640 x 480
May 19 14:21:32 octopi mjpg_streamer[1480]: MJPG-streamer [1480]: Frames Per Second.: 10
May 19 14:21:32 octopi mjpg_streamer[1480]: MJPG-streamer [1480]: Format............: JPEG
May 19 14:21:32 octopi mjpg_streamer[1480]: MJPG-streamer [1480]: TV-Norm...........: DEFAULT
May 19 14:21:33 octopi mjpg_streamer[1480]: MJPG-streamer [1480]: www-folder-path......: ./www-octopi/
May 19 14:21:33 octopi mjpg_streamer[1480]: MJPG-streamer [1480]: HTTP TCP port........: 8080
May 19 14:21:33 octopi mjpg_streamer[1480]: MJPG-streamer [1480]: HTTP Listen Address..: 127.0.0.1
May 19 14:21:33 octopi mjpg_streamer[1480]: MJPG-streamer [1480]: username:password....: disabled
May 19 14:21:33 octopi mjpg_streamer[1480]: MJPG-streamer [1480]: commands.............: disabled
May 19 14:21:33 octopi mjpg_streamer[1480]: MJPG-streamer [1480]: starting input plugin input_uvc.so
May 19 14:21:33 octopi mjpg_streamer[1480]: MJPG-streamer [1480]: starting output plugin: output_http.so (ID: 00)
May 19 14:21:33 octopi mjpg_streamer[1480]: MJPG-streamer [1480]: Can't enable video in first time
May 19 14:21:33 octopi mjpg_streamer[1480]: MJPG-streamer [1480]: cleaning up resources allocated by input thread
Starting up webcamDaemon...

--- Configuration: ----------------------------
cfg_file:      /boot/octopi.txt
camera:        auto
usb options:   -r 640x480 -f 10
raspi options: -fps 10
http options:  -w ./www-octopi -n --listen 127.0.0.1

Explicitly set USB device:
-----------------------------------------------

Found video devices:
/dev/video0
/dev/video1
/dev/video10
/dev/video11
/dev/video12
/dev/video13
/dev/video14
/dev/video15
/dev/video16
/dev/video18
/dev/video20
/dev/video21
/dev/video22
/dev/video23
/dev/video31
config file='/boot/octopi.txt':USB device was not set in options, starting MJPG-streamer with the first found video device: /dev/video0
<13>May 19 14:21:32 root: Starting USB webcam
Checking for VL805 (Raspberry Pi 4)...
  - It seems that you don't have VL805 (Raspberry Pi 4).
    There should be no problems with USB (a.k.a. select() timeout)
Running ./mjpg_streamer -o output_http.so -w ./www-octopi -n --listen 127.0.0.1 -i input_uvc.so -r 640x480 -f 10 -d /dev/video0
MJPG Streamer Version.: 2.0
 i: Using V4L2 device.: /dev/video0
 i: Desired Resolution: 640 x 480
 i: Frames Per Second.: 10
 i: Format............: JPEG
 i: TV-Norm...........: DEFAULT
 i: Could not obtain the requested pixelformat: MJPG , driver gave us: YUYV
    ... will try to handle this by checking against supported formats.
    ... Falling back to YUV mode (consider using -yuv option). Note that this requires much more CPU power
Unable to query that the FPS change is supported
: Inappropriate ioctl for device
UVCIOC_CTRL_ADD - Error at Pan (relative): Inappropriate ioctl for device (25)
UVCIOC_CTRL_ADD - Error at Tilt (relative): Inappropriate ioctl for device (25)
UVCIOC_CTRL_ADD - Error at Pan Reset: Inappropriate ioctl for device (25)
UVCIOC_CTRL_ADD - Error at Tilt Reset: Inappropriate ioctl for device (25)
UVCIOC_CTRL_ADD - Error at Pan/tilt Reset: Inappropriate ioctl for device (25)
UVCIOC_CTRL_ADD - Error at Focus (absolute): Inappropriate ioctl for device (25)
UVCIOC_CTRL_MAP - Error at Pan (relative): Inappropriate ioctl for device (25)
UVCIOC_CTRL_MAP - Error at Tilt (relative): Inappropriate ioctl for device (25)
UVCIOC_CTRL_MAP - Error at Pan Reset: Inappropriate ioctl for device (25)
UVCIOC_CTRL_MAP - Error at Tilt Reset: Inappropriate ioctl for device (25)
UVCIOC_CTRL_MAP - Error at Pan/tilt Reset: Inappropriate ioctl for device (25)
UVCIOC_CTRL_MAP - Error at Focus (absolute): Inappropriate ioctl for device (25)
UVCIOC_CTRL_MAP - Error at LED1 Mode: Inappropriate ioctl for device (25)
UVCIOC_CTRL_MAP - Error at LED1 Frequency: Inappropriate ioctl for device (25)
UVCIOC_CTRL_MAP - Error at Disable video processing: Inappropriate ioctl for device (25)
UVCIOC_CTRL_MAP - Error at Raw bits per pixel: Inappropriate ioctl for device (25)
 o: www-folder-path......: ./www-octopi/
 o: HTTP TCP port........: 8080
 o: HTTP Listen Address..: 127.0.0.1
 o: username:password....: disabled
 o: commands.............: disabled
libv4l2: error turning on stream: Invalid argument
Unable to start capture: Invalid argument
 i: Can't enable video in first time
 i: cleaning up resources allocated by input thread
Done bringing up all configured video devices

I'm still puzzled why it doesn't work :frowning:
octoprint-systeminfo-20230519143119.zip (53.8 KB)
octoprint-logs.zip (31.2 KB)

Finally got it working again using the latest pre release of OctoPi-UpToDate and camera-streamer.

2 Likes