[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

kubuntu vs fedora initrd init files



in the thread
"boot from backup copy of fc5 on usb external disk?"
i described my initial problems and final success
 
Here I comment on the differences between  kubuntu,fedora  initrd 

I had success using two different kernel,initrd
1) obtained from a kubuntu install
stanza in grub.conf:
title FC5copy (2.6.15-26-386) usbfc5 /media/disk-1 (hd1,2)sdb3 rootusb
     root (hd1,2) ## sdb3
     kernel /boot/vmlinuz-2.6.15-26-386 ro root=LABEL=rootusb  rhgb quiet
     initrd /boot/initrd.img-2.6.15-26-386

This worked without any modifications on my part of the initrd init script
Moreover the disks were _not_ reordered

2)using my mainfc5
stanza in grub.conf:
title FC5copy (2.6.17-1.2174_FC5_usbrs4.sdb2sw.img)  /media/disk-1 (hd1,2)
      root (hd1,2)  ## sdb3
      kernel /boot/vmlinuz-2.6.17-1.2174_FC5 ro root=LABEL=rootusb  rhgb quiet
      initrd /boot/initrd_usbrs4.sdb2sw.img

This also worked, but here I had to make modification of initrd init script
 both  on  "resume /dev/sdxx"
and on "mkrootdev -t reiserfs -o defaults,ro /dev/sdc1"

And here the disks _were_ reordered. 
 usb originally sdc -> now sda
 first scsi originally sda now sdb
 second scsi originally sdb, now sdc
This reordering caused me much confusion almost to the point where
I was going to give up.

So, the kubuntu kernel,initrd worked with minimum of fuss
    the fedora  kernel,initrd rqrd days of effort, confusion
      (in part bc of my perpetual noobie status)

Aside from the different results just noted
my additional point here is that the 
initrd init files are almost completely different in the two cases.

case 2) fedora initrd-2.6.17-1.2174_FC5 (modified toinitrd_usbrs4.sdb2sw.img)
[root bootp cleanrs3]# tail init
mkblkdevs
resume /dev/sdb2
echo Creating root device.
mkrootdev -t reiserfs -o defaults,ro /dev/sdc1
echo Mounting root filesystem.
mount /sysroot
echo Setting up other filesystems.
setuproot
echo Switching to new root and running init.
switchroot

case 1) kubuntu:  initrd.img-2.6.15-26-386
here the script is quite long; I will list the whole thing at the end.
I am not competent enough to try and edit this init;
as noted above, I didnt have to, it just worked.
This init has none of the fedora init structure
no use at all of 
mkrootdev, sysroot, switchroot

googling "could not find /dev/root" gives a lot of msgs over
the past few years, all failing sysroot, switchroot,
and ending in kernel panic,
 mostly from redhat,fedora users. 
I dont think I saw even one from ubuntu users--
that now is no surprise bc the ubuntu init file does its thing
in a different way.

Here is the init file from initrd.img-2.6.15-26-386
I would be interested in comments as to what it is doing;
and especially if anyone knows how it avoids reordering the disks.

[root bootp clean386]# cat init
#!/bin/sh

mkdir /sys
mkdir /proc
mkdir /tmp
mkdir -p /var/lock
mount -t sysfs none /sys
mount -t proc none /proc

# Note that this only becomes /dev on the real filesystem if udev's scripts
# are used; which they will be, but it's worth pointing out
mount -t tmpfs -o mode=0755 udev /dev
touch /dev/.initramfs-tools
mkdir /dev/.initramfs
mknod /dev/console c 5 1
mknod /dev/null c 1 3

# Export the dpkg architecture
export DPKG_ARCH=
. /conf/arch.conf

# Bring in the main config
. /conf/initramfs.conf
for i in conf/conf.d/*; do
        [ -f ${i} ] && . ${i}
done
. /scripts/functions

# Parse command line options
export break=
export init=/sbin/init
export quiet=n
export readonly=y
export ROOT=
export resume=${RESUME}
export rootmnt=/root
export debug=
for x in $(cat /proc/cmdline); do
        case $x in
        init=*)
                init=${x#init=}
                ;;
        root=*)
                ROOT=${x#root=}
                case $ROOT in
                LABEL=*)
                        ROOT="/dev/disk/by-label/${ROOT#LABEL=}"
                        ;;
                UUID=*)
                        ROOT="/dev/disk/by-uuid/${ROOT#UUID=}"
                        ;;
                esac
                ;;
        nfsroot=*)
                NFSROOT=${x#nfsroot=}
                ;;
        boot=*)

                BOOT=${x#boot=}
                ;;
        resume=*)
                resume=${x#resume=}
                ;;
        quiet)
                quiet=y
                ;;
        ro)
                readonly=y
                ;;
        rw)
                readonly=n
                ;;
        debug)
                debug=y
                exec >/tmp/initramfs.debug 2>&1
                set -x
                ;;
        break=*)
                break=${x#break=}
                ;;
        break)
                break=premount
                ;;
        esac
done

depmod -a
maybe_break top

# Don't do log messages here to avoid confusing usplash
run_scripts /scripts/init-top

. /scripts/${BOOT}
parse_numeric ${ROOT}

maybe_break modules
log_begin_msg "Loading essential drivers..."
load_modules
log_end_msg

maybe_break premount
[ "$quiet" != "y" ] && log_begin_msg "Running /scripts/init-premount"
run_scripts /scripts/init-premount
[ "$quiet" != "y" ] && log_end_msg

maybe_break mount
log_begin_msg "Mounting root file system..."
mountroot
log_end_msg

maybe_break bottom
[ "$quiet" != "y" ] && log_begin_msg "Running /scripts/init-bottom"
run_scripts /scripts/init-bottom
[ "$quiet" != "y" ] && log_end_msg

# Move virtual filesystems over to the real filesystem
mount -n -o move /sys ${rootmnt}/sys
mount -n -o move /proc ${rootmnt}/proc

while [ ! -x ${rootmnt}${init} ]; do
        panic "Target filesystem doesn't have ${init}"
done

maybe_break init

# Unset the problematic debug variable and chain to real filesystem
unset debug
exec run-init ${rootmnt} ${init} "$@" <${rootmnt}/dev/console >${rootmnt}/dev/console
[root bootp clean386]#


regards,
Jack

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]