apt-ftparchive

i got a new box and installed debian unstable on it (i just love debian). i normally install the root partiton on reiserfs filesystem and the rest of the partitions on ext3. however, i was having regular electricity outages in my area recently which gave me a headache with the reiserfs. the reasons for this are:-

  1. although reiserfs is faster than ext3, it’s not as resilient.
  2. the minimal boot/install cd does not support reiserfs as well as ext3. so to recover from a filesystem failure, i have to start a shell in the root partition. but then i can’t unmount the root partitition itself. and hence can’t do a fsck in the rw mode :(

frustrated, i formatted my root partition and reinstalled debian on an ext3 root partition. now is the part that i’m going to talk about. well, as it turns out, i already had all the packages (about 1 GB of them) already downloaded, and i wanted to, obviously, reuse them for this installation. i vaguely remembered that there was this Packages.tgz file that would help me reuse these packages. so i went searching online for “debian packages.tgz” and nothing useful turned up. i thought that since my knowledge about this was old (about 2 yrs back), probably there was some newer and better way to do what i wanted to do. but even there, i didn’t find anything useful.

1 interesting thing turned up in one of the searches though. apparently, i was searching for the _wrong_ file; no wonder i was getting no/rubbish results. i should have looked for Packages.gz instead of Packages.tgz. anyhoo, now that i knew what to look for, i got a lot of results for what i wanted to do. this is the summary of what needs to be done:-

$ apt-ftparchive packages <dir> | gzip -c9 > Packages.gz

where <dir> is the directory containing all of the previously downloaded packages. the ‘-c9′ parameter passed to gzip is just the compression level. next we need to update /etc/apt/sources.list file thusly:-

deb file:/<dir> ./

where <dir> is the directory containing the newly created Packages.gz file. in my case this is how my filesystem was arranged

/data/apt/archives contained the downloaded packages. and i created the Packages.gz file in the /data/apt directory and had this line in my sources.list

deb file:/data/apt ./

now all i needed to do was fire up aptitude, press ‘u’ for updating list of sources. and then install all those things that i needed to from my backed up archive O:-)

Posted by Pradnyesh in Uncategorized
24 October

No Comments »

No comments yet.

Leave a comment