linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* pivot_root and initrd kernel panic woes
@ 2001-12-11 18:50 Joy Almacen
  2001-12-11 21:00 ` Marcel J.E. Mol
                   ` (2 more replies)
  0 siblings, 3 replies; 18+ messages in thread
From: Joy Almacen @ 2001-12-11 18:50 UTC (permalink / raw)
  To: wa, linux-kernel; +Cc: Stephen C. Tweedie

Werner and the Kernel Gods,


 I have tried for the past 3 days fruitlessly to resolve my kernel
woes.  Spent  most of my working hours searching  google for any answers
but I got confused instead.  I am desperate for any info that would
point
me to the right direction.  Your assistance will be highly appreciated
and I know that I am not alone on this one.

Here's what I am trying to do.

I have successfully installed RH 7.1 with 2.4.2 kernel on a Compaq
Proliant 6000 (4 Processors) .  The SCSI driver that was loaded on
install is sym53c8xx .

cat /proc/scsi/scsi

Attached devices:
Host: scsi1 Channel: 00 Id: 00 Lun: 00
  Vendor: COMPAQ   Model: MAB3091SC        Rev: 0814
  Type:   Direct-Access                    ANSI SCSI revision: 02



[root@tinkerbell smpimg]# lsmod

Module                  Size  Used by
loop                    9120   2  (autoclean)
eepro100               16624   1  (autoclean)
sym53c8xx              62080   5
sd_mod                 11680   5
scsi_mod               95072   2  [sym53c8xx sd_mod]


[root@tinkerbell smpimg]# cat /proc/mounts

/dev/root / ext2 rw 0 0
/proc /proc proc rw 0 0
/dev/sda8 /home ext2 rw 0 0
/dev/sda6 /usr ext2 rw 0 0
/dev/sda5 /var ext2 rw 0 0
none /dev/pts devpts rw 0 0
/dev/loop0 /mnt/smpimg ext2 rw 0 0



Also,  /dev/ram0 is enabled:

fdisk /dev/ram0

Note: sector size is 1024 (not 512)
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF
disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.


Command (m for help): p

Disk /dev/ram0: 1 heads, 4096 sectors, 1 cylinders
Units = cylinders of 4096 * 1024 bytes

     Device Boot    Start       End    Blocks   Id  System



Since I wanted to have  EXT3 support ,   I upgraded my kernel to
2.4.9-12 from redhat.com together with the
required SysVinit, modutils, initscripts, filesystem and all.

Once I have the new kernel installed I created an initrd image. The
reason is that the SCSI drivers are modules and
not compiled in:

[root@tinkerbell scsi]# pwd

/lib/modules/2.4.9-12smp/kernel/drivers/scsi

[root@tinkerbell scsi]# ls

3w-xxxx.o   aha1740.o      cpqfc.o     fdomain.o    ips.o
pci2000.o   qlogicfas.o   sg.o         tmscsim.o
53c7,8xx.o  aic7xxx        dmx3191d.o  gdth.o       iscsi.o
pci2220i.o  qlogicfc.o    sim710.o     u14-34f.o
a100u2w.o   aic7xxx_mod.o  dpt_i2o.o   g_NCR5380.o  megaraid.o
pcmcia      qlogicisp.o   sr_mod.o     ultrastor.o
aacraid.o   aic7xxx.o      dtc.o       ide-scsi.o   NCR53c406a.o
ppa.o       scsi_debug.o  st.o         wd7000.o
advansys.o  AM53C974.o     eata_dma.o  imm.o        ncr53c8xx.o
psi240i.o   scsi_mod.o    sym53c416.o
aha152x.o   atp870u.o      eata.o      in2000.o     osst.o
qla1280.o   sd_mod.o      sym53c8xx.o
aha1542.o   BusLogic.o     eata_pio.o  initio.o     pas16.o
qla2x00.o   seagate.o     t128.o


Since I understand that I have to create an image for my booting
process, I created one with the following
command:

[root@tinkerbell scsi]# cd /boot/

mkinitrd  initrd-2.4.9-12smp.img  2.4.9-12smp  --preload scsi_mod
--with=sd_mod  --with=sym53c8xx -v

Using modules:  ./kernel/drivers/scsi/scsi_mod.o
./kernel/drivers/scsi/sd_mod.o ./kernel/drivers/scsi/sym53c8xx.o
Using loopback device /dev/loop1
/sbin/nash -> /tmp/initrd.QCmw3a/bin/nash
/sbin/insmod.static -> /tmp/initrd.QCmw3a/bin/insmod
`/lib/modules/2.4.9-12smp/./kernel/drivers/scsi/scsi_mod.o' ->
`/tmp/initrd.QCmw3a/lib/scsi_mod.o'
`/lib/modules/2.4.9-12smp/./kernel/drivers/scsi/sd_mod.o' ->
`/tmp/initrd.QCmw3a/lib/sd_mod.o'
`/lib/modules/2.4.9-12smp/./kernel/drivers/scsi/sym53c8xx.o' ->
`/tmp/initrd.QCmw3a/lib/sym53c8xx.o'
Loading module scsi_mod with options
Loading module sd_mod with options
Loading module sym53c8xx with options



Here's my /etc/modules.conf

[root@tinkerbell /boot]# cat /etc/modules.conf

alias eth0 eepro100
alias eth1 eepro100
alias scsi_hostadapter1 sym53c8xx
alias parport_lowlevel parport_pc
alias scsi_hostadapter2 sym53c8xx
alias scsi_hostadapter3 sym53c8xx
alias scsi_hostadapter4 sym53c8xx

After creating the initrd image, I wanted to make sure that it will
mount the correct device:

[root@tinkerbell /boot]# zcat initrd-2.4.9-12smp.img  > /tmp/smp

[root@tinkerbell /boot]# mount /tmp/smp -t ext2 /mnt/smpimg/ -o loop

[root@tinkerbell /boot]# cd /mnt/smpimg/

[root@tinkerbell smpimg]# vi linuxrc


Here's the content of mkinitrd generated  /linuxrc

#!/bin/nash

echo "Loading scsi_mod module"
insmod /lib/scsi_mod.o
echo "Loading sd_mod module"
insmod /lib/sd_mod.o
echo "Loading sym53c8xx module"
insmod /lib/sym53c8xx.o
mount -t proc /proc /proc
echo Mounting /proc filesystem
echo Creating root device
mkrootdev /dev/root
echo 0x0100 > /proc/sys/kernel/real-root-dev
umount /proc
echo Mounting root filesystem
mount --ro -t ext2 /dev/root /sysroot
pivot_root /sysroot /sysroot/initrd


I saw a posting on the net saying that I should have this edited as
follows:

#!/bin/nash

echo "Loading scsi_mod module"
insmod /lib/scsi_mod.o
echo "Loading sd_mod module"
insmod /lib/sd_mod.o
echo "Loading sym53c8xx module"
insmod /lib/sym53c8xx.o
mount -t proc /proc /proc
echo Mounting /proc filesystem
echo Creating root device
mkrootdev /dev/root
echo 0x0100 > /proc/sys/kernel/real-root-dev
umount /proc
echo Mounting root filesystem
mount --ro -t ext2  /dev/root  /sysroot
cd /sysroot                                                 ## CD to
/sysroot first
pivot_root /sysroot /sysroot/initrd       ## Do pivot_root
exec /sbin/init "$@"                                ## Execute
/sbin/init


After which I added this line  my  /etc/lilo.conf file:

image=/boot/vmlinuz-2.4.9-12smp
        label=2.4.9smp
        append="initrd=/boot/initrd-2.4.9-12smp.img root=/dev/ram0
init=/linuxrc rw"

Reran lilo

[root@tinkerbell /root]# lilo -v

LILO version 21.4-4, Copyright (C) 1992-1998 Werner Almesberger
'lba32' extensions Copyright (C) 1999,2000 John Coffman

Reading boot sector from /dev/sda
Merging with /boot/boot.b
Mapping message file /boot/message
Boot image: /boot/vmlinuz-2.4.2-2smp
Mapping RAM disk /boot/initrd-2.4.2-2smp.img
Added linux
Boot image: /boot/vmlinuz-2.4.2-2
Mapping RAM disk /boot/initrd-2.4.2-2.img
Added linux-up *
Boot image: /boot/vmlinuz-2.4.9-12smp    ## Entry for SMP kernel
Added 2.4.9smp
Boot image: /boot/vmlinuz-2.4.9-12-smp-4th
Added custom
/boot/boot.0800 exists - no backup copy made.
Writing boot sector.


Now for the real fun part, when I reboot I get the following error:

"VFS: Cannot open root device "ram0" or 01:00
Please append a correct "root=" boot option
Kernel panic: VFS:  unable to mount root fs on 01:00 "

I have tried other approaches but to no avail. I decided that I seek
assistance from you
hoping that you will be kind and patient enough to help me.

Thanks in advance,
Joy










^ permalink raw reply	[flat|nested] 18+ messages in thread
* RE: pivot_root and initrd kernel panic woes
@ 2001-12-17 18:38 Torrey Hoffman
  2001-12-17 18:44 ` Alexander Viro
  2001-12-17 19:02 ` Erik Andersen
  0 siblings, 2 replies; 18+ messages in thread
From: Torrey Hoffman @ 2001-12-17 18:38 UTC (permalink / raw)
  To: 'Mike Galbraith', vda; +Cc: linux-kernel

I've been following this discussion with interest as I've also 
been having initrd problems recently with a setup that used to
work perfectly.  

I haven't completely tracked it down, but for me, it seems to 
be the initrd *build* that is the problem, rather than the kernel 
booting the initrd.  

My initrd is ext2, uses busybox as init (not using linuxrc or
pivot_root) - it is booted over the network using the pxelinux 
boot loader (part of Peter Anvin's syslinux package.)  

I take the same set of files and convert them into an initrd 
multiple times.  Some of the images will boot (every time) and 
some won't - ever.  

When they don't boot, the last messages on the console are:

RAMDISK: Compressed image found at block 0
Freeing initrd memory: 1197k freed
VFS: Mounted root (ext2 filesystem).
Freeing unused kernel memory: 388k freed

and then the system just hangs.  When it works, the messages are
identical up to that point but continue...

init started:  BusyBox v0.51 (2001.04.25-13:32+0000) multi-call binary
(etc.)

I have a complete set of files and dev nodes for the initrd in 
./rootfs. They add up to about 3 MB.  Nothing too unusual - busybox, 
glibc 2.1.3, etc.

My build system kernel is 2.4.16, has the standard 4 MB ramdisk, 
and I use the following script to create the initrd:

#!/bin/bash

rm -rf initrd.gz
umount /dev/ram
mke2fs -m0 /dev/ram 4000
mount -t ext2 /dev/ram /mnt/ramdisk
cp -a rootfs/* /mnt/ramdisk
umount /dev/ram
dd if=/dev/ram bs=1k count=4000 of=initrd
gzip initrd

If I run this script several times, the resulting "initrd.gz"
files are different each time (of course - different timestamps 
and file ordering in the image).  They are all about 1.2 MB.

Some of them boot and some of them don't.  I can take a non-working
image, gunzip it, dd it back to the ramdisk, mount it, and 
recursively diff it against the original rootfs and find nothing
wrong. 

I thought this was a 2.4 kernel bug until I found that my older
2.2.19 kernel works or fails on the same initrd.gz files as the 
new 2.4.16 kernel.

But I never used to have this problem when I built initial 
ramdisks (using the *same* script and *same* files) under 2.2.19,
so maybe the problem is that creating initrd's on 2.4.x is buggy?

The other variable is I used to build them with Mandrake 7.2, 
I've since upgraded to Mandrake 8.1.  Perhaps the problem is the
version of gzip I use, or something else in the distribution.

Anyway, I hope to track this down today.

Very weird, and _very_ annoying.  Wasted 4 hours on this Friday.

Torrey Hoffman

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2001-12-17 19:02 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-12-11 18:50 pivot_root and initrd kernel panic woes Joy Almacen
2001-12-11 21:00 ` Marcel J.E. Mol
2001-12-13 10:09 ` vda
2001-12-13  8:19   ` Alexander Viro
2001-12-13 13:22     ` vda
2001-12-13 14:53       ` vda
2001-12-15 12:14       ` Mike Galbraith
2001-12-15 16:51         ` vda
2001-12-15 17:59           ` Mike Galbraith
2001-12-16  2:32             ` vda
2001-12-16  9:02               ` Mike Galbraith
2001-12-15 16:55         ` vda
2001-12-15 18:03           ` Mike Galbraith
2001-12-13 19:07 ` Stephen C. Tweedie
2001-12-13 18:35   ` Joy Almacen
2001-12-17 18:38 Torrey Hoffman
2001-12-17 18:44 ` Alexander Viro
2001-12-17 19:02 ` Erik Andersen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).