Problem inserting busybox into initrd
John Summerfield
debian at herakles.homelinux.org
Tue Mar 11 05:46:50 UTC 2008
Michal Jaegermann wrote:
> On Tue, Mar 11, 2008 at 10:35:37AM +0900, John Summerfield wrote:
>> Nothing produces a message to say what's wrong.
>
> 'nash' would be my guess. Does feeding /bin/sh to nash really has a
> chance to provide a busybox shell? I did not look but nash is
> pretty limited in what it can do.
>
> Once you have busybox on initrd then maybe you can replace
> nash with it all over the place?
The translation's not that simple, nash has some built-in commands that
need to be translated. I've been pondering restructuring it like busybox
or adding its functionality to busybox, but I'm not sure such work would
be welcomed by RH/F.
However, I've discovered the problem, and have a circumvention:
Here's the relevant bit of the diff:
emit "loadpolicy"
emit "echo Switching to new root and running init."
-emit "switchroot"
+emit "switchroot --no-rm"
emit "echo Booting has failed."
-emit "sleep -1"
+emit "sleep 60"
chmod +x $RCFILE
The problem is that rm goes deleting stuff before it fails. The above
"--no-rm" prevents that.
It's time to update my bug report and maybe open a new thread for a new
topic.
For those wishing to educate themselves, this command unpacks the initrd:
gunzip -dc </boot/initrd-2.6.25-0.101.rc4.git3.fc9.img.js \
| cpio --extract -d
This is what a nash script looks like. It doesn't seem to be
programmable - no if or looping constucts, and all those commands are
built right in. It can run external programs, but by the time I tried to
do that, switchroot had deleted everything.
#!/bin/nash
echo Beginning initialistion
mount -t proc /proc /proc
setquiet
echo Mounting proc filesystem
echo Mounting sysfs filesystem
mount -t sysfs /sys /sys
echo Creating /dev
mount -o mode=0755 -t tmpfs /dev /dev
mkdir /dev/pts
mount -t devpts -o gid=5,mode=620 /dev/pts /dev/pts
mkdir /dev/shm
mkdir /dev/mapper
echo Creating initial device nodes
mknod /dev/null c 1 3
mknod /dev/zero c 1 5
mknod /dev/systty c 4 0
mknod /dev/tty c 5 0
..
echo Activating logical volumes
lvm vgchange -ay --ignorelockingfailure VolGroup00
resume /var/swapfile1
echo Creating root device.
mkrootdev -t ext3 -o defaults,ro /dev/VolGroup00/LogVol00
echo Mounting root filesystem.
mount /sysroot
echo Setting up other filesystems.
setuproot
loadpolicy
echo Switching to new root and running init.
switchroot --no-rm
echo Booting has failed.
sleep 60
I've just noticed that setquiet statement. That's probably the case of
"no messages."
More information about the fedora-test-list
mailing list