gphoto2: Could not claim the USB device

Solution 1:

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.

Solution 2:

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