Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Thu 18 Dec 2014, 22:29
All times are UTC - 4
 Forum index » House Training » HOWTO ( Solutions )
How to cleanly unmount your filesystem on shutdowns
Moderators: Flash, Ian, JohnMurga
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 4 [54 Posts]   Goto page: 1, 2, 3, 4 Next
Author Message
Patriot


Joined: 15 Jan 2009
Posts: 734

PostPosted: Fri 21 May 2010, 20:44    Post subject:  How to cleanly unmount your filesystem on shutdowns
Subject description: puppy412, puppy421, puppy431
 

Hmmm .....

This is a quick how-to for achieving a clean "filesystem" unmount on shutdowns (Updated 5-July-2010). Currently tested for full hdd installs (ext2, PUPMODE=2), frugal installs (ext2, PUPMODE=12) and frugal ataflash installs (ext2, PUPMODE=13) only.

Primary work was done on puppy412 and further tests were later done on puppy421 and puppy431. If you're using a different frugal install mode (CF/usb/etc) then I'm still keen to know your result.

There are now two (2) different method suitable for different needs:
1. If you're basically using full hdd installs or frugals on vfat then method 1 is sufficient. This is the easiest with minimal changes.
2. If you want a complete unmount then method 2 is what you need. This requires initrd.gz minor surgery and substantial changes to the shutdown script.

    -----------------------------------------------
    METHOD 1 : HDD OR SAVEFILE UNMOUNT
    -----------------------------------------------

1. Edit /etc/rc.d/rc.shutdown in your favorite editor

2. Look for this code block at the end of rc.shutdown (this sample is from puppy412)
Code:
#v2.13 menno suggests this improvement...
STRAYPARTD="`cat /proc/swaps | grep "/dev/" | cut -f 1 -d " " | tr "\n" " "`"
for ONESTRAY in $STRAYPARTD
do
 echo "Swapoff $ONESTRAY"
 swapoff $ONESTRAY
done
sync


3. Add this code block right after the code block above:
Code:
# Stop udev & loggers
killall udevd &>/dev/null
killall klogd &>/dev/null
killall syslogd &>/dev/null

# Patriot's lame "unmount of rootfs"
if [ $PUPMODE -ne 5 ]; then
  case $PUPMODE in
   2)   pupFS=$(awk '/\/dev\/root/ {print $3}' /proc/mounts)
      mount -o remount,ro -t $pupFS /dev/root /
      sync
      ;;

   *)   uniFS=$(awk '/unionfs/ {print $3}' /proc/mounts)
      pupFS=$(awk '/pup_rw/ {print $3}' /proc/mounts)
      if [ "$uniFS" -a "$pupFS" != "tmpfs" ]; then
        mkdir -p /tmp/unrootfs
        sync
        mount -o remount,prepend:/tmp/unrootfs,xino=/tmp/unrootfs/xino -t $uniFS / /
        sync
      fi
      mount -o remount,ro /initrd${SAVE_LAYER}
      sync
      ;;
  esac
fi


4. Save it.

5. You must now manually fsck your savefile (or hdd) by either :
    a) doing a pfix=fsck on your next reboot (for frugals)
    b) boot puppy in ram (pfix=ram) and do a e2fsck of your savefile or hdd
    c) whatever fsck method that you're comfy with

From now onwards, normal shutdowns (reboot/poweroff) should be able to unmount your savefiles (on vfat) or full hdd installs cleanly.

    ---------------------------------------------------------------------------
    METHOD 2 : ROOTFS COMPLETE-THRU-THE-LAYERS UNMOUNT
    ---------------------------------------------------------------------------

Notes:
This is a quick how-to for a complete-thru-the-layers clean unmount on shutdowns. I have done some confidence testing with these scripts but they have not gone through any rigorous testing cycle (confidence testing only includes booting with pup_x.sfs, pup_x.sfs+zdrv to pup_x.sfs+zdrv+devx+ksrc). I am using it now on my daily systems and I believe that the core logics are pretty stable by now.

The affected files are init in initrd.gz, /sbin/poweroff, /sbin/reboot, /etc/rc.d/rc.shutdown, /etc/profile, ~/.bashrc

Changelog:
06-June-2010: first published
11-June-2010: fix for stray process on puppyfs (thanks to gyro)
12-June-2010: improvements and fixes for command line interface (CLI).
15-June-2010: adjustments for fresh setup (PUPMODE=5)
05-July-2010: fix for loop device detach list (thanks to gyro)


1. Modify /sbin/reboot to :
Code:
#!/bin/sh
[ "$PPID" = "1" ] && exec /etc/rc.d/rc.shutdown reboot
echo -e "\nTo reboot, select \e[0;36m[Reboot]\e[0m from the main menu or"
echo -e "use \e[0;36m'wmreboot'\e[0m from within a shell/script.\n"


2. Modify /sbin/poweroff to :
Code:
#!/bin/sh
[ "$PPID" = "1" ] && exec /etc/rc.d/rc.shutdown poweroff
echo -e "\nTo poweroff, select \e[0;36m[Poweroff]\e[0m from the main menu or"
echo -e "use \e[0;36m'wmpoweroff'\e[0m from within a shell/script.\n"


3. Edit /etc/profile and look for alias vi=e3vi and add the 3 additional alias lines (fix for CLI shutdowns):
Code:
#v4.00 run e3vi whenever vi excuted...
alias vi=e3vi

# Part of clean-unmount-on-shutdowns CLI requirement
alias poweroff="exec poweroff"
alias reboot="exec reboot"
alias xwin="exec xwin"

#v2.12
#xorgwizard creates this file, run once only...
if [ ! -f /tmp/bootcnt.txt ];then
 [ -f /etc/resolutionfix ] && eval `cat /etc/resolutionfix`
fi


4. Edit ~/.bashrc (ie. /root/.bashrc) and add the unalias and alias lines after . /etc/profile line. (Applicable X & CLI fixes):
Code:
. /etc/profile

# unalias for vt
unalias poweroff reboot

# Prevent X recursions in vt
alias X='echo -e "\nX-windows is \e[1;31malready running.\e[0m\n"'
alias Xorg=X
alias Xvesa=X
alias xwin=X


5. Edit /etc/rc.d/rc.shutdown :

- The first added block is at the beginning of the script, before the clear statement
Code:
...
...
...
if [ -z "$1" ]; then
  exit 1
else
  case $1 in
   poweroff|reboot)
     applet=$1
     shtty=$(tty)
     ;;
   *)
     exit 2
     ;;
  esac
fi

clear
exec 1>/dev/null 2>&1
echo "System is shutting down ..." >/dev/console


- The next addition is at the end of the script, after the swapoff code block
- Everything past exec /cleanup can be commented or removed
Code:
...
...
...
#v2.13 menno suggests this improvement...
STRAYPARTD="`cat /proc/swaps | grep "/dev/" | cut -f 1 -d " " | tr "\n" " "`"
for ONESTRAY in $STRAYPARTD
do
 echo "Swapoff $ONESTRAY"
 swapoff $ONESTRAY
done
sync

# Stop udevd & logs daemon
killall udevd klogd syslogd &>/dev/null

# Unload modules
for ((i=1; i<=8; i++))
do
  modlist=$(lsmod | awk '($3 == "0") {print $1}')
  [ -z "$modlist" ] && break
  for onemod in $modlist
  do
   rmmod $onemod
  done
done

# Patriot's not too lame unmount of rootfs layers
if [ ! -d /initrd -o $PUPMODE -eq 2 ]; then
  # Unmount code block for full hdd install
  devFS=$(awk '/\/dev\/root/ {print $3}' /proc/mounts)
  busybox mount -o remount,ro -t $devFS /dev/root /
  sync
  busybox umount -ar 2>/dev/null
  exec /bin/busybox $applet
fi

# Setup unrootfs, if none
if [ $(df | grep -c ' /mnt/unrootfs$') -eq 0 ]; then
  mkdir -p /mnt/unrootfs
  busybox mount -t tmpfs tmpfs /mnt/unrootfs -o size=4m
  sync
fi

# Preset, if fresh setup
[ -z "$SAVE_LAYER" ] && SAVE_LAYER="/pup_rw"

# aufs branch switcheroo ...
uniFS=$(awk '/unionfs / {print $3}' /proc/mounts)
busybox mount -o remount,prepend:/mnt/unrootfs=rw,noxino -t $uniFS / /
sync
busybox mount -o remount,ro /initrd${SAVE_LAYER}
sync

# Prep unrootfs
cd /mnt/unrootfs
rm -f init
mkdir -p bin dev etc lib mnt nroot proc sbin sys tmp var/run
sync

# Prep /bin
cp /bin/busybox /bin/grep /usr/bin/fuser bin/
bbApps=$(bin/busybox); bbApps=${bbApps##*functions:}
for bbLnk in $bbApps; do ln -s busybox bin/${bbLnk%,}; done
unset bbApps bbLnk
# Check for busybox umount option
loflag=$(bin/busybox umount 2>&1 | awk '/\t-d\t/ {print " "$1}')
# Prep /dev
cp -dR /dev/* dev/
# Prep /etc
ln -s /proc/mounts etc/mtab
cp /etc/passwd etc/
# Prep /lib
cp /lib/ld-linux.so.2 /lib/libc.so.6 /lib/libcrypt.so.1 /lib/libm.so.6 lib/
# Prep /sbin
ln -s /bin/busybox sbin/getty
sync

# Move recursions
function move_recursion()
{
  mkdir $2
  busybox mount -o move $1 $2
}
[ "$PUP_HOME" ] && move_recursion /initrd${PUP_HOME} mnt/mp1
[ "$SAVE_LAYER" ] && move_recursion /initrd${SAVE_LAYER} mnt/mp2
[ "$(grep '/mnt/tmpfs ' /proc/mounts)" ] && move_recursion /initrd/mnt/tmpfs mnt/mp3
[ "$(grep '/mnt/tmpfs2 ' /proc/mounts)" ] && move_recursion /initrd/mnt/tmpfs2 mnt/mp4
[ "$(grep ' /tmp ' /proc/mounts)" ] && busybox umount /tmp
busybox umount /dev/pts /proc/bus/usb
busybox mount -o move /proc proc
busybox mount -o move /sys sys
sync

# Switching to unrootfs
unset LANG
pivot_root . /mnt/unrootfs/nroot
sync
cd /

# Prep Cleanup
echo '#!/bin/sh
exec 0<'$shtty'
exec 1>'$shtty' 2>&1

# Terminate anything still on puppyfs
fuser -kms /nroot

# Find and unmount union branches
unibrs=$(mount | grep " aufs ")
if [ "$(echo $unibrs | grep dirs=)" ]; then
  # AUFS1
  unibrs=${unibrs##*dirs=}; unibrs=${unibrs%)*}; unibrs=${unibrs%%,*}
  for i in $(echo $unibrs | tr ":" " ")
  do
   case $i in
     /=*|/mnt/mp2=*) continue ;;
     *) unilist="${i%%=*} $unilist" ;;
   esac
  done
else
  # AUFS2
  unibrs=${unibrs##*si=}; unibrs=${unibrs%)*}; unibrs="/sys/fs/aufs/si_"${unibrs%%,*}
  for i in $(ls $unibrs/br*)
  do
   h=$(cat $i)
   case $h in
     /=*|/mnt/mp2=*) continue ;;
     *) unilist="${h%%=*} $unilist" ;;
   esac
  done
fi
for onebrs in $unilist
do
  mount -o remount,del:${onebrs} -t '$uniFS' /nroot /nroot
  sync
  umount'$loflag' $onebrs
  sync
done

# Find and detach loop devices
for onelodev in $(grep "^/dev/loop" /proc/mounts | tr -s " " ":")
do
  losetup -d ${onelodev%%:*} 2>/dev/null
  sync
done

# Final cleanup and unmount boot partition
[ -d /mnt/mp4 ] && umount'$loflag' /mnt/mp4
sync
[ -d /mnt/mp3 ] && umount'$loflag' /mnt/mp3
sync
umount'$loflag' /nroot
sync
[ -d /mnt/mp2 ] && umount'$loflag' /mnt/mp2
sync
[ -d /mnt/mp1 ] && umount /mnt/mp1

umount -ar 2>/dev/null
exec /bin/busybox '$applet'
' >/cleanup
chmod 755 /cleanup
exec /cleanup


6. Unpack initrd.gz and edit init script (at the end of the script):
Code:
sync
umount /proc/bus/usb
umount /sys
umount /proc

# Patriot: init from tmpfs
mkdir -p /pup_new/mnt/unrootfs
mount -t tmpfs tmpfs /pup_new/mnt/unrootfs -o size=4m
cp /bin/busybox /pup_new/mnt/unrootfs/init
if [ "$(readlink /pup_new/sbin/init)" != "/mnt/unrootfs/init" ]; then
  ln -sf /mnt/unrootfs/init /pup_new/sbin/init
fi
sync

#now using cpio archive for initramfs 'initial ramdisk'...
#exec switch_root -c /dev/console /pup_new /bin/busybox init 3
exec switch_root /pup_new /sbin/init

###END###


7. You must now manually fsck your savefile (or hdd) before checking your filesystem status.


Rgds

._.
busybox_static-1.17.1-i486.tar.gz
Description  busybox 1.17.1 static
gz

 Download 
Filename  busybox_static-1.17.1-i486.tar.gz 
Filesize  336.38 KB 
Downloaded  900 Time(s) 
busybox_static-1.16.2-i486.tar.gz
Description  busybox 1.16.2 static
gz

 Download 
Filename  busybox_static-1.16.2-i486.tar.gz 
Filesize  328.88 KB 
Downloaded  919 Time(s) 
busybox-static-1.16.1-i486.tar.gz
Description  busybox 1.16.1 static
gz

 Download 
Filename  busybox-static-1.16.1-i486.tar.gz 
Filesize  328.86 KB 
Downloaded  980 Time(s) 

Last edited by Patriot on Mon 26 Jul 2010, 13:32; edited 11 times in total
Back to top
View user's profile Send private message 
Patriot


Joined: 15 Jan 2009
Posts: 734

PostPosted: Fri 21 May 2010, 20:45    Post subject:  

here be dragons
Back to top
View user's profile Send private message 
jemimah


Joined: 26 Aug 2009
Posts: 4309
Location: Tampa, FL

PostPosted: Fri 21 May 2010, 21:29    Post subject:  

Excellent - I had a similar idea, though I hadn't gotten to looking up the syntax for aufs.

For Pupmode 13, I think there might be a way to remove the save file from the union, and it should copy up any open files to the RAM branch. I played with it on UnionFS but switched back to AUFS before I got very far.

That is what your code does right?
Back to top
View user's profile Send private message Visit poster's website 
Patriot


Joined: 15 Jan 2009
Posts: 734

PostPosted: Sat 22 May 2010, 03:58    Post subject:  

Hmmm .....

jemimah wrote:
Excellent - I had a similar idea, though I hadn't gotten to looking up the syntax for aufs.

For Pupmode 13, I think there might be a way to remove the save file from the union, and it should copy up any open files to the RAM branch. I played with it on UnionFS but switched back to AUFS before I got very far.

That is what your code does right?

Laughing ..... Yes, initially I was also thinking of (it couldn't be that difficult to) fully removing the save file from the union, but apparently it's harder than it seems ... Further experiments shows that switching the save file to read-only (ro) mode also gives me the desired result. So, that's what the code block above will (try) to do. I think there's no worries with pupmode=13 updates as that's already being handled earlier by snapmergepuppy ...

Thanks for highlighting pupmode=13, I did several simulation runs with that mode and have made some adjustments to cater for it ...


Rgds
Back to top
View user's profile Send private message 
MinHundHettePerro


Joined: 05 Feb 2009
Posts: 856
Location: SE

PostPosted: Sat 22 May 2010, 18:16    Post subject:  

Absolutely Brilliant Smile!

Corrects the problem with uncleanly unmounted savefiles in lupu.

Thank you Smile/
MHHP

_________________
Celeron 2.8 GHz, 1 GB, i82845, many ptns, modes 12, 13
Dual Xeon 3.2 GHz, 1 GB, nvidia quadro nvs 285

Slackos & 214X, ... and Q6xx
Nämen, vaf.... ln -s /dev/null MHHP
Back to top
View user's profile Send private message 
big_bass

Joined: 13 Aug 2007
Posts: 1747

PostPosted: Sat 29 May 2010, 14:51    Post subject:  

Hey Patriot


great news !

I would like to do some testing for you
you said that you edited code based against 4.12
could you please post the diff against the official 4.12

just to be sure all is fine before placing it in my iso

thanks Joe

I'll throw in a simple dagNdrop xdialog diff making tool
you may find it to come in handy for all the stuff you do

Code:

#!/bin/sh

# version 2 changed to *.patch
# just a simple diff tool for the lazy
# there are better but this is easy :D
# Joe Arose
# call this dnd_diff
# patched are auto made for you
DIALOG=Xdialog

$DIALOG --title "The original for DIFF   " \
        --inputbox "Type in a value or Drag N drop.
         enter first file to diff now
        the name will be given from the this file.patch
        and placed in root\n
" 0 0  2> /tmp/one.txt

retval=$?



input=`cat /tmp/one.txt`


case $retval in
  0)
    echo "Input string is '$input'";;
  1)
    echo "Cancel pressed."
    exit;;
  255)
    echo "Box closed."
    exit;;
esac

#----------------------------------
$DIALOG --title "The edited file for DIFF   " \
        --inputbox "Type in a value or Drag N drop.
        you enter second file to diff now\n
" 0 0 2>/tmp/two.txt

retval=$?

input2=`cat /tmp/two.txt`

case $retval in
  0)
    echo "Input string is '$input2'";;
  1)
    echo "Cancel pressed."
    exit;;
  255)
    echo "Box closed."
    exit;;
esac

diff -pruN $input $input2 >/root/`basename $input`.patch

#or you could do this if you have another editor installed
$DEFAULTTEXTEDITOR  /root/`basename $input`.patch

#geany is the default editor change this if you have another editor
#geany /root/`basename $input`.patch

rm -f /tmp/two.txt
rm -f /tmp/one.txt


_________________
debian wheezy ,linux mint, slackware I use them all and they all have good points
Mint would be best for general users though
Back to top
View user's profile Send private message 
jemimah


Joined: 26 Aug 2009
Posts: 4309
Location: Tampa, FL

PostPosted: Sat 29 May 2010, 19:44    Post subject:  

This is working good for cleanly unmounting the save file, but the partition that contains the save file is still not getting unmounted cleanly.

Any ideas how to fix that? How do other distros do it?
Back to top
View user's profile Send private message Visit poster's website 
Patriot


Joined: 15 Jan 2009
Posts: 734

PostPosted: Sun 30 May 2010, 12:59    Post subject:  

Hmmm .....

big_bass wrote:
..... could you please post the diff against the official 4.12 .....

Hey there Big Joe ... Sure thing. Here ya go ...
Code:
--- rc.shutdown.412   2008-11-02 05:43:37.000000000 +0800
+++ rc.shutdown   2010-05-31 00:27:09.191902581 +0800
@@ -843,6 +843,33 @@ do
 done
 sync
 
+# Stop udev & loggers
+killall udevd &>/dev/null
+killall klogd &>/dev/null
+killall syslogd &>/dev/null
+
+# Patriot's lame "unmount of rootfs"
+if [ $PUPMODE -ne 5 ]; then
+  case $PUPMODE in
+   2)   pupFS=$(awk '/\/dev\/root/ {print $3}' /proc/mounts)
+      mount -o remount,ro -t $pupFS /dev/root /
+      sync
+      ;;
+
+   *)   uniFS=$(awk '/unionfs/ {print $3}' /proc/mounts)
+      pupFS=$(awk '/pup_rw/ {print $3}' /proc/mounts)
+      if [ "$uniFS" -a "$pupFS" != "tmpfs" ]; then
+        mkdir -p /tmp/unrootfs
+        sync
+        mount -o remount,prepend:/tmp/unrootfs,xino=/tmp/unrootfs/xino -t $uniFS / /
+        sync
+      fi
+      mount -o remount,ro /initrd${SAVE_LAYER}
+      sync
+      ;;
+  esac
+fi
+
 #rm -f /tmp/wmexitmode.txt
 
 #note, there is a problem with unmounting, especially ntfs as it cannot be remounted


jemimah wrote:
This is working good for cleanly unmounting the save file, but the partition that contains the save file is still not getting unmounted cleanly.

Any ideas how to fix that? How do other distros do it?

Ah well, it didn't occur to me at the time as I'm on fat/ntfs all this while ... I'll do some experiments with frugals on ext2 later to see if there's any "easy-n-painless" way to achieve this. The way puppy is using the multi-layered FS sure borks any easy unmounting. I'm aware that Slax relies heavily on aufs but I don't recall seeing Slax using multiple layers like this ...

Well, let's see how it goes ...


Rgds
Back to top
View user's profile Send private message 
jemimah


Joined: 26 Aug 2009
Posts: 4309
Location: Tampa, FL

PostPosted: Sun 30 May 2010, 13:15    Post subject:  

The worst is when you're dual booting with ubuntu or something and it makes you wait through an fsck with every boot. Sad

Thanks for tackling this problem. This will help a lot of people.
Back to top
View user's profile Send private message Visit poster's website 
8-bit


Joined: 03 Apr 2007
Posts: 3398
Location: Oregon

PostPosted: Sun 30 May 2010, 14:06    Post subject:  

I just tried your modification to the rc.shutdown script and it works very well. After a reboot to Puppy 431 SCSI, I checked the lupusave file for puppy lucid 500 and it came back clean.
That is the first time that has ever happened.
This modification should be passed on to Barry for inclusion in all the official Puppy versions!
Very good work and a problem solved. Very Happy Very Happy
Back to top
View user's profile Send private message 
don922

Joined: 19 Jan 2008
Posts: 381
Location: The land of 14" monitors

PostPosted: Mon 31 May 2010, 03:48    Post subject:  

Works great in Puppy 4.12 retro frugal install! Very Happy

Doesn't work in Puppy 400 frugal install....Crying or Very sad

Is there any easy fix? I have no coding skills Embarassed

I notice that you limited its use but the rc.shutdowns are about the same....
Patriot wrote:
Subject description: puppy412, puppy421, puppy431

_________________
Don -- Thailand

Back to top
View user's profile Send private message 
big_bass

Joined: 13 Aug 2007
Posts: 1747

PostPosted: Mon 31 May 2010, 12:05    Post subject:  

Hey Patriot

thanks for the added patch
I have to keep track of all
the stuff I add

It gives me great pleasure to post this code snippit

Code:

 root@slaxer:~# e2fsck -av /mnt/hda2/pup_save-new2.2fs
/mnt/hda2/pup_save-new2.2fs: clean, 56364/262144 files, 908809/1048576 blocks



clean, clean, clean! Very Happy
Cool Cool Cool


-----------------------techno details --------------------------------------------

ahhh there's a little thing I want to clear up
I tested this booting in slackware 13
so as not to have any puppy symlink confusion

what happens testing the save file by mounting it you get a
broken symlink in /mnt/home pointing to /initrd/mnt/dev_save
which is a good thing


however if you boot in puppy it appears that /mnt/home is a mounted folder
which could be confusing while testing on puppy



-----------------------------------------------------------------

**if anyone needs to mount a pup_save outside of puppy
if you install ROX I wrote two simple scripts to do it I wrote an umount also but
rox can handle the unmount in the same way as puppy
so you dont need it

Code:


#!/bin/sh
#simple drag and drop mounting  tool for
#sfs iso or ext3 /ext2 files  (2fs 3fs in puppy)
#just drag and drop  on this script
#they will get mounted with the correct name
#at /mnt
#script by Joe Arose ...big_bass



#SFS
if echo `basename "$1" ` | grep -q '.sfs$'; then
                  mkdir -p /mnt/`basename $1`
mount -t squashfs -o loop,ro  $1 /mnt/`basename $1`
cd /mnt/`basename $1`
 rox -d /mnt/`basename $1`   
             
             
#EXT2             
elif echo `basename "$1" ` | grep -q '.2fs$'; then
                  mkdir -p /mnt/`basename $1`
mount -t ext2 -o loop,ro  $1 /mnt/`basename $1`
cd /mnt/`basename $1`
 rox -d /mnt/`basename $1`   
                
#EXT3             
elif echo `basename "$1" ` | grep -q '.3fs$'; then
                  mkdir -p /mnt/`basename $1`
mount -t ext3 -o loop,ro  $1 /mnt/`basename $1`
cd /mnt/`basename $1`
 rox -d /mnt/`basename $1`   
                         

#ISO             
elif echo `basename "$1" ` | grep -q '.iso$'; then
                  mkdir -p /mnt/`basename $1`
mount -t iso9600 -o loop,ro  $1 /mnt/`basename $1`
cd /mnt/`basename $1`
 rox -d /mnt/`basename $1`   
              fi                          



Joe

_________________
debian wheezy ,linux mint, slackware I use them all and they all have good points
Mint would be best for general users though
Back to top
View user's profile Send private message 
Patriot


Joined: 15 Jan 2009
Posts: 734

PostPosted: Mon 31 May 2010, 16:33    Post subject:  

Hmmm .....

don922 wrote:
..... Doesn't work in Puppy 400 frugal install....Crying or Very sad

Is there any easy fix? .....

Puppy 4.00 uses unionfs by default and my tests with that thingy gives inconsistent ummount result. Well, I do have a quick fix for puppy400 :

1. Edit your menu.lst and make puppy 4.00 use aufs (using kernel option layerfs=aufs), example:
Code:
kernel (hd0,0)/puppy400/vmlinuz pmedia=idehd pdev1=hda1 psubdir=puppy400 layerfs=aufs

2. Modify /etc/rc.d/rc.shutdown as shown above in my first post, but with two additional lines as shown below:
Code:
      if [ "$uniFS" -a "$pupFS" != "tmpfs" ]; then
        mount -t tmpfs tmpfs /tmp -o size=1m     # extra for puppy4.00
        mkdir -p /tmp/unrootfs
        sync
        mount -o remount,prepend:/tmp/unrootfs,xino=/tmp/unrootfs/xino -t $uniFS / /
        sync
        sleep 2        # maybe needed for puppy400
      fi

That's it. On your next puppy400 reboot, you will see the filesystem check running slightly faster (and yes, fsck is hardcoded to run on every boot in puppy400). The fsck log /initrd/tmp/chkret should now be showing a clean status.


Rgds

Last edited by Patriot on Tue 01 Jun 2010, 03:01; edited 1 time in total
Back to top
View user's profile Send private message 
Patriot


Joined: 15 Jan 2009
Posts: 734

PostPosted: Mon 31 May 2010, 17:03    Post subject:  

Hmmm .....

Very Happy I have managed to manually unmount all mounted partitions, loop devices, the savefile and the aufs union successfully from a live frugal puppy412. The util lsof have been really really helpful in my "quest" .....

Tracing the whole thing have shown me obscure stuffs like "embedded" recursions (/initrd/mnt/dev_save + /initrd/pup_rw) and the real badass bugger, init itself. No wonder its tough un-mounting the darn frugal thingy.

However, there's no code to show yet as I need more time to code them properly and refine them to a minimum. I should warn whoever's interested with this that your puppy may require more than just a minor modification to initrd and the shutdown scripts ...


Rgds
Back to top
View user's profile Send private message 
don922

Joined: 19 Jan 2008
Posts: 381
Location: The land of 14" monitors

PostPosted: Tue 01 Jun 2010, 01:54    Post subject: Puppy 400 still has problems  

@Patriot:

I have changed the menu.lst per your instructions and added the line to /etc/rc.d/rc.shutdown.

I shutdown puppy400, booted into puppy412 and ran e2fsck with the following results:
Code:
[~] e2fsck -vp /mnt/home/puppy400/pup_save-400.2fs
/mnt/home/puppy400/pup_save-400.2fs: Superblock last mount time is in the future.  FIXED.
/mnt/home/puppy400/pup_save-400.2fs was not cleanly unmounted, check forced.

    3740 inodes used (5.71%)
     135 non-contiguous inodes (3.6%)
         # of inodes with ind/dind/tind blocks: 402/75/0
  105865 blocks used (40.38%)
       0 bad blocks
       0 large files

    3300 regular files
     374 directories
       4 character device files
       0 block device files
       0 fifos
       1 link
      51 symbolic links (51 fast symbolic links)
       2 sockets
--------
    3732 files


On the next boot into puppy400 I saw the following in the boot message:
Quote:
Setting up the Unionfs layered file system
Performing a switch_root to the new Unionfs file system

I thought that the new menu.lst entry changed this.
Maybe puppy400 just won't cleanly unmount.

_________________
Don -- Thailand

Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 4 [54 Posts]   Goto page: 1, 2, 3, 4 Next
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » House Training » HOWTO ( Solutions )
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.1605s ][ Queries: 12 (0.0061s) ][ GZIP on ]