Update pbuilder on a slow internet connection

On a slow line (like mine, @56k) even updating pbuilder could be a problem (or a really boring task):

[host]$ sudo pbuilder update
Get:4 http://debian.fastweb.it unstable/main Packages [5302kB]

5Mb are enough to do this trick (NOTE: it will work only if you machine and the pbuilder use the same mirror). First, update your box apt packages list with

[host]# apt-get update

once done, you'll find in /var/lib/apt/lists/ the packages list we need. Let's copy those files in a new location:

[host]# cp -arp /var/lib/apt/lists/ /tmp/

then, login into the pbulder chroot with:

[host]$ sudo pbuilder --login --bindmounts /tmp/lists/ --save-after-login

(/tmp/lists/ will be mounted inside the chroot with the files we've just copied, and --save-after-login will save our changes once done). Now

[chroot]# cp /tmp/lists/*astwe* /var/lib/apt/lists/

to copy the lists for Fastweb mirror only (the one I'm using), now

[chroot]# apt-get update
Get:1 http://debian.fastweb.it unstable Release.gpg [189B]
Get:2 http://debian.fastweb.it unstable Release [86.4kB]
Get:3 http://debian.fastweb.it unstable/main Packages/DiffIndex [2038B]
Fetched 88.7kB in 12s (6962B/s)
Reading package lists... Done

now only few files are downloaded.

I used this trick earlier, in cases where creating or updating the apt packages list for pbuilder was a problem, since the files always resulted corrupted.


Raphael said...

What about using one of the multiple proxies around? apt-cacher, apt-cacher-ng, etc...
I use apt-cacher for everything: normal apt, apt in sarge, etch, lenny, sid, piuparts, and when performing archive wide checks (e.g. checkbashisms, lintian).

p2000000000 said...

I used apt-cacher to create a pbuilder environment :
sudo pbuilder create --distribution jaunty --http-proxy http://localhost:3142

with apt-cacher configured on my local computer and on port 3142