[opensuse] Unmount NFS when hibernate?
I can finally hibernate (suspend-to-disk) my laptop again, but now I ran into a problem with NFS mounts that are hanging. I use NFS mounts to machines at home and I forget to unmount them before I hibernate the laptop. When I get to a client, the NFS mount is stale and it screws up a lot of things. Nautilus crash and the machine keeps on trying to get the mount back. I cannot unmount it as it is wedged there. I had to reboot the machine to get it to release the mount. So much for the advantage of hibernating. In the past I use a wrapper script that checks for NFS mounts and unmount them before hibernating. I could set the battery monitor to use that script to hibernate, but now, in SuSE 10.2, the battery monitor that is used does not have that option anymore. The shutdown toolbar applet also do not give options to configure anything. I also looked in the powersave config and I did not find an option to unmount NFS mounts. Any idea how one is supposed to do this in SUSE 10.2? -- Andre Truter | Software Consultant | Registered Linux user #185282 Jabber: andre.truter@gmail.com | http://www.trusoft.co.za ~ A dinosaur is a salamander designed to Mil Spec ~ -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Andre Truter wrote:
I can finally hibernate (suspend-to-disk) my laptop again, but now I ran into a problem with NFS mounts that are hanging.
I use NFS mounts to machines at home and I forget to unmount them before I hibernate the laptop. When I get to a client, the NFS mount is stale and it screws up a lot of things. Nautilus crash and the machine keeps on trying to get the mount back. I cannot unmount it as it is wedged there. I had to reboot the machine to get it to release the mount. So much for the advantage of hibernating.
I have managed to unmount NFS mounts, after the event. Can't remember the exact sequence of steps but I think it involved the -f and -l flags to umount. Cheers, Dave -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On Dec 18, 06 15:26:46 +0200, Andre Truter wrote:
I can finally hibernate (suspend-to-disk) my laptop again, but now I ran into a problem with NFS mounts that are hanging.
I use NFS mounts to machines at home and I forget to unmount them before I hibernate the laptop. When I get to a client, the NFS mount is stale and it screws up a lot of things. Nautilus crash and the machine keeps on trying to get the mount back. I cannot unmount it as it is wedged there. I had to reboot the machine to get it to release the mount. So much for the advantage of hibernating.
umount -f -l <mountpoint> But I assume there's some bug lying deeper in the pit, as even when resuming in the same environment, old mount points don't work any more. This is yet to be investigated, though.
In the past I use a wrapper script that checks for NFS mounts and unmount them before hibernating. I could set the battery monitor to use that script to hibernate, but now, in SuSE 10.2, the battery monitor that is used does not have that option anymore. The shutdown toolbar applet also do not give options to configure anything.
/etc/sysconfig/powersave/events: EVENT_GLOBAL_*
You should be able to add a script here. It has the advantage, that it
is always called, no matter how the suspend was triggered (except for by
using the direct kernel interface).
Matthias
--
Matthias Hopf
On 12/18/06, Matthias Hopf
umount -f -l <mountpoint>
But I assume there's some bug lying deeper in the pit, as even when resuming in the same environment, old mount points don't work any more. This is yet to be investigated, though.
Yip, this does not always work, like today when I had to reboot the machine to get the nfs mount out of deadlock.
In the past I use a wrapper script that checks for NFS mounts and unmount them before hibernating. I could set the battery monitor to use that script to hibernate, but now, in SuSE 10.2, the battery monitor that is used does not have that option anymore. The shutdown toolbar applet also do not give options to configure anything.
/etc/sysconfig/powersave/events: EVENT_GLOBAL_* You should be able to add a script here. It has the advantage, that it is always called, no matter how the suspend was triggered (except for by using the direct kernel interface).
Ah! Yes! This should work perfect. Thanks! -- Andre Truter | Software Consultant | Registered Linux user #185282 Jabber: andre.truter@gmail.com | http://www.trusoft.co.za ~ A dinosaur is a salamander designed to Mil Spec ~ -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On 12/18/06, Matthias Hopf
On Dec 18, 06 15:26:46 +0200, Andre Truter wrote:
/etc/sysconfig/powersave/events: EVENT_GLOBAL_* You should be able to add a script here. It has the advantage, that it is always called, no matter how the suspend was triggered (except for by using the direct kernel interface).
Hmm.. This did not work, or I did something wrong. I wrote a script based on the /usr/share/doc/packages/powersave/contrib/example_event_script script and I placed it in /usr/lib/powersave/scripts I called it umount_nfs and I made it executable. Then I changed /etc/sysconfig/powersave/events:EVENT_GLOBAL_SUSPEND2DISK so that it looks like this: EVENT_GLOBAL_SUSPEND2DISK="prepare_suspend_to_disk umount_nfs screen_saver do_suspend_to_disk" I added my little script to the list, but it does not seem to get executed. I added logging that should end up in the messages file if I understand correct, but nothing. I ran SuSEconfig and restarted powersaved after adding the script, not sure if it is needed. Any idea what I am doing wrong? This is what my script look like: --<snip>-- #!/bin/bash # script to unmount all nfs mounts when suspend is called echo "umount_nfs starts" $LOGGER "umount_nfs starts" # # source helper_functions to get $PATH, $SCRIPT_RETURN, EV_ID (among others) . /usr/lib/powersave/scripts/helper_functions # Note: this sets a trap on "EXIT", so you must exit the script via the # (also provided) EXIT function after calling $SCRIPT_RETURN # If you don't call EXIT, the trap will call $SCRIPT_RETURN with return code 1 # # find nfs mounts MOUNTS=`mount -v | grep "type nfs" | grep -v nfsd | awk '{print $3}'` for MOUNTPOINT in $MOUNTS do $LOGGER "Unmount $MOUNTPOINT" umount -f -l $MOUNTPOINT if [ $? -ne 0 ] then echo "ERROR when unmounting $MOUNTPOINT" fi done $LOGGER "umount_nfs done" # always call $SCRIPT_RETURN before exiting: $SCRIPT_RETURN $EV_ID 0 "umount nfs succeeded" EXIT 0 --<snip>-- Thanks -- Andre Truter | Software Consultant | Registered Linux user #185282 Jabber: andre.truter@gmail.com | http://www.trusoft.co.za ~ A dinosaur is a salamander designed to Mil Spec ~ -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On Monday 18 December 2006 23:39, Andre Truter wrote:
On 12/18/06, Matthias Hopf
wrote: On Dec 18, 06 15:26:46 +0200, Andre Truter wrote:
/etc/sysconfig/powersave/events: EVENT_GLOBAL_* You should be able to add a script here. It has the advantage, that it is always called, no matter how the suspend was triggered (except for by using the direct kernel interface).
Hmm.. This did not work, or I did something wrong.
I wrote a script based on the /usr/share/doc/packages/powersave/contrib/example_event_script script and I placed it in /usr/lib/powersave/scripts
[8<] I had a problem too with suspend to disk (needed to shutdown/restart network and ntp services). My solution is here: http://lists.opensuse.org/opensuse/2006-12/msg01757.html Instead of ntp and network, maybe you only need one service: nfs? HTH Cheers, Leen -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On 12/19/06, Leendert Meyer
On Monday 18 December 2006 23:39, Andre Truter wrote:
I had a problem too with suspend to disk (needed to shutdown/restart network and ntp services).
My solution is here: http://lists.opensuse.org/opensuse/2006-12/msg01757.html
Instead of ntp and network, maybe you only need one service: nfs?
OK, this works! Thanks Leendert. I am now sitting at a customer without any NFS problems. Thanks -- Andre Truter | Software Consultant | Registered Linux user #185282 Jabber: andre.truter@gmail.com | http://www.trusoft.co.za ~ A dinosaur is a salamander designed to Mil Spec ~ -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Andre Truter wrote:
I can finally hibernate (suspend-to-disk) my laptop again, but now I ran into a problem with NFS mounts that are hanging.
I use NFS mounts to machines at home and I forget to unmount them before I hibernate the laptop. When I get to a client, the NFS mount is stale and it screws up a lot of things. Nautilus crash and the machine keeps on trying to get the mount back. I cannot unmount it as it is wedged there. I had to reboot the machine to get it to release the mount. So much for the advantage of hibernating.
In the past I use a wrapper script that checks for NFS mounts and unmount them before hibernating. I could set the battery monitor to use that script to hibernate, but now, in SuSE 10.2, the battery monitor that is used does not have that option anymore. The shutdown toolbar applet also do not give options to configure anything.
I also looked in the powersave config and I did not find an option to unmount NFS mounts.
Any idea how one is supposed to do this in SUSE 10.2?
You need to explain how you do your NFS mounts. Theres are several ways to do it. I personally prefer the automount method, where it does not do the mount until it needs it. If you do not use the mount sor a specified period of time, I have min umount the drive. Hoepfully, that will prevent the stale nfs mont. -- Joseph Loo jloo@acm.org -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On 12/18/06, Andre Truter
I can finally hibernate (suspend-to-disk) my laptop again, but now I ran into a problem with NFS mounts that are hanging.
I use NFS mounts to machines at home and I forget to unmount them before I hibernate the laptop. When I get to a client, the NFS mount is stale and it screws up a lot of things. Nautilus crash and the machine keeps on trying to get the mount back. I cannot unmount it as it is wedged there. I had to reboot the machine to get it to release the mount. So much for the advantage of hibernating.
In the past I use a wrapper script that checks for NFS mounts and unmount them before hibernating. I could set the battery monitor to use that script to hibernate, but now, in SuSE 10.2, the battery monitor that is used does not have that option anymore. The shutdown toolbar applet also do not give options to configure anything.
I also looked in the powersave config and I did not find an option to unmount NFS mounts.
Any idea how one is supposed to do this in SUSE 10.2?
You may try using soft and timeo mount options. That way at least it will not deadlock and you should be able to umount. -- Svetoslav Milenov (Sunny) Even the most advanced equipment in the hands of the ignorant is just a pile of scrap. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
participants (6)
-
Andre Truter
-
Dave Howorth
-
Joseph Loo
-
Leendert Meyer
-
Matthias Hopf
-
Sunny