Webcam Randomly Stops Working

Camera model
Logitech, Inc. Webcam C310

What is the problem?
Webcam randomly stops working within OctoPrint & RasPi altogether until reboot. Worked fine before switched to Raspberry Pi 4 (brand new build and setup from scratch - not even a restore from backup). Based on other similar posts I've read on this forum, it seems it may be related to specifically RasPi4s.

What did you already try to solve it?

  • Known good webcam. Used with prior OctoPrint server (RasPi3) without issue.
  • Executing "vcgencmd get_camera" during issue returns:

supported=1 detected=0

  • Executing "lsusb" shows the webcam attached during issue & returns:

Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 006: ID 1a86:7523 QinHeng Electronics HL-340 USB-Serial adapter
Bus 001 Device 005: ID 046d:081b Logitech, Inc. Webcam C310
Bus 001 Device 002: ID 2109:3431 VIA Labs, Inc. Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

  • Executing "raspistill -o test.jpg" during issue returns:

mmal: Cannot read camera info, keeping the defaults for OV5647
mmal: mmal_vc_component_create: failed to create component '' (1:ENOMEM)
mmal: mmal_component_create_core: could not create component '' (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

  • Updated all dist & standard packages + reboot

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

  • Despite webcam initially working, there is no /var/log/webcamd.log

  • Searched all logs within /var/log for "webcam" and found the below results within both the syslog & daemon logs at about the time I expect the camera stopped working

Feb 26 00:00:06 knoctopi webcamd[337]: Unable to dequeue buffer: No such device
Feb 26 00:00:06 knoctopi webcamd[337]: i: Error grabbing frames
Feb 26 00:00:06 knoctopi webcamd[337]: i: cleaning up resources allocated by input thread
Feb 26 00:00:06 knoctopi webcamd[337]: Unable to stop capture: No such device

  • Have attached zip of octoprint.log + all logs from /var/log (1.5 MB) (272.0 KB)

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

  • Hardware: Raspberry Pi 4 (1gb RAM)
  • OS: Raspbian GNU/Linux 10 (buster)
  • Kernel: Linux knoctopi 4.19.97-v7l+ #1294 SMP Thu Jan 30 13:21:14 GMT 2020 armv7l GNU/Linux
  • Octoprint: 1.3.12
  • Webcam: Logitech, Inc. Webcam C310 (USB connected to USB 2.0 port)
  • Network: Ethernet (Static IP)
  • SD:: Class 10 / Plenty of free space
  • Display: 3.5" Touch LCD (TouchUI) / HTTP / SSH
  • Power: Official RasPi4 power adapter / No undervoltage warnings
  • Plugins: (All up to date)

Action Command Prompt Support
Announcement Plugin
Anonymous Usage Tracking
Application Keys Plugin
Autoscroll (0.0.2)
Backup & Restore
Bed Visualizer (0.1.11)
BetterHeaterTimeout (1.2.0)
BLTouch Plugin (0.3.3)
Core Wizard
Dashboard (1.11.1)
DeleteAfterPrint Plugin (1.7.0)
DisplayLayerProgress Plugin (1.18.0)
Error Tracking
Filament Manager (0.5.3)
FileManager (0.1.3)
Simple FileManager
Force Login
OctoPod Plugin (0.2.4)
OctoPod extension for OctoPrint
OctoPrint-IFTTT (1.2.1)
Connects OctoPrint events to IFTTT
Pi Support Plugin
Plugin Manager
Preheat Button (0.4.1)
Printer Safety Check
PrintJobHistory (1.0.0rc5)
Pushover (0.3.3)
Resource Monitor (0.2.1)
Sidebar Webcam (0.1.7)
Software Update
Tab Order (0.5.5)
Themeify (1.2.0)
Ultimaker Format Package (0.1.2)
Virtual Printer
Wemo Switch (0.1.5)

Any suggestions are appreciated and happy to test or submit additional info. Thanks!

Does it work in safe mode?

Thanks for the reply...

Are you asking if the webcam works in Safe Mode or that the issue occurs in Safe Mode? In middle of print now so can't check, but the webcam works fine on boot - it just randomly stops working during jobs. If thinking that it may be due to a plugin conflict (assuming that Safe Mode basically disables plugins), the plugins I use + their configuration is exactly the same as they were when I used it on the RasPi3 (when I didn't have the issue.)


We're just trying to find out if one of your plugins (on the Pi4B) is causing this or if it's naked-OctoPrint causing this or if it's the OctoPi-imaged mjpg_streamer that's causing this. The first step is to disable all plugins by running in safe mode.

Assuming that it still periodically fails then we're left with the latter two. If it's not the third-party plugins and it's not OctoPrint then we're left with mjpg_streamer, the driver stack, the hardware itself to include power-related issues and the connections to the camera.

Remember that you had to disconnect the camera from the Pi 3B rig to put it on the Pi 4B. It could be as simple as the ribbon cable connection is vibrating itself loose.

USB webcam :wink:

Which is also why the raspistill test did absolutely nothing to confirm or deny functionality as that only works with a raspicam (AND won't work of said camera is already claimed by the webcam server, which is usually the case).

Same goes for vcgencmd btw - that's for the raspicam and does nothing for usb.

Could be that the camera just is wonky, I had similar issues with a Microsoft Lifecam back in the day. Next time it happens try if restarting the webcam server does the trick:

sudo service webcamd restart

The log entries from webcamd certainly sounds like the camera device simply vanished suddenly. Share /var/log/webcamd.log

Edit oh wait, is that a self install? Or OctoPi?

Thanks, Guys -

In middle of long print now, so will try once done. Don't know if related, but set up TouchUI yesterday which obviously requires installation of many additional packages. Since then, the camera is still working after 12 hours which is longer than it has before. BTW, the build was from the OctoPrint 0.17.0 image - not a custom build.