If the busybox-static package is installed, the modprobe implementation
used will be the one from busybox, which behaves slightly differently.
Specifically, the busybox implementation does not support `install`
commands from modprobe.d conf files:

https://git.busybox.net/busybox/tree/modutils/modprobe.c?h=1_31_stable#n279

Since mkinitramfs already ensures that /sbin/modprobe is copied into
/sbin for the initrd, it is safe to fully-qualify the modprobe call and
never invoke the busybox version.

Signed-off-by: Ben Love <[email protected]>

diff --git a/docs/framebuffer b/docs/framebuffer
index 81ba77f..453ac8f 100644
--- a/docs/framebuffer
+++ b/docs/framebuffer
@@ -86,7 +86,7 @@ matroxfb)
        ;;
 intelfb|i810fb|i915)
        # Needs AGP driver loaded
-       modprobe intel-agp
+       /sbin/modprobe intel-agp
        ;;
 uvesafb)
        # v86d requires /dev/zero and dev/mem, but udev haven't been started yet
@@ -99,9 +99,9 @@ esac
 
 if [ -n "${FB}" ]; then
        unset MODPROBE_OPTIONS
-       modprobe -q fbcon
+       /sbin/modprobe -q fbcon
        # shellcheck disable=SC2086
-       modprobe -q ${FB} ${OPTS}
+       /sbin/modprobe -q ${FB} ${OPTS}
 fi
 
 if [ -e /proc/fb ]; then
diff --git a/hook-functions b/hook-functions
index c9f676f..f78482f 100644
--- a/hook-functions
+++ b/hook-functions
@@ -65,8 +65,8 @@ manual_add_modules()
        # configuration lines and embedded softdep information is not
        # processed.  So we run twice, with and without this option.
        # shellcheck disable=SC2034
-       { modprobe --all --set-version="${version?}" --ignore-install --quiet 
--show-depends "$@";
-         modprobe --all --set-version="${version}" --quiet --show-depends 
"$@"; } |
+       { /sbin/modprobe --all --set-version="${version?}" --ignore-install 
--quiet --show-depends "$@";
+         /sbin/modprobe --all --set-version="${version}" --quiet 
--show-depends "$@"; } |
        while read -r prefix kmod options ; do
                if [ "${prefix}" != "insmod" ]; then
                        continue
diff --git a/init b/init
index 1cc96c3..007edf7 100755
--- a/init
+++ b/init
@@ -222,7 +222,7 @@ run_scripts /scripts/init-top
 
 maybe_break modules
 [ "$quiet" != "y" ] && log_begin_msg "Loading essential drivers"
-[ -n "${netconsole}" ] && modprobe netconsole netconsole="${netconsole}"
+[ -n "${netconsole}" ] && /sbin/modprobe netconsole netconsole="${netconsole}"
 load_modules
 [ "$quiet" != "y" ] && log_end_msg
 
diff --git a/scripts/functions b/scripts/functions
index ad900ca..3bd38cc 100644
--- a/scripts/functions
+++ b/scripts/functions
@@ -79,13 +79,13 @@ maybe_break()
                        else
                                opts="-v"
                        fi
-                       modprobe ${opts} -a i8042 atkbd ehci-pci ehci-orion \
+                       /sbin/modprobe ${opts} -a i8042 atkbd ehci-pci 
ehci-orion \
                                 ehci-hcd ohci-hcd ohci-pci uhci-hcd usbhid 
xhci \
                                 xhci-pci xhci-hcd
                        sleep 2
                        for modalias in /sys/bus/hid/devices/*/modalias; do
                                if [ -f "${modalias}" ]; then
-                                       modprobe ${opts} -b "$(cat 
"${modalias}")"
+                                       /sbin/modprobe ${opts} -b "$(cat 
"${modalias}")"
                                fi
                        done
                fi
@@ -119,7 +119,7 @@ load_modules()
                                continue
                        fi
                        # shellcheck disable=SC2086
-                       modprobe $m
+                       /sbin/modprobe $m
                done < /conf/modules
        fi
 }
diff --git a/scripts/init-top/all_generic_ide b/scripts/init-top/all_generic_ide
index 0f408d0..cdf69cc 100755
--- a/scripts/init-top/all_generic_ide
+++ b/scripts/init-top/all_generic_ide
@@ -17,11 +17,11 @@ esac
 for x in $(cat /proc/cmdline); do
        case ${x} in
        all_generic_ide)
-               modprobe ata_generic all_generic_ide=1
+               /sbin/modprobe ata_generic all_generic_ide=1
                ;;
        all_generic_ide=*)
                if [ -n "${x#all_generic_ide=}" ]; then
-                       modprobe ata_generic all_generic_ide=1
+                       /sbin/modprobe ata_generic all_generic_ide=1
                fi
                ;;
        esac
diff --git a/scripts/local b/scripts/local
index a103e68..3c2cce5 100644
--- a/scripts/local
+++ b/scripts/local
@@ -65,7 +65,7 @@ local_device_setup()
        # Load ubi with the correct MTD partition and return since fstype
        # doesn't work with a char device like ubi.
        if [ -n "$UBIMTD" ]; then
-               modprobe ubi "mtd=$UBIMTD"
+               /sbin/modprobe ubi "mtd=$UBIMTD"
                DEV="${dev_id}"
                return
        fi
diff --git a/scripts/nfs b/scripts/nfs
index 40c92c7..2b90cb0 100644
--- a/scripts/nfs
+++ b/scripts/nfs
@@ -81,7 +81,7 @@ nfs_mount_root()
        nfs_top
 
        # For DHCP
-       modprobe af_packet
+       /sbin/modprobe af_packet
 
        wait_for_udev 10
 
@@ -130,7 +130,7 @@ nfs_mount_fs()
        nfs_top
 
        # For DHCP
-       modprobe af_packet
+       /sbin/modprobe af_packet
 
        wait_for_udev 10
 
-- 
2.20.1

Reply via email to