October 6, 2016

Linux Adventure Offline Drivers

You might also be interested in the Linux Adventure Prequel post.

Lets say you want to install things on a Gentoo distro, but you have no network? Perhaps you want to install something novel, like a network, but need a network to get a network.

I am currently without a linux box and I don’t want to understand everything about my package manager just yet. The most lightweight way I know would be to just run up a Docker image with a mounting to a folder on the desktop.

Lets pull down and launch a docker gentoo machine, mounting a folder on the desktop.

mkdir ~/Desktop/portage
docker run -it -v ~/Desktop/portage:/usr/portage gentoo/stage3-amd64 bash

Note it’s bindmounting /usr/portage over the top of where we expect the portage directory. This is where cached files go, and initially it’s empty.

Next, lets download sources for offline install. We want to pass sync, emptytree and fetchonly flags to pull down all deps.

emerge --sync
emerge -ef system world
emerge -ef sys-kernel/genkernel
emerge -ef net-wireless/broadcom-sta

If it complains, you want to do something like this…

echo "=net-wireless/broadcom-sta- ~amd64" >> /etc/portage/package.keywords/broadcom-sta

This may take a while to pull everything down, so be patient. When you’ve done, exit the docker image and compress it all into a file.

tar -zcf portage.tar.gz ~/Desktop/portage

Now boot onto your install disk/usb, get yourself that image, and…

mount /dev/sda_WHATEVER /mnt
cd /usr/portage
tar -xvzf /mnt/portage.tar.gz

Now fiddle those configs and install..

echo "=net-wireless/broadcom-sta- ~amd64" >> /etc/portage/package.keywords/broadcom-sta
emerge net-wireless/broadcom-sta

Tada! You have a network installed, no network required.