Skip to contentSkip to conversation

AutoFS Problems with Laptops

DISCUSSION Daniel Qarras 3 participants 8 messages May 19, 2006 – May 22, 2006 Kernel automounter

lore
Share & tools
lore
#0 lore raw

Hi!

This is probably very easy but I can neither figure it out or use Google.. Anyway, this is what I want to achieve:

Our local network (10.0.0.0) server exports /home and /work directories and desktop workstations with static IPs can mount them all ok over NFS. I have a laptop that is using DHCP and autofs. In our local network autofs mounts work all ok with the config below.

However, when I go out to a different network where those directories are not available, I would like autofs to figure that out and not to try mount them and cause jams. What should the script output if those mounts are available?

I am asking this because I've tried almost everything and I am just getting bizarre results like directory /var/autofs/(null)/home, /var/autofs/hithere/work, etc. I want to mount available mounts under /var/autofs so that they would be /var/autofs/home and /var/autofs/work but that seems not to work.

The autofs configuration that works perfectly in our local network is the following.

/etc/auto.master:

/var/autofs /etc/auto.local --timeout=30,--ghost

And /etc/auto.local:

home -fstype=nfs,rw,soft,intr 10.0.0.1:/home
work -fstype=nfs,rw,soft,intr 10.0.0.1:/work

But, as said, if I turn auto.local as an executable script that outputs lines like those I just get those silly results with mounts.

Thanks,

Dan.

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

maintainer
#1 lore raw
Quoted 10 lines · Daniel Qarras

Hi!

This is probably very easy but I can neither figure it out or use Google.. Anyway, this is what I want to achieve:

Our local network (10.0.0.0) server exports /home and /work directories and desktop workstations with static IPs can mount them all ok over NFS. I have a laptop that is using DHCP and autofs. In our local network autofs mounts work all ok with the config below.

Quoted 7 lines

However, when I go out to a different network where those directories are not available, I would like autofs to figure that out and not to try mount them and cause jams. What should the script output if those mounts are available?

I am asking this because I've tried almost everything and I am just getting bizarre results like directory /var/autofs/(null)/home,

-------------------------------------------------------^ You'd be running FC5 then.
Can't track this down, we shouldn't be getting mount requests from the kernel with no name.

Quoted 7 lines

/var/autofs/hithere/work, etc. I want to mount available mounts under /var/autofs so that they would be /var/autofs/home and /var/autofs/work but that seems not to work.

The autofs configuration that works perfectly in our local network is the following.

Quoted 8 lines

/etc/auto.master:

/var/autofs /etc/auto.local --timeout=30,--ghost

And /etc/auto.local:

home -fstype=nfs,rw,soft,intr 10.0.0.1:/home
work -fstype=nfs,rw,soft,intr 10.0.0.1:/work

A script should just output the map entry without the key. Like -fstype=nfs,rw,soft,intr 10.0.0.1:/work

Ian

#2 lore raw

Hi Ian,

and thanks for your prompt reply.

Quoted 6 lines
Quoted 2 lines

I am asking this because I've tried almost everything and I am just getting bizarre results like directory /var/autofs/(null)/home,

-------------------------------------------------------^ You'd be running FC5 then.
Can't track this down, we shouldn't be getting mount requests from the kernel with no name.

Yes, the client is FC5, the server is CentOS-4.4. At the server only /etc/exports is configured like this:

/home 10.0.0.0/255.0.0.0(rw,no_root_squash,sync)
/work 10.0.0.0/255.0.0.0(rw,no_root_squash,sync)

Quoted 2 lines

A script should just output the map entry without the key. Like -fstype=nfs,rw,soft,intr 10.0.0.1:/work

Unfortunately, this still creates (null) directory and I can even go to /var/autofs/whatever to see contents of /work. And if the script outputs both /work and /home I see only either of them, depending the order the entries are printed and if they are on the same line or in two lines.

Do you think I should file a bug to RH Bugzilla about this? It is currently down so I cannot check whether there is already a report or two about this issue. I posted this question also to Fedora list but got no reply.

Thanks.

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

maintainer
#3 lore raw
Quoted 17 lines · Daniel Qarras

Hi Ian,

and thanks for your prompt reply.

Quoted 6 lines
Quoted 2 lines

I am asking this because I've tried almost everything and I am just getting bizarre results like directory /var/autofs/(null)/home,

-------------------------------------------------------^ You'd be running FC5 then.
Can't track this down, we shouldn't be getting mount requests from the kernel with no name.

Yes, the client is FC5, the server is CentOS-4.4. At the server only /etc/exports is configured like this:

/home 10.0.0.0/255.0.0.0(rw,no_root_squash,sync)
/work 10.0.0.0/255.0.0.0(rw,no_root_squash,sync)

Quoted 8 lines
Quoted 2 lines

A script should just output the map entry without the key. Like -fstype=nfs,rw,soft,intr 10.0.0.1:/work

Unfortunately, this still creates (null) directory and I can even go to /var/autofs/whatever to see contents of /work. And if the script outputs both /work and /home I see only either of them, depending the order the entries are printed and if they are on the same line or in two lines.

That's interesting.

You mean you get a directory "(null)" with no mount?
That shouldn't happen because the the "(null)" key shouldn't be found and so shouldn't have a mount entry associated with it. If the script needs to return a fail on the lookup it should return 1, 0 on success.

If the script emits a valid mount then it will, of course, mount that.

Ian

#4 lore raw
Quoted 12 lines
Quoted 4 lines
Quoted 2 lines

A script should just output the map entry without the key. Like -fstype=nfs,rw,soft,intr 10.0.0.1:/work

Unfortunately, this still creates (null) directory and I can even

go to

Quoted 2 lines

/var/autofs/whatever to see contents of /work. And if the script outputs both /work and /home I see only either of them, depending

the

Quoted 1 line

order the entries are printed and if they are on the same line or

in

Quoted 1 line

two lines.

Quoted 7 lines

That's interesting.

You mean you get a directory "(null)" with no mount?
That shouldn't happen because the the "(null)" key shouldn't be found and so shouldn't have a mount entry associated with it. If the script needs to return a fail on the lookup it should return 1, 0 on success.

The "(null)" directory has contents of /home. I now modified the script so that it is just like this:

#!/bin/sh
echo -fstype=nfs,rw,soft,intr 10.0.0.1:/home
echo -fstype=nfs,rw,soft,intr 10.0.0.1:/work

The (null) directory is visible when I say:

cd /var/autofs
ls

It also gave me access to /home via any directory but not to /work. meaning that I see contents of /home via these directories:

/var/autofs/home
/var/autofs/test
/var/autofs/work

Cheers,

Dan.

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

maintainer
#5 lore raw
Quoted 20 lines · Daniel Qarras
Quoted 12 lines
Quoted 4 lines
Quoted 2 lines

A script should just output the map entry without the key. Like -fstype=nfs,rw,soft,intr 10.0.0.1:/work

Unfortunately, this still creates (null) directory and I can even

go to

Quoted 2 lines

/var/autofs/whatever to see contents of /work. And if the script outputs both /work and /home I see only either of them, depending

the

Quoted 1 line

order the entries are printed and if they are on the same line or

in

Quoted 1 line

two lines.

Quoted 7 lines

That's interesting.

You mean you get a directory "(null)" with no mount?
That shouldn't happen because the the "(null)" key shouldn't be found and so shouldn't have a mount entry associated with it. If the script needs to return a fail on the lookup it should return 1, 0 on success.

Quoted 6 lines

The "(null)" directory has contents of /home. I now modified the script so that it is just like this:

#!/bin/sh
echo -fstype=nfs,rw,soft,intr 10.0.0.1:/home
echo -fstype=nfs,rw,soft,intr 10.0.0.1:/work

This is not right.

The script is passed the key and you must emit the mount corresponding to that key.

Look at auto.net for an example.

Ian

#6 lore raw
Quoted 10 lines
Quoted 3 lines

#!/bin/sh
echo -fstype=nfs,rw,soft,intr 10.0.0.1:/home
echo -fstype=nfs,rw,soft,intr 10.0.0.1:/work

This is not right.

The script is passed the key and you must emit the mount corresponding to that key.

Look at auto.net for an example.

If I run auto.net from command line with parameter 10.0.0.1 it outputs:

root@laptop# /etc/auto.net 10.0.0.1
-fstype=nfs,hard,intr,nodev,nosuid \
        /home 10.0.0.1:/home \
        /work 10.0.0.1:/work

With any other parameter I just get errors. But when I use auto.net or my own script to print $1 to /tmp/foo I see that $1 is (null) when doing ls /var/autofs or home when doind cd /var/autofs/home. Naturally, nothing gets mounted then.

Too bad that RH Bugzilla is still down and I can't check whether there's already a bug report about this already.

Thanks.

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

#7 lore raw
In reply to Daniel Qarras
Quoted 4 lines · Daniel Qarras

However, when I go out to a different network where those directories are not available, I would like autofs to figure that out and not to try mount them and cause jams. What should the script output if those mounts are available?

If I remember correctly, if the programmatic map prints nothing and exits with a nonzero exit code, autofs will realize it has failed and give up. So now, how does the script realize that the 10.0.0.x IP address assigned to eth0 is not *your* 10.0.0.x, but a customer's net or an Internet cafe somewhere? Perhaps a less obvious choice of subnet could be helpful; this is what I do on my own net.

But I'm wondering, what's in server:/home or server:/work? The ideal is to set up the laptop so the NFS mounted directories are not touched without voluntary user action, upon which autofs swings into action, and if the user forgets that he's not at headquarters, he deserves the 30 second timeout (unless the programmatic map script heads off NFS mounting). It isn't going to fly, if the user's home directory is in server:/home/$USER. On my own laptop the homedir is local, with backups to the server (and from there to removeable media), initiated manually.

If ever you might expand to have two or more NFS servers, it's important to use separate subtrees for each, e.g.
/var/autofs/server1/home
/var/autofs/server1/work
/var/autofs/server2/home
/var/autofs/server2/work
The reason is like this: Suppose the mount points were all jumbled together, e.g.
/var/autofs/home1
/var/autofs/home2
/var/autofs/work1
/var/autofs/work2

(UCLA-Mathnet actually made this mistake in the distant past.) Suppose one server is down and the other isn't, and a user hosted on the working server tries to log in. Let's say his homedir is /var/autofs/home2/luser. Several "pwd" operations can't be avoided, and it needs to stat all memebers of /var/autofs to find out which name goes with the inode which is the parent of the homedir. Frequently it will stat a mount point from the dead server before getting the right one, and suffer a 30 second timeout, several times. Hiss, boo.

James F. Carter Voice 310 825 2897 FAX 310 206 6673
UCLA-Mathnet; 6115 MSA; 405 Hilgard Ave.; Los Angeles, CA, USA 90095-1555
Email: [email protected] http://www.math.ucla.edu/~jimc (q.v. for PGP key)