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 Sun 20 May 2018, 06:10
All times are UTC - 4
 Forum index » House Training » HOWTO ( Solutions )
nfs (samba, cifs): getting shares to umount @ shutdown
Moderators: Flash, Ian, JohnMurga
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [1 Post]  
Author Message

Joined: 25 Oct 2010
Posts: 132
Location: Allentown, PA

PostPosted: Sun 21 Nov 2010, 09:15    Post subject:  nfs (samba, cifs): getting shares to umount @ shutdown  

This is NOT very elegant, but I used two ubuntu scripts: one in the /etc/init.d/ and one in /lib/init.

The issue, if I mounted shares in terminal and forgot to umount them, then the machine would hang and not shut down. I knew this was an issue with earlier 'buntus so I assumed it was the same issue.

Pnethood is a great too for mounting shares, and might solve this issue BUT if I mounted shares that way, the mounted folders were invisible to any applications except file managers and wine programs (how odd, but I get this on two machines running two different puppies.

I modified "umountnfs.sh" slightly as when I ran it, there were was an fstab command in the file, and the file needed to call another one in /lib/init. There is no /lib/init in puppy so I created it.DON'T FORGET TO MAKE THESE TWO FILES EXECUTABLE.

Put this in /etc/init.d and name it umountnfs
#! /bin/sh
# Provides:          umountnfs
# Required-Start:
# Required-Stop:     umountfs
# Should-Stop:       $network $portmap nfs-common
# Default-Start:
# Default-Stop:      0 6
# Short-Description: Unmount all network filesystems except the root fs.
# Description:       Also unmounts all virtual filesystems (proc, devfs,
#                    devpts, usbfs, sysfs) that are not mounted at the
#                    top level.

KERNEL="$(uname -s)"
RELEASE="$(uname -r)"
. /lib/init/vars.sh

. /lib/lsb/init-functions

case "${KERNEL}:${RELEASE}" in
   FLAGS="-f -l"

do_stop () {
   # Write a reboot record to /var/log/wtmp before unmounting
   halt -w

   # Remove bootclean flag files (precaution against symlink attacks)
   rm -f /tmp/.clean /var/lock/.clean /var/run/.clean

   # Make list of points to unmount in reverse order of their creation

   exec 9<&0 </etc/mtab

   while read -r DEV MTPT FSTYPE OPTS REST
      case "$MTPT" in
      case "$FSTYPE" in
         DIRS="$MTPT $DIRS"
         DIRS="$MTPT $DIRS"
      case "$OPTS" in
         DIRS="$MTPT $DIRS"

   exec 0<&9 9<&-

   if [ "$DIRS" ]
      [ "$VERBOSE" = no ] || log_action_begin_msg "Unmounting remote and non-toplevel virtual filesystems"
      umount $FLAGS $DIRS
      [ "$VERBOSE" = no ] || log_action_end_msg $ES

case "$1" in
   # No-op
   echo "Error: argument '$1' not supported" >&2
   exit 3
   echo "Usage: umountnfs.sh [start|stop]" >&2
   exit 3


Then create folder /lib/init and put this file there (call it var.sh):
# Set rcS vars

[ -f /etc/default/rcS ] && . /etc/default/rcS || true

# check for bootoption 'noswap' and do not activate swap
# partitions/files when it is set.
if [ -r /proc/cmdline ] && grep -qw 'noswap' /proc/cmdline ; then

# Accept the same 'quiet' option as the kernel
if [ ! -e /proc/cmdline ] || egrep -qw 'quiet' /proc/cmdline ; then

# But allow both rcS and the kernel options 'quiet' to be overrided
# when INIT_VERBOSE=yes is used as well.

Lastly, call the file in /etc/rc.d/shutdown
I put this near the top of the file, as the first command right after the intro commented lines:
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [1 Post]  
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.0750s ][ Queries: 11 (0.0164s) ][ GZIP on ]