l i n u x - u s e r s - g r o u p - o f - d a v i s
Next Meeting:
July 7: Social gathering
Next Installfest:
Latest News:
Jun. 14: June LUGOD meeting cancelled
Page last updated:
2003 Jan 22 00:23

The following is an archive of a post made to our 'vox-tech mailing list' by one of its subscribers.

Report this post as spam:

(Enter your email address)
Re: [vox-tech] Recovering Debian without /var/lib/dpkg...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [vox-tech] Recovering Debian without /var/lib/dpkg...

on Tue, Jan 21, 2003 at 11:30:28AM -0800, R. Douglas Barbieri (doug@dooglio.net) wrote:
> Here is a good article about recovering a Debian system without having a
> backup of /var/lib/dpkg...
> http://www.linuxworld.com/2003/0113.petreley.html

Funny, I walked someone through that on irc.debian.org:#debian last
week.  This can be somewhat simplified from Nick's procedure.  Rather
than manually re-selecting packages in dselect, you would take advantage
of the fact that Debian policy requires all packages to create an entry
in /usr/share/doc, with the name of the package.

Procedure (in handy shell-script format).  Note that I *haven't* tried
this (suggestion:  someone with a faster box than I should try
installing Debian under UML and self-inflicting damage, then recovering,
and telling me what I got wrong).

(Aside to Nick:  this expands somewhat on my prior email.)

    export PATH=/usr/sbin:/usr/bin:/sbin:/bin

    # Let's be verbose....
    set -v

    # Create /var directory tree stubs
    mkdir /var/cache/apt/archives
    mkdir /var/cache/debconf
    mkdir /var/log
    mkdir -p /var/lib/dpkg/{info,parts,alternatives,methods,updates}

    # Create a rudimentary status file
    cat <<-EOF>/var/lib/dpkg/status
    Package: libc6
    Status: install ok installed
    Version: 2.3.1-9

    # Update package cache
    apt-get update
    apt-get dist-upgrade

    # Register as installed crucial packages.
    dpkg --clear-avail
    apt-get update
    apt-get dist-upgrade
    cd /var/cache/apt/archives
    dpkg -i libncurses*
    dpkg -i perl-base*
    dpkg -i libstdc++*
    dpkg -i dselect*
    dpkg -i dpkg*

    # Reinstall libc to register it.
    apt-get install --reinstall libc6                                                             
    # Reinstall base packages.
    apt-get dist-upgrade

    # Generate list of installed packages to Re-register previously
    # installed packages as installed, using /usr/share/doc as a
    # fallback package registry.
    dpkg --get-selections $(
        ls /usr/share/doc | grep -v [A-Z] | awk '{print $1 " install"}'

    # Re-register everything.
    apt-get dist-upgrade


Karsten M. Self <kmself@ix.netcom.com>        http://kmself.home.netcom.com/
 What Part of "Gestalt" don't you understand?
   Geek for hire:  http://kmself.home.netcom.com/resume.html
vox-tech mailing list

LUGOD Group on LinkedIn
Sign up for LUGOD event announcements
Your email address:
LUGOD Group on Facebook
'Like' LUGOD on Facebook:

Hosting provided by:
Sunset Systems
Sunset Systems offers preconfigured Linux systems, remote system administration and custom software development.

LUGOD: Linux Users' Group of Davis
PO Box 2082, Davis, CA 95617
Contact Us

LUGOD is a 501(c)7 non-profit organization
based in Davis, California
and serving the Sacramento area.
"Linux" is a trademark of Linus Torvalds.

Sponsored in part by:
EDGE Tech Corp.
For donating some give-aways for our meetings.