You are not logged in.

#1 2015-08-11 18:56:24

marko2010
Member
Registered: 2010-04-17
Posts: 70

Autofs tries to mount offline computer and hangs repeatedly

Normally autofs with NFS4 works great for me, but recently I have hit an issue where it intermittently fails to connect to any computer on my LAN. An inspection of the output of the command "automount -f -v" revealed that autofs is attempting to mount a particular computer on my LAN that is shut down. When it fails to mount the shut down computer automount hangs and does no let me mount anything. Here is the relevant output of "automount -f -v".  Note the computer that is shut down has the hostname of "eddy":

mounted /net/archbox3
1 remaining in /net
1 remaining in /net
1 remaining in /net
expiring path /net/archbox3
expired /net/archbox3
attempting to mount entry /net/eddy
(and this is where automount hangs, and I have to kill it with a Cnt + c)

I found a partial workaround by commenting out "eddy" in my /etc/hosts file, but this is not a permanent solution. Also I have seen this same issue with autofs attempting to mount other computers on the LAN that are shut down.

Offline

#2 2015-08-11 21:59:15

branch
Member
Registered: 2014-03-16
Posts: 209

Re: Autofs tries to mount offline computer and hangs repeatedly

The timeout settings are in /etc/autofs/autofs.conf (see man autofs.conf for details). Also you can add the "soft" mount option in the map file to let mount know it can fail. Keep in mind if the mount is allowed to fail then the result of an operation such as

echo something > /net/foo/something.txt

will be to create something.txt in the /net/foo directory of the local filesystem, which is probably not what you want.

Offline

#3 2015-08-11 23:58:35

alphaniner
Member
From: Ancapistan
Registered: 2010-07-12
Posts: 2,810

Re: Autofs tries to mount offline computer and hangs repeatedly

The reason the workaround, er, works is that mount just gives up when it can't resolve the hostname. I'm not aware of any option that only affects the timeout for the mount operation. Maybe look into the 'bg' option as an alternative.

But frankly the fact that automount attempts to mount 'blindly' (eg. without verifying connectivity or validating the export) is rather shoddy. Unless there's a way to make it do that, I think the only solution will be to find out why it's trying to mount those unavailable shares.

Edit: durr, look into 'retry'.

branch wrote:

Also you can add the "soft" mount option in the map file to let mount know it can fail.

It's my understanding that soft/hard has to do with recovery, eg. after a connection has been made.

Last edited by alphaniner (2015-08-12 00:15:37)


But whether the Constitution really be one thing, or another, this much is certain - that it has either authorized such a government as we have had, or has been powerless to prevent it. In either case, it is unfit to exist.
-Lysander Spooner

Offline

#4 2015-08-14 21:21:16

marko2010
Member
Registered: 2010-04-17
Posts: 70

Re: Autofs tries to mount offline computer and hangs repeatedly

I have added "retry=0" to my auto.master file and that seems to have fixed the problem with autofs hanging:

/net            /etc/autofs/auto.nfs --retry=0  --timeout=2 --ghost

Documentation for the "retry" flag is pretty hard to find, but I ran across this on another board:
"retry=0" means the mount command will fail as soon as the first mount(2) system call fails."

...oddly enough even when I leave off the "--" the problem will still go away. I'll keep watching this for anther week or two, it easy to fooled by the wrong fix with autofs.

Offline

#5 2015-08-14 21:58:02

alphaniner
Member
From: Ancapistan
Registered: 2010-07-12
Posts: 2,810

Re: Autofs tries to mount offline computer and hangs repeatedly

Actually, retry is an nfs mount option, not a flag. You can find it in the "MOUNT OPTIONS" section of nfs(5).


But whether the Constitution really be one thing, or another, this much is certain - that it has either authorized such a government as we have had, or has been powerless to prevent it. In either case, it is unfit to exist.
-Lysander Spooner

Offline

Board footer

Powered by FluxBB