LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices


Reply
  Search this Thread
Old 05-01-2004, 06:31 AM   #1
torriate
LQ Newbie
 
Registered: May 2004
Location: Spain
Distribution: debian/sarge
Posts: 3

Rep: Reputation: 0
Unhappy kernel panic: No init found after uninstaling libc6


Hi,

I upgraded woody-libc6 (2.2.5-11.5) to sarge-libc6 (2.3.2.ds1-11). But I run into problems with dselect and apt-get trying to uninstall lot of packages, so I tried to downgrade libc6 again to 2.2.5-11.5 using dpkg.

As it didn't allow me to do so, I used dpkg -r forcing it, thinking that I would be able to run dpkg -i woody-libc6.deb afterwards.

But when it finished removing sarge-libc6, almost any command worked, including dpkg.

I thought my debian needed a reboot so the daemons reinitiated (in fact when i upgraded to sarge-libc6 serveral daemons reinitiated), but what I got is a:

kernel panic: No init found. Try passing init= option

I tried booting with install-disks, using rescue=/dev/hda1, but i get the same message.

Does anybody knows how to solve it??

Thanks in advance!
 
Old 05-01-2004, 08:50 PM   #2
ToniT
Senior Member
 
Registered: Oct 2003
Location: Zurich, Switzerland
Distribution: Debian/unstable
Posts: 1,357

Rep: Reputation: 47
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:
Quote:
Yes, do as I say!
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.
 
Old 05-02-2004, 08:45 AM   #3
torriate
LQ Newbie
 
Registered: May 2004
Location: Spain
Distribution: debian/sarge
Posts: 3

Original Poster
Rep: Reputation: 0
Thumbs up yeah!! THANKS!!

Thank you very much! I thought I would have to reinstall everything...

Well, yes apt-get ask me to write
Yes, do as I say!

But I didn't go on with that, because it also would have uninstalled 540 packages (539 depends on libc6 package), and I only wanted to downgrade libc6.
It's really difficult to break debian's defences, but if you try hard you get to it .

As downgrading didn't work because some daemons (including init) depended on libc6 and they should reinitiate before going on, what I finally did was using several --force-thing options with dpkg:
dpkg -r --force-depends --force-bad-verify --force-remove-essential --force-... libc6

Or I don't really remember if I just used:
dpkg -r --force-all libc6

The fact is that it let me went on, and uninstalled libc6. When I tried next to:
dpkg -i libc6_2.2.5-11.5.deb (woody version)

It didn't run. And neither did apt-get or almost every command I knew. Then I realised that almost everything depends on libc6 (that's why it's so difficult uninstalling it!).

Maybe due to microsoft culture, I thought that rebooting I'd get daemons reinitiated without libc6 and that I could try to reinstall libc6, but what i got is the kernel panic.

Following your steps

I first tried to use the installations disks to boot and recuperate the libc6 lib. In the disks I only found libc-2.2.5.so. I mounted /dev/hda1 to /mnt and copied it to /mnt/lib. Then rebooted, but nothing happened.

In debianhelp.org (thanks acid_man) I was told to use knoppix or tomsrtbt to boot and reinstall the package using chroot /mnt. As my cd-writer is in my deb-machine, i couldn't burn knoppix, and it was too big to download and get the knoppix rescue disks. So I got tomsrtbt (just 1 floppy) from http://www.toms.net/rb.

I booted the disk and tried chroot /mnt, but again it failed.

Then you posted your how-to. I was saved! And you talked about busybox (also used by tomsrtbt) so I though that this time all was going to work!

step 1

I didn't have installed sash or busybox-static and I don't have knoppix. But I had the tomsrtbt disk, so I booted it.

step 2

You were right, my system is on /dev/hda1, so I mounted it on /mnt:
mount /dev/hda1 /mnt

step 3
Right again: 'chroot /mnt' failed. The error:
chroot: cannot execute /bin/sh: No such file or directory
but trying to run '/mnt/bin/sh', gave me an error message about a missing libc. The only libc in my /mnt/lib/ directory was libc-2.2.5.so (I had previously copied it there).

In the tomsrtbt disk there were only the libc-2.2.5.so. So as I already had downloaded libc6_2.2.5-11.5.deb.

In the tomsrtbt disk I had found an 'undeb--' command, and I had previously unpackaged the libc6_2.2.5-11.5.deb:
undeb-- libc6_2.2.5-11.5.deb

It produced debian-binary, data.tar.gz and control.tar.gz files. But I don't know why, when trying to 'gzip -d data.tar.gz', it answers me that gzip didn't find the file data.tar.gz. 'cat debian-binary' produced the same error message but not finding debian-binary file.

I was doing all this in /mnt/tmp, but I got the same result in /tmp (ramdrive).

I changed permissions of the files ('chmod ugo+rwx *'). I was allowed to change permissions, but when gunziping I got the same message.

I decided to try with a different file system, and as I had another disk with my old win2k data (but fat32 formatted), I mounted it:
mkdir /mnt2
mount /dev/hdc1 /mnt2 -t msdos

This was an error, because msdos type doesn't support long names (I should have used: 'mount /dev/hdc1 /mnt2 -t vfat)

Anyway, then I did this (note: the version of tar in the tomsrtbt disk doesn't manage gzipes files):
cp /mnt/tmp/data.tar.gz /mnt2/data.gz
gzip -d data.gz
mv /mnt2/data /mnt2/data.tar
tar -xvf data.tar

But it didn't work, although the error was related to internal error in the file...
I copied the file data.tar in /mnt/tmp and produced the same error. The bad point is that it didn't work, but the good point is that I could access the file from /mnt/tmp!
So I copied the text file debian-binary to /mnt2, and back to /mnt/tmp (as debian-b) to see if I could read it. And I could.

So I did the following:
cp /mnt/tmp/data.tar.gz /mnt2/data.gz
cp /mnt2/data.gz /mnt/tmp/data.tar.gz
gzip -d data.tar.gz
tar xvf data.tar

AND IT WORKED!!!!!

Ok, now I could go on step 4!

step 4

cp /mnt/tmp/lib/libc* /mnt/lib
chroot /mnt /sbin/ldconfig

It Fails! I look into /mnt/sbin and ldconfig doesn't exist. Ok, the tar command has created more directories apart from lib: etc, sbin, usr. I look in sbin, and there it is!!
cp /mnt/tmp/sbin/ldconfig /mnt/sbin
chroot /mnt /sbin/ldconfig

It Works!

step 5
chroot /mnt

Yes!! Now, it works!!

step 6
dpkg -i libc6_2.2.5-11.5.deb

It Fails! It didn't found ldconfig, ... Let see the $PATH:
echo $PATH
/usr/bin:/bin
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
dpkg -i libc6_2.2.5-11.5.deb

It works!!

Step 7
Let's check:
exit
chroot /mnt

Works wonderfully!!

Step 8
Let's boot ......... Yeah!! Great!!


THANKS ToniT!!
Linux community really improves due to people helping each other!!


For the next time I should find less risky and stressy ways to learn! At least until tomorrow!

Now I'll try to upgrade the whole distrib from woody to sarge. Let's see how it goes!
Thanks again!

Last edited by torriate; 05-02-2004 at 09:50 AM.
 
Old 05-02-2004, 09:12 AM   #4
fsbooks
Member
 
Registered: Jan 2002
Location: Missoula. Montana, USA
Distribution: Slackware (various)
Posts: 458

Rep: Reputation: 42
Good work. God, I love Linux.
 
Old 01-26-2008, 02:18 PM   #5
CrazyC
LQ Newbie
 
Registered: Apr 2006
Posts: 9

Rep: Reputation: 0
Thank you very much!

torriate & ToriT, thank you so much.
I know this is quite an old thread, but the information on this page has helped save me numerous hours of reconfiguration on a new install.

I just recently got a new Dell laptop and spent the last 2 weeks setting up Kubuntu Gutsy with all the things I require for daily use and a LOT of extra goodies.
I got to the point of installing Skype (which went ok) and then want to get my bluetooth headset to work with Skype.
I found a tutorial which got into a lot of custom configuration and using a couple of Debian packages from the Debian Sid repositories. Well long story short, I got into a bind and in the process of trying to undo my work, I had removed libc6 from the system completely and was unable to get it booted.
But thanks to torriate's problem (basically identical situation) and ToriT's instructions on how to restore the missing libc6 package, I am back up and running with only about 2 hours of messing around, versus the couple days to another week or so of reconfiguring a new install.

Again, thank you!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Kernel panic: no init found. Try passing init= option to kernel. ericb Slackware - Installation 3 10-20-2005 11:03 AM
Kernel Panic: No init found. Try passing init=option to Kernel ridak Fedora 5 09-08-2004 01:25 AM
Kernal Panic: No init found. Try passing init= option to kernel raees Linux - General 12 03-18-2004 11:10 PM
error "Kernel panic: No init found. Try passing init= option Anauj0101 Linux - Newbie 3 05-06-2003 10:18 PM
Compiled own kernel and got: Kernel panic: No init found. Try passing init= option to fbl Linux - General 12 01-14-2003 03:38 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian

All times are GMT -5. The time now is 10:38 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration