USB tethering, convergence, etc

With my android I can plug a USB cord into both the android device and my Ubuntu desktop computer. What happens is that the android device is mounted on the ubuntu computer, and I can then do file transfers. Also, I am able to run adb commands in the desktop’s terminal to operate on the android (if I need to). Finally, I can mirror my android device on my desktop computer.

I am curious how to do these same things with the Librem 5 and my Ubuntu desktop computer. I connected the phone and the computer together, but nothing noticeable happened.

How does a person do these things (or are they not possible) when the Librem 5 and a desktop computer are connected via a USB cord?

  1. File transfers and manipulation
  2. The Librem 5 counterpart to adb type commands
  3. Mirror the Librem 5 and control it on the desktop
  4. Also - I’ve read about “convergence”, but it seems that works only with certain, custom “hubs” - is that true?

(I previously asked a much simpler, more limited version of this question, and got a response, for which I am grateful. But upon further research I am thinking that these things should be possible but still left me very confused, so I thought I’d post once more, this time trying to make my question more detailed.)


Any particular reason why you want to do this over USB? Extra security?

Many people would just do this over WiFi using whatever networking works for them. Could be SFTP or sshfs or NFS or Samba.

I believe what you are looking for is PTP / MTP.

Yes, it is a known limitation of the Librem 5 that it doesn’t do this yet.

If you want to get closer to mounting the phone’s disk on the desktop / laptop then Jumpdrive is what you want. You boot your Librem 5 in a special mode where it will boot by loading software over USB from the desktop / laptop and you choose that software to be Jumpdrive. Then the Librem 5’s disk(s) will mount on the desktop / laptop and you can change / manipulate / corrupt to your heart’s content.

The differences between the two are that

  • for PTP / MTP the phone has to be and is booted normally and is therefore also operating normally as a phone and access to the phone’s disk safely coexists between the phone and the desktop / laptop
  • whereas with Jumpdrive the phone is essentially shut down as a phone and is operating (more or less) purely as a USB drive and you cannot safely access the phone’s disk(s) both from the desktop / laptop and the phone i.e. it’s one or the other.

I have no idea what those are - no Android here. However it isn’t always the case that doing the same things is appropriate (Android v. Librem 5) but rather achieving the same goals.

Somewhat. I guess the answer is that it is hit and miss. Some will work. Some won’t.

There’s no “custom” about it though. You buy an off-the-shelf dock. Some will work. Some won’t.

1 Like

Thanks. The reasons I like to do this over USB: It is so convenient, since the unused end of the usb cable is sitting right at my fingertips; and, when I do need to move a large number of files, it seems to happen much more quickly.

Yes, USB will be faster.

I don’t know about more convenient. No matter where the unused end of the cable is … cable is less convenient than no cable - presuming that the networking is already configured (one-off). It is particularly inconvenient for me as I keep the cable with the charging station, not with the phone (which is not to say that I couldn’t use another standard USB-C cable for data connectivity with a desktop / laptop).

Even so, I’m pretty sure that just about everyone wants PTP / MTP to work eventually.

Use sshfs.

Use ssh.

Hm, I think running phosh over ssh with X forwarding was it.

No, it works with many hubs. If you’re after an external display, the dongle must support DisplayPort over USB-C. Check this:

Or vnc.

(10 chars)

1 Like

And for fun, when you connect via USB, the Librem 5 will offer a network connection. So you can run your favourite networking protocol over that network connection over USB, if you want, rather than running it over WiFi.

From what I’ve seen though the network connection won’t fire up automatically on the desktop / laptop i.e. it needs to configured on the host side. That may well depend on the desktop’s / laptop’s distro.

Correct: the Librem 5 will automatically try to get a DHCPv4 lease, as well as IPv6 autoconfig. If there is no DHCPv4 server running on the host, then there’s no IPv4 connectivity. If the host ignores the network interface completely, then there’s also no IPv6 link-local connectivity.

The phone also uses mDNS, so you can ssh purism@pureos.local if host doesn’t ignore that.

1 Like

Thanks dcz.

Yep, I knew about the ssh options, my question was, Can those same actions be done via simply using a USB cord.

(You need to understand I’m not a tech expert, I’m coming from the android world so that’s my mental template. I realize things will be different - I’m trying to understand how things will be different, and how similar actions can be done.)

“Hm, I think running phosh over ssh with X forwarding was it.” Sorry, I don’t know what the words “running phosh over ssh” means. How do I do that? Or, can you recommend a source I can rely on and read for myself to learn?

Thanks for your help.

ookhoi, I don’t understand - Don’t I need a vnc server running on the Librem 5 to do what you’re suggesting? Is there one that will work with the Librem 5?

Yes, you can use ssh over the USB cable. The phone treats it as an Ethernet socket. So will the host computer. I use it all the time.

I deliberately left “running phosh over ssh with X forwarding” unspecified - it’s a bit involved. Also, it should have been “phoc”. Basic, incomplete steps involve: ssh -X phone, and then phoc && myprogram.

I’m not actually sure if VNC works on the Librem 5, but if it does, it’s already built into the shell. You could probably follow instructions for the sway compositor, because we’re using the same base. It’s another thing that involves doing your own research. But if you manage, you can write it up for others :slight_smile:

You do not need vnc at all to have a fully functional Librem 5 :slight_smile:

dzc said that you can use phosh/phoc over ssh Xforwarding to mirror Librem 5 on the desktop, and I suggested that one could also use vnc for that.

With ssh Xforwarding one can run an application on the Librem 5 with the GUI of that application visible on the desktop.

With vnc one actually connects to the desktop environment on a remote device like the Librem 5, a true duplication of said desktop.

The difference is that vnc shows the exact same desktop of the Librem 5, while Xforwarding starts a single new application with no connection to an already running application.

If you lose the connection with ssh Xforwarding, the application dies. If you lose the connection with vnc, nothing dies, and one can reconnect from any device to find the exact same situation.

I’ve used wayvnc (vnc server) on sway (both remote and local), so I’m 99% it will work. I do not have a Librem 5 yet though, so cannot test for real.

Ok, this noob took the challenge - sort of! - here’s what I have for you:

On the Librem 5, in the file /etc/ssh/sshd_config, these settings needed to look like this and be enabled:

X11Forwarding yes
X11DisplayOffset 10
X11UseLocalhost no

The Librem 5 already has xauth installed, which it seems is also needed.

Then, on your client (e.g., desktop) that runs X11, enter this command into the terminal:

ssh -X purism@pureos.local , or perhaps ssh -X user@ipaddress

Once the connection is made, to graphically run a Librem 5 application on your X11 client, in the client’s terminal that has the ssh session going, type a command like this:

GDK_BACKEND=x11 name_of_the_librem_application

example: GDK_BACKEND=x11 nautilus

(Note: If you run the command for the app without the GDK_BACKEND=x11 stuff, then the application will open on the server [phone] instead of on the client [desktop].)

I’ve just played around with this, it works, I have only one problem I don’t know how to solve: For some of the Librem apps - nautilus is one - when I run an app graphically on the client side I don’t know how to gracefully exit out of the application from within the ssh terminal session on the client. For example, I don’t know how to close nautilus when I’m done using it. So then it hangs on the phone.

Also, sadly there is no “interaction” possible - that I can figure out - between the graphical window from the Librem that appears on the client device, and the client device’s own graphical windows. What I mean, for example: If I have nautilus running from the Librem on my desktop computer, and I have the desktop computer’s copy of nautilus running, I can’t drag and drop files between the two windows.

Oh… I guess I do have one other problem: I don’t know how to find the names of all the apps I have installed on the phone that I would use in a terminal command to start them.

An approximate answer, if I understand the question, is:

cd /usr/share/applications
grep Exec *.desktop

That will show you applications that are installed and what command will be executed under the hood if you were to launch the application using the GUI and hence what command might work if you typed that command at the shell prompt.

Some caveats:

  • if a .desktop file lists more than one command then you probably need to study the .desktop file in more detail to see what each different command is for
  • if the command contains something like %U or %f or %u then you would try leaving that off the command

If you can connect trought USB you may be able to use wayvnc (needs to be compiled) in the L5 and a VNC viewer in your PC

To compile it I followed this before;

uzanto, thanks, but… I don’t know what to do with the instructions on that site. First off, there are discussions about how the instructions should be modified, which leaves a layman like me wondering, What am I supposed to follow? Second, it looks like instructions for building software… intially, I guess? But, nowhere does it say what I need to do to actually run the thing.

Not criticizing you for suggesting this, I thank you for your input. Rather, I know my limitations, and it looks like that site is meant for someone with knowledge beyond mine.