I have following record in /etc/fstab: ojo:/a\040b /mnt/a\040b nfs rw,nosuid,nodev,v3,rsize=8192,wsize=8192,hard,intr,udp,lock,addr=ojo 0 0 I used \040 for space (see man fstab). When I try to run script /etc/init.d/netmount stop it prints "Failed to unmount filesystems this retry" So I modified it by adding stop() function this way ( there are 3 new/modified lines started with (*) ): stop() { # umount -art $fstypes doesn't seem to work, so... # NB: we have to check if any network filesystems is mounted, # else mount do not exit cleanly local sig retry local remaining="$(awk '$3 ~ /coda|nfs|ncpfs|smbfs/ { if ($2 != "/") print $2 }' /proc/mounts | sort -r)" # just keep things nice and uniform if [ -z "${remaining}" ] then ebegin "Unmounting network filesystems" eend 0 else sig= retry=3 while [ -n "${remaining}" -a "${retry}" -gt 0 ] do (*) remaining=`echo "${remaining}" | sed 's/\\\040/ /g'` if [ "${retry}" -lt 3 ] then ebegin "Unmounting network filesystems (retry)" (*) umount "${remaining}" &>/dev/null eend $? "Failed to unmount filesystems this retry" else ebegin "Unmounting network filesystems" (*) umount "${remaining}" &>/dev/null eend $? "Failed to unmount filesystems" fi remaining="$(awk '$3 ~ /coda|nfs|ncpfs|smbfs/ { if ($2 != "/") print $2 }' /proc/mounts | sort -r)" [ -z "${remaining}" ] && break /bin/fuser -k -m ${sig} ${remaining} &>/dev/null sleep 5 retry=$((${retry} -1)) sig=-9 done fi } At least it works for me. Reproducible: Always Steps to Reproduce:
what if you changed stop to read: stop() { ebegin "Unmounting network filesystems" umount -art coda,nfs,ncpfs,smbfs,cifs eend $? "Failed to unmount filesystems" } there's a comment that says '-art' doesnt work, but that was back around Oct 2001, so i wonder if newer versions of util-linux fix it ... i know `umount -art nfs` unmounted all my nfs mounts ...
Yes I saw a comment in that file and '-art' works for me. # qpkg -I -v util-linux sys-apps/util-linux-2.12-r4
Ok, this is in rc-scripts cvs now (Spanky's simpler solution)
baselayout-1.11.2+
the extra logic is needed in case the remote filesystems are in use ...
Created attachment 45067 [details] netmount the original suggested is not correct ... it may work if there is only 1 filesystem left to unmount, but not if the user has multiple ones and each one may have spaces try this netmount and make sure it works for you please :)
added a slightly updated netmount to cvs watch for it in 1.11.7 !
2004-12-02 11:08 GMT+2 http://www.gentoo.org/cgi-bin/viewcvs.cgi/sys-apps/baselayout/ I can only see baselayout-1.11.6-r1.ebuild.