Integrated Webcam stops working after few seconds [Ubuntu 16.04]

7,180

Solution 1

Ok, so the real solution to the problem was me working with a non-supportive kernel for my webcam. I upgraded from 4.8.0-54-generic to 4.10.0-22-generic, and the webcam is very stable now. Only a few times it will turn itself off (like on Facebook messenger for example), but just restarting the application will fix that. No need to reboot anymore.

Solution 2

Read the edit below as well!

So it seems that there are many other who face(d) the error -71 problem; not only with webcams, but USB devices in general. The issue appears to be "a USB bug that was introduced with the power-saving modules [in kernel 2.6.27]". So in order to save power I guess, the webcam got shut down after a minute or so.

That website also has what appears to be the working solution:

$ sudo -s
$ echo -1> /sys/module/usbcore/parameters/autosuspend

This is written down to be the 'hotfix', but it seemed to have permanently solved my problem (after reboot the value changed back to the original value 2, but hey no more webcam failures :) )

Just to be sure, I also did the 'permanent fix':

  1. Create a file in /etc/modprobe.d called usbcore
  2. Populate the file with the following options usbcore autosuspend=-1
  3. Save the file
  4. Run "mkinitrd" (If you are sure that no USB device modules are loaded via the initrd, then you can skip this step). I skipped this step, because this command couldn't be found.
  5. Reboot

Hope this helps someone!

Important Edit!

So the above mentioned way to set the autosuspend is not universal, and depends on your OS. Please find a more elaborate answer on how to edit your autosuspend parameter here: https://unix.stackexchange.com/questions/91027/how-to-disable-usb-autosuspend-on-kernel-3-7-10-or-above

I will mention it here just for completeness.

For Ubuntu 14.04 & 15.04:

Edit the /etc/default/grub file and change the GRUB_CMDLINE_LINUX_DEFAULT line to add the usbcore.autosuspend=-1 option:

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash usbcore.autosuspend=-1"

Note that quit splash were already present options. So keep other options you have too.

After save the file, update grub:

sudo upgrade-grub
(might also be sudo update-grub2 (I did both))

And reboot.

Now check autosuspend value:

cat /sys/module/usbcore/parameters/autosuspend And it should display -1

Ubuntu 15.10 and above

The procedure is the same, but the param to change is autosuspend_delay_ms (instead of autosuspend).

Edit 2

False alarm... So the above didn't work after all. I still get that the USB device errors out on error -71. Here is a complete stack trace of /var/log/kern.log at the moment the webcam crashed: https://pastebin.com/8qHpBcdR. One note though: the first time the webcam crashes I get this kind of output: https://pastebin.com/XVwSEDBZ, The error -71 happens only after I try to run cheese again (which can launch normally). When it crashes again, it cannot work at all anymore (until I reboot).

If anyone has a clue what I can do, please let me know!

Edit 3

So I updated my kernel from 4.8.0-54-generic to 4.10.0-22-generic, and so far it seems to be stable. If it crashes again I will report it.

Share:
7,180

Related videos on Youtube

JimmyJumbo
Author by

JimmyJumbo

Updated on September 18, 2022

Comments

  • JimmyJumbo
    JimmyJumbo over 1 year

    For the past couple of hours I have been trying to get my integrated webcam (of my Dell E7470 laptop) to work for applications such as Skype.

    The problem:

    After every boot the camera functions well, but only for a couple of seconds (~ 30 sec) after I start the video application. After that the camera cannot be found by any application (including cheese) until I reboot.

    The pastebin

    pastebin (sorry not enough rep to have multiple links)

    When it's working:

    • ls /dev/video0 shows the camera is there

    • v4l2-ctl --info gives the following output: pastebin (first part)

    • hwinfo | grep video gives the following output: pastebin (second part)

    When it's not working:

    • ls /dev/video0 gives: cannot access '/dev/video0': No such file or directory

    • v412-ctl --info gives Failed to open /dev/video0: No such file or directory

    • hwinfo | grep video gives the following output: pastebin (third part)

    What I tried:

    1. Checked if my webcam is supported by Ubuntu. Checked on the Dell website as well as the UVC website, and came to the conclusion it should work.
    2. Checked if there is any Fn + F_Key combination that enables / disables my webcam. It seems to be not there.
    3. Installed the drivers: sudo apt-get install cheese build-essential linux-headers- uname -r
    4. Tried: rmmod uvcvideo && modprobe uvcvideo
    5. Tried solution #9 from here, by changing a line in /etc/default/grub (also tried putting iommu=soft after quiet splash)

    Sorry for the combined pastebin, but I don't have enough reputation to post more than 2 links. Any help on how I could potentially solve this problem would be greatly appreciated!

    Edit 1:

    From After a while integrated webcam is disconnected I found that this problem occurred more than four years ago as well. Doing sudo rmmod uvcvideo && sudo modprobe uvcvideo seems to bring it back alive for a few seconds (I forgot to perform this command with sudo, so that is why it didn't do anything before), but then fails again... Did anyone ever solve this issue?

    By the way the rmmod / modprobe trick works only a few times. After that it doesn't work at all until I reboot.

    Edit 2:

    Here is the Call Trace in /var/log/kern.log at the time that the camera fails:

    Jun  5 10:54:21 me kernel: [  219.778042] CPU: 0 PID: 2455 Comm: cheese Not tainted 4.8.0-53-generic #56~16.04.1-Ubuntu
    Jun  5 10:54:21 me kernel: [  219.778043] Hardware name: Dell Inc. Latitude E7470/0T6HHJ, BIOS 1.13.4 02/07/2017
    Jun  5 10:54:21 me kernel: [  219.778044]  0000000000000286 000000002daf03ef ffff8d9e4be93b98 ffffffff9082e7b3
    Jun  5 10:54:21 me kernel: [  219.778045]  ffff8d9e4be93be8 0000000000000000 ffff8d9e4be93bd8 ffffffff9048314b
    Jun  5 10:54:21 me kernel: [  219.778047]  000000ed4be93bd8 0000000000000000 ffffffff912d06c0 ffff8d9e771d70c0
    Jun  5 10:54:21 me kernel: [  219.778049] Call Trace:
    Jun  5 10:54:21 me kernel: [  219.778051]  [<ffffffff9082e7b3>] dump_stack+0x63/0x90
    Jun  5 10:54:21 me kernel: [  219.778054]  [<ffffffff9048314b>] __warn+0xcb/0xf0
    Jun  5 10:54:21 me kernel: [  219.778055]  [<ffffffff904831cf>] warn_slowpath_fmt+0x5f/0x80
    Jun  5 10:54:21 me kernel: [  219.778057]  [<ffffffff906b78a8>] ? kernfs_find_and_get_ns+0x48/0x60
    Jun  5 10:54:21 me kernel: [  219.778058]  [<ffffffff906bb56b>] sysfs_remove_group+0x8b/0x90
    Jun  5 10:54:21 me kernel: [  219.778060]  [<ffffffff909a6297>] dpm_sysfs_remove+0x57/0x60
    Jun  5 10:54:21 me kernel: [  219.778062]  [<ffffffff90998ab8>] device_del+0x58/0x270
    Jun  5 10:54:21 me kernel: [  219.778063]  [<ffffffff90942c42>] ? kbd_disconnect+0x22/0x30
    Jun  5 10:54:21 me kernel: [  219.778065]  [<ffffffff90ac6ea3>] evdev_disconnect+0x23/0x60
    Jun  5 10:54:21 me kernel: [  219.778066]  [<ffffffff90ac1ef5>] __input_unregister_device+0xb5/0x160
    Jun  5 10:54:21 me kernel: [  219.778067]  [<ffffffff90ac2cc7>] input_unregister_device+0x47/0x70
    Jun  5 10:54:21 me kernel: [  219.778071]  [<ffffffffc0a14ba2>] uvc_status_cleanup+0x42/0x50 [uvcvideo]
    Jun  5 10:54:21 me kernel: [  219.778073]  [<ffffffffc0a0a208>] uvc_delete+0x18/0x160 [uvcvideo]
    Jun  5 10:54:21 me kernel: [  219.778074]  [<ffffffffc0a0a423>] uvc_release+0x23/0x30 [uvcvideo]
    Jun  5 10:54:21 me kernel: [  219.778078]  [<ffffffffc098f946>] v4l2_device_release+0xe6/0x120 [videodev]
    Jun  5 10:54:21 me kernel: [  219.778079]  [<ffffffff909982d2>] device_release+0x32/0x90
    Jun  5 10:54:21 me kernel: [  219.778081]  [<ffffffff90830f7a>] kobject_release+0x6a/0x170
    Jun  5 10:54:21 me kernel: [  219.778082]  [<ffffffff90830e37>] kobject_put+0x27/0x50
    Jun  5 10:54:21 me kernel: [  219.778083]  [<ffffffff909985c7>] put_device+0x17/0x20
    Jun  5 10:54:21 me kernel: [  219.778086]  [<ffffffffc098e490>] v4l2_release+0x50/0x80 [videodev]
    Jun  5 10:54:21 me kernel: [  219.778087]  [<ffffffff906350f7>] __fput+0xe7/0x230
    Jun  5 10:54:21 me kernel: [  219.778088]  [<ffffffff906352ae>] ____fput+0xe/0x10
    Jun  5 10:54:21 me kernel: [  219.778090]  [<ffffffff904a230e>] task_work_run+0x7e/0xa0
    Jun  5 10:54:21 me kernel: [  219.778091]  [<ffffffff904032d2>] exit_to_usermode_loop+0xc2/0xd0
    Jun  5 10:54:21 me kernel: [  219.778093]  [<ffffffff90403b3e>] syscall_return_slowpath+0x4e/0x60
    Jun  5 10:54:21 me kernel: [  219.778094]  [<ffffffff90c9a8fe>] entry_SYSCALL_64_fastpath+0xa6/0xa8
    Jun  5 10:54:21 me kernel: [  219.778095] ---[ end trace cd02296d8a08b517 ]---
    Jun  5 10:54:21 me kernel: [  219.802017] ------------[ cut here ]------------
    Jun  5 10:54:21 me kernel: [  219.802022] WARNING: CPU: 0 PID: 2455 at /build/linux-hwe-MohJvK/linux-hwe-4.8.0/fs/sysfs/group.c:237 sysfs_remove_group+0x8b/0x90
    Jun  5 10:54:21 me kernel: [  219.802023] sysfs group ffffffff912d06c0 not found for kobject 'input14'
    

    Edit 3:

    Another Call Trace shows that the usb connection might be faulty:

    Jun  5 11:08:11 me kernel: [ 1049.717359] usb 1-2: new full-speed USB device number 8 using xhci_hcd
    Jun  5 11:08:11 me kernel: [ 1049.841492] usb 1-2: device descriptor read/64, error -71
    Jun  5 11:08:12 me kernel: [ 1050.069407] usb 1-2: device descriptor read/64, error -71
    Jun  5 11:08:12 me kernel: [ 1050.297575] usb 1-2: new full-speed USB device number 9 using xhci_hcd
    Jun  5 11:08:12 me kernel: [ 1050.417566] usb 1-2: device descriptor read/64, error -71
    Jun  5 11:08:12 me kernel: [ 1050.645641] usb 1-2: device descriptor read/64, error -71
    Jun  5 11:08:12 me kernel: [ 1050.873599] usb 1-2: new full-speed USB device number 10 using xhci_hcd
    Jun  5 11:08:12 me kernel: [ 1050.873825] usb 1-2: Device not responding to setup address.
    Jun  5 11:08:13 me kernel: [ 1051.081804] usb 1-2: Device not responding to setup address.
    Jun  5 11:08:13 me kernel: [ 1051.289562] usb 1-2: device not accepting address 10, error -71
    Jun  5 11:08:13 me kernel: [ 1051.409586] usb 1-2: new full-speed USB device number 11 using xhci_hcd
    Jun  5 11:08:13 me kernel: [ 1051.409821] usb 1-2: Device not responding to setup address.
    Jun  5 11:08:13 me kernel: [ 1051.617820] usb 1-2: Device not responding to setup address.
    Jun  5 11:08:13 me kernel: [ 1051.825581] usb 1-2: device not accepting address 11, error -71
    Jun  5 11:08:13 me kernel: [ 1051.825661] usb usb1-port2: unable to enumerate USB device
    

    A weird thing is that the idVendor (0bda) can be found (which is Realtek Semiconductor Corp.), but the idProduct (5765) is nowhere to be found...

    Edit 4:

    Just to be clear, my workflow is as following.

    1. Fresh boot in Ubuntu 16.04
    2. Launch cheese
    3. After 1 minute it crashes with the following kern.log output: https://pastebin.com/XVwSEDBZ
    4. Restart cheese. Seems to work fine...
    5. After 1 minute it crashes again, but now with the following kern.log output: https://pastebin.com/8qHpBcdR (the error -71)
    6. Now cheese cannot launch successfully anymore (no device detected).
    7. Reboot and back to step 1...
  • user3405291
    user3405291 almost 7 years
    Did you try this method?
  • JimmyJumbo
    JimmyJumbo almost 7 years
    Just tried that. So after the reboot, I started cheese and again it crashed, with the following kern.log output: pastebin.com/XVwSEDBZ. Actually I would get this output without this method as well. Only after I try again, I would get an error -71. However, this time I do not get the error -71, but instead cheese keeps showing a black screen. It doesn't seem to crash anymore though...
  • JimmyJumbo
    JimmyJumbo almost 7 years
    I updated my original post (Edit 4) to describe my workflow.
  • user3405291
    user3405291 almost 7 years
    Someone was getting error -71 while trying to connect a smartphone. Apparently he/she resolved the issue by replacing the USB cable.
  • JimmyJumbo
    JimmyJumbo almost 7 years
    The issue is that the webcam is built-in, so I cannot simply replace the USB connection. But the kernel update seems to have solved the issue.
  • João Pimentel Ferreira
    João Pimentel Ferreira over 2 years
    I'm using the Linux 5.4.0-90-generic and I have the same problem, camera freezes after a certain period