Saturday, January 01, 2005

the thing boots but has errors:
exec: 64: chroot not found
kernel panic: Attempted to kill init!

i am going to check out the busy box build maybe i didnt
tell busybox to build chroot!

what i found out. i was indeed building busybox with
chroot support. so that wasnt the issue.
i looked on google of coarse and i found similar
issues but not exactly the same as mine.
then i notice that 64 probably meant line 64 or the linuxrc script.
-------------------------- linuxrc ---------------------------------
#!/bin/sh
#
# /linuxrc: System initialization script.
#

# where should all the output go
# OUTPUT=/dev/stdout if you want to see the error messages
OUTPUT=/dev/stdout

mount -t proc proc /proc

# test /dev/sr*, if we can mount it test for
# the file /mnt/cdrom/RESCUECD, if it is there we assume it is the RESCUECD
mountCD() {
for i in /dev/sr*; do
if mount -t iso9660 $i /mnt/cdrom 2> $OUTPUT 1> $OUTPUT; then
if test -f /mnt/cdrom/RESCUECD -o -f /mnt/cdrom/rescuecd; then
DEVICE=$i
return 0
else
umount $i
fi
fi
done
return 1
}

# first load some modules if necessary
(cat /etc/modules; echo) | # make sure there is a LF at the end
while read module args
do
case "$module" in
\#*|"") continue ;;
esac
insmod /lib/modules/$module $args
done

# so long no rescue cd found prompt for it
while ! mountCD; do
echo "Can't find valid cdrom in any drive - Fix that and press Enter"
read TMP
done

# copy the imagefile with the /var filesystem to /dev/ram1
# - saves a lot of space in contrast to using a tar archive and
# - compiling tar/gzip support into busybox and adding
# - an mke2fs binary
dd if=/mnt/cdrom/usr/lib/varbase/ram1.img of=/dev/ram1 2> $OUTPUT 1> $OUTPUT
mount /dev/ram1 /mnt/cdrom/var 2> $OUTPUT 1> $OUTPUT

# link /dev/cdrom and /dev/root_dev to the proper target
ln -sf $DEVICE /mnt/cdrom/dev/cdrom
ln -sf $DEVICE /mnt/cdrom/var/dev/root_dev

# umount /proc
umount /proc

# let's do some root device changing
cd /mnt/cdrom
pivot_root . initrd

# and finally start the real init
# at this point /dev/ram1 is mounted on /var
exec chroot . /sbin/init dev/console 2>&1 #line 64
----------------------------- end linuxrc --------------------------

so line 64 was giving the issue i went back to my minimal
timo cd install. and tried some things.
first i removed removed /sbin/init. with the result:
chroot: cannot execute /sbin/init: No such file or directory
Kernel panic: Attempted to kill init!

that is not my error.

then i tried killing all the contents of the etc directory:
INIT: No inittab file found.

i then wondered whose chroot am i really talking about?
i found when i had build the coreutils that i never
bothered to build chroot, i went back and installed chroot
onto my system and i got the above error:

INIT: No inittab file found.

this make sense as i have a totally empty /etc
directory. this is purposeful i wanted to start
from nothing a truly clean slate. timos is
great bit i have no idea was is absolutely
necessary or was caried over from the debian distro
it was builton.

THE BIG IDEA.
above script

pivot_root . initrd
this command must move from being an intial ram
disk to being what is on the cd.





No comments: