LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   can't compile kernel 2.6.23.8 ERROR: no /sbin/init found on rootdev (https://www.linuxquestions.org/questions/slackware-14/cant-compile-kernel-2-6-23-8-error-no-sbin-init-found-on-rootdev-602049/)

tommcd 11-24-2007 02:25 AM

can't compile kernel 2.6.23.8 ERROR: no /sbin/init found on rootdev
 
I have been trying to learn how to compile a kernel. I am using the current kernel from kernel.org (2.6.23.8). I have been following Alien Bob's totally excellent guide:
http://alien.slackbook.org/dokuwiki/...kernelbuilding
as well as the O'Reilly book:
http://kroah.com/lkn/
I used " make oldconfig" first, as in Alien Bob's guide, and I used the config file from Slackware 12's 2.6.21.5-generic-smp kernel found in the /boot directory to configure the kernel. I then did "make xconfig" to enable the changes suggested in Alien Bob's guide. The kernel compiles without errors, but when I try to boot it I get:
-------------------------------------------------
Kernel panic - not syncing : VFS : unable to mount root fs on unknown-block (0,0).
----------------------------------------------------
I assume this is because I need an initrd. I did add ext3 and jbd in the kernel, not as modules, when I ran "make xconfig", but because of the kernel panic I created an initrd for the new kernel anyway. Then when I try to boot the new kernel I get:
-----------------------------------------------------
ERROR: no /sbin/init found on rootdev (or not mounted). Trouble ahead.
Kernel panic -not syncing: Attempted to kill init!
--------------------------------------------------------
I used Alien Bob's guide to compile a new kernel for Zenwalk and it worked fine. Kernel runs great! So I tried running "make oldconfig" on Slackware again but this time using the config from Zenwalk. The new kernel boots ok, except my battery monitor on the laptop don't work.
So using the config from Zenwalk at least lets me boot the kernel, but using the config from Slackware doesn't.
I have been trying this for a few days now and I can't get any further.
Question: which config file should I be using to compile a new kernel using "make oldconfig" for Slack12? I tried compiling a new kernel from scratch using "make xconfig" but I screwed that up too, so I would like to be able to run "make oldconfig" to get things right. Any advice on what I'm missing here using? Any help appreciated, thanks!

Alien_Hominid 11-24-2007 02:56 AM

Do the same steps as in Alien Bob's guide again, but this time do not forget to add your filesystem support into the kernel if you are not going to use initrd.

tommcd 11-24-2007 03:11 AM

Thanks Alien_H. I did add ext3 and jdb to the kernel (placed a check mark in the box in "make xconfig" for ext3 and jbd). Is there something else I am missing?, and when the kernel would not boot I made an initrd for the new kernel anyway. The I got the 2nd error in my original post.
Am I using the right config file to run "make oldconfig" on to compile a new kernel? I used the one for Slack12's 2.6.21.5-smp kernel, which I am running now. I don't know why it won't boot, even after creating an initrd.

pappy_mcfae 11-24-2007 04:16 AM

Quote:

Originally Posted by tommcd (Post 2969131)
Thanks Alien_H. I did add ext3 and jdb to the kernel (placed a check mark in the box in "make xconfig" for ext3 and jbd). Is there something else I am missing?, and when the kernel would not boot I made an initrd for the new kernel anyway. The I got the 2nd error in my original post.
Am I using the right config file to run "make oldconfig" on to compile a new kernel? I used the one for Slack12's 2.6.21.5-smp kernel, which I am running now. I don't know why it won't boot, even after creating an initrd.

My first thought/question would be, are you actually operating with the ext3 file system, or are you using reiserfs or something else? From what I have read, and from my experience, the kernel panic you list in the original post looks like your file system isn't directly installed in the kernel.

My two cents worth.

Blessed be!
Pappy

tommcd 11-24-2007 04:45 AM

Thanks Pappy_M, your post made me question that too, but I am indeed using ext3. I am writing this from Slackware 12's stock generic-smp-2.6.21.5 kernel, so I had to create an initrd as per the instructions in /boot/README.initrd to boot this kernel. For reference, here is my fstab (Slackware is on /dev/sda5):
Code:

bash-3.1$ cat /etc/fstab
/dev/sda2        swap            swap        defaults        0  0
/dev/sda5        /                ext3        defaults        1  1
/dev/sda7        /data            ext3        defaults        1  2
#/dev/cdrom      /mnt/cdrom      auto        noauto,user,ro  0  0
/dev/fd0        /mnt/floppy      auto        noauto,owner    0  0
devpts          /dev/pts        devpts      gid=5,mode=620  0  0
proc            /proc            proc        defaults        0  0
bash-3.1$

I am totally new at compiling a kernel. Am I using the right config file to run "make oldconfig" on? I used the one for config-generic-smp-2.6.21.5-smp found in the /boot directory since that it what I am running now.

tobyl 11-24-2007 06:05 AM

Hi tommcd,

If you have established that the problem is down to differences in your .config files, you could compare them.
Copy them both somewhere, renaming one of them to .config1 or something different.
Get yourself a nice big console window up, cd to where they are and type:

diff -y .config .config1

this one is pretty cool too:
diff -y --suppress-common-lines .config .config1

there are some clever gui programs that do the same type of thing if you prefer, Kompare for instance.
This is not the only way to solve your problem, but it just might save you some legwork...

tobyl

tommcd 11-24-2007 06:55 AM

Thanks Tobyl, I tried using the diff commands to compare them, but the output is huge. It will take some time to compare them. I will have to let this rest for now.
For now can you suggest which Slackware .config file I should be using to run "make oldconfig" on to compile a new kernel? I have tried config-generic-smp-2.6.21.5-smp and config-generic-2.6.21.5 from Slackware's /boot directory. Both got the same errors. I didn't want to use one of the config files for the huge kernels since according to the Changes_And_Hints.txt we should be running one of the generic kernels, but I guess I could try that since the generic config files don't seem to be working for me.

Alien Bob 11-24-2007 07:09 AM

Try the slackware-current's kernel config file for a 2.6.23.8 kernel, instead of the old config for a 2.6.21.5 kernel. You can find one here:
http://slackware.osuosl.org/slackwar...p-2.6.23.8-smp

What is the mkinitrd command you are using? What other steps did you take (kernel installation commands, lilo.conf editing, etc). Maybe you missed a step, but you did not document anything in your posts.

Another thing you may be experiencing is that your /dev/sda drive is not called /dev/hda with that new kernel. Try to see what kernel messages during boot refer to harddisk detection, and whether they mention sda or hda.

Eric

tobyl 11-24-2007 07:12 AM

I would have thought config-generic-smp would be best. After make oldconfig, make xconfig and pay special attention to the filesystem, Sata (if you have a sata disk) and ACPI sections. You should at least be able to compare those sections. Remember, if in doubt, compile it in, as opposed to modules. You can fine tune later.

tobyl

edit: ok ignore me, go with what Eric says, I defer to him!

tommcd 11-24-2007 07:47 AM

Quote:

Originally Posted by Alien Bob (Post 2969254)
Try the slackware-current's kernel config file for a 2.6.23.8 kernel, instead of the old config for a 2.6.21.5 kernel. You can find one here:
http://slackware.osuosl.org/slackwar...p-2.6.23.8-smp

What is the mkinitrd command you are using? What other steps did you take (kernel installation commands, lilo.conf editing, etc). Maybe you missed a step, but you did not document anything in your posts.

Another thing you may be experiencing is that your /dev/sda drive is not called /dev/hda with that new kernel. Try to see what kernel messages during boot refer to harddisk detection, and whether they mention sda or hda.

Eric

Thanks. I have been doing this:
cd /usr/src
rm -r linux
tar -xvjf linux-2.6.23.6.tar.bz2
ln -s linux-2.6.23.8 linux
cd linux
make mrproper
Then I copied the generic-smp config to /usr/src/linux/.config and ran make oldconfig, the make xconfig to enable ext3, low latency kernel, and smp processor.
I use grub from ubuntu (on /dev/sda1) to boot Slack, so I didn't have to worry about lilo. I will try the config from Slackware-current you suggested and report back later. (It takes me a while to go through this stuff). I'll try to watch the kernel boot messages more closely. Thanks everyone.
EDIT: oh, and the mkinitrd command was:
mkinitrc -c -k 2.6.23.8 -m ext3 -f ext3 -r /dev/sda5. I also tried just mkinitrd -c -k 2.6.23.8 -m ext3, but it didn't help.

tommcd 11-24-2007 08:11 AM

Forgot to add that I also ran "make bzImage" "make modules" "make modules_install" and I copied arch/i386/boot/bzImage, System.map and config to boot, and symlinked the new SYstem.map.

duryodhan 11-24-2007 08:17 AM

Does the kernel detect your HDD and still say that it can't mount it?

I mean, is it able to find the HDD and not mount it (which is a FS issue) or not able to find the HDD at all (which is an issue with the controllers you compiled in)?

tommcd 11-24-2007 10:12 AM

Quote:

Originally Posted by duryodhan (Post 2969302)
Does the kernel detect your HDD and still say that it can't mount it?

I mean, is it able to find the HDD and not mount it (which is a FS issue) or not able to find the HDD at all (which is an issue with the controllers you compiled in)?

This must be the problem. I tried compiling the 2.6.23.8 kernel again using the .config Eric suggested. I got basically the same error:
Code:

VFS: Cannot open root device "sda5" or unknown block(0,0)
Please append a correct "root="boot option; here are the available partitions:
0300...78150744... hda driver: ide-disk
0301...9767488...hda1
0302...979965...hda2
0303........1...hda3
0305...9767488...hda5
0306...9767488...hda6
0307...47865636...hda7
1600...4194302...hdc driver:ide-cdrom
Kernel panic-not syncing: VFS: Unable to mount root filesystem on unknown block(0,0)

So I tried booting again, but this time added root=/dev/hda5 (instead of sda5) to grub's menu. This time it gets a little further... and I get:
Code:

/sbin/e2fsck: No such device or address while trying to open /dev/sda5
Possibly non-existent or swap device?
*************************************************
An error occurred during the root filesystem check. You will be given a chance to log in single-user  mode to fix the problem.
If you are using ext2 filesystem running `e2fsck -v -y <partition>` might help
**************************************************

I tried running the e2fsck command. It then reboots to the same error (the 2nd error listed here).
So it must be something with the file system. Is that right? At least I got a little closer this time!
I enabled every option for ext3 (and jbd) in the kernel, not as a module. I enabled ext2 also. Could that be it? All my partitions are ext3, and sda2 is swap. Slackware is sda5. I can boot the 2.6.21.5-smp kernel using /dev/sda5 with an initrd and it boots just fine.

Alien Bob 11-24-2007 11:24 AM

Quote:

Please append a correct "root="boot option; here are the available partitions:
0300...78150744... hda driver: ide-disk
0301...9767488...hda1
0302...979965...hda2
0303........1...hda3
0305...9767488...hda5
0306...9767488...hda6
0307...47865636...hda7
1600...4194302...hdc driver:ide-cdrom
OK that proved that indeed your drive is now recognized as /dev/hda instead of /dev/sda.

Now, look at your /etc/fstab ... that one still uses /dev/sdX devices, which lead to your other errors. If you fix that in fstab, you will be OK

Eric

jelaiwang 11-24-2007 11:42 AM

I experienced a similar problem a few weeks ago when moving from the stock kernel to the newly recompiled kernel. Here are a few notes I took at the time that may help you:

After the first kernel recompile and reboot, there was a kernel panic where the kernel couldn't find the root partition. Here are some facts:

* The stock kernel recognized the SATA hard drive as /dev/sda, but the new kernel recognized the hard drive as /dev/hda.
* In /etc/lilo.conf, root=/dev/sda2. This creates an obvious problem if the hard drive isn't /dev/sda.
* The new kernel had standard IDE/ATA support compiled in, but no SATA.
* The page at http://www.serpentine.com/blog/2006/...s-cddvd-drive/ describes a similar problem and fix for Fedora.
* I took the spirit of this suggestion and removed ATA support (for disk and cdrom) and added it for SATA. This particular computer uses an Intel 82801GBM/GHM (ICH7 family) SATA IDE controller, so I used the ata_piix kernel option.
* In other words, instead of /dev/hda and /dev/hdc, I now have /dev/sda and /dev/sr0.

This was obviously a head-scratcher until I realized what I was going on.

HTH, JW.


All times are GMT -5. The time now is 07:01 PM.