Normal user can't access USB camera Error (-53: 'Could not claim the USB device')

Bug #189506 reported by Thomas Perl
54
This bug affects 2 people
Affects Status Importance Assigned to Milestone
gphoto2 (Ubuntu)
Fix Released
Undecided
Unassigned
udev (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

Binary package hint: gphoto2

As a normal user, I cannot access my Canon Digital IXUS 60 camera in Ubuntu anymore (it worked in 7.10, currently using 8.04 development):

$ gphoto2 --auto-detect
Model Port
----------------------------------------------------------
Canon Digital IXUS 60 (PTP mode) usb:
Canon Digital IXUS 60 (PTP mode) usb:005,008

$ gphoto2 --get-all-files

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

For debugging messages, please use the --debug option.
Debugging messages may help finding a solution to your problem.
If you intend to send any error or debug messages to the gphoto
developer mailing list <email address hidden>, please run
gphoto2 as follows:

    env LANG=C gphoto2 --debug --debug-logfile=my-logfile.txt --get-all-files

Please make sure there is sufficient quoting around the arguments.

I've attached the debug file. I think it's a permission problem, as it works with the "root" user.

Revision history for this message
Thomas Perl (thp) wrote :
Revision history for this message
Fabián Rodríguez (magicfab) wrote :

Could you please attach the output of the file generated on your desktop by this command:
dmesg > ~/Desktop/dmesg.txt

And also optionally try, from command line:

sudo fspot-import

and tell us if it works.

Thank you.

Revision history for this message
Thomas Perl (thp) wrote :

I can't reproduce this bug as of today after upgrading all packages in the current 8.04 development distribution, so if nobody else has this problem, I think we can close the bug now.

Revision history for this message
Peter de Kraker (peterdekraker) wrote :

I am still having this issue, even after upgrading all packages in the current 8.04 dev distribution. Running x86_64.

When using sudo it does work, when just using it as user, it doesn't.

$ gphoto2 --auto-detect
Model Port
----------------------------------------------------------
Canon PowerShot A95 (PTP mode) usb:
$ gphoto2 --get-all-files

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

See attachment for output of it running while --debug is enabled.
Main errors are:
*** Error ***
PTP: Sequence number mismatch 0 vs expected 1.
0.524642 context(0): PTP Error: bad parameter

Revision history for this message
Peter de Kraker (peterdekraker) wrote :
Revision history for this message
Peter de Kraker (peterdekraker) wrote :

Looks like another bug according to the --debug output. The bad parameter error doesn't show up on the bug starters errorlog.

Revision history for this message
Peter de Kraker (peterdekraker) wrote :

Also, this is normal? Doesn't it need to be something like usb:005,008 ?

$ gphoto2 --auto-detect
Model Port
----------------------------------------------------------
Canon PowerShot A95 (PTP mode) usb:

Revision history for this message
Peter de Kraker (peterdekraker) wrote :

Ignore the earlier mentioned PTP Error, it was due to using the memory card earlier directly on a windows PC.
New debug log shows exactly the same problems as the reporter's.

Revision history for this message
Toltech (robert-toltech) wrote :

I can confirm this bug with my "Canon DIGITAL IXUS 800 IS" (always used to work).
As root everything works, as a normal user not. I get following messages:

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

Strace points to a permission error:
open("/dev/bus/usb/005/005", O_RDWR) = -1 EACCES (Permission denied)
open("/dev/bus/usb/005/005", O_RDONLY) = 4
ioctl(4, USBDEVFS_GETDRIVER, 0xbfd653b4) = -1 EPERM (Operation not permitted)
ioctl(4, USBDEVFS_CLAIMINTERFACE, 0xbfd654d4) = -1 EPERM (Operation not permitted)

Manually changing the group permissions recursively for /dev/bus/usb/005 to plugdev solves the problem.

It looks like udev is not working properly. I also noticed /etc/udev/rules.d/45-libgphoto2.rules is not installed, I copied this file from feisty to no avail. I am not very good with udev, If somebody could point me out what to do, this bug can be solved.

Revision history for this message
Ian (eddieshowcase) wrote :

I can confirm this bug too. I'm using a Canon SD800. Annoying as it has always worked before.

Output of gphoto2:

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

Please fix!

Revision history for this message
Steffen Röcker (sroecker) wrote :

I can confirm this. (Finepix F30)

Since version 2.4.0-8ubuntu2 libgphoto2 tries to implement the hardy-hardware-detection specs
and removes the udev rules, but the new stuff (Hal with dynamic ACLs?) doesn't work for me.

Quick workaround: recreate the udev rules and the hal information.

sudo /usr/lib/libgphoto2/print-camera-list udev-rules group plugdev > /etc/udev/rules.d/45-libgphoto2.rules
sudo /usr/lib/libgphoto2/print-camera-list hal-fdi > /usr/share/hal/fdi/information/10freedesktop#10-camera-libgphoto2.fdi

Now it should work again until the new implementation is fixed.

Revision history for this message
Steffen Röcker (sroecker) wrote :

Sorry for the typo:

sudo /usr/lib/libgphoto2/print-camera-list udev-rules group plugdev > /etc/udev/rules.d/45-libgphoto2.rules
sudo /usr/lib/libgphoto2/print-camera-list hal-fdi > /usr/share/hal/fdi/information/10freedesktop/10-camera-libgphoto2.fdi

Revision history for this message
Toltech (robert-toltech) wrote :

Thanks, this worked for the udev part, however I don't get a message on dbus. If the real implementation is not through udev, it might not be worthwhile pursuing this path.

What needs to be done to make these camera's work with the new hardy-hardware-detection specs before release of hardy? (I am only beta testing)

Though not critical, users will expect their camera's to work, especially when they used to work with dapper/feisty/gutsy.

Revision history for this message
Peter de Kraker (peterdekraker) wrote :

Linked the bug to udev, I see more bugs there, also a confirmed one. So this way it will get the right attention I hope.

Revision history for this message
sbolten (stephan-bolten) wrote :

I can confirm this (IXUS 55 and EOS 20D).

Workaround proposed is good enough to get access to the pictures as a "normal" user. However, it does not fix the automount problem I have - configuration in "System/Preferences/Removable Drives and Media/Digital Camera" does not have any effect - configured app is not starting automatically when camera is connected.

Revision history for this message
Achim (ach1m) wrote :

I have a Canon Powershot S3 IS and I also cannot access my camera.

It even doesn't appear in Nautilus. If I boot the latest beta CD My camera is working and accessible through nautilus.
I tried starting gThumb with super user permissions and now I can copy my photos.

Shouldn't this bug be set to confirmed with a high priority?

my system:
hardy 64-bit with latest updates.

best wishes
Achim

Revision history for this message
Hubert Figuiere (hub) wrote : Re: [Bug 189506] Re: Normal user can't access USB camera Error (-53: 'Could not claim the USB device')

On Tue, 2008-03-25 at 13:12 +0000, Achim wrote:
> I have a Canon Powershot S3 IS and I also cannot access my camera.
>
> It even doesn't appear in Nautilus.

That's normal. This camera is NOT a USB Storage device

> If I boot the latest beta CD My camera is working and accessible
> through nautilus.

That's normal, GVFS which is new to the latest GNOME has a camera
module.

Hub

Revision history for this message
Achim (ach1m) wrote : Re: [Bug 189506] Re: Normal user can't access USB camera Error (-53: 'Could not claim the USB device')

Am Dienstag, den 25.03.2008, 13:29 +0000 schrieb Hubert Figuiere:
> On Tue, 2008-03-25 at 13:12 +0000, Achim wrote:
> > It even doesn't appear in Nautilus.
> 
> That's normal. This camera is NOT a USB Storage device

I know that it is not a USB Storage device, I meant the new gphoto2://
protocol. Nautilus 2.22 shows normally a camera icon were I can access
the data of my camera, if it is pluged in.

> > If I boot the latest beta CD My camera is working and accessible
> > through nautilus.
>
> That's normal, GVFS which is new to the latest GNOME has a camera
> module.

Yes, I am aware that this is a new feature in GNOME. What I tried to say
is that it worked in an earlier version of hardy and now it doesn't work
anymore.

best wishes
Achim

Revision history for this message
Samuli Seppänen (samuli-seppanen) wrote :

I can confirm this on Canon Digital Ixus 400. The problem itself is old - I've stumbled on these camera & permissions problems several times between 2003 and now in Debian and Ubuntu.

Anyways, when I plug in my Ixus I get device nodes like this:

root@macbook:/dev/bus/usb# lsusb
--- snip ---
Bus 002 Device 003: ID 04a9:3075 Canon, Inc. IXUS 400 Camera
---snip ---

root@macbook:/dev/bus/usb# ls -l 002/003
crw-rw-r-- 1 root root 189, 130 2008-03-26 11:03 002/003

I can download the photos as root or if I change the permissions to rw-rw-rw- manually. I agree this should be given high priority - especially if this affects all digital cameras in Hardy.

Revision history for this message
Achim (ach1m) wrote :

The update of libgphoto2 today fixed my problem I am able the access my date with nautilus and F-Spot as it should be.

Version 2.4.0-8ubuntu6:

  * Add debian/patches/72_deprecated_hal_key.dpatch: Replace the deprecated
    hal property "info.bus" with "info.subsystem" in the hal FDI generation
    tool. This fixes cameras to work with current hal without using deprecated
    keys. (LP: #205417)

It would be nice if someone else can confirm this so that we can close this bug.

best wishes
Achim

Revision history for this message
royden (ryts) wrote :

Confirmed that since libghoto2-2 update to 2.4.0-8ubuntu6 camera is accessible to software without root privileges.

ryts

Revision history for this message
Samuli Seppänen (samuli-seppanen) wrote :

Version 2.4.0-8ubuntu6 fixed this issue for me, too.

Revision history for this message
Achim (ach1m) wrote :

libgphoto2 Version 2.4.0-8ubuntu6:

  * Add debian/patches/72_deprecated_hal_key.dpatch: Replace the deprecated
    hal property "info.bus" with "info.subsystem" in the hal FDI generation
    tool. This fixes cameras to work with current hal without using deprecated
    keys. (LP: #205417)

Changed in udev:
status: New → Invalid
Changed in gphoto2:
status: New → Fix Released
Revision history for this message
sbolten (stephan-bolten) wrote :

Regarding the access as normal user fixed for me too.

Starting application (gthumb) configured through "System/Preferences/Removable Drives and Media/Digital Camera" still not working - but that might be a different issue.

Revision history for this message
Giuseppe Pennisi (giupenni78) wrote :

The access fixed for me too.
But does not start automaticaly, I must start f-spot and manually select the cam to import photos.

gp

Revision history for this message
Peter de Kraker (peterdekraker) wrote :

My accessproblem is fixed as well with the fix.

Revision history for this message
Pierre Frenkiel (pierre-frenkiel) wrote :

Sorry, but the access problem is not fixed for me with version 2.4.0-8ubuntu7
(I didn't try with 2.4.0-8ubuntu6).
The access problem occurs with gphotofs as well as for gphoto2.
The workaround I use is a chmod of both programs to rws-r-sr-x

Revision history for this message
JS (j5) wrote :

On my computer, gphoto2 used to work fine for normal users (as long as they were members of the "plugdev" group). The previous time I tried it was on 19 April 2008, with an up-to-date (k)ubuntu; it worked fine.

Nowadays, this is no longer the case. Presumably it broke down when I upgraded to Kubunut 8.04. Symptoms:

- gphoto2 seems to work only if the same user account has a KDE session running. (Likely it would be the same case for a Gnome session; I don't have Gnome installed so I cannot tell.)

- If I log out from KDE and try to use gphoto2 from a text console, I get the "operation not permitted" error mentioned in this bug report.

- If other users try to use gphoto2 (e.g., via ssh), they get the same error, even if I have a KDE session running.

I have tried both an old Canon PowerShot A80 camera and a new Canon IXUS 80 IS; the same thing happens for both of them.

Revision history for this message
Samuli Seppänen (samuli-seppanen) wrote :

Jukka, your problem sounds like a different problem altogether... this problem was caused by device permission problem created by udev scripts. Having a KDE/Gnome session running does not affect that. In addition this problem has been fixed before Hardy was released. You should definitely file a new bug report on your specific issue.

Revision history for this message
Remke (r-schuurmans) wrote :
Revision history for this message
szczym (szczym) wrote :

In hardy the bug still exists, despite fixes, i just tested it on fresh 8.04.3
it actually makes gphoto2 not usable for many users...

Changed in gphoto2 (Ubuntu):
status: Fix Released → Confirmed
Revision history for this message
Scott James Remnant (Canonical) (canonical-scott) wrote :

Please see http://wiki.ubuntu.com/StableReleaseUpdates; this bug is fixed in the current development Ubuntu release

Changed in gphoto2 (Ubuntu):
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Related questions

Remote bug watches

Bug watches keep track of this bug in other bug trackers.