[plug] Debian base reinstall

Cameron Patrick cameron at patrick.wattle.id.au
Sun Dec 28 19:23:01 WST 2003


First thing to try: if your system isn't too broken to use dpkg, and you
want to get back all the packages that you removed previously, you can
list packages that have been removed using dpkg:
	dpkg --get-selections | grep deinstall$

Then you can reinstall those packages using dpkg (getting the debs from
a CD or /var/cache/apt/archives) or even apt-get install, if that works.

On the other hand, if worse things have happened:

On Sun, Dec 28, 2003 at 06:45:43PM +0800, Craig Ringer wrote:

| >I won't remove perl next time!
| 
| Whoops. You know, you can probably just manually unpack the perl .deb, 
| drop it into /usr/local (with an appropriate $PATH etc set), then 
| force-reinstall the packaged perl. Then again, I've never tried it.

apt, dselect and dpkg work fine when Perl isn't installed - even when
perl-base is missing, in fact - so this shouldn't be necessary.  If
dpkg's database is severely corrupted (which I've never seen happen, but
you never know...), you might be able to rm -rf /var/lib/apt /var/lib/dpkg
and then run debootstrap to reinstall[1].  (Installing debootstrap without
using dpkg is left as an exercise to the reading.  dpkg -x may do the
trick; if that doesn't work, well, .deb files are standard 'ar'
archives which can probably be extracted somehow.)

If you /do/ decide to run debootstrap or destroy your apt/dpkg
database, take a backup copy of /etc and probably /var with cp -a
first so that you can go back, Just In Case:
	cp -a /etc /etc.backup
	cp -a /var /var.backup

Cameron.

[1] I've no idea how debootstrap copes with being run over an existing
system, but...), but I see no reason why it shouldn't work.  You'll be
left with a whole bunch of files that the package system knows nothing
about, so perhaps a complete reinstall would be simpler and better.




More information about the plug mailing list