Problem inserting busybox into initrd

John Summerfield debian at herakles.homelinux.org
Tue Mar 11 01:35:37 UTC 2008


Bruno Wolff III wrote:
> On Mon, Mar 10, 2008 at 17:47:06 +0900,
>   John Summerfield <debian at herakles.homelinux.org> wrote:
>> 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.
> 
> I have been having luck with the rescue (netinst) image. After coming up
> in rescue mode I chroot to /mnt/sysimage and then most (but not all)
> things work. I can even use yum to get updates.
> (I am trying to get mkinitrd to put in the proper crypto stuff and it seems
> to be having a problem with dm-crypt stacked on top of software raid.)
> Depending on what you need to look at that may work for you.
> 

Thanks Bruno for your response. My post should be read in context with 
some others I made - it's clear to me, but I didn't make the link in 
this thread. The message I get is "Booting has failed" and the reason 
it's failed is that it can't find my disks (there are two of them).


I'm trying to diagnose a boot failure by getting a shell at the time of 
the failure.

A rescue CD doesn't help, I have a kernel (two no) that does boot, and 
while they're good for making changes, I really need to run a 2.6.25 
kernel to see why it doesn't boot properly.

My best idea so far is to get busybox in there, but so far nothing I've 
tried has got me a working shell.

I've changed my version of mkinitrd, here's the latest diff:
[summer at localhost ~]$ diff -u /sbin/mkinitrd*
--- /sbin/mkinitrd      2008-03-07 09:25:01.000000000 +0900
+++ /sbin/mkinitrd.js   2008-03-11 07:45:07.000000000 +0900
@@ -1370,6 +1370,19 @@
  inst /sbin/nash "$MNTIMAGE" /bin/nash
  inst /sbin/modprobe "$MNTIMAGE" /bin/modprobe
  inst /sbin/rmmod "$MNTIMAGE" /bin/rmmod
+inst /sbin/busybox "$MNTIMAGE" /bin/busybox
+cat <<. | tee ${MNTIMAGE}/linuxrc
+#!/bin/sh
+echo linuxrc begin
+/bin/sh
+echo linuxrc end
+.
+chmod +x ${MNTIMAGE}/linuxrc
+(
+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"
@@ -1574,7 +1587,7 @@
  echo -n >| $RCFILE
  cemit << EOF
  #!/bin/nash
-
+echo Beginning initialistion
  mount -t proc /proc /proc
  setquiet
  echo Mounting proc filesystem
@@ -1793,7 +1806,12 @@
  emit "echo Switching to new root and running init."
  emit "switchroot"
  emit "echo Booting has failed."
-emit "sleep -1"
+emit "help"
+emit "echo Trying a shell"
+emit "openvt -c 9 -s -w -- /bin/sh"
+emit "/bin/busybox sh"
+emit "echo  Shell failed or shell done"
+emit "sleep 60"

  chmod +x $RCFILE

[summer at localhost ~]$

the openvt doesn't seem to have helped, and neither has linuxrc. Nothing 
produces a message to say what's wrong.






More information about the test mailing list