Using Debian apt over a dialup link

Introduction to apt

Apt system is an "intelligent" frontend to Debian package management system. It is meant to take care of dependency problems and to download the newest versions of software. However, it can easily use simply too much bandwidth - fetching the newest package listings and the newest program versions - to be usable over a slow connection.

I haven't come across any good tips on how to configure apt system in such a case - excluding the setup described in documentation under /usr/doc/apt, which can be used if it's possible to bring the files from another computer on some mass storage.

Configuring apt

First of all one should tell apt to fetch as little from the network as possible. Add the following lines to /etc/apt/apt.conf:

APT::Get::No-List-Cleanup;
APT::Get::Diff-Only;

The first line tells the system not to erase package listings fetched earlier. The second line tells the preferred way of transferring the list updates is as diffs - only the changes should be transmitted, as opposed to downloading the whole listing when actually only a small part of it has changed.

The biggest effect is on controlling which packages are to be considered as available. If only local files and the distribution CDs are used, there will be nothing to download off the net, but then no upgrades will be available. On the other hand, if the latest 'unstable' packages are to be used, there are few packages that can be installed from local files as it's very likely there is a newer version already made available on the net.

The solution I present here is to change the list of sources according to desire. When one wants to install from the local files - even if there's already a newer version available on the net - a list made of only local sources is used. When an upgrade from the net is to be done, a different list is used. To achieve this, we will create a separate sources.list file for each case. To change the list, one can use a simple script provided here.

apt-from script

/usr/local/sbin/apt-from:

#!/bin/sh
ln -sf /etc/apt/sources.list.$1 /etc/apt/sources.list
cp /var/state/apt/lists/*dists* /var/cache/apt/lists
cp /var/cache/apt/lists/*dists* /var/state/apt/lists

Local files

The local sources should include every source that is to be considered as 'free': distribution CDs, distribution directories copied onto hard disk, servers on the local network. On my case, the list includes Debian Potato and Helix Gnome CDs copied onto disk. /etc/apt/sources.list.local:

deb file:/mnt/shares/helix woody main

deb file:/mnt/shares/potato/CD1 unstable contrib main
deb file:/mnt/shares/potato/CD2 unstable contrib main
deb file:/mnt/shares/potato/CD3 unstable contrib main

This file can be used as a basis for the following ones, so that files from the network are only used if a newer version is available there.

Security updates

/etc/apt/sources.list.security:

deb http://security.debian.org stable/updates main contrib non-free 

To get the obligatory security upgrades issue the following commands:

# apt-from security
# apt-get update
# apt-get upgrade

Stable releases

/etc/apt/sources.list.stable:

deb http://ftp.fi.debian.org/debian-non-US stable non-US/main non-US/contrib non-US/non-free
deb http://ftp.fi.debian.org/debian stable main contrib non-free

To apply the official bug fixes, run the following:

# apt-from stable
# apt-get update
# apt-get upgrade

http://www.iki.fi/Tuukka.Hastrup/linux/dialup-apt.html
2000 Tuukka Hastrup (Tuukka.Hastrup@iki.fi)