1

I want to run debootstrap and create a distro multiple times without constantly downloading packages.

Using apt-cacher-ng or the --foreign option in debootstrap doesn't work completely offline (e.g. if I am doing this on the train) because debootstrap will still try to connect to the internet to get the InRelease file from the remote repo.

It seems like squid (or some other caching proxy) should be able to be configured to cache certain urls so that when I am offline I can still run the process.

What should I install and how should I configure it to achieve this?

0

If you apt install squid-deb-proxy you can run debootstrap offline (even the InRelease files).

However, if you want to save bandwidth and continue to use the offline file once you are are online again you need to modify it slightly.

There are absolute paths in the squid-deb-proxy.conf file so you need to make a copy of it in your project and modify it.

Find the references to /etc and /var and modify them to be relative to separate it from the system files.

In order to still use the proxy when you are online you need to add this to the conf file.

#Use cached values when offline
offline_mode on

You can then start it like this:

mkdir -p squid/var/log/squid-deb-proxy
mkdir -p squid/var/run/

echo "Starting an instance of squid using the working dir for caches and logs instead of the system dirs"
squid -Nf squid/squid-deb-proxy.conf

Then before you start debootstrap

#Use a caching proxy to save bandwidth
export http_proxy=http://127.0.0.1:8000

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.