OpenWrt Forum Archive

Topic: When is root changed?

The content of this topic has been archived on 15 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hi there,

I installed Kamikaze 7.09 this morning and followed UsbStorageHowto to setup my ASUS WL500G Deluxe.
At some point the documentation asks to create script "pivotroot" and to test it afterwards by issuing command "df -h".

This test appears to be failing on my system:

root@OpenWrt:~# df -h
Filesystem                Size      Used Available Use% Mounted on
none                     14.9M     32.0k     14.9M   0% /tmp
/dev/mtdblock/4           2.0M      1.0M      1.0M  50% /jffs
mini_fo:/jffs             1.2M      1.2M         0 100% /
/dev/scsi/host0/bus0/target0/lun0/part2    231.6M      7.5M    212.3M   3% /mnt

The USB stick is mounted... but I would expect to see about 200 MB on root ('/')...

What might have gone wrong?

"dmesg" shows these messages:

kjournald starting.  Commit interval 5 seconds
EXT3 FS 2.4-0.9.19, 19 August 2002 on sd(8,2), internal journal
EXT3-fs: mounted filesystem with ordered data mode.

Does anyone have an idea what causes this issue?

Any help is greatly appreciated!

Thank you in advance,

slowjoe

Found the error:

The instructions in "4.2. How do I boot from the USB device (prep)" say:

mount -t ext3 /dev/scsi/host0/bus0/target0/lun0/part1 /mnt
mkdir /tmp/root
mount -o bind /rom /tmp/root
mount -o bind / /tmp/root
cp /tmp/root/* /mnt -a
umount /tmp/root
umount /mnt

Unfortunately, this creates a directory named "root" on the USB stick. I.e. the "/etc" directory, then can be found at "/mnt/root/etc".

This does not comply with the instructions given below in section "4.4. Boot Configuration (Kamikaze)". In the listing of script "pivotroot" the token "root" does not occur in the path names:

[ -x /mnt/sbin/init ] && {
        mount -o move /proc /mnt/proc && \
        pivot_root /mnt /mnt/mnt && {
                mount -o move /mnt/dev /dev
                mount -o move /mnt/tmp /tmp
                mount -o move /mnt/jffs /jffs 2>&-
                mount -o move /mnt/sys /sys 2>&-
        }
}

I fixed this on my system like this:

mv /mnt/root/* /mnt

What do you think? Is this a bug in the Howto document?

The discussion might have continued from here.