Problem inserting busybox into initrd

John Summerfield debian at herakles.homelinux.org
Mon Mar 10 08:47:06 UTC 2008


Some will have noticed that I'm having a difficulty with f9 kernels.

In order to have a poke around and see what I can see, I've been trying 
to insert anaconda into the initrd so as to get a shell.

Unfortunately, RH/Fedora uses nash, and nash is, er, not a shell.

Here is how I make a new batch of initrds:
[root at localhost ~]# for K in $(for k in $(rpm -q kernel) ; do echo $k | 
sed -r -e 's=kernel-==' -e 's=[[:space:]].*==' -e 's=.x86_64==' ;done); 
do /sbin/mkinitrd.js --allow-missing -f /boot/initrd-${K}.img.js $K ;done

Here;s how I created my modified initrd:
[root at localhost ~]# diff -u /sbin/mkinitrd*
--- /sbin/mkinitrd      2008-03-07 09:25:01.000000000 +0900
+++ /sbin/mkinitrd.js   2008-03-09 21:52:44.000000000 +0900
@@ -1370,6 +1370,12 @@
  inst /sbin/nash "$MNTIMAGE" /bin/nash
  inst /sbin/modprobe "$MNTIMAGE" /bin/modprobe
  inst /sbin/rmmod "$MNTIMAGE" /bin/rmmod
+inst /sbin/busybox "$MNTIMAGE" /bin/busybox
+(
+cd "$MNTIMAGE/bin"
+for f in $(./busybox | sed -r -e '0,/Currently defined functions/d' | 
tr -d ,\\\n); do ln -sf busybox  $f  ;done
+ls -l --color
+)

  if [ -e /etc/fstab.sys ]; then
      inst /etc/fstab.sys "$MNTIMAGE"
@@ -1793,6 +1799,12 @@
  emit "echo Switching to new root and running init."
  emit "switchroot"
  emit "echo Booting has failed."
+emit "help"
+emit "echo Trying a shell"
+emit "/bin/sh </dev/tty"
+emit "/bin/sh </dev/tty1"
+emit "/bin/busybox --help"
+emit "echo  Shell failed or shell done"
  emit "sleep -1"

  chmod +x $RCFILE
[root at localhost ~]#


Now, if I unpack the initrd then I can chroot into it and it seems fine; 
I get a shell can can do stuff.

Before you ask, I have this:
+emit "/bin/sh </dev/tty"
because this didn't work either.
+emit "/bin/sh"

However, when I boot one of these, the echo commands work, but none of 
the "/bin/" lines does anything. There are no messages, nothing to 
indicate any reason for failure.

Here are the relevant bits of what I have in the initrd:

[root at localhost ~]# gunzip -dc 
</boot/initrd-2.6.25-0.87.rc3.git4.fc9.img.js | cpio --list --verbose | 
grep  bin/ | egrep 'sh|/bus'
lrwxrwxrwx   1 root     root            7 Mar 10 17:33 bin/sh -> busybox
-rwxr-xr-x   1 root     root      2009352 Feb 20 00:13 bin/busybox
lrwxrwxrwx   1 root     root            7 Mar 10 17:33 bin/sha1sum -> 
busybox
lrwxrwxrwx   1 root     root            7 Mar 10 17:33 bin/ash -> busybox
lrwxrwxrwx   1 root     root            7 Mar 10 17:33 bin/msh -> busybox
-rwxr-xr-x   1 root     root       100136 Mar  7 09:25 bin/nash
20970 blocks
[root at localhost ~]#

Can anyone think what I might have missed?

I'm off to see whether openvt does better. It fine straw, I know.

-- 

Cheers
John

-- spambait
1aaaaaaa at coco.merseine.nu  Z1aaaaaaa at coco.merseine.nu
-- Advice
http://webfoot.com/advice/email.top.php
http://www.catb.org/~esr/faqs/smart-questions.html
http://support.microsoft.com/kb/555375

You cannot reply off-list:-)




More information about the fedora-test-list mailing list