| 1 |
AUTHOR: Bryan Mason <bmason@bmason.com> |
|---|
| 2 |
|
|---|
| 3 |
DATE: 2004-05-20 |
|---|
| 4 |
|
|---|
| 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. |
|---|
| 13 |
|
|---|
| 14 |
SYNOPSIS: Installing the version 4 autofs automounter on LFS |
|---|
| 15 |
|
|---|
| 16 |
DESCRIPTION: This hint describes how to install autofs 4 on a Linux |
|---|
| 17 |
From Scratch system. |
|---|
| 18 |
|
|---|
| 19 |
ATTACHMENTS: Patch for compiling autofs-4.1.2: |
|---|
| 20 |
http://www.bmason.com/LFS/autofs/unused-variables.patch |
|---|
| 21 |
|
|---|
| 22 |
Init scripts: |
|---|
| 23 |
http://www.bmason.com/LFS/autofs/autofs-initscripts.tar.gz |
|---|
| 24 |
|
|---|
| 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 |
|---|
| 30 |
fully tested. |
|---|
| 31 |
|
|---|
| 32 |
HINT: |
|---|
| 33 |
|
|---|
| 34 |
Contents |
|---|
| 35 |
======== |
|---|
| 36 |
|
|---|
| 37 |
1. Introduction |
|---|
| 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 |
|---|
| 42 |
6. Troubleshooting |
|---|
| 43 |
|
|---|
| 44 |
1. Introduction |
|---|
| 45 |
=============== |
|---|
| 46 |
|
|---|
| 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. |
|---|
| 54 |
|
|---|
| 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. |
|---|
| 59 |
|
|---|
| 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 |
|---|
| 63 |
in. |
|---|
| 64 |
|
|---|
| 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: |
|---|
| 70 |
|
|---|
| 71 |
"Automount mini-Howto" |
|---|
| 72 |
http://www.linux-consulting.com/Amd_AutoFS/autofs.html |
|---|
| 73 |
|
|---|
| 74 |
"Autofs Automounter HOWTO" |
|---|
| 75 |
http://www.tldp.org/HOWTO/Automount.html |
|---|
| 76 |
|
|---|
| 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 |
|---|
| 83 |
|
|---|
| 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>. |
|---|
| 86 |
|
|---|
| 87 |
|
|---|
| 88 |
2. Configuring the LFS Kernel for Autofs Support |
|---|
| 89 |
================================================ |
|---|
| 90 |
|
|---|
| 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: |
|---|
| 94 |
|
|---|
| 95 |
In the "File Systems" section: |
|---|
| 96 |
- "Kernel automounter version 4 support (also supports v3)" |
|---|
| 97 |
(CONFIG_AUTOFS4_FS). |
|---|
| 98 |
|
|---|
| 99 |
In the "File Systems -> Network File Systems" section: |
|---|
| 100 |
- "NFS file system support" (CONFIG_NFS_FS) |
|---|
| 101 |
|
|---|
| 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/>. |
|---|
| 107 |
|
|---|
| 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.) |
|---|
| 111 |
|
|---|
| 112 |
After the kernel has been recompiled, the following line should |
|---|
| 113 |
be added to /etc/modules.conf if automount support was compiled |
|---|
| 114 |
as a kernel module: |
|---|
| 115 |
|
|---|
| 116 |
alias autofs4 autofs |
|---|
| 117 |
|
|---|
| 118 |
|
|---|
| 119 |
3. Downloading, Configuring, and Installing Autofs |
|---|
| 120 |
================================================== |
|---|
| 121 |
|
|---|
| 122 |
Autofs can be downloaded from kernel.org at |
|---|
| 123 |
ftp://ftp.kernel.org/pub/linux/daemons/autofs/v4 |
|---|
| 124 |
|
|---|
| 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> |
|---|
| 129 |
|
|---|
| 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. |
|---|
| 133 |
|
|---|
| 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 |
|---|
| 138 |
unnecessary. |
|---|
| 139 |
|
|---|
| 140 |
Configuration, building, and installation of autofs is |
|---|
| 141 |
straightforward. Simply run the standard, "configure, make, |
|---|
| 142 |
make install" routine: |
|---|
| 143 |
|
|---|
| 144 |
./configure && |
|---|
| 145 |
make && |
|---|
| 146 |
make install |
|---|
| 147 |
|
|---|
| 148 |
This will install the following files to the following directories: |
|---|
| 149 |
|
|---|
| 150 |
Automount Daemon |
|---|
| 151 |
Destination Directory: /usr/sbin |
|---|
| 152 |
File: automount |
|---|
| 153 |
|
|---|
| 154 |
Man Files |
|---|
| 155 |
Destination Directory: /usr/share/man/man5 |
|---|
| 156 |
Files: auto.master.5 |
|---|
| 157 |
autofs.5 |
|---|
| 158 |
Destination Directory: /usr/share/man/man8 |
|---|
| 159 |
Files: autofs.8 |
|---|
| 160 |
automount.8 |
|---|
| 161 |
|
|---|
| 162 |
Configuration Files |
|---|
| 163 |
Destination Directory: /etc |
|---|
| 164 |
Files: auto.master |
|---|
| 165 |
auto.net |
|---|
| 166 |
auto.misc |
|---|
| 167 |
|
|---|
| 168 |
Init Scripts |
|---|
| 169 |
Destination File: /etc/rc.d/init.d |
|---|
| 170 |
File: autofs |
|---|
| 171 |
|
|---|
| 172 |
|
|---|
| 173 |
Libraries |
|---|
| 174 |
Destination Directory: /usr/lib/autofs |
|---|
| 175 |
Files: lookup_file.so |
|---|
| 176 |
lookup_program.so |
|---|
| 177 |
mount_afs.so |
|---|
| 178 |
mount_changer.so |
|---|
| 179 |
mount_generic.so |
|---|
| 180 |
lookup_multi.so |
|---|
| 181 |
lookup_userhome.so |
|---|
| 182 |
mount_autofs.so |
|---|
| 183 |
mount_ext2.so |
|---|
| 184 |
mount_nfs.so |
|---|
| 185 |
lookup_nisplus.so |
|---|
| 186 |
lookup_yp.so |
|---|
| 187 |
mount_bind.so |
|---|
| 188 |
mount_ext3.so |
|---|
| 189 |
parse_sun.so |
|---|
| 190 |
|
|---|
| 191 |
|
|---|
| 192 |
4. Creating Initialization Scripts |
|---|
| 193 |
================================== |
|---|
| 194 |
|
|---|
| 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 |
|---|
| 199 |
exits. |
|---|
| 200 |
|
|---|
| 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: |
|---|
| 205 |
|
|---|
| 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). |
|---|
| 213 |
|
|---|
| 214 |
Stop: all of the automount deamon(s) specified in /etc/auto.master, |
|---|
| 215 |
as well as all other automount process, will be stopped. |
|---|
| 216 |
|
|---|
| 217 |
Restart: the "stop" procedure is run, followed by a one-second |
|---|
| 218 |
delay, and then the "start" procedure is run. |
|---|
| 219 |
|
|---|
| 220 |
Reload: not implemented. |
|---|
| 221 |
|
|---|
| 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. |
|---|
| 225 |
|
|---|
| 226 |
|
|---|
| 227 |
5. Configuring Mount Points |
|---|
| 228 |
=========================== |
|---|
| 229 |
|
|---|
| 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 |
|---|
| 232 |
here. |
|---|
| 233 |
|
|---|
| 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 |
|---|
| 239 |
|
|---|
| 240 |
In addition, the following man pages contain descriptions |
|---|
| 241 |
of autofs and its configuration files: |
|---|
| 242 |
- auto.master(5) |
|---|
| 243 |
- autofs(5) |
|---|
| 244 |
- automount(8) |
|---|
| 245 |
- autofs(8) |
|---|
| 246 |
|
|---|
| 247 |
|
|---|
| 248 |
6. Troubleshooting |
|---|
| 249 |
================== |
|---|
| 250 |
|
|---|
| 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. |
|---|
| 255 |
|
|---|
| 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 |
|---|
| 258 |
it to this section. |
|---|
| 259 |
|
|---|
| 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. |
|---|
| 262 |
|
|---|
| 263 |
|
|---|
| 264 |
ACKNOWLEDGEMENTS: |
|---|
| 265 |
|
|---|
| 266 |
R. Cort Tompkins <rtompkin@cs.odu.edu> wrote a hint on installing autofs |
|---|
| 267 |
version 3 on LFS. |
|---|
| 268 |
|
|---|
| 269 |
|
|---|
| 270 |
CHANGELOG: |
|---|
| 271 |
[2004-05-20] |
|---|
| 272 |
* Originated |
|---|
| 273 |
|
|---|
| 274 |
|
|---|