Package: autofs
Version: 5.0.8-2
Severity: wishlist

Dear Maintainer,

As described in the final section of
https://www.kernel.org/doc/Documentation/filesystems/autofs4.txt it is
necessary to run "mount --make-shared /autofs/mount/point" on systems
which make use of bind mounts and/or namespaces, or else things start
spuriously failing with ELOOP.

Assuming that there is no desire to change the default then having an
easy way to configure this would be very useful. Locally I've gone
with the following patch but it is obviously pretty specific to our NIS
environment.

diff --git a/init.d/autofs b/init.d/autofs
index 2de0f26..cc6bf97 100755
--- a/init.d/autofs
+++ b/init.d/autofs
@@ -60,6 +60,17 @@ start() {
                return 1
        fi
        log_end_msg 0
+
+       # See end of 
https://www.kernel.org/doc/Documentation/filesystems/autofs4.txt
+       # autofs mount points need to be made shared else they can interact
+       # badly with the use of namespaces.
+       log_action_begin_msg "Making automount roots shared"
+       for mnt in $(ypcat -k auto.master | cut -f1 -d' ') ; do
+               log_action_cont_msg " $mnt"
+               mount --make-shared $mnt
+       done
+       log_end_msg 0
+
        return 0
 }

I'm running Jessie but I've checked the Stretch and Sid changelogs (Debian and
upstream) and I didn't see anything which suggested this had changed.

Thanks!
Ian.

-- System Information:
Debian Release: 8.1
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 3.16.0-4-amd64 (SMP w/8 CPU cores)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
Init: sysvinit (via /sbin/init)

Versions of packages autofs depends on:
ii  libc6              2.19-18
ii  libxml2            2.9.1+dfsg1-5
ii  multiarch-support  2.19-18
ii  ucf                3.0030

Versions of packages autofs recommends:
ii  kmod               18-3
ii  module-init-tools  18-3
ii  nfs-common         1:1.2.8-9

autofs suggests no packages.

-- Configuration Files:
/etc/apm/event.d/autofs 374404a5115c1c9ef87fc99fab9600c1 [Errno 2] No such file 
or directory: u'/etc/apm/event.d/autofs 374404a5115c1c9ef87fc99fab9600c1'
/etc/auto.master a0e3fc444b0824664ffc04826e2f3c97 [Errno 2] No such file or 
directory: u'/etc/auto.master a0e3fc444b0824664ffc04826e2f3c97'
/etc/auto.net 0acd3943236c9eae496eb815610c25db [Errno 2] No such file or 
directory: u'/etc/auto.net 0acd3943236c9eae496eb815610c25db'
/etc/auto.smb eec3f773e09846b7d4325f0ce20ab5bd [Errno 2] No such file or 
directory: u'/etc/auto.smb eec3f773e09846b7d4325f0ce20ab5bd'
/etc/default/autofs 424c4415a458ca32a56e88f847a80690 [Errno 2] No such file or 
directory: u'/etc/default/autofs 424c4415a458ca32a56e88f847a80690'
/etc/init.d/autofs changed:
PROG=automount
DAEMON=/usr/sbin/$PROG
NAME=autofs
PIDFILE="/var/run/$NAME.pid"
test -e $DAEMON || exit 0
PATH=/sbin:/usr/sbin:/bin:/usr/bin
export PATH
. /lib/lsb/init-functions
if [ -r /etc/default/autofs ]; then
        . /etc/default/autofs
fi
start_stop_autofs() {
        start-stop-daemon "$@" --pidfile $PIDFILE --exec $DAEMON -- \
                $OPTIONS --pid-file $PIDFILE
}
start() {
        log_action_begin_msg "Starting $PROG"
        if ! grep -qw autofs /proc/filesystems
        then
                if ! modprobe autofs4 >/dev/null 2>&1
                then
                        log_action_end_msg 1 "failed to load autofs4 module"
                        return 1
                fi
        elif [ -f /proc/modules ] && grep -q "^autofs[^4]" /proc/modules
        then
                log_action_end_msg 1 "autofs kernel module is loaded, autofs4 
required"
                return 1
        fi
        if ! start_stop_autofs --start --oknodo --quiet ; then
                log_action_end_msg 1 "no valid automount entries defined."
                return 1
        fi
        log_end_msg 0
        # See end of 
https://www.kernel.org/doc/Documentation/filesystems/autofs4.txt
        # autofs mount points need to be made shared else they can interact
        # badly with the use of namespaces.
        log_action_begin_msg "Making automount roots shared"
        for mnt in $(ypcat -k auto.master | cut -f1 -d' ') ; do
                log_action_cont_msg " $mnt"
                mount --make-shared $mnt
        done
        log_end_msg 0
        return 0
}
stop() {
        log_action_begin_msg "Stopping $PROG"
        if ! start_stop_autofs --stop --retry 5 --oknodo --quiet ; then
                log_action_end_msg 1
                return 1
        fi
        log_end_msg 0
        return 0
}
reload() {
        log_action_begin_msg "Reloading $PROG maps"
        if ! start_stop_autofs --stop --signal=HUP --quiet
        then
                log_action_end_msg 1 "$PROG not running"
                return 1
        fi
        log_action_end_msg 0
        return 0
}
forcestart() {
        OPTIONS="$OPTIONS --force"
        start
}
case "$1" in
        start|forcestart|stop|reload)
                $1
                ;;
        restart|force-reload)
                stop
                start
                ;;
        forcerestart)
                stop
                forcestart
                ;;
        status)
                status_of_proc -p $PIDFILE $DAEMON $PROG
                ;;
        *)
                echo "Usage: $0 
{start|forcestart|stop|restart|forcerestart|reload|force-reload|status}"
                exit 1
                ;;
esac


-- debconf information:
  autofs/upgrade-from-broken-version:

Reply via email to