Package: kmod
Version: 8-1

[I'd file this as RC because failing to load a module in /etc/modules
could break someone's system, except that a bug in the change causes it
to not take effect.]

Per the changelog for kmod 8-1:
  * Made the init script exit without processing /etc/modules if the
    /etc/modules-load.d/modules.conf symlink exists.

The systemd package ships this symlink, but having the systemd package
installed doesn't mean that the user boots via systemd and thus loads
modules via systemd; the system will only boot via systemd if the user
sets init on the kernel command line or installs systemd-sysv.

So, if the user has systemd installed but boots via sysvinit (a fairly
common case), nothing will load the modules in /etc/modules.

Fortunately, kmod 8-1 doesn't actually break this yet, because it uses
$(readlink /etc/modules-load.d/modules.conf) rather than $(readlink -f
/etc/modules-load.d/modules.conf), and the former returns ../modules
rather than /etc/modules.

When we previously discussed this, I suggested that the kmod init script
could process modules-load.d itself (by processing each file in it just
like /etc/modules), and that it would need to skip /etc/modules if
already processed via the symlink in modules-load.d to avoid processing
/etc/modules twice.  (systemd overrides the kmod init script and prevents
it from running it all, in favor of its own module loading mechanism, so
having /etc/init.d/kmod process modules-load.d would allow the same
mechanism to work either under systemd or other init systems.)  However,
making the second change (skipping /etc/modules) without the first
(processing modules-load.d) means nothing will load the modules in
/etc/modules.

The following (tested) code should work to process modules-load.d the
same way systemd-modules-load does, as well as processing /etc/modules
if no symlink to it exists:

module_files() {
    MODULES_LOAD_DIRS="/etc/modules-load.d /run/modules-load.d 
/usr/local/lib/modules-load.d /usr/lib/modules-load.d /lib/modules-load.d"
    processed=" "
    load_etc_modules=true
    for dir in $MODULES_LOAD_DIRS ; do
        for file in $(run-parts --list --regex='\.conf$' $dir 2>/dev/null || 
true) ; do
            base=$(basename $file)
            if echo -n "$processed" | grep -qF " $base " ; then
                continue
            fi
            if $load_etc_modules && [ -L $file ] && [ "$(readlink -f $file)" = 
"/etc/modules" ] ; then
                load_etc_modules=false
            fi
            processed="$processed$base "
            echo $file
        done
    done
    if $load_etc_modules ; then
        echo /etc/modules
    fi
}
files=$(module_files)
if [ -n "$files" ] ; then
    grep -h '^[^#]' $files |
    while read module args; do
        [ "$module" ] || continue
        load_module "$module" "$args"
    done
fi

Alternatively, you might check with systemd and kmod upstreams to find
out if the program currently shipped by systemd as
/lib/systemd/systemd-modules-load could move to the kmod package, in
which case you could just run that.

- Josh Triplett



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to