autofs suspend/hibernate script should be ported from apmd system to pm-utils

Bug #506116 reported by Wizzu
44
This bug affects 8 people
Affects Status Importance Assigned to Milestone
pm-utils (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

Binary package hint: autofs

The autofs package in karmic ships with the script /etc/apm/event.d/autofs which will try to unmount all automounted NFS shares during suspend/hibernate. However Ubuntu now uses pm-utils instead of apmd, and so the script is largely ignored. In order to be usefule again, it needs to be ported to pm-utils, namely placed to /etc/pm/sleep.d and checked for pm-utils call compatibility.

See https://bugs.launchpad.net/ubuntu/+source/pm-utils/+bug/30594

Description: Ubuntu 9.10
Release: 9.10

autofs:
  Installed: 4.1.4+debian-2.1ubuntu2
  Candidate: 4.1.4+debian-2.1ubuntu2
  Version table:
 *** 4.1.4+debian-2.1ubuntu2 0
        500 http://fi.archive.ubuntu.com karmic/main Packages
        100 /var/lib/dpkg/status

Revision history for this message
Wizzu (wizzu) wrote :

Here's a script I created that seems to work on my system for this purpose. I placed it in /etc/pm/sleep.d/80_autofs

Of course, as expected, if any of the automounted shares are busy (any files open), it won't do anything for them. It's just a "best effort" attempt.

Chuck Short (zulcss)
affects: autofs (Ubuntu) → pm-utils (Ubuntu)
Revision history for this message
MountainX (dave-mountain) wrote :

I'm running 10.10 and it fails to suspend to RAM if I have used any NFS shares. Even if no files are currently open, if some files on a share were previously opened during the current session, Ubuntu will fail to suspend. If I log out and log back in, I can suspend if I do so before beginning any work that involves a share.

I tried the script in comment #1. It didn't resolve the issue. I simply placed it in the location mentioned (/etc/pm/sleep.d/80_autofs) and made it executable and tried to suspend. Is more required to make it work?

Revision history for this message
Wizzu (wizzu) wrote :

@MountainX: What you did should be enough in theory.
You can test it manually too: run "./autofs suspend" as root before selecting suspend from the menu, and see if it helps. Any/all unused autofs shares should be umounted by the script.

But I don't know if the 10.10 suspend setup is similar to what was in 9.10, so it might not be compatible... With luck, even if there are changes, the location just needs to be changed.

Suspend is not working for me (running 10.04 currently) due to a kernel bug causing crashes on resume, so I've not been making much use of the script myself...

Revision history for this message
MountainX (dave-mountain) wrote :

I mount my NFS shares via /etc/fstab using entries such as:

10.10.1.1:/home/shared /home/shared nfs auto,rw,noatime 0 0

Is the "auto" option used there the same as (or related to) the autofs mentioned in this bug report? I had assumed so, but now I realize I might be wrong because when I run "./autofs suspend" the response is:
autofs: command not found

(Sorry if I have posted to the wrong bug report.)

Revision history for this message
Wizzu (wizzu) wrote :

@MountainX: No, the "auto" option for /etc/fstab is different to "autofs".

The "auto option" mounts the filesystem in question automatically at boot time.

"autofs" is a program/daemon which mounts/unmounts NFS shares on-demand. It's an alternative way to mount NFS shares so to speak, and in this case you wouldn't have those NFS entries listed in /etc/fstab at all. "autofs" control files are /etc/auto.master and some other /etc/auto.* files (user defined).

One of the reasons I started using autofs was to get a working suspend, because mounted NFS shares don't seem to work very well with suspend/resume...

Revision history for this message
MountainX (dave-mountain) wrote :

Wizzu, thank you. As a next step I will try autofs with your script.

Changed in pm-utils (Ubuntu):
status: New → Confirmed
Revision history for this message
Calvin Spealman (ironfroggy) wrote :

It should be noted that this bug is not related to NFS, specifically, but any network mounts handled by autofs. I have this same problem with my samba/CIFS shares.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Bug attachments

Remote bug watches

Bug watches keep track of this bug in other bug trackers.