Adventures As Me


Disconnected Update: Part 3

Written 30 Mar 2004

How to keep a Debian Unstable current? That is a question occupying my mind lately. This is the third article I've written on this. You may separately read parts one and two.

Using debootstrap I created a basic Debian system, based on stable (currently Woody), at /ch_sid. According to the package description, debootstrap is used to create a Debian base system from scratch, without requiring the availability of dpkg or apt. It does this by downloading .deb files from a mirror site, and carefully unpacking them into a directory which can eventually be chrooted into. Once installed you have a new installation you can log into, without needing a reboot, or messing with User Mode Linux (which I still keep in mind in case this fails).

With my chrootable system setup, the next item is using it to download the necessary updates. This requires the following:

  1. A copy of /etc/apt/sources.list from the origination machine
  2. The database of installed software
  3. Enable cron-apt for the chroot system

The first is easy, just copy the file from machine A to machine B /ch_sid/etc/apt. The second is harder, the third I have yet to tackle.

After several hours of researching step 2, it appears I need to copy the /var/lib/dpkg directory hierarchy from the origination machine to the chroot installation. This hierarchy contains the "database" of software installed by apt/dpkg, along with configuration scripts and installation status. On my test system, this directory is small:

# du -h /var/lib/dpkg
19M     /var/lib/dpkg/info
220K    /var/lib/dpkg/alternatives
4.0K    /var/lib/dpkg/methods/mnt
4.0K    /var/lib/dpkg/methods/disk
4.0K    /var/lib/dpkg/methods/floppy
16K     /var/lib/dpkg/methods
4.0K    /var/lib/dpkg/updates
4.0K    /var/lib/dpkg/parts
38M     /var/lib/dpkg

Nice, hopefully my origination system is similar. As a bonus, I could copy the contents of /var/lib/apt/lists to the chroot directory. /var/lib/apt/lists contains the package lists downloaded by apt-get update. They aren't needed, really, because they will be recreated next time I execute apt-get update. That saves several 10's of Megabytes of data to transfer to the chroot installation (24 on my test system, probably a lot more on the actual machine since I source far more).

With step two out of the way (execpt for data transfer), that leaves step three. I've performed a bit of testing, but have yet to get cron jobs to work properly in a chroot environment.

Related Posts