1

I am trying to mount a cifs partition using autofs. After a lot of trial and errors, I finally manage to get it mounted (the main issue I ran into is that in the instructions, here, this line in the mapping file

"[any_name] -fstype=cifs,[other_options] > ://[remote_server]/[remote_share_name]"

should really be:

"[remote_share_name] -fstype=cifs,[other_options] ://[remote_server]/"

At any rate after all this, I am able to mount my cifs partition using this command:

sudo automount -f -d &

Unfortunately, when I use the actual autofs service using the command below, my share does not get mounted

sudo /sbin/service autofs restart

I looked at the log files using after configuring autofs sysconfig to be in debug mode, and see the following errors:

Dec 18 13:33:51 SRVR_XYZ automount[7986]: autofs stopped
Dec 18 13:46:09 SRVR_XYZ automount[8740]: lookup_read_master: lookup(file): could not open master map file /etc/auto.master
Dec 18 13:46:09 SRVR_XYZ automount[8740]: lookup_read_master: lookup(file): could not open master map file /etc/auto.master
Dec 18 13:46:11 SRVR_XYZ automount[8740]: lookup_read_master: lookup(file): could not open master map file /etc/auto.master
Dec 18 13:46:13 SRVR_XYZ automount[8740]: lookup_read_master: lookup(file): could not open master map file /etc/auto.master
Dec 18 13:46:15 SRVR_XYZ automount[8740]: lookup_read_master: lookup(file): could not open master map file /etc/auto.master
Dec 18 13:46:17 SRVR_XYZ automount[8740]: lookup_read_master: lookup(file): could not open master map file /etc/auto.master
Dec 18 13:46:19 SRVR_XYZ automount[8740]: problem reading master map, maximum wait exceeded
Dec 18 13:46:19 SRVR_XYZ automount[8740]: automount: warning: could not read at least one map source after waiting, continuing ...
Dec 18 13:46:19 SRVR_XYZ automount[8740]: lookup_read_master: lookup(file): could not open master map file /etc/auto.master
Dec 18 13:53:34 SRVR_XYZ automount[9139]: lookup_read_master: lookup(file): could not open master map file /etc/auto.master
Dec 18 13:53:34 SRVR_XYZ automount[9139]: lookup_read_master: lookup(file): could not open master map file /etc/auto.master
Dec 18 13:53:36 SRVR_XYZ automount[9139]: lookup_read_master: lookup(file): could not open master map file /etc/auto.master
Dec 18 13:53:38 SRVR_XYZ automount[9139]: lookup_read_master: lookup(file): could not open master map file /etc/auto.master
Dec 18 13:53:40 SRVR_XYZ automount[9139]: lookup_read_master: lookup(file): could not open master map file /etc/auto.master
Dec 18 13:53:42 SRVR_XYZ automount[9139]: lookup_read_master: lookup(file): could not open master map file /etc/auto.master
Dec 18 13:53:44 SRVR_XYZ automount[9139]: problem reading master map, maximum wait exceeded
Dec 18 13:53:44 SRVR_XYZ automount[9139]: automount: warning: could not read at least one map source after waiting, continuing ...
Dec 18 13:53:44 SRVR_XYZ automount[9139]: lookup_read_master: lookup(file): could not open master map file /etc/auto.master
Dec 18 13:54:18 SRVR_XYZ automount[9250]: lookup_read_master: lookup(file): could not open master map file /etc/auto.master
Dec 18 13:54:18 SRVR_XYZ automount[9250]: lookup_read_master: lookup(file): could not open master map file /etc/auto.master
Dec 18 13:54:20 SRVR_XYZ automount[9250]: lookup_read_master: lookup(file): could not open master map file /etc/auto.master
Dec 18 13:54:22 SRVR_XYZ automount[9250]: lookup_read_master: lookup(file): could not open master map file /etc/auto.master
Dec 18 13:54:24 SRVR_XYZ automount[9250]: lookup_read_master: lookup(file): could not open master map file /etc/auto.master
Dec 18 13:54:26 SRVR_XYZ automount[9250]: lookup_read_master: lookup(file): could not open master map file /etc/auto.master
Dec 18 13:54:28 SRVR_XYZ automount[9250]: problem reading master map, maximum wait exceeded
Dec 18 13:54:28 SRVR_XYZ automount[9250]: automount: warning: could not read at least one map source after waiting, continuing ...
Dec 18 13:54:28 SRVR_XYZ automount[9250]: lookup_read_master: lookup(file): could not open master map file /etc/auto.master

I have no idea why this is I made sure to set the proper permissions (chmod 640) and ownership of /etc/auto.master to the root account.

I have no idea why autofs service cannot mount the partition, while it works properly when I manually launch automout.

I use:

Automount version 5.0.5-133.el6_9
Linux distro: CentOS release 6.9(Final)

Here is how the /etc/auto.master file looks like:

#
# Sample auto.master file
# This is a 'master' automounter map and it has the following format:
# mount-point [map-type[,format]:]map [options]
# For details of the format look at auto.master(5).
#
/misc   /etc/auto.misc
#
# NOTE: mounts done from a hosts map will be mounted with the
#       "nosuid" and "nodev" options unless the "suid" and "dev"
#       options are explicitly given.
#
/net    -hosts
#
# Include central master map if it can be found using
# nsswitch sources.
#
# Note that if there are entries for /net or /misc (as
# above) in the included master map any keys that are the
# same will not be seen as the first read key seen takes
# precedence.
#
+auto.master
/mnt/cifs /etc/auto.cifs-shares --ghost

Thanks in advance for your help.

1

AutoFS uses a two-level hierarchy of configuration files.

  1. Top-level control /etc/auto.master

    The top-most file in the hierarchy is /etc/auto.master and it defines the directory trees over which AutoFS has control. Your example file in your question had three non-comment lines:

    /misc   /etc/auto.misc
    /net    -hosts
    +auto.master
    

    This says that /misc is to be managed through AutoFS by the file or script /etc/auto.misc, and that /net is to be derived from the set of "Known hosts running NFS". The final line says that NIS should be consulted for a central map. You will not be running NIS so that line is irrelevant.

    I would suggest that you comment out the /net and the +auto.master lines leaving just the /misc /etc/auto.misc definition.

  2. Second level implementation

    Now we have only one file remaining for the second level of the hierarchy, /etc/auto.misc. We can edit that to include your new definition:

    [share_name] -fstype=cifs,[other_options] ://[remote_server]/[remote_share]"
    

    For example, this entry will create a transient entry /misc/myshare that maps directly to the share //CIFSSERVER/ITSSHARE:

    myshare -fstype=cifs,noperm,credentials=/root/.cifscred ://cifsserver/itsshare
    

    Note that until the share is accessed by explicit name it will not appear in /misc. You can see errors reported in the logger (/var/log/syslog on my version of Debian, for example).


Personally I like to rename /misc as /var/autofs/misc in /etc/auto.master so that it's not in the way, and create a top level directory /autofs with symlinks to the known entries in /var/autofs/misc. In my example's case,

# Prepare the /etc/auto.master file
#
mkdir -p -m755 /var/autofs/misc /autofs
rmdir /misc
sed -i.bak 's!^/misc!/var/autofs/misc!' /etc/auto.master

# Create the symlink
#
cd /autofs
ln -s ../var/autofs/misc/myshare

and I would then reference AutoFS mounts in /autofs. You may find this doesn't work for you, especially if AutoFS-mounting filesystems is a slow/expensive process, but it saves me having to remember all the AutoFS mount names.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.