Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?

Installing Electrum on an air-gapped Ubuntu Machine

This guide shows how to install Electrum on an air-gapped machine. You will also need an Ubuntu machine connected to the network in order to complete this guide (it can be a virtual machine).

On the online machine

If you are running Ubuntu 16.04 off of a live USB, there is a bug that affects the package manager. You need to run these two commands at the terminal to fix it:

$ sudo mv /var/cache/app-info/xapian/default /var/cache/app-info/xapian/default_old

$ sudo mv /var/cache/app-info/xapian/default_old /var/cache/app-info/xapian/default

Next update the package manager:

$ sudo apt-add-repository universe

$ sudo apt-get update

Make a temporary directory to download .deb package files

$ mkdir debs

$ cd debs

Generate a list of URIs for the software you would like to install. This generates a text file called “apturls”.

$ sudo apt-get -y install --print-uris python-qt4 python-pip qrencode | cut -d\' -f2 | grep http:// > apturls

Now download the software packages to your hard drive

$ wget -i apturls

The previous step downloaded several .deb files to your hard drive in the “debs” directory. Copy this directory to the software usb drive. Make another temporary directory for the Electrum python sources

$ mkdir ~/python_files

$ cd ~/python_files

Download Electrum’s python dependencies $ sudo pip download

Check to see if there is a URL available for a more recent version. The previous step should have downloaded several files into the “python_files” directory. Copy this to your software usb. Your software usb is now ready to be transferred to the air-gapped machine.

On the air-gapped machine

Plug in the usb and navigate to the directory of the "debs" files. Install the packages.

$ sudo dpkg -i *.deb

Now switch to the directory with the python files. Install the python files

$ sudo pip install --no-index --find-links=../python_files ../python_files/Electrum-2.7.5.tar.gz

That's it! You should be able to run Electrum by typing $ electrum at the command line.

I found an alternative way to install the debian packages on the airgapped machine. It doens't seem to work on computers running on a live USB, but it may be more secure (I think apt-get checks package signatures and dpkg doesn't, but I'm still researching this).

Instead of $ sudo dpkg -i *.deb, copy all the .deb files to /var/cache/apt/archive. Then you should be able to sudo apt-get install python-qt4 python-pip. Try it and see what works for you.

Please leave any feedback in a comment!

johnf commented Jun 12, 2017

If your destination airgap is a different architecture e.g. raspberry pi you'll need to do
pip download --no-binary :all:

johnf commented Aug 30, 2017

If you are upgrading an existing machine you need to add --upgrade to the install command

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment