23

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

Whenever I try to launch:

gphoto2 --capture-movie

I returns 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 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.

Perhaps I should... Yes, where to start?

2
  • Does your camera have any webcam mode or similar? If not then expect it not to work as you want and just as the typical mass storage device which is how the OS will "see" it and nothing else.
    – user692175
    Jan 9, 2018 at 12:06
  • There are many cameras supported by gphoto2. This is really cool, as the quality is superior to typical webcam.
    – PeterM
    Jan 9, 2018 at 17:43

3 Answers 3

24

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.

3
  • What to do if the "gvfs-gphoto2-volume-monitor" process keeps starting again? DO we have to manually always kill the process?
    – Zythyr
    Aug 21, 2018 at 17:49
  • That's a good question. I don't know how to remove it from startup. Feel free to ask another question, or improve this answer if You figure out this.
    – PeterM
    Aug 21, 2018 at 20:40
  • 1
    What is the purpose of "gvfs-gphoto2-volume-monitor"? I assume it is running for a reason, and might provide something useful?
    – Quigi
    Jan 18, 2021 at 1:39
6

PeterM's answer works in principle. To make it simpler and quicker I propose the following procedure:

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

if they are the ones shown above you can safely kill these

pkill -f gphoto2

and happily take pictures

gphoto2 --capture-image-and-download --filename pic0001.jpg
2
  • love it - much easier Jun 10, 2020 at 17:04
  • in fact this is my standard procedure for killing stuff i might have to rerun. Quite a few of my scripts are using this approach ... Oct 26, 2020 at 11:58
1

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .