Mosh: Installing mosh without sudo access

Created on 25 Sep 2018  路  9Comments  路  Source: mobile-shell/mosh

I'm not a sudoer on the server I want to access. How can I install mosh onto it? This is the script I have come up with, but it doesn't work.

# libtool
mkdir -p ~/programs/libtool
mkdir ~/test
cd ~/test
wget http://ftpmirror.gnu.org/libtool/libtool-2.4.6.tar.gz
tar xf libtool-2.4.6.tar.gz
cd libtool-*
./configure --prefix=$HOME/programs/libtool
make
make install

# protobuf, the Protocol Buffers from google
mkdir -p ~/programs/protobuf
cd ~/test
wget https://github.com/protocolbuffers/protobuf/archive/v3.6.1.tar.gz
tar xf protobuf-*.tar.gz
cd protobuf-*
./autogen.sh
./configure --prefix=$HOME/programs/protobuf
make
make install

# Export variables #
export PATH="$PATH:$HOME/programs/protobuf/bin"
export PKG_CONFIG_PATH=$HOME/programs/protobuf/lib/pkgconfig

# mosh, mobile-shell
mkdir -p ~/programs/mosh
cd ~/test
wget https://mosh.org/mosh-1.3.2.tar.gz
tar xf mosh-*.gz
cd mosh-*
./configure --prefix=$HOME/programs/mosh CFLAGS="-I$HOME/programs/protobuf/include/google/protobuf" LDFLAGS="-L$HOME/programs/protobuf/lib"
make
make install

It fails at the ./autogen.sh part with the following error.

+ mkdir -p third_party/googletest/m4
+ autoreconf -f -i -Wall,no-obsolete
configure.ac:104: error: possibly undefined macro: AC_PROG_LIBTOOL
      If this token and others are legitimate, please use m4_pattern_allow.
      See the Autoconf documentation.
autoreconf: /usr/bin/autoconf failed with exit status: 1
support

Most helpful comment

Ah thanks that last complier flag made it work.

For anyone coming here later, now I have to invoke mosh like this:

 mosh --server='env LD_LIBRARY_PATH=/home/xapple/programs/protobuf/lib:/home/xapple/programs/openssl/lib /home/lucas/programs/mosh/bin/mosh-server' ssh.cluster.com

Hard to estimate how much of mosh's potential user base owns the remote server and how much doesn't. But you certainly are cutting down your user base drastically, by denying access to those that don't own the remote machine (because I don't know many people who are ready to go through all this just to get it installed).

All 9 comments

It looks like your difficulty is in installing protobuf -- the question is probably better directed at them. But please note that you probably want to be installing protobuf from a release, not from the development tree. If you do that you don't have to run autogen.sh and you don't need autotools or libtool to be installed (these tools are generally only needed by developers). You are installing a mosh release and that's why you don't need to run autogen.sh for Mosh.

Also you really don't want to be specifying CFLAGS on the Mosh ./configure line -- just set the PKG_CONFIG_PATH environment variable so that ./configure can find the protobuf.pc file installed by protobuf. (Mosh is a C++ program anyway, so CFLAGS won't have the desired effect -- and you are turning off optimization by setting it like that!)

You might also check out this page on the Mosh wiki: https://github.com/mobile-shell/mosh/wiki/Build-Instructions

Good luck!

The only reason I am doing all this is to access your product, so I feel like directing the question to you is appropriate. I don't have any direct interest in any of these other packages.

The issue is with the installability of mosh, or lack thereof.

I'm not sure why you are suggesting that I am installing protobuf from the development tree? I am installing protobuf from a release. You can see that in the download URL, it's the latest release as listed in the "releases" section on GitHub.

You also suggest that I don't need libtool in such a case. How is that so? The error message received possibly undefined macro: AC_PROG_LIBTOOL specifically indicates that I can't compile without it.

If you try to run ./configure without running ./autogen.sh first you get: -bash: ./configure: No such file or directory.

As for your advice on the CFLAGS on the Mosh ./configure line, thanks, I'll try to apply them when and if I get there. But for now the script doesn't execute that far.

I want to make sure we're clear: Mosh is not a product. It's a piece of free software, that you are downloading and using without charge, and we do this on a volunteer basis. We're happy to help educate you on how to build Mosh from source, but you'll have to do your part too. Otherwise you should be asking these questions of your system administrator or paying somebody to help you with this.

The URL you provided (https://github.com/protocolbuffers/protobuf/archive/v3.6.1.tar.gz) is not a protobuf release; it's a GitHub snapshot of the development tree. It hasn't been "released", which is to say, it doesn't have a ./configure in the archive and requires developer tools (e.g. autotools and libtool) to build. GitHub has these for every tag (I think actually for every commit!); it doesn't mean it's a release archive.

The release is here: https://github.com/protocolbuffers/protobuf/releases/download/v3.6.1/protobuf-cpp-3.6.1.tar.gz This includes a ./configure so you don't need the developer tools (like libtool or autotools).
(The same thing is true for Mosh -- if you get a snapshot from GitHub you need autotools to compile it, but if you download a release like the mosh-1.3.2.tar.gz file, you don't.)

It looks like Google also makes binary builds of protobuf available so you don't even have to compile it: https://github.com/protocolbuffers/protobuf/releases

You could also compile mosh-server statically somewhere else and just copy it to the machine in question.

Ah thanks for that, by using the CPP version of protobuf I was able to get further.

That's definitely a piece of information that would go well in the https://github.com/mobile-shell/mosh/wiki/Build-Instructions document (that currently assumes the user is necessarily amongst the list of sudoers on both machines and thus doesn't say much about the dependencies).

Now the problem is that when I run ./configure in the mosh directory I get configure: error: OpenSSL crypto library not found.

I really think you should revise your distribution/install strategy for mosh. The use case where you don't own the remote server is a common one!

OK so I installed OpenSSL from source. This is my install script now: https://gist.github.com/xapple/9c50d7767b3cd8d1f7ba75e2f97c8da2

But it fails on the make step inside the mosh directory with this output: https://gist.github.com/xapple/9db34e4642af67c931ba42359e7a02f6

mosh is currently uninstallable in its current distribution strategy.

I think you're running into a recent protobuf change to require a C++11 compiler, and you're using a compiler that doesn't default to C++11. (Mosh in Git has a workaround for this but the protobuf change happened after our most recent release.)

Try configuring Mosh with ./configure CXXFLAGS="-std=c++11 -g -O2".

Or if your compiler really isn't capable of C++11, you'll need an earlier release of protobuf. (Even version 2 will work fine.)

Ah thanks that last complier flag made it work.

For anyone coming here later, now I have to invoke mosh like this:

 mosh --server='env LD_LIBRARY_PATH=/home/xapple/programs/protobuf/lib:/home/xapple/programs/openssl/lib /home/lucas/programs/mosh/bin/mosh-server' ssh.cluster.com

Hard to estimate how much of mosh's potential user base owns the remote server and how much doesn't. But you certainly are cutting down your user base drastically, by denying access to those that don't own the remote machine (because I don't know many people who are ready to go through all this just to get it installed).

Nearly every bit of of open-source software suffers from the problem you just described (how to get it installed). Some software is even harder than mosh, because it requires root! (mosh doesn't require root to install or run). Some software is easier because it is so popular that it's almost always installed by default.

I understand that compiling software from source can be difficult at times, but hopefully you learned something useful from this exercise :smiley:. Also, we welcome any improvements to the "Build Instructions" wiki -- anyone with a github account is free to edit it.

The gist mentioned on the Build Instructions wiki worked for me on an Ubuntu 18.04 server on which I have no root access. I only had to change its INSTALL_DIR setting. Its builds of ncursesw and ncurses failed, but that didn't matter on this particular machine because it already had ncurses libraries installed system-wide. I ended up with things being installed under the mosh subdirectory of my home directory (as that's what I'd edited INSTALL_DIR to), and then on my own machine I can do mosh --server=mosh/bin/mosh-server ds and I'm in. (My .ssh/config is set to recognise ds as the name of the server.)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

xapple picture xapple  路  7Comments

jscinoz picture jscinoz  路  7Comments

franzf picture franzf  路  5Comments

unphased picture unphased  路  5Comments

Intensity picture Intensity  路  7Comments