2

So yeah it seems to me most people don't bother with USB anymore and just connect wirelessly using KDE Connect app but honestly I'd rather just do it wired, wired is the most secure way to do it in my opinion, I just want to plug my phone into the PC via USB and transfer files.

So what is the definitive way to plug my phone into my PC via USB and transfer files from phone to PC or vice versa?

I went and googled "how to connect android smartphone to computer through usb linux" and hardly any search results turned up, and the ones that did turn up are out of date (it seems to me the vast majority of Linux users just use KDE Connect app, it seems hardly anyone bothers with USB anymore) but I really don't want to transfer files wirelessly I'd much rather do this through a wire.

This turned up on Google search though, this article tells you how to transfer files via USB on Linux but how accurate is it? https://www.debugpoint.com/how-to-access-android-devices-internal-storage-and-sd-card-in-ubuntu-linux-mint-using-media-transfer-protocol-mtp/

I mean I thought it was going to be so easy, I thought I'd just plug my phone into my PC and transfer a few files, I didn't think it'd be this hard. So like I said, it seems to me basically everyone just uses KDE Connect, it seems hardly anyone even bothers with USB anymore. I don't know, should I just go with KDE? But is KDE 100% secure? Whereas I know a USB wire is totally secure. But it looks like transferring files via USB isn't going to be as easy as I thought it'd be on Linux.

Please I just need experts to tell me what to do here? What do i do?

I guess if I'm told "Hey don't bother with USB, just use KDE." Then I guess I'll consider doing that. I just thought it would be so easy to do this using USB but here I am about ready to pull my hair out, I'm very frustrated with this.

Btw I've got a Pixel 6a smartphone and it came with a USB adapter that plugs into the USB-C port on the phone, that way I can hook up a regular USB cable to the phone. I ordered a USB 3.0 data transfer cable off of Amazon.

user68186
  • 37,461
SpaceX
  • 155

4 Answers4

6
  • Copying files via USB from my android phone to the PC with Ubuntu is easy, connect the phone directly to the PC via USB. As already mentioned by yehtetmaungmaung, in the phone you must allow it (in a popup window).

    enter image description here

    I do this often in order to copy photos to the PC, and I use two windows of the file browser 'Files' alias nautilus for this purpose, one viewing the source directory in the phone and one viewing the target directory in the PC).


  • Copying files directly via USB from the PC to my android phone does not work. It is 'not allowed'. I have not looked into the details, because I would seldom need it. (I guess the security/privacy settings of my phone are preventing it.)

    But there are workarounds to copy from the PC to the android phone:

    • Email: I can attach files that I send to myself via email (and download those files into the phone).

      enter image description here

    • Pendrive: I have a USB pendrive with a standard type A connector in one end and a type C connector in the other end.

      enter image description here

      With an MSDOS partition table and a FAT32 or exFAT file system I can transfer files in both directions (to and from the android phone). But it is a two-step operation.

      Learn how to unmount the file system in the USB pendrive from the phone, particularly important after writing to the USB pendrive. The menu system may vary between android versions, but this link should be helpful, even if it does not match exactly for your phone.

      To safely remove a USB device from your Samsung tablet, follow these steps:

      1. Tap the Apps icon on the home screen.
      2. Tap Settings.
      3. Tap the Device tab.
      4. Tap Storage.
      5. Tap the USB device you want to remove.
      6. Tap the Eject icon.
      7. Tap OK to confirm.

      Your USB device should now be safely removed from your Samsung tablet.

      • First plug the USB pendrive to one device (for example the PC) and copy the files to the USB device. Unmount it (to avoid corruption of the files), and unplug it.

      • Next plug the USB pendrive to the other device (for example the phone) and copy the files from the USB device. Unmount it (to avoid corruption of the files), and unplug it.


Edit 1:

  • I tested some settings in my android phone (in the pulldown menu when connected to my computer). I let

    • the phone control USB
    • use USB to transfer files

    enter image description here

  • I also tested with Windows, where I could both read and write. In Windows I found no way to 'unplug safely' alias eject alias unmount the partitions on the phone (built-in drive and card), so I shut down Windows. I have Fast Startup (semi-hibernation) turned off in my Windows system, so it flushes the buffers in the shutdown process.

Going back to Ubuntu, suddenly I could both read and write. I am not sure what happened.

  • Maybe the 'dirty' bit was set, and it was cleared after the visit to Windows with the proper shutdown. It is well known that a dirty bit makes Ubuntu unwilling to write to a file system, and it can be fixed by Windows

    • reboot (always)
    • shutdown (only when Fast Startup is switched off).
  • Maybe the modified settings in the pulldown menu of the phone made the difference.

  • Maybe both of the above actions made copying to the phone (writing in the phone) work.

I am inclined to blame the 'dirty bit', but need more testing to really know how to fix the problem. Finally, I must agree that it should be easier to write to a phone via USB cable from Ubuntu.

Edit 2:

Here are a couple of tips, that can be useful if you want to do 'more' than what your standard tools can manage.

  • The command line tool gio can be useful, if/when some standard commands do not work, for example

    gio mount ...
    gio copy ...
    

    See man gio for details.

  • In the current Ubuntu versions (2023-2024), for example 22.04.3 LTS, when the phone is connected via USB (and mounted automatically), I find the path to it using this command,

    find /run/user/*/gvfs -maxdepth 1 -name 'mtp:*'
    
sudodus
  • 47,684
2

I had the same problem,no popup when connecting my tablet to my pc in xubuntu. It was a good cable,the one I also use to transfer files to my e-reader and that works. What I found is when I connected my tablet to the pc there is message in the pull down menu from the top on my tablet with 'tablet loading' (in dutch - tablet opladen) and very small below it: more options. When I clicked that I found a page with usb options what is allowed. Just loading only or also transferring files. I choose the last one and it all worked fine.

1

As far as I know, when you plug in a usb, you need to tap in on your phone and check use for file transfer. My phone automatically pops up notification for you to choose how this USB is used for connection.

1

In Ubuntu 24.04 setting up a USB/Android cable connection takes 5 to 10 seconds. I've tested connecting to Android 9, 12 & 13 and the responses differ but all require a single click.

Requirements:

  1. A USB C data transfer cable. (No visible difference to a charging cable but contains additional wires used for data so you have to test)
  2. USB debug mode enabled on your Android device.

When you connect the devices a phone icon appears in the Ubuntu Dock (similar to that of a connected USB drive) and a pop up window opens on the Android device with an option to allow data transfer. Select that and the Ubuntu file manager treats the phone like an external drive. That's it.

Hillman
  • 21
  • 3