Attempting to copy music (m4a) files from laptop to external device (LG G7 phone connected via usb cable) via mass copy-paste of a list of directories. Randomly, copy/paste will stop and error reported.

Bug #1813429 reported by Chad Paine on 2019-01-26
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
libmtp (Ubuntu)
Low
Unassigned

Bug Description

Steps to reproduce:
1) Plug phone into computer.
2) Copy a large number of directories with nested file structures to phone from computer hard drive, via Nautilus: [highlight files on computer, then ctrl-c; go to directory on phone, then ctrl-v].

Expected outcome: No copy errors.
Actual Outcome: Usually, the expected outcome; randomly, Error:
    "Error while copying <filename>.m4a>. There was an error copying the file into
    mtp://LGE_LG-G710_LGG710PMd4...". Show more details : "File not found".
    Options: ["Cancel","Skip All","Skip"].

I can't force reproducibility, sometimes it won't complain, but larger copy/paste datasets correlate to more likely ending up with an error.

Workarounds: At error, select 'Cancel'; delete the offending subdirectory/file from the phone; restart the copy-paste operation from the point of failure; repeat as necessary.

lsb_release -rd: "Ubuntu 18.10"
apt-cache policy nautilus:
"nautilus:
  Installed: 1:3.26.4-0ubuntu7.1
  Candidate: 1:3.26.4-0ubuntu7.1
  Version table:
 *** 1:3.26.4-0ubuntu7.1 500
        500 http://us.archive.ubuntu.com/ubuntu cosmic-updates/main amd64 Packages
        100 /var/lib/dpkg/status
     1:3.26.4-0ubuntu7 500
        500 http://us.archive.ubuntu.com/ubuntu cosmic/main amd64 Packages"

ProblemType: Bug
DistroRelease: Ubuntu 18.10
Package: nautilus 1:3.26.4-0ubuntu7.1
ProcVersionSignature: Ubuntu 4.18.0-13.14-generic 4.18.17
Uname: Linux 4.18.0-13-generic x86_64
ApportVersion: 2.20.10-0ubuntu13.1
Architecture: amd64
CurrentDesktop: ubuntu:GNOME
Date: Sat Jan 26 14:01:47 2019
ExecutablePath: /usr/bin/nautilus
GsettingsChanges: b'org.gnome.nautilus.window-state' b'geometry' b"'890x550+67+30'"
InstallationDate: Installed on 2019-01-10 (16 days ago)
InstallationMedia: Ubuntu 18.10 "Cosmic Cuttlefish" - Release amd64 (20181017.3)
ProcEnviron:
 SHELL=/bin/bash
 XDG_RUNTIME_DIR=<set>
 PATH=(custom, no user)
 LANG=en_US.UTF-8
SourcePackage: nautilus
UpgradeStatus: No upgrade log present (probably fresh install)
usr_lib_nautilus:

Chad Paine (chadpaine) wrote :
Sebastien Bacher (seb128) wrote :

Thank you for your bug report, could you give some details on how is connected your phone? with a cable in mtp mode? Could you also add the journalctl log from a session which showed the issue? (and maybe include a screenshot of the error dialogà

Changed in nautilus (Ubuntu):
importance: Undecided → Low
status: New → Incomplete
Chad Paine (chadpaine) wrote :

I reproduced the bug again this morning, first thing this boot cycle. I am including the journalctl log as requested, as well as a screenshot.

Yes, my phone was plugged into the computer via usb cable.

Chad Paine (chadpaine) wrote :
Sebastien Bacher (seb128) wrote :

The log has that error at 08:06:01, do you remember if that's the time where you saw the problem?

gvfsd[2501]: PTP_ERROR_IO: failed to open session, trying again after resetting USB interface
gvfsd[2501]: LIBMTP libusb: Attempt to reset device
kernel: usb 2-4: USB disconnect, device number 6
gvfsd[2501]: inep: usb_get_endpoint_status(): No such device
gvfsd[2501]: outep: usb_get_endpoint_status(): No such device
gvfsd[2501]: libusb_open() failed!: No such file or directory
gvfsd[2501]: LIBMTP PANIC: Could not init USB on second attempt

The log suggest that the lower level stack kernel/libmtp acted like if the device vanished and got plugged again. Are you confident the cable doesn't have a loose connection? Does copying from the same device/cable works fine from other computer (or ideally from the same computer on another OS)?

Chad Paine (chadpaine) wrote :

Yes, that's the proper time code.

Yes, I'm also sure that it's not a problem with the physical connection.

A) Problem with USB hub/connector

No. Following the same steps but replacing the phone with a regular USB (EMTEC-brand) 64GB thumb drive, and using the same USB connector, I am able to move the music folders/files over with no errors.

B) Problem with the phone / charging cable

When I first connect the phone to the computer, the phone asks me to allow/disallow USB file transfer. Also, the phone charges whenever it is plugged in to an applicable USB port, even during data transfer. The phone never stopped charging during the event; neither did the phone indicate any need to reconnect to the computer nor have me re-authorize data transfer. This indicates the phone never thought it had been disconnected from the power source, at least. If there's a diagnosable problem on the phone's side, I wouldn't know how to debug that.

As for the cable, it's new. I have used it only three times, and keep it wrapped up in the original packaging when not in use. I've only used the cable between my phone and the computer in question, though. As indicated before, however, I don't think there's a problem with the cord because the phone never stopped charging during the event.

I do have other devices I can attempt to move files between, but haven't given that a go yet. I'm
now moving the music files off my computer and onto a flash for some testing on another box later this afternoon.

Chad Paine (chadpaine) wrote :

As part of a more thorough test of the connection of my device, I reproduced the error again today, and also installed gmtp (1.3.10-1) on my system to see if I could move files over more easily that way instead. gmtp fails to connect to my device. I'm including another journalctl, testing started about 8:40am. You should find similar errors relating to my reproduction of the file transfer via copy/paste, and there may or may not be errors relating to gmtp failing to connect to my phone.

Also, here are the warnings gmtp gives me when I try to have it connect to the device:

Device 0 (VID=1004 and PID=631c) is a LG Electronics Inc. Various E and P models.
error returned by libusb_claim_interface() = -6LIBMTP PANIC: Unable to initialize device
Detect: Unable to open raw device?
LIBMTP PANIC: Trying to dump the error stack of a NULL device!
LIBMTP PANIC: Trying to clear the error stack of a NULL device!

Chad Paine (chadpaine) wrote :

<edit last comment> The 'warnings' from gmtp are coming from the command line, not the graphical portion of the application.

Changed in nautilus (Ubuntu):
status: Incomplete → New
Chad Paine (chadpaine) wrote :

From the error generated by gmtp: 'error returned by libusb_claim_interface() = -6LIBMTP PANIC: Unable to initialize device'

If we add a newline:

'error returned by libusb_claim_interface() = -6
LIBMTP PANIC: Unable to initialize device'

I looked up libusb error -6. It indicates that the device in question is "BUSY".
https://github.com/libusb/libusb/blob/master/libusb/libusb.h:1074

Should I report this as a bug to libusb/gmtp? The computer wasn't performing any other read/write operations with the phone when I tried to attach gmtp, so far as I am aware. I might have had nautilus open inside of a directory on the phone's storage, to confirm the device was connected, but that's it.

Sebastien Bacher (seb128) wrote :

Unsure at this point where the issue is but it seems with the lower part of the stack so libmtp/libusb/kernel probaly...

affects: nautilus (Ubuntu) → libmtp (Ubuntu)
Chad Paine (chadpaine) wrote :

Might be related to https://forum.antergos.com/topic/10165/how-to-connect-access-android-smartphone-via-usb

Im going to try installing android-udev next time I have my box on. But the guy's post indicates he failed completely, while with my issue, I can at least move files over in chunks.

Chad Paine (chadpaine) wrote :

I observed that libmtp contains a large listing of device/vendor information tied in with special flags for handling/mitigating errors. I noticed my device is not in the list.

idVendor=1004, idProduct=631c

https://sourceforge.net/p/libmtp/code/ci/master/tree/src/music-players.h

Not sure if libmtp's adding of my device's info and related device flags would make a difference?

https://sourceforge.net/p/libmtp/code/ci/master/tree/src/device-flags.h:314

Chad Paine (chadpaine) wrote :

Please Disregard last comment. It is listed.

Chad Paine (chadpaine) wrote :

android-udev-rules https://github.com/M0Rf30/android-udev-rules as installed exactly according to the directions did not fix the issue.

Noticeably, however, the file transfer got further than average by a great margin.

Dylan Aïssi (daissi) wrote :

I'm wondering if it could be related to https://sourceforge.net/p/libmtp/bugs/1797/.
Newer Linux kernels require an updated udev rule which is only available with libmtp 1.1.16 (not in cosmic).

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers