How to transfer files via USB cable between computer and Librem 5?

I want to exchange files but when I connect my L5 with my computer via USB cable all I get is a ominous network problem message (“Connection failed. Activation of network connection failed”) but the storage of the L5 is not mounted automatically on my computer.

How can I do this (easily), is there a setting in PureOS, a good App for that…?

On my computer I can see this log:

~  > dmesg | tail
[61875.851036] usb-storage 3-1:1.4: USB Mass Storage device detected
[61875.851306] scsi host8: usb-storage 3-1:1.4
[61876.867447] scsi 8:0:0:0: Direct-Access     Linux    File-Stor Gadget 0509 PQ: 0 ANSI: 2
[61876.867812] sd 8:0:0:0: Attached scsi generic sg10 type 0
[61876.868016] sd 8:0:0:0: Power-on or device reset occurred
[61876.868294] sd 8:0:0:0: [sdj] 2048 512-byte logical blocks: (1.05 MB/1.00 MiB)
[61876.868470] sd 8:0:0:0: [sdj] Write Protect is off
[61876.868475] sd 8:0:0:0: [sdj] Mode Sense: 0f 00 00 00
[61876.868593] sd 8:0:0:0: [sdj] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[61876.889126] sd 8:0:0:0: [sdj] Attached SCSI disk

PS: Interestingly the FAQ states it should work out-of-the-box:

Can I transfer my photos, files, downloads from Android or iOS to the Librem 5?

Yes, you will be able to use the phone as a storage device, that can show up on your computer by just plugging in the USB cable and viewing the folders. This will allow you to import or export files, photos, documents, with ease. With the Librem 5 there is no proprietary software that locks your files into proprietary formats, allowing easy sharing of the content you want to share.

PS 2: May be related to Transfer files between the L5 and networked computers

2 Likes

Relevant thread:

I think it’s easiest to set up the network between the 2 computers and go from there. You’ll notice that when the Librem 5 is connected, there’s a new network card registered.

GNOME doesn’t have anything for this as far as I can tell, but Plasma offers a “share connection” option that the phone can pick up.

Then you can copy as with any other networked computer (tiny HTTP server, sshfs, whatever else).

Mass storage will never work nicely, and in fact we hope to remove that registration at some point.

2 Likes

My current work-around is mounting a NAS share via SMB protocoll from the phone (after installing cifs-utils).

I was hopeful to see a mtp-based solution (perhaps at least for the SD memory card in the phone) since network-based solutions require a non-trivial setup for each environment which prevents ad-hoc file transfers.

I have no trouble using a USB-C drive to transfer files. (-C to -A connectors).

Example: https://www.amazon.com/SanDisk-128GB-Ultra-Drive-Type-C/dp/B01EZ0X55C

1 Like

Sounds promising! Just to be sure: You are attaching a USB drive to the L5 phone to exchange files with your computer? Do you have use an OTG adapter for that?

PS: My preferred scenario is attaching the L5 via USB to my computer, but taking a small “detour” via an USB stick is also OK for me

2 Likes

Yes.
No OTG adapter. (That’s a different thing.)
This method will also come in handy when you’re traveling, as you can back up your photos or share files with someone else.
Edit: Plug the -C end into the phone. Copy files to it. Disconnect, then plug the -A end into your computer to paste. Or reverse the process.
Or insert into another device with -C end, etc.

3 Likes

You will also need to install a file manager on the L5 if you want to do this by GUI. I use Nemo; some other people are using Nautilus.

1 Like

I do not need any application. If there is just a network after plug-in the USB cable in the laptop (i.e. USB tethering) you can SSH into the phone or SCP files between mobile and laptop. I do this all the time with my Linux phone BQ E4.5 (running UBports) and my FreeBSD laptops.

I do that, too, but if you want to copy a large batch at once, the USB is more convenient. My drive actually has a USB-B adapter, too, so I can move to any other device I have lying around, as well.

If SSH is working then sshfs should work too - and then you can use all the normal tools and applications on the big computer. How you get the local network could be any of: WiFi, ethernet via dock or similar, network adapter over USB.

For a large large batch, you could use the uSD card as sneakernet. That might be slower than using the network though.

So far I have only used scp as I have only needed to move a file now and then.

I suppose I should try out ‘network over USB’ at some point.

sftp://USER@LIBREM

works fine in the Gnome file browser when you have an openssh server running on the phone. You can browse, copy, etc…

1 Like

I have taken to use my Nextcloud as an intermediary storage. Put anything there that I need to access from my phone and connect to it using the GnomeOnlineAccounts thingie.

1 Like

Oh, I meant setting up the network connection itself.

Did you ever find a solution to your question that was not a workaround? In particular

  1. how to get rid of “ Connection failed. Activation of network connection failed ” message, and

  2. how is best way to access phone files from something like Debian?

The best way is ssh and scp over a Terminal or Shell, but for beginners its difficult to set up.

However most Users feel to have an USB Adapter and just plug in some USB-Stick to the Phone and later to the Computer.

You can use E2E encrypted Messengers too or just mail some tar-Files encrypted with password by e-mail.

… and to be clear … that means SSH (over IP) over WiFi on the Librem 5 end - not via USB cable.

I regularly use sshfs which I guess is even more setup but it does allow all vanilla shell file access commands etc. to work on the host computer, rather than requiring the use of scp or sftp.

1 Like

Why not? I often use it this way.

1 Like

Because I only have one cable that came with the Librem 5 and that is ‘permanently’ attached to the Librem 5’s charger which is in the phone charging area, not particularly near to the computer that I would want to use to send the files to the Librem 5. So WiFi is just more convenient (can be done regardless of whether the Librem 5 is on charge or next to the computer or elsewhere in the house), and WiFi is fast ‘enough’.

There’s nothing wrong with doing it via USB cable and I didn’t intend to imply that you can’t do it. SSH over IP can be IP over whatever is available.

I think the implication of the post to which I was replying was … be mindful of how much one-off setup is involved to get it going, and whether that is appropriate for a newb to handle. Most customers will already have WiFi working on the Librem 5, so that is one less thing to think about.

Heck, if I am going to drag the Librem 5 physically over to the computer and connect a cable to the Librem 5, I can use my USB-to-ethernet dongle into the Librem 5 and transfer files over ethernet. :slight_smile:

Well, it all depends on the circumstances - if I’m using a laptop on a train with spotty cellular coverage and want to copy something from/to the phone, then getting the USB cable out of the bag is easily the most convenient option :smile: Same at home with USB cable attached to my computer, which then charges the phone as I’m sitting next to it.

In fact, with mDNS name resolution I don’t even have to think about which interface am I going to use. When it’s connected over USB it simply uses USB automatically, and when not it goes through WiFi. I also have an option to use cellular data over a VPN, but that’s the last resort thing as that connection is metered :wink:

I attach the L5 with its original USB charger cable to my MacBook, and do (for example)

Mac:~ $ ssh purism@192.168.33.2
Linux pureos 6.2.0-1-librem5 #1 SMP PREEMPT Fri May 19 14:12:38 UTC 2023 aarch64

You have mail.
Last login: Mon Jun 12 09:40:22 2023 from 192.168.33.1
inhibiting suspend ...
purism@pureos:~$ ls -l foo
-rw-r--r-- 1 purism purism 0 Jun 12 09:40 foo
purism@pureos:~$ exit
logout
Connection to 192.168.33.2 closed.

Mac:~ $ scp -p purism@192.168.33.2:foo .
foo                                           100%    0     0.0KB/s   00:00
...

Ofc I normaly do not use its IP addr 192.168.33.2, but l5usb from a line in /etc/hosts, the IP addr was only for demonstration here.

2 Likes