NSLU2-Linux
view · edit · print · history

A normal console boot without an /initrd directory looks like

 6 RedBoot partitions found on MTD device IXP4XX-Flash0
 Creating 6 MTD partitions on "IXP4XX-Flash0":
 0x00000000-0x00040000 : "RedBoot"
 0x00040000-0x00060000 : "SysConf?"
 0x00060000-0x00160000 : "Kernel"
 0x00160000-0x00180000 : "Ramdisk"
 0x00180000-0x007e0000 : "Flashdisk"
 0x007e0000-0x00800000 : "FIS directory"
 i2c /dev entries driver
 LOADED Xicor x1205 RTC Dvr v0.9.3.3NPW
 NET: Registered protocol family 2
 IP: routing cache hash table of 512 buckets, 4Kbytes
 TCP: Hash tables configured (established 2048 bind 4096)
 NET: Registered protocol family 1
 RAMDISK: Compressed image found at block 0
 VFS: Mounted root (ext2 filesystem). 
 Root filesystem will be mounted from /dev/mtdblock4 ...
 VFS: Mounted root (jffs2 filesystem) readonly.
 Trying to move old root to /initrd ... failed
 Unmounting old root
 Trying to free ramdisk memory ... okay
 Freeing init memory: 72K
 INIT: version 2.86 booting
 VFS: Can't find ext2 filesystem on dev ram0.
 Setting up IP spoofing protection: rp_filter.
 Configuring network interfaces... done.
 Starting portmap daemon: portmap.
 INIT: Entering runlevel: 2
 Starting Dropbear SSH server: dropbear.
 Starting portmap daemon: portmap/sbin/portmap already running.
 964
 .
 Starting syslogd/klogd: done

 OpenEmbedded Linux nslu2 ttyS0

 nslu2 login:

console log from enabling /initrd from after the partition info.

 Using buffer write method
 6 RedBoot partitions found on MTD device IXP4XX-Flash0
 Creating 6 MTD partitions on "IXP4XX-Flash0":
 0x00000000-0x00040000 : "RedBoot"
 0x00040000-0x00060000 : "SysConf?"
 0x00060000-0x00160000 : "Kernel"
 0x00160000-0x00180000 : "Ramdisk"
 0x00180000-0x007e0000 : "Flashdisk"
 0x007e0000-0x00800000 : "FIS directory"
 i2c /dev entries driver
 LOADED Xicor x1205 RTC Dvr v0.9.3.3NPW
 NET: Registered protocol family 2
 IP: routing cache hash table of 512 buckets, 4Kbytes
 TCP: Hash tables configured (established 2048 bind 4096)
 NET: Registered protocol family 1
 RAMDISK: Compressed image found at block 0
 VFS: Mounted root (ext2 filesystem).
 Root filesystem will be mounted from /dev/mtdblock4 ...
 VFS: Mounted root (jffs2 filesystem) readonly.
 Trying to move old root to /initrd ... okay
 Freeing init memory: 72K
 INIT: version 2.86 booting
 /etc/rcS.d/S35mountall.sh: 23: test: not found
 /etc/rcS.d/S35mountall.sh: 42: test: not found
 /etc/init.d/rcS: 58: [: not found
 /etc/init.d/rcS: 58: [: not found
 /etc/init.d/rcS: 58: [: not found
 /etc/init.d/rcS: 58: [: not found
 /etc/rcS.d/S38devpts.sh: 5: test: not found
 /etc/init.d/rcS: 58: [: not found
 /etc/init.d/rcS: 58: [: not found
 /etc/rcS.d/S40hostname.sh: 10: test: not found
 /etc/init.d/rcS: 58: [: not found
 /etc/init.d/rcS: 58: [: not found
 /etc/rcS.d/S40hotplug: 21: [: not found
 /etc/rcS.d/S40hotplug: 21: [: not found
 /etc/hotplug/input.rc: 20: [: not found
 /etc/hotplug/input.rc: 20: [: not found
 /etc/hotplug/input.rc: 24: [: not found
 /etc/hotplug/input.rc: 148: [: not found
 /etc/hotplug/isapnp.rc: 16: [: not found
 ./hotplug.functions: 23: [: not found
 ./hotplug.functions: 31: [: not found
 ./hotplug.functions: 31: [: not found
 ./hotplug.functions: 43: [: not found
 /etc/hotplug/pci.rc: 101: [: not found
 /etc/hotplug/pci.rc: 101: which: not found
 /etc/hotplug/pci.rc: 101: [: not found
 /etc/hotplug/pci.rc: 101: [: not found
 /etc/hotplug/pci.rc: 101: [: not found
 /etc/hotplug/pci.rc: 101: find: not found
 /etc/hotplug/hotplug.functions: 23: [: not found
 /etc/hotplug/hotplug.functions: 31: [: not found
 /etc/hotplug/hotplug.functions: 31: [: not found
 /etc/hotplug/hotplug.functions: 43: [: not found
 /etc/hotplug/sleeve.rc: 25: [: not found
 grep: /proc/bus/sleeve/device: No such file or directory
 grep: /proc/bus/sleeve/device: No such file or directory
 grep: /proc/bus/sleeve/device: No such file or directory
 /sbin/hotplug: 34: [: not found
 /sbin/hotplug: 34: [: not found
 /etc/hotplug/usb.rc: 34: [: not found
 /etc/hotplug/usb.rc: 37: [: not found
 /etc/hotplug/usb.rc: 46: [: not found
 /etc/hotplug/usb.rc: 397: [: not found
 /etc/hotplug/usb.rc: 397: [: not found
 /etc/hotplug/usb.rc: 397: [: not found
 /etc/hotplug/usb.rc: 397: [: not found
 /etc/hotplug/usb.rc: 397: [: not found
 /etc/init.d/rcS: 58: [: not found
 /etc/init.d/rcS: 58: [: not found
 /etc/rcS.d/S40networking: 9: [: not found
 /etc/init.d/rcS: 58: [: not found
 /etc/init.d/rcS: 58: [: not found
 /etc/rcS.d/S43portmap: 5: test: not found
 /etc/init.d/rcS: 58: [: not found
 /etc/init.d/rcS: 58: [: not found
 /etc/rcS.d/S45mountnfs.sh: 84: test: not found
 /etc/init.d/rcS: 58: [: not found
 /etc/init.d/rcS: 58: [: not found
 /etc/rcS.d/S55bootmisc.sh: 14: test: not found
 /etc/rcS.d/S55bootmisc.sh: 23: test: not found
 /etc/rcS.d/S55bootmisc.sh: 33: test: not found
 /etc/rcS.d/S55bootmisc.sh: 43: test: not found
 /etc/init.d/rcS: 58: [: not found
 /etc/init.d/rcS: 58: [: not found
 /etc/rcS.d/S99finish: 5: test: not found
 /etc/init.d/rcS: 63: [: not found
 /etc/init.d/rcS: 72: [: not found
 INIT: Entering runlevel: 2
 /etc/init.d/rc: 45: [: not found
 /etc/init.d/rc: 50: [: not found
 /etc/init.d/rc: 52: [: not found
 /etc/init.d/rc: 101: [: not found 

 OpenEmbedded Linux (none) ttyS0

 (none) login:OpenEmbedded Linux (none) ttyS0

 (none) login: root
 login[791]: root login  on `ttyS0' 

 -sh: id: not found
 -sh: [: not found
 -sh: [: not found
 -sh: [: not found
 ~ #

observation:

i started with mkdir /initrd ; reboot to manually fix the errormessages i did some cd /bin

  1. ln -s busybox \[ ; # etc....

and reboot

still had errors, so

  1. cd /bin
  2. ls

[ dd grep mkdir pwd tar addgroup delgroup gunzip mknod readlink test adduser deluser gzip mktemp rm tinylogin ash df hostname more rmdir touch busybox dmesg id mount run-parts true cat dumpkmap ip mountpoint sed umount chgrp echo kill mv sh uname chmod egrep ln netstat sleep vi chown env login pidof stty watch cp false ls ping su zcat cpio fgrep lsmod ping6 sync date find lsmod.26 ps tail

  1. cd /sbin
  2. ls ../bin

[ cat echo md5sum sh switchbox umount ash dd ls mount sleep test wget

so WYSINWYG

 root@nslu2:/sbin# df .
 Filesystem           1k-blocks      Used Available Use% Mounted on

 root@nslu2:/sbin# df ../bin
 Filesystem           1k-blocks      Used Available Use% Mounted on
 /dev/root.old             1003       230       722  24% /initrd

ccsmart thx for the info.

The root cause on OpenSlug is due to the way the / gets mounted by fstab.

Changing the root mount to /dev/mtdblock4 / jffs2 defaults 0 0

will cure the problem if you are booting on the jffs2 root

Thanks for moving this along so we could resolve it.

Cheers [g2]

[non-cryptic explanation(jbowler): The *unslung* fstab contains:

  /dev/ram0 / ext2 defaults 1 1

this is correct for unslung, most of the time, but in OpenSlug and in Unslung rebooting in ramdisk mode the root is somewhere else (/dev/mtdblock4 or /dev/ram1 respectively). Most stuff ignores fstab, but if some script attempts to remount / on the basis of fstab and the / device is wrong but valid all manner of strangeness results.

E.g. in this case /dev/ram0 was apparently overmounted on /, so /bin now contains just the initrd programs, but init is still chdir'ed to the old /, so init programs see, in bin, the old stuff, but a symlink (interpreted by the kernel) sees the new stuff.

This only happens with /initrd present, because without it the kernel umounts / (/dev/ram0) and does a freeramdisk on it, making it unmountable - the overmount fails.

My simple fix was:

 cd packages/base-files/base-files
 bk mv nslu2 unslung # this is where the problem fstab is - it's unslung specific

This exposes the standard OE fstab which contains:

 rootfs / auto defaults 1 1

'rootfs' is not a valid device, and 'auto' is not a valid type, so a dumb script invariably fails.

Cryptic addendum: Attempting a pivot_root *inside* linuxrc can produce similar results - because on return from linuxrc the kernel (init/do_mounts_initrd.c) attempts to restore the old root with the assumption that /dev/ram0 is still sitting on /a:

 sys_mount("/", ".", NULL, MS_MOVE, NULL);

"." is actually "/old", so the new pivot_root ends up in /old. There's a gross hack to cause this to get back to "/" - tell the kernel the real root is /dev/ram0, but this is unlikely to work after someone gets round to rewriting kernel/init and, anyway, the init boot would have to freeramdisk /dev/ram0 itself.]

view · edit · print · history · Last edited by g2.
Based on work by g2, ccsmart, and rwhitby.
Originally by jbowler.
Page last modified on April 14, 2005, at 03:26 PM