Webcam not working after upgrading

I have a Logitech QuickCam Pro 9000, on a Raspberry Pi 3B+, which was running fine - probably until I started to update/upgrade it, but I had been monitoring tabs other than with the webcam stream.

I noticed the camera had stopped working, with one error being "It might not be configured correctly or require authentication."

This particular setup has been running for about 6 months with no issue (call this OctoPi-A). I have just set up my second 3D printer with Octoprint within the last week with a fresh download of the SD card image (call this OctoPi-B) - so I can compare the two.

The OctoPi-B has been configured identically to the OctoP-A, with the only differences being the machine name and IP address (as well as a different colour scheme in Themify plugin). I have updated Octoprint and logged in via SSH, running "sudo apt update" and "sudo apt upgrade" on both and rebooting so they should be the same.

Hardware-wise the only difference is the webcam - OctoPi A running the Logitech QuickCam Pro 9000 (USB ID 046d:0990) and OctoPi B running a Logitech HD Pro Webcam C920 (USB ID 046d:082d). Unfortunately, I did not swap them to see if the error moved from one machine to the other!

Having looked around and come across editing /boot/octopi.txt (which gave me options but did not fix the problem) as well as other possible solutions I found the following:

  1. Accessing OctoPi A by name, octopi.local, IP address or otherwise, with or without http:// or https:// results in the same problem - suggestions elsewhere regarding this can then be ignored and you can jump onto other testing.
  2. On OctoPi A, the command "ps -ax|grep mjpg" came back wrong (I don't have a copy of that unfortunately) - after fixing it now shows something including " ./mjpg_streamer -o output_http.so -w ./www-octopi -n -i input_uvc.so -r 1920x1080 -f 5 -d /dev/video0" which is better - I assume this just means it is up and running OK.
  3. After other tests the webcamd.service appeared to be the problem. The following is the commands and output:
login as: pi
pi@OctoPi-A's password:
Linux OctoPi-A 5.4.72-v7+ #1356 SMP Thu Oct 22 13:56:54 BST 2020 armv7l

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Mon Nov  9 09:23:48 2020 from 192.168.0.235

------------------------------------------------------------------------------
Access OctoPrint from a web browser on your network by navigating to any of:

    http://OctoPi-A.local
    http://192.168.0.185

https is also available, with a self-signed certificate.
------------------------------------------------------------------------------
This image comes without a desktop environment installed because it's not
required for running OctoPrint. If you want a desktop environment you can
install it via

    sudo /home/pi/scripts/install-desktop
------------------------------------------------------------------------------
OctoPrint version : 1.4.2
OctoPi version    : 0.17.0
------------------------------------------------------------------------------

pi@OctoPi-A:~ $ sudo service webcamd status
● webcamd.service - the OctoPi webcam daemon with the user specified config
   Loaded: loaded (/etc/systemd/system/webcamd.service; enabled; vendor preset: enabled)
   Active: active (running) since Mon 2020-11-09 10:06:11 GMT; 2min 15s ago
  Process: 335 ExecStart=/root/bin/webcamd (code=exited, status=0/SUCCESS)
 Main PID: 443 (mjpg_streamer)
    Tasks: 3 (limit: 1939)
   CGroup: /system.slice/webcamd.service
           └─443 ./mjpg_streamer -o output_http.so -w ./www-octopi -n -i input_uvc.so -r 1920x1080 -f 5 -d /dev/video0

Nov 09 10:06:11 OctoPi-A mjpg_streamer[443]: MJPG-streamer [443]: commands.............: disabled
Nov 09 10:06:11 OctoPi-A mjpg_streamer[443]: MJPG-streamer [443]: starting input plugin input_uvc.so
Nov 09 10:06:11 OctoPi-A mjpg_streamer[443]: MJPG-streamer [443]: starting output plugin: output_http.so (ID: 00)
Nov 09 10:06:11 OctoPi-A webcamd[335]: Done bring up all configured video device
Nov 09 10:06:11 OctoPi-A webcamd[335]: Goodbye...
Nov 09 10:06:11 OctoPi-A systemd[1]: Started the OctoPi webcam daemon with the user specified config.
Nov 09 10:06:16 OctoPi-A webcamd[335]:  i: select() timeout
Nov 09 10:06:16 OctoPi-A webcamd[335]:  i: cleaning up resources allocated by input thread
Nov 09 10:06:16 OctoPi-A mjpg_streamer[443]: MJPG-streamer [443]: select() timeout
Nov 09 10:06:16 OctoPi-A mjpg_streamer[443]: MJPG-streamer [443]: cleaning up resources allocated by input thread
pi@OctoPi-A:~ $ sudo service webcamd restart
pi@OctoPi-A:~ $ sudo service webcamd status
● webcamd.service - the OctoPi webcam daemon with the user specified config
   Loaded: loaded (/etc/systemd/system/webcamd.service; enabled; vendor preset: enabled)
   Active: activating (start) since Mon 2020-11-09 10:08:45 GMT; 948ms ago
Cntrl PID: 885 (webcamd)
    Tasks: 2 (limit: 1939)
   CGroup: /system.slice/webcamd.service
           ├─885 /bin/bash /root/bin/webcamd
           └─910 sleep 1

Nov 09 10:08:45 OctoPi-A webcamd[885]:  i: TV-Norm...........: DEFAULT
Nov 09 10:08:45 OctoPi-A mjpg_streamer[909]: MJPG-streamer [909]: Using V4L2 device.: /dev/video0
Nov 09 10:08:45 OctoPi-A mjpg_streamer[909]: MJPG-streamer [909]: Desired Resolution: 1920 x 1080
Nov 09 10:08:45 OctoPi-A webcamd[885]: Unable to set format: 1196444237 res: 1920x1080
Nov 09 10:08:45 OctoPi-A webcamd[885]: Init v4L2 failed !! exit fatal
Nov 09 10:08:45 OctoPi-A webcamd[885]:  i: init_VideoIn failed
Nov 09 10:08:45 OctoPi-A mjpg_streamer[909]: MJPG-streamer [909]: Frames Per Second.: 5
Nov 09 10:08:45 OctoPi-A mjpg_streamer[909]: MJPG-streamer [909]: Format............: JPEG
Nov 09 10:08:45 OctoPi-A mjpg_streamer[909]: MJPG-streamer [909]: TV-Norm...........: DEFAULT
Nov 09 10:08:45 OctoPi-A mjpg_streamer[909]: MJPG-streamer [909]: init_VideoIn failed
pi@OctoPi-A:~ $ sudo service webcamd restart
pi@OctoPi-A:~ $ sudo service webcamd status
● webcamd.service - the OctoPi webcam daemon with the user specified config
   Loaded: loaded (/etc/systemd/system/webcamd.service; enabled; vendor preset: enabled)
   Active: activating (start) since Mon 2020-11-09 10:09:15 GMT; 670ms ago
Cntrl PID: 1031 (webcamd)
    Tasks: 2 (limit: 1939)
   CGroup: /system.slice/webcamd.service
           ├─1031 /bin/bash /root/bin/webcamd
           └─1056 sleep 1

Nov 09 10:09:15 OctoPi-A webcamd[1031]:  i: Frames Per Second.: 5
Nov 09 10:09:15 OctoPi-A mjpg_streamer[1055]: MJPG-streamer [1055]: Frames Per Second.: 5
Nov 09 10:09:15 OctoPi-A webcamd[1031]:  i: Format............: JPEG
Nov 09 10:09:15 OctoPi-A mjpg_streamer[1055]: MJPG-streamer [1055]: Format............: JPEG
Nov 09 10:09:15 OctoPi-A webcamd[1031]:  i: TV-Norm...........: DEFAULT
Nov 09 10:09:15 OctoPi-A mjpg_streamer[1055]: MJPG-streamer [1055]: TV-Norm...........: DEFAULT
Nov 09 10:09:15 OctoPi-A webcamd[1031]: Error opening device /dev/video10: video capture not supported.
Nov 09 10:09:15 OctoPi-A webcamd[1031]: Init v4L2 failed !! exit fatal
Nov 09 10:09:15 OctoPi-A webcamd[1031]:  i: init_VideoIn failed
Nov 09 10:09:15 OctoPi-A mjpg_streamer[1055]: MJPG-streamer [1055]: init_VideoIn failed
pi@OctoPi-A:~ $ sudo service webcamd restart
pi@OctoPi-A:~ $ sudo service webcamd status
● webcamd.service - the OctoPi webcam daemon with the user specified config
   Loaded: loaded (/etc/systemd/system/webcamd.service; enabled; vendor preset: enabled)
   Active: active (running) since Mon 2020-11-09 10:09:33 GMT; 1s ago
  Process: 1137 ExecStart=/root/bin/webcamd (code=exited, status=0/SUCCESS)
 Main PID: 1161 (mjpg_streamer)
    Tasks: 3 (limit: 1939)
   CGroup: /system.slice/webcamd.service
           └─1161 ./mjpg_streamer -o output_http.so -w ./www-octopi -n -i input_uvc.so -r 1920x1080 -f 5 -d /dev/video0

Nov 09 10:09:32 OctoPi-A mjpg_streamer[1161]: MJPG-streamer [1161]: www-folder-path......: ./www-octopi/
Nov 09 10:09:32 OctoPi-A mjpg_streamer[1161]: MJPG-streamer [1161]: HTTP TCP port........: 8080
Nov 09 10:09:32 OctoPi-A mjpg_streamer[1161]: MJPG-streamer [1161]: HTTP Listen Address..: (null)
Nov 09 10:09:32 OctoPi-A mjpg_streamer[1161]: MJPG-streamer [1161]: username:password....: disabled
Nov 09 10:09:32 OctoPi-A mjpg_streamer[1161]: MJPG-streamer [1161]: commands.............: disabled
Nov 09 10:09:32 OctoPi-A mjpg_streamer[1161]: MJPG-streamer [1161]: starting input plugin input_uvc.so
Nov 09 10:09:32 OctoPi-A mjpg_streamer[1161]: MJPG-streamer [1161]: starting output plugin: output_http.so (ID: 00)
Nov 09 10:09:33 OctoPi-A webcamd[1137]: Done bring up all configured video device
Nov 09 10:09:33 OctoPi-A webcamd[1137]: Goodbye...
Nov 09 10:09:33 OctoPi-A systemd[1]: Started the OctoPi webcam daemon with the user specified config.
pi@OctoPi-A:~ $ lsusb
Bus 001 Device 005: ID 1eaf:0004
Bus 001 Device 011: ID 046d:0990 Logitech, Inc. QuickCam Pro 9000
Bus 001 Device 006: ID 0424:7800 Standard Microsystems Corp.
Bus 001 Device 003: ID 0424:2514 Standard Microsystems Corp. USB 2.0 Hub
Bus 001 Device 002: ID 0424:2514 Standard Microsystems Corp. USB 2.0 Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
pi@OctoPi-A:~ $

What you have is webcamd.service, or related code (mjpg_streamer in particular) is not working properly, restarting webcamd.service a number of times fixes it (eventually and temporarily). Note the webcam is now Device 011 even though it has not been changed/unplugged.

I rebooted and tested again. It did not work immediately so the fix above does not work across reboots. You can tell it is working once you see the HTTP TCP port 8080 in the service status response. You can also see that the webcam remained as Device 004 throughout.

login as: pi
pi@OctoPi-A's password:
Linux OctoPi-A 5.4.72-v7+ #1356 SMP Thu Oct 22 13:56:54 BST 2020 armv7l

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Mon Nov  9 10:08:15 2020 from 192.168.0.235

------------------------------------------------------------------------------
Access OctoPrint from a web browser on your network by navigating to any of:

    http://OctoPi-A.local
    http://192.168.0.185

https is also available, with a self-signed certificate.
------------------------------------------------------------------------------
This image comes without a desktop environment installed because it's not
required for running OctoPrint. If you want a desktop environment you can
install it via

    sudo /home/pi/scripts/install-desktop
------------------------------------------------------------------------------
OctoPrint version : 1.4.2
OctoPi version    : 0.17.0
------------------------------------------------------------------------------

pi@OctoPi-A:~ $ lsusb
Bus 001 Device 005: ID 1eaf:0004
Bus 001 Device 004: ID 046d:0990 Logitech, Inc. QuickCam Pro 9000
Bus 001 Device 006: ID 0424:7800 Standard Microsystems Corp.
Bus 001 Device 003: ID 0424:2514 Standard Microsystems Corp. USB 2.0 Hub
Bus 001 Device 002: ID 0424:2514 Standard Microsystems Corp. USB 2.0 Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
pi@OctoPi-A:~ $ sudo service webcamd status
● webcamd.service - the OctoPi webcam daemon with the user specified config
   Loaded: loaded (/etc/systemd/system/webcamd.service; enabled; vendor preset: enabled)
   Active: active (running) since Mon 2020-11-09 10:11:45 GMT; 1min 3s ago
  Process: 331 ExecStart=/root/bin/webcamd (code=exited, status=0/SUCCESS)
 Main PID: 448 (mjpg_streamer)
    Tasks: 2 (limit: 1939)
   CGroup: /system.slice/webcamd.service
           └─448 ./mjpg_streamer -o output_http.so -w ./www-octopi -n -i input_uvc.so -r 1920x1080 -f 5 -d /dev/video0

Nov 09 10:11:45 OctoPi-A mjpg_streamer[448]: MJPG-streamer [448]: commands.............: disabled
Nov 09 10:11:45 OctoPi-A mjpg_streamer[448]: MJPG-streamer [448]: starting input plugin input_uvc.so
Nov 09 10:11:45 OctoPi-A mjpg_streamer[448]: MJPG-streamer [448]: starting output plugin: output_http.so (ID: 00)
Nov 09 10:11:45 OctoPi-A webcamd[331]: Done bring up all configured video device
Nov 09 10:11:45 OctoPi-A webcamd[331]: Goodbye...
Nov 09 10:11:45 OctoPi-A systemd[1]: Started the OctoPi webcam daemon with the user specified config.
Nov 09 10:11:50 OctoPi-A webcamd[331]:  i: select() timeout
Nov 09 10:11:50 OctoPi-A webcamd[331]:  i: cleaning up resources allocated by input thread
Nov 09 10:11:50 OctoPi-A mjpg_streamer[448]: MJPG-streamer [448]: select() timeout
Nov 09 10:11:50 OctoPi-A mjpg_streamer[448]: MJPG-streamer [448]: cleaning up resources allocated by input thread
pi@OctoPi-A:~ $ lsusb
Bus 001 Device 005: ID 1eaf:0004
Bus 001 Device 004: ID 046d:0990 Logitech, Inc. QuickCam Pro 9000
Bus 001 Device 006: ID 0424:7800 Standard Microsystems Corp.
Bus 001 Device 003: ID 0424:2514 Standard Microsystems Corp. USB 2.0 Hub
Bus 001 Device 002: ID 0424:2514 Standard Microsystems Corp. USB 2.0 Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
pi@OctoPi-A:~ $ sudo service webcamd restart
pi@OctoPi-A:~ $ lsusb
Bus 001 Device 005: ID 1eaf:0004
Bus 001 Device 004: ID 046d:0990 Logitech, Inc. QuickCam Pro 9000
Bus 001 Device 006: ID 0424:7800 Standard Microsystems Corp.
Bus 001 Device 003: ID 0424:2514 Standard Microsystems Corp. USB 2.0 Hub
Bus 001 Device 002: ID 0424:2514 Standard Microsystems Corp. USB 2.0 Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
pi@OctoPi-A:~ $ sudo service webcamd status
● webcamd.service - the OctoPi webcam daemon with the user specified config
   Loaded: loaded (/etc/systemd/system/webcamd.service; enabled; vendor preset: enabled)
   Active: active (running) since Mon 2020-11-09 10:13:10 GMT; 11s ago
  Process: 825 ExecStart=/root/bin/webcamd (code=exited, status=0/SUCCESS)
 Main PID: 849 (mjpg_streamer)
    Tasks: 3 (limit: 1939)
   CGroup: /system.slice/webcamd.service
           └─849 ./mjpg_streamer -o output_http.so -w ./www-octopi -n -i input_uvc.so -r 1920x1080 -f 5 -d /dev/video0

Nov 09 10:13:09 OctoPi-A mjpg_streamer[849]: MJPG-streamer [849]: www-folder-path......: ./www-octopi/
Nov 09 10:13:09 OctoPi-A mjpg_streamer[849]: MJPG-streamer [849]: HTTP TCP port........: 8080
Nov 09 10:13:09 OctoPi-A mjpg_streamer[849]: MJPG-streamer [849]: HTTP Listen Address..: (null)
Nov 09 10:13:09 OctoPi-A mjpg_streamer[849]: MJPG-streamer [849]: username:password....: disabled
Nov 09 10:13:09 OctoPi-A mjpg_streamer[849]: MJPG-streamer [849]: commands.............: disabled
Nov 09 10:13:09 OctoPi-A mjpg_streamer[849]: MJPG-streamer [849]: starting input plugin input_uvc.so
Nov 09 10:13:09 OctoPi-A mjpg_streamer[849]: MJPG-streamer [849]: starting output plugin: output_http.so (ID: 00)
Nov 09 10:13:10 OctoPi-A webcamd[825]: Done bring up all configured video device
Nov 09 10:13:10 OctoPi-A webcamd[825]: Goodbye...
Nov 09 10:13:10 OctoPi-A systemd[1]: Started the OctoPi webcam daemon with the user specified config.
pi@OctoPi-A:~ $

Obviously a permanent fix would be preferable. However, in the meantime you can create a cron job that executes the restart for webcamd.service, or if someone can script something that checks the status and restarts it, testing again and repeating, 3 times after a delay each time.

Hope this helps people.

Update: Seems to be holding/working after another restart and no cron jobs. Also, upgraded to Python3 (which shouldn't have had any effect, I doubt if it touched any related files but maybe the upgrade did something???).

No, it doesn't hold every time after updating.
I have just had to start another print, but I will check again and see if I can remember how to do a cron job and/or appropriate scripts - unless someone else can help?
I assume there will need to be a test, after a possible delay, to see if webcamd.service is in an error state, restart the service, then repeat if necessary.

Thanks for spreading the knowledge!

I had these errors and thought it was due to an apt-get upgrade. I eventually found that the my raspi camera board has two connectors: the ribbon cable and the camera press-on connector. I was putting my camera in a case that always knocked the press-on connector loose. When I hot glued the press-on connector, the webcamd always finds the camera correctly.

The red LED light on the camera was very helpful. If it wasn't lit, the webcamd service would not capture video.

I just upgraded to version 1.5.0 The webcam no longer displays when I select WebCam, I am using Octiprint Widescreen Plug in and the Webcam Tab plugin.

The Webcam does display on the test in settings.
browser.user_agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.66 Safari/537.36
connectivity.connection_check: 8.8.8.8:53
connectivity.connection_ok: true
connectivity.enabled: true
connectivity.online: true
connectivity.resolution_check: octoprint.org
connectivity.resolution_ok: true
env.hardware.cores: 4
env.hardware.freq: 1500
env.hardware.ram: 4041732096
env.os.bits: 32
env.os.id: linux
env.os.platform: linux2
env.plugins.pi_support.model: Raspberry Pi 4 Model B Rev 1.2
env.plugins.pi_support.octopi_version: 0.17.0
env.plugins.pi_support.throttle_state: 0x0
env.python.pip: 19.3.1
env.python.version: 2.7.16
env.python.virtualenv: true
octoprint.safe_mode: false
octoprint.version: 1.5.0
printer.firmware: Marlin 2.0.6_DW7 TM3D SSMDBB (Oct 8 2020

Check in safe mode.

I have about the same issue, after upgrading the webcam tab is blank, when booted in safe mode the cam shows up in the control tab just fine so looks like its an issue with the webcam plugin. My sys info is below, also acts the same on a mac running Catalina.

browser.user_agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.1 Safari/605.1.15
connectivity.connection_check: 8.8.8.8:53
connectivity.connection_ok: true
connectivity.enabled: true
connectivity.online: true
connectivity.resolution_check: octoprint.org
connectivity.resolution_ok: true
env.hardware.cores: 4
env.hardware.freq: 1400
env.hardware.ram: 918192128
env.os.bits: 32
env.os.id: linux
env.os.platform: linux2
env.plugins.pi_support.model: Raspberry Pi 3 Model B Plus Rev 1.3
env.plugins.pi_support.octopi_version: 0.15.1
env.plugins.pi_support.throttle_state: 0x0
env.python.pip: 9.0.3
env.python.version: 2.7.13
env.python.virtualenv: true
octoprint.safe_mode: true
octoprint.version: 1.5.0
printer.firmware: Marlin 1.1.9 (Github)

Sounds like a problem with the webcam plugin then, probably due to the added support for HLS. Apparently already reported to the author here: https://github.com/malnvenshorn/OctoPrint-WebcamTab/issues/13 And plugin wizard @jneilliii seems to even have provided a fixed version here: https://github.com/malnvenshorn/OctoPrint-WebcamTab/issues/13#issuecomment-736149264

1 Like

I'm not sure how good my patch is, but it does seem to work and should handle the HLS support as well.

during my debugging of this plugin though I noticed something strange that seems like a change, possibly related to knockout upgrade or a timing issue. The plugin was utilizing onAfterBinding to grab a hold of the webcam div and append it to it's own tab. For some reason, during this callback the jquery selector used for the webcam container wouldn't grab anything and therefore the image div remained on the control tab. I moved that code to the ontabchange event just to get around the issue, but was wondering is there some rendering logic that changed there in the callbacks whereas the html code is not available during onAfterBinding anymore?

Nothing intentional. I can't remember even touching the binding process for 1.5.0

maybe something internal to knockout then with the upgrade maybe. I just know while debugging, this line would return 0 length, so didn't exist. I was totally confused why that was happening.

Well, now we are both confused, good job :joy:

@jneilliii There was also the permission check added to the webcam, wonder if it is initially false & doesn't show up, but then once all VMs are bound it becomes true and there is something there?

Or I am just making things up. That was not based on any testing (or to be honest, knowledge) just making things up :thinking:

Oh, no, wait, that could indeed be it!

1 Like

That's kind of what I was thinking Charlie. That it was probably related to permission changes and forced login.

1 Like

Any updates on this? This appears to be my exact problem- I was working fine with my Webcam until I just updated to the newest version- now no feed on the webcam.

OctoPrint update doesn't affect the webcam stream. Please test the problem either in safe mode, or take the webcam URL outside OctoPrint and test it.

I'm having the same (I think) problem, or one that's very similar. Logitech C920S works fine fir a bit, then fails. Sometimes resetting webcamd fixes it, sometimes it doesn't. I posted a thread about it before I saw this one.

Starting in safe mode makes no difference for me.