MTP file transfer not working with Ubuntu/Kubuntu 20.04

I just have a fresh install of Kubuntu 20.04 on an Acer Swift 3 laptop. I ran into problem with transferring files from my Android phone. Here was the steps I went through:

  1. Plug the phone into USB port. The device shows up on Kubuntu (Dolphin and popup notification)
  2. Unlock the phone and accept permission.
  3. Click on the device and got the following error:

No storage media found. Make sure your device is unlocked and has MTP enabled in its USB connection settings.

When I run mtp-detect, I got the following error:

$ mtp-detect
libmtp version: 1.1.17

Listing raw device(s)
Device 0 (VID=04e8 and PID=6860) is a Samsung Galaxy models (MTP).
Found 1 device(s):
Samsung: Galaxy models (MTP) (04e8:6860) @ bus 3, dev 11
Attempting to connect device(s)
error returned by libusb_claim_interface() = -6LIBMTP PANIC: Unable to initialize device
Unable to open raw device 0
OK.

dmesg:

[ 1799.438225] usb 3-1: new high-speed USB device number 16 using xhci_hcd
[ 1799.593572] usb 3-1: New USB device found, idVendor=04e8, idProduct=6860, bcdDevice= c.00
[ 1799.593575] usb 3-1: New USB device strings: Mfr=7, Product=8, SerialNumber=9
[ 1799.593576] usb 3-1: Product: SAMSUNG_Android
[ 1799.593577] usb 3-1: Manufacturer: SAMSUNG
[ 1799.593578] usb 3-1: SerialNumber: 27a0c9216c1c7ece
[ 1799.603905] cdc_acm 3-1:1.1: ttyACM0: USB ACM device

lsusb:

$ lsusb
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 003: ID 1c7a:0575 LighTuning Technology Inc. EgisTec EH575
Bus 003 Device 002: ID 0408:a094 Quanta Computer, Inc. HD User Facing
Bus 003 Device 004: ID 8087:0026 Intel Corp. 
Bus 003 Device 016: ID 04e8:6860 Samsung Electronics Co., Ltd Galaxy series, misc. (MTP mode)
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

But something is really strange. It works if I do the following:

  1. Plug the phone into laptop.
  2. Boot the laptop.
  3. Once Kubuntu loaded, run $ mtp-detect. This time mtp-detect no longer reports any error.
  4. Access the phone device via Dolphin works now.

Then MTP file transfer will work, until the phone is unplugged. Replugging the phone in will not work anymore.

I really have no idea what is going on. Any help is much appreciated.


Solution 1:

I'm also confronted by this bug and have discovered this issue reported elsewhere:

https://bugs.mageia.org/show_bug.cgi?id=28216

And here:

https://bugs.kde.org/show_bug.cgi?id=442170

If I understand correctly, a fix is available here:

https://github.com/libusb/libusb/commit/f6d2cb561402c3b6d3627c0eb89e009b503d9067

Unfortunately, my Linux Voodoo only goes so far. I don't know how to implement this fix, but maybe you do. It might also be possible to install later versions of Libusb (the package that seems to be at issue):

https://packages.ubuntu.com/search?keywords=libusb

But I leave that to others better suited to advise. I only post this with the hope that others with more experience can explain to us how to implement the fix.