2

Suddenly, my webcam stopped working in my browsers even though it works if I run the cheese application in the terminal. I am testing it with this website (and many others) on Google Chrome (incognito mode and Firefox) and I get this error message:

NotFoundError: Requested device not found; Object

lsusb gives:

Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 004: ID 0bda:57f2 Realtek Semiconductor Corp. HD WebCam
Bus 001 Device 003: ID 04ca:3015 Lite-On Technology Corp. Qualcomm Atheros QCA9377 Bluetooth
Bus 001 Device 002: ID 093a:2510 Pixart Imaging, Inc. Optical Mouse
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

If I use an external webcam this still does not get detected. I tried to re-install Chrome, change user and reboot my machine but still does not work. Microphone, instead, is correctly detected.

My system information:

Distributor ID: Ubuntu
Description:    Ubuntu 21.10
Release:        21.10
Codename:       impish
Kernel:         5.13.0-23-generic

ls -l /dev/video* prints

crw-rw----+ 1 root video 81, 0 gen  6 18:06 /dev/video0
crw-rw----+ 1 root video 81, 1 gen  6 18:06 /dev/video1

groups $USER prints

alex : alex adm cdrom sudo dip video plugdev lpadmin lxd sambashare

bash ./pathlld /dev/video* prints

drwxr-xr-x 21 root root 4096 gen  6 12:46 /
/dev/sdb2 on / type ext4 (rw,relatime,errors=remount-ro)
drwxr-xr-x 22 root root 4960 gen  6 19:14 /dev
udev on /dev type devtmpfs (rw,nosuid,relatime,size=6036388k,nr_inodes=1509097,mode=755,inode64)
crw-rw----+ 1 root video 81, 0 gen  6 19:12 /dev/video0
drwxr-xr-x 21 root root 4096 gen  6 12:46 /
/dev/sdb2 on / type ext4 (rw,relatime,errors=remount-ro)
drwxr-xr-x 22 root root 4960 gen  6 19:14 /dev
udev on /dev type devtmpfs (rw,nosuid,relatime,size=6036388k,nr_inodes=1509097,mode=755,inode64)
crw-rw----+ 1 root video 81, 1 gen  6 19:12 /dev/video1

getfacl /dev/video* prints

getfacl: Removing leading '/' from absolute path names
# file: dev/video0
# owner: root
# group: video
user::rw-
user:alex:rw-
group::rw-
mask::rw-
other::---

# file: dev/video1
# owner: root
# group: video
user::rw-
user:alex:rw-
group::rw-
mask::rw-
other::---
tail
  • 121
  • 5

1 Answers1

0

Many device access problems can be resolved through group membership changes.

You can find the device name by watching sudo journalctl --follow as you connect your device. OR ls -1 /dev >dev.before, connect the device, wait 10 seconds, ls -1 /dev >dev.after;diff dev.{before,after}. Your camera is probably /dev/video.

Specifically, if ls -l shows that the group permissions (the second "rwx" triplet) is "rw" (e.g."-rw-rw----"), then, adding oneself to the group that owns the device will grant rw access.

Here's how:

device="/dev/whatever"
sudo adduser $USER $(stat -c "%G" $device)

This allows you membership in the group that can rw the device, but there is one more step.

To make all your processes members of the new group, logout and login. Group memberships are set up at login time.

To create a single process in the new group (for testing, prior to logout/login):

newgrp $(stat -c "%G" $device)  

or, just type the group name. See man newgrp.

waltinator
  • 35,099
  • 19
  • 57
  • 93
  • I can't simply connect my device because my webcam is integrated. Anyway if I run `ls -l /dev | grep video` there are shown video0 and video1. What should I pick? I suppose it is `dev/video0` as you said and if I list I get: `crw-rw----+`. So I `device="/dev/video0" sudo adduser $USER $(stat -c "%G" $device)`. I reboot my computer and `newgrp $(stat -c "%G" $device)`. Is there any mistake? This still does not work – tail Jan 06 '22 at 16:34
  • Explore your Mount/Read/Write/Execute problems with `https://github.com/waltinator/pathlld`, a `bash` script to show the permissions, mount options along the path to an object or objects. – waltinator Jan 06 '22 at 22:09
  • Try `bash ./pathlld /dev/video*`, or `chmod +x ./pathlld` followed by `./pathlld /dev/video*`. By running a `bash` script with the less capable `sh`, you broke it. – waltinator Jan 06 '22 at 23:37
  • Comments are designed for US to ask YOU questions about your Question. You should [Edit] your question to add information. By updating your Question, and using the formatting buttons, you make all the information available to new readers. People shouldn't have to read a long series of comments to get the whole story. – waltinator Jan 06 '22 at 23:40
  • @tail The output of `groups $USER` looks as if you shortened it. Please post original output instead of edited command output. Also interesting to see output of `getfacl /dev/video*`. – mook765 Jan 07 '22 at 00:44
  • @mook765 I edited my post. Check it out – tail Jan 07 '22 at 09:24
  • @tail The ACL's tell us, that user alex has rw-permission on both files, you wouldn't even need to be in the video group. The ACL's look ok, same on my system. Also groups are the same for my user with the exeption of the video group which I don't need to access the camera. Sorry, no idea where to look next... – mook765 Jan 07 '22 at 09:37