Score:1

Browsers can't detect my webcam but it works in cheese

cn flag

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::---
Marcin Erbel avatar
im flag
Were you able to solve it?
tail avatar
cn flag
@MarcinErbel no
FedKad avatar
cn flag
Can you try in _Incognito_ mode? Can you try with _Firefox_?
tail avatar
cn flag
@FedKad not working on both
Matthias Lenmher avatar
nl flag
Did you tried accepting "web device access permissions" when website request it?.
tail avatar
cn flag
@MatthiasLenmher Yes, of course. I tried to re-install chrome as well
us flag
Can you try rebooting with an older kernel (in advanced options in the GRUB menu)
tail avatar
cn flag
@ArchismanPanigrahi same problem
FedKad avatar
cn flag
Can you try the same with a _newly created Ubuntu user_?
tail avatar
cn flag
@FedKad same problem
mook765 avatar
cn flag
I guess the problematic applications are installed as snap packages and you might need to configure their permissions, you can do so from within the snap-store.
tail avatar
cn flag
@mook765 How? ..
mook765 avatar
cn flag
@tail Open the snap-store or software-center or however you call it, search for the applications and look for the `Permissions`-button.
tail avatar
cn flag
@mook765 I can't find Permission button if I click on Google Chrome on Ubuntu Software Center
mook765 avatar
cn flag
@tail You can check with `snap list` which applications are installed as snaps. You wrote `Google Chrome (downloaded by terminal)`, what does this mean exactly? It's probably not a snap.
tail avatar
cn flag
@mook765 I downloaded the deb file and install it via terminal (it is not a snap). Anyway I am still facing issues with webcam on any browsers
Score:0
it flag

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.

tail avatar
cn flag
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
waltinator avatar
it flag
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 avatar
it flag
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 avatar
it flag
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.
mook765 avatar
cn flag
@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*`.
tail avatar
cn flag
@mook765 I edited my post. Check it out
mook765 avatar
cn flag
@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...
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.