dpkg madness

posted @ 10:34 pm on Thursday, June 5, 2003

Well, there has been an issue with dpkg that has been annoying me for weeks but its only just been now that I have jumped off my fat lazy arse and did something about it.

The problem is that I blew away one of my debian machines as it needed a low level format on its only disk (IBM ‘deathstar’ drive, you know, the infamous 45Gb ones). I backed up all the necessary data, and when it came to reinstall time, I was to install the debian ‘sarge/testing’ base on the rebuilt machine and then use dpkg --get-selections > installed-packages.txt (from existing configured machine with all the right packages installed) and dpkg --set-selections on the reinstalled boxen.

In theory this is supposed to work like a charm, and essentially it does, but the next step after the --set-selections is the one that eluded me.

All google was able to tell me over the past few weeks while I have been 'casually' looking for why the packages wouldn't install, were pages that said a simple apt-get update && apt-get upgrade after doing the –set-selections would work fine, this is really NOT the case as the packages will not install unless you manually apt-get install them.

Though tonight when I remembered to have another quick look, I stumbled upon the infamous command required to get these packages installed without specifying them manually. the process is as follows:

On host you wish to replicate (original system before rebuild, or identical system you wish to copy):

dpkg --get-selections > /tmp/installed-packages.txt

scp /tmp/installed-packages.txt to the freshly built debian machine

dpkg --set-selections
Your new machine will then attempt to install all the packages in 'installed-packages.txt' that are not yet installed on the system.

Its times like these that a nice alcoholic drink is well called for ;-) hehe