Exodus - A Tool to Safely Copy Linux Binaries

Do you ever need that one of your system has some binaries installed on it and you want to transfer same binaries on another machine? Yes, Right? We are going to discuss such tool which can help you to achieve it. Exodus is a tool that makes it easy to successfully relocate Linux ELF binaries from one system to another. This is useful in situations where you don't have root access on a machine or where a package simply isn't available for a given Linux distribution.

Exodus manages collection all of the binary's dependencies, compiling a statically linked wrapper for the executable that invokes the relocated linker directly, and installing the bundle in ~/.exodus/ on the remote machine. Let's see it in action.

Installation of Exodus

Exodus can be installed from the package on pypi. Execute a below command to install it locally for your current user.

$ pip install --user exodus-bundler
Collecting exodus-bundler
Downloading exodus_bundler-1.1.8-py2.py3-none-any.whl
Installing collected packages: exodus-bundler
Successfully installed exodus-bundler-1.1.8

Add ~/.local/bin to your PATH variable to make exodus executable. This can be done by executing the below command.

export PATH="~/.local/bin/:${PATH}"

This PATH is set for a current session only, to make it permanent add above command in ~/.bashrc file. You successfully installed it, now let's see how to use it.

Usage of Exodus

Installation over ssh

You can use Exodus to install an executable bundle on a remote machine. For example, One machine has package "tree" has installed on it, while other machine doesn't have. You can simply install tree package on another machine by executing below command on machine on which tree package is installed.

$ exodus tree | ssh 192.168.0.144
Pseudo-terminal will not be allocated because stdin is not a terminal.
[email protected]'s password:
Installing executable bundle in "/opt/exodus"...
Successfully installed, be sure to add /opt/exodus/bin to your $PATH.

Now, go the machine where you have just installed tree and add /opt/exodus/bin into PATH variable.

$ export PATH="/opt/exodus/bin:${PATH}"

That's it. You are done. You can start using tree package on your machine. It's that simple.

Renaming Binaries

Binaries with same name can be installed in parallel using -r/--rename option.Suppose If you have two versions of tree at /bin/tree and /usr/local/bin/tree then you can create aliases for each version with -r option and You can parallely use them.

exodus -r tree-1 -r tree-2 /bin/tree /usr/local/bin/tree

Now, you can use tree at /bin/tree and /usr/local/bin/tree by tree-1 and tree-2 respectively.

Installation by manual extraction

You can create tarball of binaries directly by --tarball option. You can copy this tarball to remote machine and can install it on ~/your-path

#create tarball of tree binaries
$ exodus --tarball tree --output tree.tgz

#copy generated tarball to remote machine
scp tree.tgz 192.168.0.144:~

#create ~/your-path
ssh 192.168.0.144 "mkdir -p ~/your-path"

#extract tarball to ~/your-path
ssh intoli.com "tar --strip 1 -C ~/your-path -zxf tree.tgz"

Now you need to add ~/your-path into PATH variable as explained earlier. You can start using tree binaries on your remote machine.

You can explore more option by using -h(help) option, It will give you usage and all options.

usage: exodus [-h] [--ldd LDD_SCRIPT] [-o OUTPUT_FILE] [-q] [-r NEW_NAME] [-t]
              [-v]
              EXECUTABLE [EXECUTABLE ...]

Bundle ELF binary executables with all of their runtime dependencies so that
they can be relocated to other systems with incompatible system libraries.

positional arguments:
  EXECUTABLE            One or more ELF executables to include in the exodus
                        bundle.

optional arguments:
  -h, --help            show this help message and exit
  --ldd LDD_SCRIPT      The linker that will be invoked to resolve
                        dependencies. In advanced usage, you may want to write
                        your own `ldd` script which invokes the linker with
                        custom arguments. (default: ldd)
  -o OUTPUT_FILE, --output OUTPUT_FILE
                        The file where the bundle will be written out to. The
                        extension depends on the output type. The
                        "{{executables}}" and "{{extension}}" template strings
                        can be used in the provided filename. If omitted, the
                        output will go to stdout when it is being piped, or to
                        "./exodus-{{executables}}-bundle.{{extension}}"
                        otherwise. (default: None)
  -q, --quiet           Suppress warning messages. (default: False)
  -r NEW_NAME, --rename NEW_NAME
                        Renames the binary executable(s) before packaging. The
                        order of rename tags must match the order of
                        positional executable arguments. (default: [])
  -t, --tarball         Creates a tarball for manual extraction instead of an
                        installation script. Note that this will change the
                        output extension from ".sh" to ".tgz". (default:
                        False)
  -v, --verbose         Output additional informational messages. (default:
                        False)

So, We have installed and see how to use exodus binaries relocation tool. Hope You find it useful, If you have anything to say on this, Let me know in comment section.

Pradip Sakhavala 12:05 am

About Pradip Sakhavala

Pradip is a Linux system administrator, an ardent believer in sharing and contributing to open source community. He has a keen interest in DevOps And IoT. He likes to discuss technical stuff anytime. He has started sharing his experience by blogs recently.

Author's All Posts
Like to become part of Linoxide Team and contribute tips? Contact us here.

Comments

Your email address will not be published. Required fields are marked *

All comments are subject to moderation.