26

I'm trying to use My Canon 100D as a webcam on Ubuntu 17.10.

Whenever I try to launch:

gphoto2 --capture-movie

I return this error:

An error occurred in the io-library ('**Could not claim the USB device**'):
Could not claim interface 0 (Device or resource busy). Make sure no other
program (gvfs-gphoto2-volume-monitor) or kernel module (such as sdc2xx, stv680,
spca50x) is using the device and you have read/write access to the device.

The camera is detected by the system and I can transfer data from it.

Also, lsusb shows this device:

Bus 001 Device 020: ID 04a9:3270 Canon, Inc.

Pretty verbose description, but it is it.

How can I fix this issue?

Pablo Bianchi
  • 17,371
PeterM
  • 764

4 Answers4

25

It turned out that that in fact there was gvfs-gphoto2-volume-monitor process in the background.

Run ps aux | grep gphoto, which might have output like:

peter    25802  2.1  0.1 302504  8736 ?        Ssl  13:10   0:00 /usr/lib/gvfs/gvfs-gphoto2-volume-monitor
peter    25814  2.2  0.1 441508 11176 ?        Sl   13:10   0:00 /usr/lib/gvfs/gvfsd-gphoto2 --spawner :1.3 /org/gtk/gvfs/exec_spaw/21
peter    25835  0.0  0.0  22676  1096 pts/0    S+   13:10   0:00 grep --color=auto gphoto

First colums is PID (process id), kill them:

kill -9 25802
kill -9 25814

Now gphoto2 can now connect to camera.

PeterM
  • 764
8

Simpler and quicker than PeterM's answer:

  1. First, find all processes which are related to gphoto2

    pgrep -fla gphoto2
    1236 /usr/lib/gvfs/gvfs-gphoto2-volume-monitor
    1345 /usr/lib/gvfs/gvfsd-gphoto2 --spawner :1.4 /org/gtk/gvfs/exec_spaw/1
    
  2. if they are the ones shown above, you can safely kill these

    pkill -f gphoto2
    
  3. Happily, take pictures

    gphoto2 --capture-image-and-download --filename pic0001.jpg
    
Pablo Bianchi
  • 17,371
1

If your SD card has magic lantern installed, you must remove that SD card for it to work.

rdc
  • 29
1

When I plugin then USB cable, the Camera is mounted automatically. You can simply eject the device in the Nautilus file browser, i.e. unmount it, and then the USB device should be free:

Screenshot of Unmounting Camera in Nautilus

lumbric
  • 4,129