Starting with commit 24a38bc1cbe461c344ce61c7e10b6d51d5689c93 dracut uses udev builtins but still depends on >=udev-166 in dracut.spec. This patch makes dracut work with older udev again. All credits go to Alexander Tsoy <alexander@xxxxxxx>; see https://bugs.gentoo.org/show_bug.cgi?id=437700 --- modules.d/95udev-rules/59-persistent-storage.rules | 8 +++---- modules.d/95udev-rules/61-persistent-storage.rules | 2 +- modules.d/95udev-rules/module-setup.sh | 2 ++ modules.d/95udev-rules/udev-rules-prepare.sh | 25 ++++++++++++++++++++++ modules.d/99base/init.sh | 2 +- 5 files changed, 33 insertions(+), 6 deletions(-) create mode 100644 modules.d/95udev-rules/udev-rules-prepare.sh diff --git a/modules.d/95udev-rules/59-persistent-storage.rules b/modules.d/95udev-rules/59-persistent-storage.rules index f2756ee..c221cda 100644 --- a/modules.d/95udev-rules/59-persistent-storage.rules +++ b/modules.d/95udev-rules/59-persistent-storage.rules @@ -3,8 +3,8 @@ ACTION!="add|change", GOTO="ps_end" # Also don't process disks that are slated to be a multipath device ENV{DM_MULTIPATH_DEVICE_PATH}=="?*", GOTO="ps_end" -KERNEL=="cciss[0-9]*", IMPORT{builtin}="blkid" -KERNEL=="nbd[0-9]*", IMPORT{builtin}="blkid" +KERNEL=="cciss[0-9]*", IMPORT BLKID +KERNEL=="nbd[0-9]*", IMPORT BLKID KERNEL!="md[0-9]*|md_d[0-9]*|md/*", KERNEL!="md*", GOTO="md_end" @@ -21,7 +21,7 @@ ATTR{md/array_state}=="|clear|inactive", GOTO="md_end" LABEL="md_ignore_state" IMPORT{program}="/sbin/mdadm --detail --export $tempnode" -IMPORT{builtin}="blkid" +IMPORT BLKID OPTIONS+="link_priority=100" OPTIONS+="watch" LABEL="md_end" @@ -34,7 +34,7 @@ ENV{DM_NAME}!="?*", GOTO="ps_end" ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}=="1", GOTO="ps_end" ENV{DM_UUID}=="CRYPT-TEMP-?*", GOTO="ps_end" ENV{DM_UUID}!="?*", ENV{DM_NAME}=="temporary-cryptsetup-?*", GOTO="ps_end" -IMPORT{builtin}="blkid" +IMPORT BLKID LABEL="ps_end" diff --git a/modules.d/95udev-rules/61-persistent-storage.rules b/modules.d/95udev-rules/61-persistent-storage.rules index 7dbd151..37148b0 100644 --- a/modules.d/95udev-rules/61-persistent-storage.rules +++ b/modules.d/95udev-rules/61-persistent-storage.rules @@ -12,7 +12,7 @@ GOTO="pss_end" LABEL="do_pss" # by-path (parent device path) -ENV{DEVTYPE}=="disk", ENV{ID_PATH}=="", DEVPATH!="*/virtual/*", IMPORT{builtin}="path_id" +ENV{DEVTYPE}=="disk", ENV{ID_PATH}=="", DEVPATH!="*/virtual/*", IMPORT PATH_ID ENV{DEVTYPE}=="disk", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}" ENV{DEVTYPE}=="partition", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}-part%n" diff --git a/modules.d/95udev-rules/module-setup.sh b/modules.d/95udev-rules/module-setup.sh index 533dfeb..54a192e 100755 --- a/modules.d/95udev-rules/module-setup.sh +++ b/modules.d/95udev-rules/module-setup.sh @@ -74,5 +74,7 @@ install() { inst_script "$moddir/load-modules.sh" /lib/udev/load-modules.sh inst_libdir_file "libnss_files*" + + inst_hook pre-udev 10 "$moddir/udev-rules-prepare.sh" } diff --git a/modules.d/95udev-rules/udev-rules-prepare.sh b/modules.d/95udev-rules/udev-rules-prepare.sh new file mode 100644 index 0000000..08263ea --- /dev/null +++ b/modules.d/95udev-rules/udev-rules-prepare.sh @@ -0,0 +1,25 @@ +#!/bin/sh +# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- +# ex: ts=8 sw=4 sts=4 et filetype=sh + +for f in /etc/udev/rules.d/*-persistent-storage.rules; do + [ -e "$f" ] || continue + while read line; do + if [ "${line%%IMPORT PATH_ID}" != "$line" ]; then + if [ $UDEVVERSION -ge 174 ]; then + printf '%sIMPORT{builtin}="path_id"\n' "${line%%IMPORT PATH_ID}" + else + printf '%sIMPORT{program}="path_id %%p"\n' "${line%%IMPORT PATH_ID}" + fi + elif [ "${line%%IMPORT BLKID}" != "$line" ]; then + if [ $UDEVVERSION -ge 176 ]; then + printf '%sIMPORT{builtin}="blkid"\n' "${line%%IMPORT BLKID}" + else + printf '%sIMPORT{program}="/sbin/blkid -o udev -p $tempnode"\n' "${line%%IMPORT BLKID}" + fi + else + echo "$line" + fi + done < "${f}" > "${f}.new" + mv "${f}.new" "$f" +done diff --git a/modules.d/99base/init.sh b/modules.d/99base/init.sh index 16c8958..0259053 100755 --- a/modules.d/99base/init.sh +++ b/modules.d/99base/init.sh @@ -83,7 +83,7 @@ trap "emergency_shell Signal caught!" 0 [ -d /run/initramfs ] || mkdir -p -m 0755 /run/initramfs -UDEVVERSION=$(udevadm --version) +export UDEVVERSION=$(udevadm --version) if [ $UDEVVERSION -gt 166 ]; then # newer versions of udev use /run/udev/rules.d export UDEVRULESD=/run/udev/rules.d -- 1.7.12.4 -- To unsubscribe from this list: send the line "unsubscribe initramfs" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html