I've found that the following works on Ubuntu 9.10 Karmic while using wireless and WPA2 on my laptop:
After hours of beating my head against the wall trying to figure out how to get rid of those time-consuming CIFS VFS errors during shutdown, I cobbled together this (ugly) fix.
I take no credit for this script. I found it here. I simply put two and two together, as I guessed this script may execute before Network Manager is killed. I just plugged in the umountnfs.sh portion.
- Save the script somewhere safe. I saved it in ~/Scripts, and gave it root-only permissions.
- sudo chmod +x /path/to/script/scriptname
- Add the script to your Start-up Applications. (System > Preferences > Startup Applications)
#Author: Seamus Phelan
#This program runs a custom command/script just before gnome shuts
#down. This is done the same way that gedit does it (listening for
#the 'save-yourself' event). This is different to placing scipts
#in /etc/rc#.d/ as the script will be run before gnome exits.
#If the custom script/command fails with a non-zero return code, a
#popup dialog box will appear offering the chance to cancel logout
#Usage: 1 - change the command in the 'subprocess.call' in
# function 'session_save_yourself' below to be what ever
# you want to run at logout.
# 2 - Run this program at every gnome login (add via menu System
# -> Preferences -> Session)
class Namespace: pass
ns = Namespace()
ns.dialog = None
prog = gnome.init ("gnome_save_yourself", "1.0", gnome.libgnome_module_info_get(), sys.argv, )
client = gnome.ui.master_client()
#set up call back for when 'logout'/'Shutdown' button pressed
def session_save_yourself( *args):
#Unmount those CIFS shares!
retcode = subprocess.call("sudo /etc/init.d/umountnfs.sh", shell=True)
if retcode != 0:
def shutdown_cancelled( *args):
if ns.dialog != None:
ns.dialog = gtk.Dialog("There was a problem running your pre-shutdown script",
gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
("There was a problem running your pre-shutdown script - continue logout", gtk.RESPONSE_ACCEPT))
if ns.test_mode == True:
response = ns.dialog.run()
#when in shutdown mode gnome will only allow you to open a window using master_client().save_any_dialog()
#It also adds the 'Cancel logout' button
#Find out if we are in test mode???
if len(sys.argv) >=2 and sys.argv == "test":
ns.test_mode = True
ns.test_mode = False
if ns.test_mode == True:
- Run in terminal:
- Add the following to the bottom of the file:
%admin ALL=NOPASSWD: /etc/init.d/umountnfs.sh
- Press Ctrl-X to exit, press Y to save changes, and hit [Enter] to write the file.
I hope this helps! I'm a linux noob, so apologies if my guide wasn't perfect.
(Credit to stevo1982 for the sudo password workaround!)