]> git.ipfire.org Git - thirdparty/dracut-ng.git/commitdiff
fix: /etc/modprobe.d --> /run/modprobe.d
authorLaszlo Gombos <laszlo.gombos@gmail.com>
Sun, 19 May 2024 18:58:17 +0000 (14:58 -0400)
committerNeal Gompa (ニール・ゴンパ) <ngompa13@gmail.com>
Tue, 21 May 2024 14:49:59 +0000 (10:49 -0400)
Change /etc/modprobe.d path to /run/modprobe.d in hooks.

/etc might be mounted as read-only.

man/dracut.modules.7.asc
modules.d/01fips/fips-boot.sh
modules.d/01fips/fips-load-crypto.sh
modules.d/01fips/fips-noboot.sh
modules.d/01fips/fips.sh
modules.d/01fips/module-setup.sh
modules.d/90kernel-modules/parse-kernel.sh
modules.d/95lunmask/parse-lunmask.sh
modules.d/98dracut-systemd/dracut-pre-udev.sh

index c1e86247fa9f15df009d6dacbb336a1077d0d5e6..0f33bd712003e216637f9ae08f7b3d86b0588490 100644 (file)
@@ -181,7 +181,7 @@ hook _insmodpost.sh_ in the _initqueue/settled_.
 _parse-insmodpost.sh_:
 ----
 for p in $(getargs rd.driver.post=); do
-    echo "blacklist $p" >> /etc/modprobe.d/initramfsblacklist.conf
+    echo "blacklist $p" >> /run/modprobe.d/initramfsblacklist.conf
     _do_insmodpost=1
 done
 
index 34760e018c9288d4bcb88a5cab486d3b4b03c946..d703a10b4d388af081f9057b8cf7ff3184e2af51 100755 (executable)
@@ -3,7 +3,7 @@
 type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh
 
 if ! fipsmode=$(getarg fips) || [ "$fipsmode" = "0" ]; then
-    rm -f -- /etc/modprobe.d/fips.conf > /dev/null 2>&1
+    :
 elif [ -z "$fipsmode" ]; then
     die "FIPS mode have to be enabled by 'fips=1' not just 'fips'"
 elif getarg boot= > /dev/null; then
index 6ef42b951cf1594c59db96604c1698a748d992d6..d1d90c8958ae64f67a92bbf5eb2afdfb4ea02ae1 100755 (executable)
@@ -3,7 +3,7 @@
 type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh
 
 if ! fipsmode=$(getarg fips) || [ "$fipsmode" = "0" ]; then
-    rm -f -- /etc/modprobe.d/fips.conf > /dev/null 2>&1
+    :
 elif [ -z "$fipsmode" ]; then
     die "FIPS mode have to be enabled by 'fips=1' not just 'fips'"
 else
index 963a034d6a618f28c6948a4c2273975eae5bd39a..319da90d8fa6e6923eb4691eaa93612816f45abc 100755 (executable)
@@ -3,7 +3,7 @@
 type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh
 
 if ! fipsmode=$(getarg fips) || [ "$fipsmode" = "0" ]; then
-    rm -f -- /etc/modprobe.d/fips.conf > /dev/null 2>&1
+    :
 elif [ -z "$fipsmode" ]; then
     die "FIPS mode have to be enabled by 'fips=1' not just 'fips'"
 elif ! [ -f /tmp/fipsdone ]; then
index 2e7b7cb0dd38be8ac6d1e2721cd77ae3a9fd34dd..c81c2a6b83bbefa657582b6369fad168287f88be 100755 (executable)
@@ -97,7 +97,6 @@ fips_load_crypto() {
     read -d '' -r FIPSMODULES < /etc/fipsmodules
 
     fips_info "Loading and integrity checking all crypto modules"
-    mv /etc/modprobe.d/fips.conf /etc/modprobe.d/fips.conf.bak
     for _module in $FIPSMODULES; do
         if [ "$_module" != "tcrypt" ]; then
             if ! nonfatal_modprobe "${_module}" 2> /tmp/fips.modprobe_err; then
@@ -113,7 +112,10 @@ fips_load_crypto() {
             fi
         fi
     done
-    mv /etc/modprobe.d/fips.conf.bak /etc/modprobe.d/fips.conf
+    if [ -f /etc/fips.conf ]; then
+        mkdir -p /run/modprobe.d
+        cp /etc/fips.conf /run/modprobe.d/fips.conf
+    fi
 
     fips_info "Self testing crypto algorithms"
     modprobe tcrypt || return 1
index 0e47c84e9aba5aff2f4e4e2bad3ae3fcb3b34f10..67d9894feba16fac8a83e84ae090376725408cf5 100755 (executable)
@@ -39,13 +39,10 @@ installkernel() {
         _fipsmodules+="aead cryptomgr tcrypt crypto_user "
     fi
 
-    # shellcheck disable=SC2174
-    mkdir -m 0755 -p "${initdir}/etc/modprobe.d"
-
     for _mod in $_fipsmodules; do
         if hostonly='' instmods -c -s "$_mod"; then
             echo "$_mod" >> "${initdir}/etc/fipsmodules"
-            echo "blacklist $_mod" >> "${initdir}/etc/modprobe.d/fips.conf"
+            echo "blacklist $_mod" >> "${initdir}/etc/fips.conf"
         fi
     done
 
index d14f912dff714a2fad4a316c0510295f90cf9669..218a3e0a9ae5bf6066612448767fac9e3268ad6b 100755 (executable)
@@ -1,11 +1,7 @@
 #!/bin/sh
 
-_modprobe_d=/etc/modprobe.d
-if [ -d /usr/lib/modprobe.d ]; then
-    _modprobe_d=/usr/lib/modprobe.d
-elif [ -d /lib/modprobe.d ]; then
-    _modprobe_d=/lib/modprobe.d
-elif [ ! -d $_modprobe_d ]; then
+_modprobe_d=/run/modprobe.d
+if [ ! -d $_modprobe_d ]; then
     mkdir -p $_modprobe_d
 fi
 
@@ -18,8 +14,6 @@ for i in $(getargs rd.driver.pre -d rdloaddriver=); do
     )
 done
 
-[ -d /etc/modprobe.d ] || mkdir -p /etc/modprobe.d
-
 for i in $(getargs rd.driver.blacklist -d rdblacklist=); do
     (
         IFS=,
index 5e05e5bcc0fd6226009e427ce3f9127709a414dd..147e3de8e6a541c3d5bad4133c6cc7dbb080bf10 100755 (executable)
@@ -32,8 +32,9 @@ for lunmask_arg in $(getargs rd.lunmask); do
         IFS="$OLDIFS"
         if [ -d /sys/module/scsi_mod ]; then
             printf "manual" > /sys/module/scsi_mod/parameters/scan
-        elif [ ! -f /etc/modprobe.d/95lunmask.conf ]; then
-            echo "options scsi_mod scan=manual" > /etc/modprobe.d/95lunmask.conf
+        elif [ ! -f /run/modprobe.d/95lunmask.conf ]; then
+            mkdir -p /run/modprobe.d
+            echo "options scsi_mod scan=manual" > /run/modprobe.d/95lunmask.conf
         fi
         create_udev_rule "$1" "$2" "$3"
     )
index a08f0fc711e8a6905e1782687f56f4492c31dda9..9c8ac9dde9fee81bf01af31badfc92257567a7d1 100755 (executable)
@@ -13,12 +13,8 @@ make_trace_mem "hook pre-udev" '1:shortmem' '2+:mem' '3+:slab'
 getargs 'rd.break=pre-udev' -d 'rdbreak=pre-udev' && emergency_shell -n pre-udev "Break before pre-udev"
 source_hook pre-udev
 
-_modprobe_d=/etc/modprobe.d
-if [ -d /usr/lib/modprobe.d ]; then
-    _modprobe_d=/usr/lib/modprobe.d
-elif [ -d /lib/modprobe.d ]; then
-    _modprobe_d=/lib/modprobe.d
-elif [ ! -d $_modprobe_d ]; then
+_modprobe_d=/run/modprobe.d
+if [ ! -d $_modprobe_d ]; then
     mkdir -p $_modprobe_d
 fi
 
@@ -31,8 +27,6 @@ for i in $(getargs rd.driver.pre -d rdloaddriver=); do
     )
 done
 
-[ -d /etc/modprobe.d ] || mkdir -p /etc/modprobe.d
-
 for i in $(getargs rd.driver.blacklist -d rdblacklist=); do
     (
         IFS=,