Bug 51770

Summary: when kernel loads just created initrdfile, it panics
Product: [Retired] Red Hat Public Beta Reporter: lethalwp
Component: mkinitrdAssignee: Matt Wilson <msw>
Status: CLOSED NOTABUG QA Contact: David Lawrence <dkl>
Severity: medium Docs Contact:
Priority: medium    
Version: roswell   
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2001-08-24 16:26:33 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
Description Flags
initrd done with mkinitrd initrdttt.img 2.4.8
my rpm -qa |sort >rpmlist.txt
my fstab
my lilo.conf none

Description lethalwp 2001-08-14 21:59:45 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.3) Gecko/20010808

Description of problem:
after doing a mkinitrd file 2.4.8 && edit lilo.conf && lilo
2.4.8 refused to startup, till i edit the linuxrc file

Version-Release number of selected component (if applicable):

How reproducible:
Didn't try

Steps to Reproduce:
1.rpm -e kernel kernel-headers --nodeps
2.compile new kernel && ln -s /usr/src/linux/include/linux
/usr/include/linux && same for asm
3. mkinitrd /boot/initrd2.4.8.img 2.4.8
4. edit lilo.conf && run lilo
5. reboot

Actual Results:  kernel panic showing errors about (pivot_root /sysroot
and afterwards a 'No init found'
(/sbin/init is present on the rootdevice, but apparently it was badly mounted)

Expected Results:  begin of /sbin/init && rc.sysinit

Additional info:

when editing the linuxrc contained in the initrd:
i can read:

               echo "Loading sd_mod module"                               
insmod /lib/sd_mod.o                                                      
echo "Loading aic7xxx module"                                             
insmod /lib/aic7xxx.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 had to remark those lines to get the bootproces working)

when i looked for a binary called mkrootdev, but haven't found it (neither
in the initrd, neither on the existent system), i suppose that is the cause

i also did a :

for i in *.rpm; do ( if ( rpm -qlp $i | grep mkrootdev ) ; then echo $i ;
fi ) ; done

in the rpmdir of the roswell cds, haven't found any infos about some mkrootdev

Comment 1 Matt Wilson 2001-08-23 22:17:46 UTC
there should be more errors (from the mount command, perhaps) further up the log.

Comment 2 lethalwp 2001-08-24 13:50:28 UTC
Created attachment 29355 [details]
initrd done with mkinitrd initrdttt.img 2.4.8

Comment 3 lethalwp 2001-08-24 13:59:10 UTC
I have attached the initrdfile created, it panics just after loading the scsi
module, but there are no traces in the logs (which is normal, because the root
drive isn't mounted yet), anyway here are the messages:
Mounting /proc filesystem
Mounting root filesystem
pivotroot: pivot_root(/sysroot,/sysroot/initrd) failed:2
Freeing unused kernel mem: 232k freed
Kernel panic: No init found. Try passing init option to kernel.

here is the version used of mkinitrd:
Creating root device[lethalwp@little RPMS]$ rpm -qa |grep initrd

I'm also putting as attachment a rpm -qa >rpmlist.txt
I have to admit i haven't used the install of the roswell cds when upgrading
from my 7.1, i did the update all manually using rpm -F (which was way 'longer'
to do than wolverine -> 7.1 :/, a lot of new packages needed...)

Again, for me, it is calling some devfile or so that does not exist?

Kernel used if 2.4.8 homecompiled (using the latest rpm of redhat .config, with
a make oldconfig or so, changing some little stuff)

Comment 4 lethalwp 2001-08-24 14:00:20 UTC
Created attachment 29356 [details]
my   rpm -qa |sort >rpmlist.txt

Comment 5 Matt Wilson 2001-08-24 14:11:47 UTC
Are you sure?  It should have said:

Mounting /proc filesystem
Creating root device
Mounting root filesystem

Comment 6 lethalwp 2001-08-24 14:39:40 UTC
Yup sorry, copy/paste that went wrong it did say:

Mounting /proc filesystem
Creating root device
Mounting root filesystem
pivotroot: pivot_root(/sysroot,/sysroot/initrd) failed:2
Freeing unused kernel mem: 232k freed
Kernel panic: No init found. Try passing init option to kernel.

Comment 7 Matt Wilson 2001-08-24 14:44:14 UTC
does your root filesystem have an ext3 journal file on it?

Comment 8 lethalwp 2001-08-24 14:52:48 UTC
Nope, it is "good old" ext2
but what i don't understand is the following:
[lethalwp@little lethalwp]$ locate mkrootdev
[lethalwp@little lethalwp]$ 

I have no mkrootdev file (same kind of result with find of course)
How can it make the 'rootdev' if the program it is calling is not present?

Comment 9 Matt Wilson 2001-08-24 15:23:07 UTC
no, these are special nash commands.  They are built in to nash.  The initrd is
way too small to have a full runtime environment for a shell and commands.

Comment 10 Matt Wilson 2001-08-24 15:24:37 UTC
What device is your root filesystem on?  What bootloader are you using?  Can you
upload your bootloader config file?

Comment 11 lethalwp 2001-08-24 15:30:13 UTC
I have done a little more digging, but can be wrong: and remarked this:

actually: [root@little kernel]# cat real-root-dev
which is  0x812  (hrm, but root is on  brw-rw----    1 root     disk       8, 
18 Jul 18 17:58 /dev/sdb2
so i was expecting 0x818 or so?)
Anyway, in the linuxrc file i can read:  
mkrootdev /dev/root                                                      
echo 0x0100 > /proc/sys/kernel/real-root-dev   

I presume: 0x0100 is brw-rw----    1 root     disk       1,   0 Jul 18 17:58
/dev/ram0) which is not the real needed root?

And, to end, i've read this little info in the

"Obsolete root change mechanism

The following mechanism was used before the introduction of pivot_root.
Current kernels still support it, but you should _not_ rely on its
continued availability. ... ... ..."
Which explain the use of echo something>real-root-dev

I'm lost on this, why trying to implement the use of real-root-dev? What is the
need of pivot_root? I thought that once the linuxrc was ended, initrd was
cleaned up,and kernel mounted the root by its own (using rdev or lilo setup)

And actually, it's this last method i am using to get it working

Adding lilo.conf & fstab scripts in a tiffy ;)

Comment 12 lethalwp 2001-08-24 15:31:08 UTC
Created attachment 29375 [details]
my fstab

Comment 13 lethalwp 2001-08-24 15:31:46 UTC
Created attachment 29376 [details]
my lilo.conf

Comment 14 Matt Wilson 2001-08-24 15:36:23 UTC
18 decimal == 0x12.

Comment 15 Matt Wilson 2001-08-24 15:40:23 UTC
you'll notice we're using pivot_root now.  What we're doing is tricking the
kernel into thinking that the real-root-device is the ramdisk (which is really
the initrd).  This means that the kernel won't be doing anything at all when
linuxrc ends except for exec'ing /sbin/init.

Comment 16 lethalwp 2001-08-24 16:26:29 UTC
you've told me initrd was to little to put a bash in it, but that gave me the
idea of doing it... giving it 8MB of ram, bash, ls, cat, + libs

anyway, i have found the explanation, which is quite ridiculous, and was so
evident :(

after the:
pivotroot: pivot_root(/sysroot,/sysroot/initrd) failed:2
in the bash, i've seen my rootdev was correctly mounted in /sysroot
and then checking /sysroot/initrd: no such directory, so i've made one, and the
system was able to boot.

I really do not understand the need of using that 'tempdir', which, if deleted,
will stop the whole bootsequence?

But, if i may ask one little last question:
kernel said: real-root-dev: 2066  which is in hex=818  and you' telling me to
take those number appart?, and convert 8->hex  and 18->hex?
(A Yes/No question ;) )

Thank you for helping, well-done ;)
Greetz, lethalwp

Comment 17 Matt Wilson 2001-08-24 16:30:46 UTC
run "rpm -y mkinitrd" - it required a new RPM of filesystem which made the
directory, it seems you don't have that installed...