1 AUTHOR: Bryan Mason <bmason@bmason.com>
5 LICENSE: GNU Free Documentation License Version 1.2
6 Copyright (c) 2003, Bryan Mason.
7 Permission is granted to copy, distribute and/or modify
8 this document under the terms of the GNU Free
9 Documentation License, Version 1.2 or any later version
10 published by the Free Software Foundation. A copy of the
11 license can be found at
12 http://www.gnu.org/copyleft/fdl.html.
14 SYNOPSIS: Installing the version 4 autofs automounter on LFS
16 DESCRIPTION: This hint describes how to install autofs 4 on a Linux
19 ATTACHMENTS: Patch for compiling autofs-4.1.2:
20 http://www.bmason.com/LFS/autofs/unused-variables.patch
23 http://www.bmason.com/LFS/autofs/autofs-initscripts.tar.gz
25 PREREQUISITES: This hint assumes that you have already a working system
26 and are comfortable with configuring and re-compiling
27 the Linux kernel. Although this hint was written based
28 on LFS 3.3 (kernel 2.4.18), it should work equally well
29 on newer LFS installations, although they have not been
38 2. Configuring the Kernel for autofs Support
39 3. Downloading, Configuring, and Compiling autofs
40 4. Creating Initialization Scripts
41 5. Configuring Mount Points
47 Automounting is the process of automatically mounting and unmounting
48 of file systems by a daemon. When a file in the file system is
49 accessed, the automounter will automatically mount the file system.
50 After a period of inactivity, the file system is automatically
51 unmounted. This can be extremely useful for network file systems
52 (both SMB and NFS) as well as automatically mounting CD-ROM drives
53 and floppy disk drives.
55 There are two types of automounters in Linux, "AMD" and "autofs".
56 AMD is implemented entirely as a user-space daemon. Autofs includes
57 both a user-space daemon and code in the kernel that assists the
58 daemon. There are currently two versions of autofs, v3 and v4.
60 Although there are several good documents on how to configure autofs
61 after installation, there seem to be few documents on how to compile
62 and install the autofs package, which is where this document comes
65 This document describes how to configure and compile autofs version
66 4 for LFS and provides a boot script to start autofs. It does not
67 discuss AMD or how to configure autofs after it has been installed.
68 There are two very good HOWTO's that describe the post-install
69 configuration of autofs:
71 "Automount mini-Howto"
72 http://www.linux-consulting.com/Amd_AutoFS/autofs.html
74 "Autofs Automounter HOWTO"
75 http://www.tldp.org/HOWTO/Automount.html
77 Installation of autofs consists of the following basic steps which
78 are described in more detail below:
79 1) Configuring the Kernel for autofs support
80 2) Downloading, configuring, and installing the autofs daemon,
81 man pages, and libraries
82 3) Creating boot scripts to start the automount daemons
84 If you have any comments or corrections to be made to this document,
85 please send an e-mail message to the author at <bmason@bmason.com>.
88 2. Configuring the LFS Kernel for Autofs Support
89 ================================================
91 To provide support for the automount user-space daemon, the
92 following options must be configured in the kernel, either
93 as a module or as part of the kernel:
95 In the "File Systems" section:
96 - "Kernel automounter version 4 support (also supports v3)"
99 In the "File Systems -> Network File Systems" section:
100 - "NFS file system support" (CONFIG_NFS_FS)
102 If you want to mount shares on Windows systems, you should also
103 enable the "SMB file system support" (CONFIG_SMB_FS) option in the
104 "File Systems -> Network File Systems" section. In addition, you
105 may need to install and configure Samba as described in Beyond Linux
106 From Scratch (BLFS) at <http://www.linuxfromscratch.org/blfs/>.
108 After the kernel is configured, proceed with the normal process of
109 building and installing a new Linux kernel (make bzImage, make
110 modules, make modules_install, copy the bzImage file, etc.)
112 After the kernel has been recompiled, the following line should
113 be added to /etc/modules.conf if automount support was compiled
119 3. Downloading, Configuring, and Installing Autofs
120 ==================================================
122 Autofs can be downloaded from kernel.org at
123 ftp://ftp.kernel.org/pub/linux/daemons/autofs/v4
125 There are some problems compiling autofs 4.1.2 with gcc 2.95.3, so
126 you can download version 4.0.0 (autofs-4.0.0-1.tar.gz or
127 autofs-4.0.0-1.tar.bz2), or apply the patch located at
128 <http://www.bmason.com/LFS/autofs/unused-variables.patch>
130 To apply the patch, cd to "autofs-4.1.2/lib" and execute
131 "patch -Np1 < [path-to-patch]" where [path-to-patch] is the path to
132 where you copied the patch on your system.
134 The problem is that gcc 2.95.3 doesn't recognize the
135 "-Wno-unused-variables" option (although it does recognize
136 "-Wno-unused"). If later versions of gcc recognize the
137 "-Wno-unused-variables" option, then this patch is probably
140 Configuration, building, and installation of autofs is
141 straightforward. Simply run the standard, "configure, make,
142 make install" routine:
148 This will install the following files to the following directories:
151 Destination Directory: /usr/sbin
155 Destination Directory: /usr/share/man/man5
158 Destination Directory: /usr/share/man/man8
163 Destination Directory: /etc
169 Destination File: /etc/rc.d/init.d
174 Destination Directory: /usr/lib/autofs
175 Files: lookup_file.so
192 4. Creating Initialization Scripts
193 ==================================
195 The installation script installed by default will not run under LFS
196 because it expects the distribution to be either Debian or Red Hat.
197 the script looks for the files /etc/debian_version and
198 /etc/redhat-release, and if it doesn't find them, it complains and
201 I've created a new init script with a more LFS-style flavor. The
202 init script and configuration file is in a single tarball located at
203 <http://www.bmason.com/LFS/autofs/autofs-initscripts.tar.gz>. The
204 script performs the following functions:
206 Start: the file /etc/auto.master will be read and the mount point(s)
207 in the file will be created, if necessary. Some basic checks are
208 made to verify that the map files are there, and the automount
209 daemon(s) will be started with the correct options to implement the
210 mount point(s). Currently, only static map files and executable map
211 files are supported (I don't know enough about yp, etc. to write the
212 code to handle the more complex cases).
214 Stop: all of the automount deamon(s) specified in /etc/auto.master,
215 as well as all other automount process, will be stopped.
217 Restart: the "stop" procedure is run, followed by a one-second
218 delay, and then the "start" procedure is run.
220 Reload: not implemented.
222 Status: a list of configured mount points, followed by a list of the
223 active automount deamon(s), and then a list of actively automounted
224 directories (from mount) will be displayed.
227 5. Configuring Mount Points
228 ===========================
230 There are several good texts that describe how to configure
231 mount points with autofs, so I won't describe how to do that
234 The following Howto's describe how to configure autofs:
235 "Automount mini-Howto"
236 http://www.linux-consulting.com/Amd_AutoFS/autofs.html
237 "Autofs Automounter HOWTO"
238 http://www.tldp.org/HOWTO/Automount.html
240 In addition, the following man pages contain descriptions
241 of autofs and its configuration files:
251 Generally speaking, most problems are caused by problems in the
252 configuration script (/etc/auto.master) and the associated map files
253 (/etc/auto.misc, /etc/auto.net, and so forth). Double-check the man
254 pages and Howto's to make sure everything is OK.
256 If you have some problems and have figured out a good way to overcome
257 them, send me a message describing your problem/solutin and I'll add
260 If you find a bug in the init scripts please send a message to me at
261 <bmason@bmason.com> so I can correct them. Thank you.
266 R. Cort Tompkins <rtompkin@cs.odu.edu> wrote a hint on installing autofs