[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

How I fixed my trashed Debian system



On 5 Aug 1997, Martin Steigerwald wrote:

> > > > Whats the trick to this?
> 
> > I did the same thing. Ended up with about 100 broken packages. I was able
> > to fix it without reinstalling from scratch. I could describe what I did
> > if anybody is interested. It involved having a spare partition where I
> > installed the 1.3.1 base system, plus the ability to boot DOS to download
> > the 1.3.1 install disk set which I didn't have on my machine.
> 
> Please do it. My system is broken down so serverely, that I even could
> not log in as root cause libreadline.so.2 is missing.

OK. If this helps just one person I think it's worth typing up. I welcome
any suggestions of things I may have missed fixing or cleaning up.

My system has been up-to-date with unstable for over a year and a half
without problems. I stopped making updates a few weeks ago when Bruce said
that it wasn't in a working state due to the ongoing conversion to libc6.

Then I needed to get g++ working, so I tried to do some updates and got
into a depends/conflicts mess. I tried executing the dselect "install"
option, which started out OK but then got into problems then stopped
working altogether. The clincher was when I did the dselect "remove
unwanted software" option. :-(

At that point I couldn't execute anything anymore. It would boot but 
then I couldn't login.

The first thing that I thought of was reinstalling the base 1.3.1 over top
of my old system. I was afraid to try this; I figured it would blindly
delete my old system. Somebody else asked this same question today. I
haven't seen an answer yet. I guess that I wouldn't work.

So, here's what I did:

o  Booted DOS, dialed up, and downloaded the 1.3.1 install disks.

o  Installed 1.3.1 onto an empty 200 MB partition that I had.
   (just ran the "install.bat" from the dos directory, and did the
   install from there. I didn't even have to write out any floppies)
   This was just the base install and one default go at deselect.
   I just let dselect install whatever was pre-selected as required, etc.

o  Did the following copies from the new (temporary) 1.3.1 to my
   original system, which was mounted as "/mysys" under 1.3.1:

   cp -a /usr/sbin /mysys/usr
   cp -a /usr/bin  /mysys/usr
   cp -a /sbin /mysys
   cp -a /bin  /mysys
   cp -a /usr/lib/libc5-compat /mysys/usr
   cp -a /lib                  /mysys
   cp -a /usr/X11R6/lib        /mysys/usr/X11R6
   cp -a /usr/lib/lib*         /mysys/usr/lib

   This was the list that I came up with that I figured contained
   all the binaries and libraries installed by Debian. I may have
   missed some, but this allowed my old system to work again!

o  Then I downloaded the 1.3.1 distribution that I have mirrored
   at my office. This took 6-8 hours over ISDN.

Now, to downgrade the system to 1.3.1 and clean up:

o  I changed dselect to point to 1.3.1 instead of the unstable tree.

o  I had maybe 100 broken packages in dselect. I made a list of them,
   (dselect marks them cleary) and:

   - the ones that had installed versions but no "available" versions
     were packages that are new to unstable but not in 1.3.1.
     I purged these.

   - All the rest I manually ran "dpkg -i <deb-file>".

     An easy way to get the deb-file name is to make a little
     script (that I called debfind) that looks like this:

        #!/bin/sh
        locate $1 | grep debian

        Of course, this assumes that you have the tree locally and that
        your "updatedb" includes this directory. Just grep for something
        in the path of the debian tree.

   This way, I successfully fixed all the broken packages according to
   dselect.

o  Oops. I let let the 1.3.1 install some stuff that I don't normally
   have, and I copied this to my old system with the "cp" commands above.

   I ran "dpkg --get-selections" on the 1.3.1 partition, and ran "diff"
   of this with the output of the same command on the old system. This
   gave me a list of the packages that I needed to get rid of, only
   dselect on my old system didn't know about these because I just 
   copied some of the files (potentially) with those "cp" commands.
   
   To clean these up, I just installed and purged these packages with
   "dpkg -i <deb-file>" and "dpkg --purge <package>".

o  Now, the last thing to do is to reinstall every package that I have
   installed, because:

   -  some need downgrading from unstable to 1.3.1, others may be
      messed up but I don't now about it.

   Now, a lot of these I just reinstalled to fix the broken packages
   above, but I'm just reinstalling the whole anyway.

   So, I wrote a little Tcl script that I posted today but here it is
   again:

The output looks like this:

dpkg -i /usr/local/src/debian/1.3.1-fixed/binary-i386/base/adduser_3.2.deb
dpkg -i /usr/local/src/debian/1.3.1-fixed/binary-i386/base/ae_962-14.deb
dpkg -i /usr/local/src/debian/1.3.1-fixed/binary-i386/libs/aout-svgalib_1.2.10-4.deb
dpkg -i /usr/local/src/debian/1.3.1-fixed/binary-i386/admin/at_3.1.7-3.deb

So, I capture the output of this script and now I'm pasting them a few at
a time into an xterm and it's going fine so far. 

In the end, I may have a few stray file from unstable still, but when the
next release of Debian comes out, these should get overwritten when the
final packages are installed on my system.

--- snip ---
#!/bin/sh
# the next line restarts using tclsh \
exec tclsh "$0" "$@"

set plist [split [exec dpkg --get-selections] \n]

foreach l $plist {
    set p [string trim [lindex $l 0]]
    set s [string trim [lindex $l 1]]
    if {$s == "install"} {
        set d [exec debfind /${p}_ | grep -v /unstable/]
        if {[llength $d] == 1} {
            puts "dpkg -i $d"
        } {
            puts "Found multiple matches for $p: $d"
        }
    } {
        puts "Skipping $p: $s"
    }
}
--- snip ---   

...RickM...



--
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
debian-user-request@lists.debian.org . Trouble? 
e-mail to templin@bucknell.edu .


Reply to: