Rootfs is mounted at two points when booting from SD card with latest image.

Delbert Franz ddf at
Tue Sep 18 13:51:15 EDT 2012

On Sat, 15 Sep 2012 23:41:42 +0800
Xiangfu Liu <xiangfu at> wrote:

> On 09/15/2012 04:43 AM, Delbert Franz wrote:
> > The latest image leaves the rootfs partition mounted under
> > /mnt/mmcblk0p1 when it boots from an SD card.  I don't recall this
> > being the case in prior images.  Unmounting that mount point in
> > rc.local appears not to work.
> >
> > Manually unmounting /mnt/mmcblk0p1 works and everything else continues
> > to function as expected.  Does anyone know what initialization script
> > might be at fault for leaving the rootfs mounted in this way?
> Hi
> Guess some script files under '/lib/preinit' with name > "55_XXXXX"
> Xiangfu

Thanks, Xiangfu.  I looked through the scripts but my knowledge of 
shell scripting does not reach the level used in the typical init 
script.  Some of them are absolutely inscrutable without an intimate 
knowledge of scripting plus all the other routines that are called 
directly or sometimes very indirectly:-) 

So, I did the easiest thing, by adding this:

if [ -d /mnt/mmcblk0p1/etc ]; then
#   echo "directory is there. Unmount the rootfs partition"
   umount /mnt/mmcblk0p1

to the end of /etc/profile.  This script is supposed to be executed 
everytime a console is opened, and if the rootfs is still mounted on 
/mnt, the "etc" directory should be there.  

On startup, there are some cases where it does not seem to work, but I 
have not been able to discern what I do to cause it to fail.  If I 
wait long enough on boot up to console, then hit enter, and then clear 
the screen, it seems to work.  

In the process of doing this, I finally found some good introductions 
to shell scripting that seems to fit "sh" or "ash".  So much is 
focused on "bash" but clearly "ash is not bash".  They have much in 
common but many things that work in "bash" fail to work in "ash".  In 
fact there are many variations between versions of "sh" or "ash".  
Here are some links that I found that appear to deal primarily with 
"vanilla ash or sh".  However, as always, the only way to see if 
something works on a particular machine/OS is to try it:-)

Happy shell scripting to all!


More information about the discussion mailing list