GNOME Bugzilla – Bug 786821
Could not claim the USB device (-53)
Last modified: 2019-01-25 16:09:40 UTC
Created attachment 358453 [details] Error message Ubuntu Linux 17.04 64 bit, Camera: Canon PowerShot SX120IS, Unable to fetch previews from the camera: Could not claim the USB device (-53) Occasionally but not always,connecting the camera and turning on the viewer launches Shotwell. When Shotwell launches, occasionally but not always, the camera icon is visible in the left hand pane. Shotwell and the camera should always be launched and connected whenever the camera is connected by usb to the computer when power for the camera is turned on.
You could try with 0.27.0 from https://launchpad.net/~yg-jensge/+archive/ubuntu/shotwell-unstable - that should have a fix for it, but also has a nasty data corruption issue.
https://git.gnome.org/browse/shotwell/commit/?id=43c17c9eece5387d3cc5a332b2c7acdf9cc871e6
What additional information may I provide? If you walk me through anything in particular I will attempt to explore this with you.
For now, please check version 0.27.0. The reason for this is pretty clear, 0.27.0 (or git master) should have a work-around
I attempted to install 0.27.0. Unfortunately, I could find only source code, but not DEB files which I would need. I am not knowledgable enough to compile the source code. I finally purchased an Ercrysto Card Reader +HUB which solved my download issues. If you can provide me a link to DEB files for 0.27.0 then I will give it a try. Blessings, Joe Conner, Poulsbo, WA USA
https://launchpad.net/~yg-jensge/+archive/ubuntu/shotwell-unstable
Before I try shotwell-unstable, could I ask for more details about the "nasty data corruption issue"? I hope you'll understand my hesitation here.
I was brave / daring / reckless just now and tried shotwell-unstable (0.27.0) on my Ubuntu 16.04.3 LTS system. When I tried to import photos from a Samsung Galaxy S5 phone, Shotwell just hung "forever", saying it was "Starting import, please wait", but without actually importing anything.
Did you enable any transfer mode on your phone? I get this behavior when plugging in to USB and the phone is in charge-only mode
The phone asked if I wanted to allow or deny access to its data. I allowed access, but Shotwell hung forever without importing anything.
If you run gphoto2 -L, do you get anything back?
$ gphoto2 -L *** 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. *** 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 <gphoto-devel@lists.sourceforge.net>, please run gphoto2 as follows: env LANG=C gphoto2 --debug --debug-logfile=my-logfile.txt -L Please make sure there is sufficient quoting around the arguments. $
FWIW, the patch from 0.27.0 in the ImportPage.refresh_camera() doesn't solve the problem on my Aquaris M4.5 Android device. Also, I get the same error as reported above by richw@richw.org when invoking gphoto2.
As it is, the error message tells the user that shotwell was unable to claim the USB device, and nothing more. Whatever that means to the user. The workaround to unmount the volume from the file manager doesn't occur to most of them. A more explicit error dialog for error -53 would greatly improve the user experience. The one from gphoto2 could serve as inspiration. What about "Could not claim the USB device (-53). Make sure no other program is using the device and that it is not mounted."
The camera, I assume, is getting mounted automatically when it is plugged in. But even if I unmount the camera, I'm still unable to get Shotwell to connect to the camera. I tried this just now, and I got an error box saying this: Shotwell Unable to fetch previews from the camera: Unspecified error (-1) The only way I've been able to upload photos lately has been to copy the JPG files from the camera to the computer's hard drive, then use Shotwell's "Import from Folder" function on the hard drive copies. This is unreasonably complicated for an ordinary user to be expected to have to do. Uploading from a camera used to work, a long time ago, but it's broken now. My dear, 95-year-old mother (who really doesn't understand the difference between Linux and Windows) is still running Ubuntu 12.04, on which Shotwell can be made to work with some coaxing from me. I really want to upgrade her to a new Ubuntu version with support, but I don't dare do so now because it would break Shotwell and leave her asking me if she needs a new computer. :-(
Which desktop are you on? It works perfectly fine on 17.10 with GNOME with all of my PTP/MTP devices.
(In reply to Richard B. Kreckel from comment #13) > FWIW, the patch from 0.27.0 in the ImportPage.refresh_camera() doesn't solve > the problem on my Aquaris M4.5 Android device. Also, I get the same error as > reported above by richw@richw.org when invoking gphoto2. For the record: This was on Debian stretch (stable) running Gnome 3.22.2.
Are you able to talk to the device with gphoto2 if no desktop session is running?
I'm running Ubuntu 16.04.3 LTS with MATE. My phone is a Samsung Galaxy S5 running Android 6.0.1. I can try other desktop session options in a few days' time, once a long-running xterm job is done. However, switching from MATE to a different desktop is not an acceptable long-term strategy for me.
I tried running Shotwell using the Unity desktop, and the result was exactly the same -- same errors as with the MATE desktop.
(In reply to Jens Georg from comment #18) > Are you able to talk to the device with gphoto2 if no desktop session is running? Yes, I can get a complete file listing with gphoto2 -L from the device if no desktop session is running. Also, I can talk to the device with gphoto2 after unmounting it from the desktop session. OTOH, if a desktop session is running, I get error -53: 'Could not claim the USB device. And if a desktop session of another user is running (which has mounted the device), I get a plain error -7: 'I/O problem'. (Again, this is on Debian stretch (stable) running Gnome 3.22.2.)
That's an interesting difference in behavior. Additionally, I don't understand why shotwell doesn't prompt the user to unmount; that probably needs some more investigation. richw: The issue was more to check when there is NO desktop running at all; It might be that the two issues are different and GPhoto is not able to talk to your device at all, while Richard's device is just blocked by gvfs.
(In reply to Jens Georg from comment #22) > That's an interesting difference in behavior. Additionally, I don't > understand why shotwell doesn't prompt the user to unmount; that probably > needs some more investigation. Ah! In method ImportPage.try_refreshing_camera(fail_on_locked=true), variable RefreshResult has value 1==BUSY, as returned by ImportPage.refresh_camera(). But the BUSY case does not prompt the user to unmount! Indeed, if I modify the program and let it go to the LOCKED case, a meaningful dialog appears. Next problem, a few lines down: Shotwell doesn't display the "Shotwell needs to unmount the camera..." dialog but the "The camera is locked by another application" dialog. Apparently, File.find_enclosing_mount(null) has returned null. Why is this?
(In reply to Richard B. Kreckel from comment #23) > Next problem, a few lines down: Shotwell doesn't display the "Shotwell needs > to unmount the camera..." dialog but the "The camera is locked by another > application" dialog. Apparently, File.find_enclosing_mount(null) has > returned null. Why is this? The uri of find_enclosing_mount() is "gphoto2://[usb:005,017]/". But, according to gvfs-mount -l, it should be "mtp://[usb:005,017]/". Indeed, if I replace "gphoto2" with "mtp" when I create File uri, shotwell can unmount the camera and access all photos on it.
Do you know where the gphoto2 is coming from?
(In reply to Jens Georg from comment #25) > Do you know where the gphoto2 is coming from? From method CameraTable.get_port_uri(string port) in src/camera/CameraTable.vala:1004.
Created attachment 362746 [details] [review] fix for "could not claim USB device (-53)" problem I can confirm that the attached patch fixes the problem for me. I don't understand enough of gvfs to be sure it is correct, though.
Ah! I think your device is blocked by gvfs-mtp-volume-monitor, not gvfs-gphoto2-volume-monitor.
(In reply to Jens Georg from comment #28) > Ah! I think your device is blocked by gvfs-mtp-volume-monitor, not > gvfs-gphoto2-volume-monitor. Seems so. Both processes are running. A more flexible fix is needed, then?
(In reply to Richard B. Kreckel from comment #27) > I can confirm that the attached patch fixes the problem for me. For the record: That patch works on Debian stable (9.1) and on current Debian testing (buster/sid).
richw@richw.org, can you please also check gvfs-mount -l ?
I connected my phone. I got a prompt on the phone to deny or allow access to device data; I chose "allow". A Caja window (remember, I'm using the MATE desktop) appeared for the phone, showing two top-level items, "Card" and "Phone". "gvfs-mount -l" at this point returned no output and exit status 0. Not sure if this detail is relevant or not, but I've configured my phone's camera app to store photos on an SD card, due to limitations in the phone's own memory.
I successfully imported photos to Shotwell from my Samsung tablet (where the photos are stored in the device's own memory, not in a card). I will try switching my phone's camera app to store photos directly in the camera's memory, rather than on a card, and see if that makes a difference. However, I would hope it's not unreasonably hard to make Shotwell capable of looking for photos on a card -- for some users/devices, there may not be a viable alternative.
I still think there is some problem of gphoto2 communicating with the aquarius. I can check if we have that device available at work as one of our test devices, but I don't have high hopes that I can find one.
(In reply to Jens Georg from comment #34) > I still think there is some problem of gphoto2 communicating with the > aquarius. I can check if we have that device available at work as one of our > test devices, but I don't have high hopes that I can find one. Oh, I thought I was chasing a general problem. For the record: * Gphoto2 doesn't do anything special with the Aquaris M4.5, it calls LibUSB's libusb_claim_interface function. * LibUSB doesn't doe anything special either. The ioctl(fd, IOCTL_USBFS_CLAIMINTF, &iface) in claim_interface() fails (file linux_usbfs.c:1416) with EBUSY on the Aquaris M4.5, but apparently not on other devices. Weird. Anyway, since it works fine when the phone is unmounted, can Shotwell's error message please be improved? "Could not claim the USB device (-53)" is just irritating. Some hint at unmounting it from the file manager would be nice. (The diagnostic message of gphoto2 includes such a hint, and this is helpful.)
Oh, sorry, I mixed up the phones.
Created attachment 363222 [details] [review] Fix unmounting devices on MTP conflict Apparently there are devices that are occupied bz the MTP volume monitor. Fix unmounting those cameras as well
Can you please test this patch? I assume it should fix Richard B. Kreckel's problem.
(In reply to Jens Georg from comment #38) > Can you please test this patch? I assume it should fix Richard B. Kreckel's > problem. Tested the patch: Yes, it does solve my problem with the Aquaris M4.5.
Attachment 363222 [details] pushed as 4d4041a - Fix unmounting devices on MTP conflict
I'm running Shotwell 0.27.1, on an Ubuntu 16.04 LTS system, installed via the Ubuntu PPA. Shotwell still will not talk to my Samsung Galaxy S5 phone. I connected the phone, and I responded to an "allow access to device data" prompt on the phone by touching "allow". Shotwell recognizes the phone (under "Cameras") as "SAMSUNG_Android". It says "Connecting to camera, please wait...", but nothing more happens, even after several minutes.
I've tried the above with both the phone (device) and the memory card as the picture storage location, but Shotwell can't find the photos either way. Unlike what happened earlier, with 0.27.1 I'm not getting any of the confusing (and, to a novice, likely incomprehensible) error boxes about not being able to "claim USB device". But it's still not working. I can work around this issue, to be sure, by copying photos from the phone to /tmp and then doing an "import from folder" operation, but I trust you'll understand why I'm unwilling to accept this as a real solution.
Hi. Any more word on this issue?
Can you please check whether or not the camera is accessible by gphoto2 -L when you do not boot into any desktop environment?
I recently upgraded my phone from a Samsung Galaxy S5 running Android 6 ("Marshmallow") to a Samsung Galaxy S8 running Android 7 ("Nougat"). When I connected my new phone to my Ubuntu 16.04 LTS desktop and launched Shotwell 0.27.2, I got a message asking for permission to unmount the phone's file system in order for Shotwell to continue. I said yes, and Shotwell successfully downloaded the photos on the phone. So, for me, the problem appears to be solved. Whether this is because of my new phone, or because I am now running Shotwell 0.27.2 (instead of 0.27.1), I can't tell. I still have my old phone and may try experimenting with it if I have time.