LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux From Scratch (https://www.linuxquestions.org/questions/linux-from-scratch-13/)
-   -   LFS kernel panic/boot problem (https://www.linuxquestions.org/questions/linux-from-scratch-13/lfs-kernel-panic-boot-problem-4175486523/)

lich000king 12-02-2013 04:01 AM

LFS kernel panic/boot problem
 
Hi

After successfully building lfs stable 7.4 using jhalfs I run into problems when rebooting.
I get kernel panic - no init found.

When I try to boot manually using the GRUB command line, I can see the root folder structure and the kernel image is where it is supposed to be. However, /dev only contains console and null. sda1 is not there for some reason.

I have read a lot of threads describing similar problems, but I could not find a solution. It looks as if the kernel was missing a driver. But I did the kernel config using essentially default settings. A large number of drivers is compiled into the kernel (not as a module). In particular, ext4 is there. I really don't know what to look for...

Any ideas?

I did do chapter 8 manually, grub install went through ok...

Code:

# Begin /boot/grub/grub.cfg
set default=0
set timeout=5

insmod ext2
set root=(hd0,1)

menuentry "GNU/Linux, Linux 3.10.10-lfs-7.4" {
        linux  /boot/vmlinuz-3.10.10-lfs-7.4 root=/dev/sda1 ro
}

Code:

# /etc/fstab

/dev/sda1  /        ext4  defaults      0        0
proc        /proc    proc  defaults      0        0
sys        /sys      sys    defaults      0        0
devpts      /dev/pts  devpts gid=4,mode=620 0        0
tmpfs      /run      tmpfs  defaults      0        0


druuna 12-02-2013 08:17 AM

I'm not sure this is a grub problem.

Have you double checked the /etc/inittab file for correctness and the presence of /sbin/init?

lich000king 12-02-2013 08:50 AM

Hi druuna

Thanks for your reply.
Hm, I installed mingetty and changed /etc/inittab accordingly (in order to get auto login).

However, now I have overwritten the file with the original from the book and reinstalld the lfs-bootscripts. It still doesn't work (same message).
What do you mean by /sbin/init, exactly? Because the book version does not contain this line:
http://www.linuxfromscratch.org/lfs/...r07/usage.html

druuna 12-02-2013 08:56 AM

The init command itself is installed here: 6.59. Sysvinit-2.88dsf

Can you post the exact error message (or a screen-shot) with +/- 10 lines leading up to the error?

lich000king 12-02-2013 09:03 AM

I tried again, this time I reinstalled Sysvinit-2.88dsf, then the bootscripts. Still the same.
Here is the screenshot:
http://postimg.org/image/atxeznalb/
Unfortunately, that's all the console shows.
I'm on a virtual box right now, but the error also appears on an physical machine.

druuna 12-02-2013 09:17 AM

Looking at the output posted you can see that sda1 (device 8:1) can be mounted, grub seems to be doing its part.

That leaves the following:
- /sbin/init
- /etc/inittab
- /etc/rc.d/*

I would concentrate on the last 2.
- There's either a mistake in /etc/inittab.
- One (or more) files in /etc/rc.d is missing or incorrect.

lich000king 12-02-2013 10:11 AM

Hm...

/sbin/init is in place.
So are the contents of /etc/rc.d. I checked the files from appendix D, i.e. the files from the bootscripts, and they are all there.
/etc/inittab is a copy/paste from the book so it should be correct.

I really don't know what to look for.
I'm sure it's something very simple...

druuna 12-02-2013 10:36 AM

Quote:

Originally Posted by lich000king (Post 5073947)
/sbin/init is in place.

Can I assume you actually checked this?

Quote:

So are the contents of /etc/rc.d. I checked the files from appendix D, i.e. the files from the bootscripts, and they are all there.
The scripts might be there, but are the correct script(s) called from /etc/inittab?

Quote:

/etc/inittab is a copy/paste from the book so it should be correct.
I've seen copy/pastes from the book go wrong. Depends on the book, but I do believe that copy/pasting from pdf books can go wrong. Do check the html version (book or on-line) and/or post it here.

lich000king 12-03-2013 03:56 AM

Quote:

Originally Posted by druuna (Post 5073956)
Can I assume you actually checked this?

Code:

root:/# ls sbin/ |grep init
init
telinit


Quote:

The scripts might be there, but are the correct script(s) called from /etc/inittab?
I will look into this.

Quote:

I've seen copy/pastes from the book go wrong. Depends on the book, but I do believe that copy/pasting from pdf books can go wrong. Do check the html version (book or on-line) and/or post it here.
I always use the online html version of the book, see the link in my second post and the following:

Code:

root:/# cat etc/inittab
# Begin /etc/inittab

id:3:initdefault:

si::sysinit:/etc/rc.d/init.d/rc S

l0:0:wait:/etc/rc.d/init.d/rc 0
l1:S1:wait:/etc/rc.d/init.d/rc 1
l2:2:wait:/etc/rc.d/init.d/rc 2
l3:3:wait:/etc/rc.d/init.d/rc 3
l4:4:wait:/etc/rc.d/init.d/rc 4
l5:5:wait:/etc/rc.d/init.d/rc 5
l6:6:wait:/etc/rc.d/init.d/rc 6

ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now

su:S016:once:/sbin/sulogin

1:2345:respawn:/sbin/agetty --noclear tty1 9600
2:2345:respawn:/sbin/agetty tty2 9600
3:2345:respawn:/sbin/agetty tty3 9600
4:2345:respawn:/sbin/agetty tty4 9600
5:2345:respawn:/sbin/agetty tty5 9600
6:2345:respawn:/sbin/agetty tty6 9600

# End /etc/inittab

The two are identical, i.e. no copy/paste error.

druuna 12-03-2013 07:24 AM

The output shown looks correct.

BTW: You might be able to use SHIFT-PAGEUP in the console to see some more lines, which might tell us more.

lich000king 12-03-2013 07:43 AM

I'm on the physical machine now. Shift-Pageup does not work but I can see a little mor due to higher resolution. Right before the EXT4 message two error messages failing to mount ext2 and ext3 appear. Before this there is only a long list of drivers being loaded. No errors or warnings. Looks reasonable to me.

From looking at inittab and /etc/rc.d I can't find anything wrong. But maybe I don't know what to look for exactly.

I think the best thing for me to do is to rebuild the whole system, sticking to the book as closely as possible. Then try to reboot again and see if it works...

lich000king 12-04-2013 04:25 AM

Ok, I restarted where jhalfs finished, i.e. at the end of chapter 6. Then I sticked as closely to the book as possible. Now I get a different error message (this time from the virtual box, where shift+page up works):

http://postimg.org/image/fzc6j8asd/
http://postimg.org/image/u68kevm4b/

I will try this on a physical machine to see if it has something to do with virtualbox.

druuna 12-04-2013 04:52 AM

I don't see any virtual box related errors.

The errors I do see indicate possible missing or wrong entries in /etc/fstab. It should look something like this (looks different then the one in your first post):
Code:

# Begin /etc/fstab

# file system  mount-point  type    options            dump  fsck
#                                                              order

/dev/sda1      /            ext4    defaults            1    1
/dev/<yyy>    swap        swap    pri=1              0    0
proc          /proc        proc    nosuid,noexec,nodev 0    0
sysfs          /sys        sysfs    nosuid,noexec,nodev 0    0
devpts        /dev/pts    devpts  gid=5,mode=620      0    0
tmpfs          /run        tmpfs    defaults            0    0
devtmpfs      /dev        devtmpfs mode=0755,nosuid    0    0

# End /etc/fstab

If you do not use swap, remove that line.

Also have a look at /etc/rc.d/init.d/mountvirtfs to determine what is done.

lich000king 12-06-2013 05:49 AM

Right! My /etc/fstab is bad.
The test system I created booted perfectly with the corrected file.

The other system still does not boot. The reason is the kernel config. It can't mount the root file system.
I suspect it misses some driver, but I have yet to find which. My system does not have any modules, but a lot of drivers compiled into the kernel. I don't know how I could have missed such an important part. But I will simply compare the config files to find out where the problem lies. The other system does boot with a defconfig kernel...
I will post back when I have the solution.

Thanks so far, druuna!

druuna 12-06-2013 06:13 AM

You've talked about and been using different machines and different configurations.

To stay on the right track can you post the error(s) shown (as much as possible, like post #12) from the machine you are having problems with?

First thing that comes to mind without seeing any errors: This one needs to be selected
Device Drivers -> Generic Driver Options -> Maintain a devtmpfs filesystem to mount at /dev


All times are GMT -5. The time now is 03:41 PM.