Librem 5 USB Mount to Linux

The SD card on my old Galaxy SIII smoked… one more sign that it might not last until my Evergreen arrives. I installed an old SD card I had laying around and it mounted, so I plugged the phone into a USB port on my Linux Mint workstation to copy over some music. It just mounted and I dragged some folders across from the PC. Then I realized that I take this behavior for granted. What happens when you plug the Librem 5 into a PC with a USB cable? Does it work this way on Chestnut?

I don’t know wether that works so far but as an easy alternative you could just use SCP to copy data through a wireless SSH session.

1 Like

Good questions. It has been discussed before.

MTP is what I am used to - but I am not wedded to that particular protocol. You will note that the second link above suggests simply syncing via WiFi.

For my L5, I plan to put music on the µSD card, which means that I could load the card by putting the µSD card in the host computer, loading it up and then moving the µSD card to the L5.

The outstanding question is whether, via the USB interface (as yet unspecified?), the eMMC drive will be exposed in some way.

I suspect that the answer right now is: lower priority but it’s on the radar.

Thanks for finding that. I looked, but I didn’t see it when I started this thread.

I agree about pulling the µSD and SSH, but plugging in the USB is just so damned convenient. I keep forgetting that I I won’t have to plug it in at all if I don’t want to, as it will integrate into my home LAN just like my other Linux boxes.

Still, I can’t wait to see if the local file system is exposed when plugged in via USB.

After some googling I found out that some raspberry Pis (the Zero/A/A+ specifically as those support USB-OTG, which I’ll assume Librem 5 also supports?) has made this possible.

There seems to be some kernel module which makes the device work as a standard USB mass storage device called g_mass_storage, in the example it points directly at a image file though rather than a local filesystem, not sure how to point it to the running filesystem. I found it in this guide, see the bottom about “g_mass_storage”

Once I receive my Librem 5 I could attempt making a simple app for this.

That isn’t safe though, is it? … exposing a local disk as a USB mass storage class device while it is being used by the device itself.

It can be made safe if the device itself is capable of running without using the local disk for the entire period that it is being used by the connected computer e.g. can boot into some kind of RAM-only mode that does not touch the local disk (after booting).

However that isn’t very convenient, hence my suggestion for something like MTP or anything equivalent to that.


Hm, seems like you’re correct.

Was a long time since I used MTP but back then it was not very widely supported so I always avoided it.
But it seems like android has a good reason why it removed USB mass storage support after a while, so maybe it’s not a very good idea after all.


Interesting. When I plugged the Galaxy SIII into Mint the other day, both the phone internal storage and the SD card were exposed to Linux. Of course, the SIII is OLD.

Also interesting… I double-clicked and MP3 file and it opened xplayer, which promptly told me that it did not have an MTP plugin installed. That’s when I realized that I had double-clicked on the phone MP3’s, not the copy I had made on the Mint machine. Xplayer worked fine from the file on Mint, as it wasn’t trying to stream the MP3 across a USB cable.

It ought to be transparent to xplayer (and anything else) if you have the GVFS MTP backend installed and working. However there are a lot of moving parts e.g. whether the phone identifies itself as having, among other things, an MTP USB device class e.g. whether Mint recognized that correctly e.g. how Mint chose to handle that.

By default, you get a network device and a emulated serial port when connecting the Librem 5 to a PC via USB - so you can use tools like scp, rsync etc.

That’s however just the default; you can reconfigure the usb gadget to export the SD card directly as a mass storage device just fine. Of course it then needs to be unmounted locally for the time of being exported.

Technically there’s also nothing to stop you from implementing MTP mode, but I have no idea how easy would that be and if there’s some existing prior art already.


Which, in the case of the eMMC drive, is why we were ruminating about MTP (or other equivalent protocols).

1 Like

Please, how do you actually do this?

I’m plugging a Librem 5 to a Librem 13 with a USB-C cord.

How, from the Librem 13 command line, do I connect to the Librem 5? I have no idea what the IP address of the phone is (and ip addr on the phone returns nothing useful).

1 Like

How you actually do this depends less on the physical machine your connecting to and more on the OS you are running.

Out the box, the Librem 5 supports Ethernet over USB and by default it runs a DHCP client on the interface so is looking for IP configuration from a DHCP server, so the machine you are connecting to would need to support and be running connection sharing to provide the Librem 5 with an IP address.

How you setup connection sharing on your machine very much depends on your OS.

The OS I use uses NetworkManager to manage all network connections so I can use nmcli from the command line to setup connection sharing. There is a myriad of configuration setups, it really depends on your requirements, to setup a basic connection share using nmcli on single interface…

  1. Determine the device/interface to enable connection sharing on by attaching the Librem 5 to a USB port of your machine and from the command line of the machine enter…
nmcli dev

This will produce an output similar to…

DEVICE           TYPE      STATE                                   CONNECTION
enxe44b62d3acf5  ethernet  connecting (getting IP configuration)   Wired Connection N
lo               loopback  unmanaged

You are looking for the interface that is showing a state of getting IP configuration, in this case the device/interface the Librem 5 is connected to is enxe44b62d3acf5.

  1. Enable connection sharing on the device/interface from the command line of your machine by entering…
nmcli con add type ethernet ifname <devicename> ipv4.method shared con-name NetShare
  1. Bring up the new connection by entering…
nmcli con up NetShare
  1. You should now be able to ping the Librem 5 from the command line of your machine (assuming the Librem 5 has the default pureos hostname) by entering…
ping pureos.local

If you don’t get a response, check the state of the USB interface from the terminal of the Librem 5 by entering…

nmcli dev

If you see the usb0 device showing as disconnected, you can bring that up from the terminal of the phone by entering…

nmcli dev connect usb0

It should now be the case that whenever you connect the Librem 5 to the same USB port of your machine then connection share will be automatically established.

Note that this enables connection sharing with the machine you are a connected to so this provides access to the internet to your Librem 5 through your machine.

Well, I’m screwed from the get-go apparently. My Librem 13 (running pureos) does not show anything on nmcli dev except for the wifi connection and loopback. No third option trying to connect that would be my phone.

If you haven’t done so already, try other USB ports on your Librem 13 if possible.

Also, while Librem 5 and Librem 13 are connected, check the output of nmcli dev from the Librem 5 terminal, does it show a usb0 device and if so what is showing for it’s “state”?

You could also check from the terminal of Librem 5 nmcli con show, is there a usb0 in the output of that command?

Best to back it up a little.

First thing: Do lsusb on the host computer before plugging in the Librem 5 and after.

If you don’t see any USB device appear then that’s a bad sign. Stop here.

Second thing: Do lsusb -v -sM:N where M is the bus number and N is the device number (numbers taken from the previous output).

While you may not understand all the output, from that output someone can tell what kind of device(s) the Librem 5 is offering.

However there are limited reasons why you would want to network via USB anyway - since if the WiFi on the Librem 5 is working, you can just access all network services via the existing local network. That in turn depends on what network services you want to use i.e. what you mean by connecting to the Librem 5. Access files on the Librem 5? Remote log in to the Librem 5? (both of which can be achieved using SSH)

Ideally I’d be able to log in to the Librem 5 and edit files there from the 13. Failing that, I can copy the file I want back and forth. All accomplishable via ssh provided, of course, the phone has an IP address seen from the Librem 13 and I know what it is. (From that point forward, I know how to use ssh and its relatives.)

I will try your other suggestions when I have time–I’m a bit pressed right now.


Do you have What IP installed on the L5?

Failing that, your router will tell you what the devices’ IP addresses are.

1 Like

No router. Just me plugging the phone directly into the Librem 13 with a USB C cable