NSLU2-Linux
view · edit · print · history

How I recovered my broken Debian kernel using the install image

I broke my Debian kernel with an upgrade to lenny. Here's how I got it into a "recovery mode" where I was able to re-install the kernel.

Install and start the Debian installer, according to these instructions (use the unslug2 method):

http://www.cyrius.com/debian/nslu2/install.html

Once your Debian installer is up, do this:

  • Choose your language
  • Choose your Debian mirror
  • Choose your distribution - stable, testing, etc (it shouldn't matter which one)
  • Let it download its startup stuff
  • Under "Download installer components", select "[*] ext3-modules-2.6.18-6-ixp4xx-di: EXT3? filesystem support" and "[*] usb-storage-modules-2.6.18-6-ixp4xx-di: USB storage support".
  • Let it install those.
  • When it gets to "Partition disks", go down to "Go back" using the TAB key and press ENTER.
  • At the menu, choose "Execute a shell".
  • Once you're in the shell, type the stuff below, because certain things need to be set up right for installation of kernels to work. You can omit the "mknod"s if you have already done them.
~ # dmesg | tail
sda: assuming drive cache: write through
SCSI device sda: 625142448 512-byte hdwr sectors (320073 MB)
sda: Write Protect is off
sda: Mode Sense: 00 00 00 00
sda: assuming drive cache: write through
 sda: sda1 sda2 sda3
sd 0:0:0:0: Attached scsi disk sda
~ # mount -t ext3 /dev/sda3 /mnt     <-- substitute your Linux partition for /dev/sda3
~ # umount /proc
~ # echo none /mnt/proc proc defaults 0 0 >> /etc/fstab
~ # mount /mnt/proc
~ # cd /mnt/dev
/mnt/dev # mknod mtdblock0 b 31 0
/mnt/dev # mknod mtdblock1 b 31 1
/mnt/dev # mknod mtdblock2 b 31 2
/mnt/dev # mknod mtdblock3 b 31 3
/mnt/dev # mknod mtdblock4 b 31 4
/mnt/dev # mknod mtdblock5 b 31 5
/mnt/dev # chroot /mnt
sh-3.1# 

If all went well, you now have a system that looks like your running system, and you can install Debian kernels using apt-get.

Postscript: My lenny problem

I have the luxury of a serial port (AddASerialPort) and the error was this:

NET: Registered protocol family 1
NET: Registered protocol family 17
Time: OSTS clocksource has been installed.
x1205 0-006f: setting the system clock to 2008-08-07 14:02:33 (1218117753)
Freeing init memory: 92K
libgcc_s.so.1 must be installed for pthread_cancel to workKernel panic - not syncing: Attempted to kill init!

The following bug report describes this problem perfectly. This is supposed to be fixed but it looks like a regression to me.

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=426395

Create a file called /etc/initramfs-tools/hooks/fixgcc which contains the following text:

#!/bin/sh
PREREQ=""
prereqs()
{
   echo "$PREREQ"
}

case $1 in
prereqs)
   prereqs
   exit 0
   ;;
esac

cp /lib/libgcc_s.so.1 ${DESTDIR}/lib

Mark it executable with

chmod +x /etc/initramfs-tools/hooks/fixgcc

Now your kernel installs should work. This command should re-generate a corrected initrd and write it to flash (the kernel version may need to be different - use "dpkg --list | grep linux-image"):

rm /boot/initrd.img-2.6.18-6-ixp4xx
update-initramfs -c -k 2.6.18-6-ixp4xx
flash-kernel

This takes a long long time on the NSLU2 (about 10 mins). Reinstalling the kernel with "apt-get --reinstall install <version>" is simpler and will also work but it is very very slow, and I am trying to save you the hours it took me.

My second lenny problem

The boot stalled here...

Checking root file system...fsck 1.40-WIP (14-Nov-2006)
/dev/sda3: Superblock last mount time is in the future.  FIXED.
/dev/sda3: clean, 1904722/36519936 files, 49665341/73013416 blocks
done.
EXT3 FS on sda3, internal journal
x1205 0-006f: rtc intf: dev (254:0)
Setting the system clock..

I was able to fix this by getting rid of /etc/rcS.d/S11hwclock.sh (by mounting my disk on a PC). This will get reverted if the package gets upgraded, though.

view · edit · print · history · Last edited by Stephen Blackheath.
Originally by Stephen Blackheath.
Page last modified on August 08, 2008, at 03:57 AM