Didn't the apt-get say something like:
Quote:
WARNING: The following essential packages will be removed
This should NOT be done unless you know exactly what you are doing!
|
and asked you to write:
It did, didn't it? You broke it.
Ok. The situation probably is that there isn't a working C library in the system (or a libc at all).
So, any program that is dynamically linked (90-99% of them are. eg. dpkg, init, bash, sh,login, not to mention anything more complex) won't work.
To fix the situation, we have to do the following:
1. Get booted.
2. Get into the system
3. Get some version of libc
4. Put some version of libc in to it's place to get system temporarily up.
5. chroot into the system (or boot; chroot is safer)
6. Install libc debian package (any version).
7. Checking that the thing works.
8. Enjoy.
Step 1:
Have you installed sash, busybox-static? You do?
Great.
Using a stock-kernel or compiled your own?
For stock kernel (or a kernel with initial ramdisk)
In lilo prompt use parameter 'init=/bin/sh'
and when you get to the prompt run:
'init init=/bin/busybox' or 'init init=/bin/sash'
For selfmade kernels (or ones without the initrd)
in lilo put parameter 'init=/bin/busybox' or 'init=/bin/sash'
==> Go directly to step 3.
You don't?
Well.. we have to fight few more steps to get into your system.
You have knoppix around? (I would recommend this path even if you have sash/busybox) Great. Put it in and boot. We are ready to step 2.
You don't? How about an installation cd? No? Go get your self a one (or preferably knoppix once you are into it)
You have an installation cd. Boot from it.
Step 2: mounting
To access the disk we have to mount it. If you have used sash or busybox, you are allready in
the system and can skip this step.
First we have to figure out in what partition your system is (something like /dev/hda1). fdisk -l /dev/hda might help on this.
Once you know there it is, mount it somewhere eg.
'mount /dev/hda1 /mnt/hda1' should do it.
Step 3:Finding a working libc.
At this point it might be a good to check if missing libc6 is really the problem.
Try running 'chroot /mnt/hda1' (or where ever you mounted your system). It should fail. With some error message related to a missing libc.
Also there shouldn't be a 'libc'-something in /lib/ directory in your own system.
So, where to get one? If you got in from an external media (bootcd or knoppix), there should be one in the bootmedia's root system. That is, there should be file /lib/libc.so.6 in there.
If you came in locally, you probably have to extract one from the debian package (or if the libc in the installation media is not good).
How to do it? Now we manually do what dpkg does.
First we have to find the package. If you haven't flushed the archive cache of apt, there should be a debian package named libc6-something in /var/cache/apt/archives directory. If you flushed the cache, you have to download one from
http://packages.debian.org/libc6. (In practise you have to either have other os installed or boot from external media to get that one downloaded).
Now when we have the packgage, we have to extract it to get our hands to the libc-file.
First go to a nice directory to work in, like /tmp (or /mnt/hda1/tmp). and extract the package.
In busybox:
ar x /path/to/deb/file/debfile.deb
tar xvzf data.tar.gz
In sash:
-ar x /path/to/deb/file/debfile.deb
-gunzip data.tar.gz
-tar xvf data.tar
(The prependind dash '-' is part of the command)
Or in clean system (knoppix/bootcd):
dpkg -x /path/to/deb/file/debfile.deb .
Now we have a libc in lib subdirectory.
Step 4: put the libc in place
'cp /whereever/the/libc/is /mnt/hda1/lib/' (put in the correct paths, depending on how you are doing it).
And run 'chroot /mnt/hda1 /sbin/ldconfig'
That should set the linker to be aware of the new library.
Step 5: Chrooting in
'chroot /mnt/hda1' now if everything went correctly, this should work (in contrast to situation in step 3).
Step 6: Installing the libc correctly
You should now be happily in a shell prompt with some libc version.
To install it correctly, run
'dpkg -i /var/cache/apt/archives/libc6....deb' (what ever is it's version).
If you have flushed the cache, you can try to run 'apt-get install libc6', or if it doesn't work,
get the package using w3m, wget, lynx, ftp, or similar tool.
Note: your network is not probably up and you have to run pump, dhclient or ifconfig manually to get into internet.
Step 7: Checking
Now that you have installed the new version of libc, try exiting from the shell and chrooting
back. If that works, it is time to umount your disk and reboot.
Step 8: Enjoy
It booted? Great, enjoy.
It didn't? Well, go and buy yourself a beer.
And please get back here to tell us how it went.