Skip to contentSkip to conversation

SUSE patches which should show up mainline

PATCH RESEND In review Thomas Renninger 5 participants 52 messages Dec 11, 2014 – Feb 24, 2015 9 messages not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH RESEND 1/1 SUSE patches which should show up mainline

Hi,

Changes to last post:
- Removed unnecessary IFS variable restoring
- Removed inst_multiple sed and host from nfs module
- Removed warpclock patch/module (according Chao Wang this is done by systemd by copying /etc/{localtime,adjtime} to initramfs)

One cleanup for the future I have in mind:
As udev rules are often moved around in timeline (just the number changes), it would be nice if systemd enforces that udev rules must be unique. That would mean this is forbidden:
01-ruleXXX
05-ruleXXX
Then dracut could implement:
inst_rule ruleXXX
and it would work for all distros and versions.
But this needs clarification with systemd people first.

Would be great to see as many of these applied already. E.g. mkinitrd-suse: Update to sles12 SUSE state should not be a big deal to apply.

Thanks a lot,

Thomas

A message that is not in the archive (sent off-list or not yet received): 1418309193-11208-1-git-send-email-trenn-l3A5Bk7waGM@public.gmane.org

#2 lore raw

PATCH 1/42 mkinitrd-suse: Update to sles12 SUSE state

Incorporates these patches:
- 0013 mkinitrd-suse: do not update bootloader if no kernel was found bnc#858268
- 0018 mkinitrd-suse: Fix whitespaces when adding drivers
- 0032 mkinitrd-suse.sh: Use '--hostonly' and '--hostonly-cmdline' correctly bnc#874000,bnc#874905,bnc#874363
- 0039 Remove --force parameter from mkinitrd
- 0041 mkinitd-suse: remove --hostonly and --hostonly-cmdline Should be set via configuration files, not in the script itself.
- 0051 mkinitrd-suse: add 'update bootloader' message
- 0120 mkinitrd-suse.sh: Bail out with exit 1 if initrd cannot be generated bnc#886630

---
 mkinitrd-suse.8.asc |  7 +++---
 mkinitrd-suse.sh    | 66 +++++++++++++++++++++++++----------------------------
 2 files changed, 34 insertions(+), 39 deletions(-)
mkinitrd-suse.8.asc +3 -4
index 9eb8fc9..cdb8e3a 100644
@@ -76,7 +76,9 @@ OPTIONS
 
 **-A**::
     Create a so called "monster initrd" which includes all available
-    features and modules.
+    features and modules. This calls dracut with --no-hostonly and
+    --no-hostonly-cmdline parameters internally, instead of the default
+    --hostonly and --hostonly-cmdline.
 
 **-v, --verbose**::
     increase verbosity level
@@ -85,9 +87,6 @@ OPTIONS
     Disable logging to _/var/log/YaST2/mkinitrd.log_. This is useful for
     testing if you don’t want to clutter the system log.
 
-**--force**::
-    overwrite existing initramfs file.
-
 **--help**::
     print a help message and exit.
 
mkinitrd-suse.sh +31 -35

133 lines not on this page · raw message

Signature · 1 line
1.8.5.2
#3 lore raw

PATCH 2/42 systemd always tries to load autofs4

In reply to a message not in the archive

During boot systemd tries to load autofs4, but dracut will only add it if it's loaded by the time dracut is run. Modify dracut to always load autofs4.

References: bnc#869411

---
 modules.d/98systemd/module-setup.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
modules.d/98systemd/module-setup.sh +1 -1
index 8052984..53e07a2 100755
@@ -18,7 +18,7 @@ depends() {
 }
 
 installkernel() {
-    instmods autofs4 ipv6
+    hostonly='' instmods autofs4 ipv6
     instmods -s efivarfs
 }
 
Signature · 1 line
1.8.5.2
#4 lore raw

PATCH 3/42 Fixup mdraid setup

In reply to a message not in the archive

From: NeilBrown <[email protected]>

This sed script to edit 64-md-raid-assemble.rules needs to be adjusted for latest mdadm

References: bnc#866660

---
 modules.d/90mdraid/module-setup.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
modules.d/90mdraid/module-setup.sh +1 -1
index bc4c514..ce3394a 100755
@@ -86,7 +86,7 @@ install() {
     for rule in 64-md-raid.rules 64-md-raid-assembly.rules; do
         rule_path="${initdir}${udevdir}/rules.d/${rule}"
         [ -f "${rule_path}" ] && sed -i -r \
-            -e '/RUN\+?="[[:alpha:]/]*mdadm[[:blank:]]+(--incremental|-I)[[:blank:]]+(\$env\{DEVNAME\}|\$tempnode|\$devnode)/d' \
+            -e '/(RUN|IMPORT\{program\})\+?="[[:alpha:]/]*mdadm[[:blank:]]+(--incremental|-I)[[:blank:]]+(--export )?(\$env\{DEVNAME\}|\$tempnode|\$devnode)/d' \
             "${rule_path}"
     done
 
Signature · 1 line
1.8.5.2
#5 lore raw

PATCH 4/42 95udev-rules: Include correct sg3_utils rules

In reply to a message not in the archive

From: Hannes Reinecke <[email protected]>

sg3_utils now provides two rules 55-scsi-sg3_id.rules and 58-scsi-sg3_symlink.rules, which need to be included instead of the older 59-scsi-sg3_utils.rules.

References: bnc#873151

---
 modules.d/95udev-rules/module-setup.sh | 1 +
 1 file changed, 1 insertion(+)
modules.d/95udev-rules/module-setup.sh +1 -0
index 9d6f960..e50709d 100755
@@ -31,6 +31,7 @@ install() {
         50-udev.rules 95-late.rules \
         50-firmware.rules \
         59-scsi-sg3_utils.rules \
+        55-scsi-sg3_id.rules 58-scsi-sg3_symlink.rules \
         70-uaccess.rules 71-seat.rules 73-seat-late.rules \
         75-net-description.rules \
         80-net-name-slot.rules 80-net-setup-link.rules \
Signature · 1 line
1.8.5.2

A message that is not in the archive (sent off-list or not yet received): 1418309193-11208-5-git-send-email-trenn-l3A5Bk7waGM@public.gmane.org

#7 lore raw

Re: [PATCH 04/42] 95udev-rules: Include correct sg3_utils rules

Quoted 20 lines · Thomas Renninger

From: Hannes Reinecke <[email protected]>

sg3_utils now provides two rules 55-scsi-sg3_id.rules and 58-scsi-sg3_symlink.rules, which need to be included instead of the older 59-scsi-sg3_utils.rules.

References: bnc#873151

---
 modules.d/95udev-rules/module-setup.sh | 1 +
 1 file changed, 1 insertion(+)
modules.d/95udev-rules/module-setup.sh +0 -0
index 9d6f960..e50709d 100755

modules.d/95udev-rules/module-setup.sh install() { · line 37

Quoted 7 lines
modules.d/95udev-rules/module-setup.sh +1 -0
@@ -31,6 +31,7 @@ install() {
         50-udev.rules 95-late.rules \
         50-firmware.rules \
         59-scsi-sg3_utils.rules \
+        55-scsi-sg3_id.rules 58-scsi-sg3_symlink.rules \
         70-uaccess.rules 71-seat.rules 73-seat-late.rules \
         75-net-description.rules \
         80-net-name-slot.rules 80-net-setup-link.rules \

Can we remove the old rule, then?

commit c96f1b1e6b25f0795d163a5b8ba498565d3201d5

Author: Julian Wolf <juwolf-IBi9RG/[email protected]>
Date:   Thu Apr 3 14:55:19 2014 +0200

udev-rules: include 59-scsi-sg3_utils.rules

#8 lore raw

PATCH 5/42 90multipath: install correct multipath rules

In reply to a message not in the archive

From: Hannes Reinecke <[email protected]>

The multipath and kpartx rules have different numbers in SUSE.

The 11-dm-mpath.rules file had been missing, causing blacklisting to not work properly.

References: bnc#873151, bnc#872662, bnc#883149

---
 modules.d/90multipath/module-setup.sh | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
modules.d/90multipath/module-setup.sh +4 -1
index a8700f4..0f88f82 100755
@@ -114,6 +114,9 @@ install() {
 
     inst_hook cleanup   80 "$moddir/multipathd-needshutdown.sh"
 
-    inst_rules 40-multipath.rules 62-multipath.rules 65-multipath.rules 66-kpartx.rules
+    inst_rules 40-multipath.rules 56-multipath.rules \
+	62-multipath.rules 65-multipath.rules \
+	66-kpartx.rules 67-kpartx-compat.rules \
+	11-dm-mpath.rules
 }
 
Signature · 1 line
1.8.5.2
#9 lore raw

PATCH 6/42 95iscsi: Autodetect iSCSI firmware

In reply to a message not in the archive

From: Hannes Reinecke <[email protected]>

Some iSCSI initiator present firmware information in /sys/firmware/ibft or /sys/firmware/iscsi_bootX

Whenever we detect one of those directories we should assume that the iSCSI devices should be activated.

Also incorporates SUSE patches:
0049:
95iscsi: Use 'ip=ibft' for ibft autoconfiguration

For iBFT autoconfiguration we should be setting 'ip=ibft' instead of rd.neednet. This should instruct dracut to only enable the iBFT interfaces and leave the rest alone.

References: bnc#879038

0054:
95iscsi: update commandline printing

dracut has a separate callout 'cmdline' which should be used for printing out the generated commandline.

---
 modules.d/95iscsi/module-setup.sh | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)
modules.d/95iscsi/module-setup.sh +26 -0
index 8b42d3e..5d2a39b 100755
@@ -28,6 +28,21 @@ check() {
     return 0
 }
 
+install_ibft() {
+    # When iBFT / iscsi_boot is detected:
+    # - Use 'ip=ibft' to set up iBFT network interface
+    # - specify firmware booting cmdline parameter
+
+    for d in /sys/firmware/* ; do
+        if [ -d ${d}/initiator ] ; then
+            if [ ${d##*/} = "ibft" ] ; then
+                echo -n "ip=ibft "
+            fi
+            echo -n "rd.iscsi.firmware=1"
+        fi
+    done
+}
+
 # called by dracut
 depends() {
     echo network rootfs-block
@@ -37,6 +52,12 @@ depends() {
 installkernel() {
     local _arch=$(uname -m)
 
+    # Detect iBFT and perform mandatory steps
+    if [[ $hostonly_cmdline == "yes" ]] ; then
+        install_ibft > "${initdir}/etc/cmdline.d/95iscsi.conf"
+        echo >> "${initdir}/etc/cmdline.d/95iscsi.conf"
+    fi
+
     instmods bnx2i qla4xxx cxgb3i cxgb4i be2iscsi
     hostonly="" instmods iscsi_tcp iscsi_ibft crc32c iscsi_boot_sysfs
     iscsi_module_filter() {
@@ -77,6 +98,11 @@ installkernel() {
 }
 
 # called by dracut
+cmdline() {
+    install_ibft
+}
+
+# called by dracut
 install() {
     inst_multiple umount iscsistart hostname iscsi-iname
     inst_multiple -o iscsiuio
Signature · 1 line
1.8.5.2
#10 lore raw

PATCH 7/42 95iscsi: Install libgcc_s library

In reply to a message not in the archive

From: Hannes Reinecke <[email protected]>

iscsiuio is using pthread, which requires libgcc_s for pthread_cancel to work.
Without this library iscsiuio will crash with SIGABRT.

References: bnc#881692

---
 modules.d/95iscsi/module-setup.sh | 1 +
 1 file changed, 1 insertion(+)
modules.d/95iscsi/module-setup.sh +1 -0
index 5d2a39b..3641fb8 100755
@@ -106,6 +106,7 @@ cmdline() {
 install() {
     inst_multiple umount iscsistart hostname iscsi-iname
     inst_multiple -o iscsiuio
+    inst_libdir_file 'libgcc_s.so*'
     inst_hook cmdline 90 "$moddir/parse-iscsiroot.sh"
     inst_hook cleanup 90 "$moddir/cleanup-iscsi.sh"
     inst "$moddir/iscsiroot.sh" "/sbin/iscsiroot"
Signature · 1 line
1.8.5.2
#11 lore raw

PATCH 8/42 95iscsi: Set correct iscsi_started value for iSCSI firmware

In reply to a message not in the archive

From: Hannes Reinecke <[email protected]>

When iSCSI firmware booting is selected we should not rely on 'netroot' or 'iscsiroot' variables to be set.

References: bnc#873448

---
 modules.d/95iscsi/parse-iscsiroot.sh | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
modules.d/95iscsi/parse-iscsiroot.sh +6 -2
index ca57668..85c3027 100755
@@ -90,8 +90,12 @@ if [ -n "$netroot" ] && [ "$root" != "/dev/root" ] && [ "$root" != "dhcp" ]; the
     fi
 fi
 
-netroot_enc=$(str_replace "$netroot" '/' '\2f')
-echo "[ -f '/tmp/iscsistarted-$netroot_enc' ]" > $hookdir/initqueue/finished/iscsi_started.sh
+if [ -n "$iscsi_firmware" ] ; then
+    echo "[ -f '/tmp/iscsistarted-firmware' ]" > $hookdir/initqueue/finished/iscsi_started.sh
+else
+    netroot_enc=$(str_replace "$netroot" '/' '\2f')
+    echo "[ -f '/tmp/iscsistarted-$netroot_enc' ]" > $hookdir/initqueue/finished/iscsi_started.sh
+fi
 
 # Done, all good!
 rootok=1
Signature · 1 line
1.8.5.2
#12 lore raw

PATCH 9/42 95iscsi: strip one set of quotes when calling initqueue

In reply to a message not in the archive

From: Hannes Reinecke <[email protected]>

The bad initqueue parameter passing is already addressed by git commit:
commit bb8c16d12178373f17553294603ff5187e318b51
and
commit 486a8f33e2edaf249e3a09c98a910094e201cf9e

However this appraoch is slightly different:
"$netroot" instead of "'$netroot'", etc.

initqueue will process the arguments, assuming the first non-option argument to be the program to be executed. Putting the entire commandline into this argument confuses both, initqueue and the program in question.

References: bnc#879038

---
 modules.d/95iscsi/parse-iscsiroot.sh | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
modules.d/95iscsi/parse-iscsiroot.sh +3 -3
index 85c3027..37e46ad 100755
@@ -59,10 +59,10 @@ fi
 
 # iscsi_firmware does not need argument checking
 if [ -n "$iscsi_firmware" ] ; then
-    netroot=${netroot:-iscsi:}
+    [ -z "$netroot" ] && netroot=iscsi:
     modprobe -q iscsi_boot_sysfs 2>/dev/null
     modprobe -q iscsi_ibft
-    initqueue --onetime --timeout /sbin/iscsiroot dummy "'$netroot'" "'$NEWROOT'"
+    initqueue --onetime --timeout /sbin/iscsiroot dummy "$netroot" "$NEWROOT"
 fi
 
 # If it's not iscsi we don't continue
@@ -86,7 +86,7 @@ fi
 
 if [ -n "$netroot" ] && [ "$root" != "/dev/root" ] && [ "$root" != "dhcp" ]; then
     if ! getargbool 1 rd.neednet >/dev/null || ! getarg "ip="; then
-        initqueue --onetime --settled /sbin/iscsiroot dummy "'$netroot'" "'$NEWROOT'"
+        initqueue --onetime --settled /sbin/iscsiroot dummy "$netroot" "$NEWROOT"
     fi
 fi
 
Signature · 1 line
1.8.5.2
#13 lore raw

PATCH 10/42 95iscsi: Fixup bnx2i offload booting

In reply to a message not in the archive

From: Hannes Reinecke <[email protected]>

bnx2i is using a separate iSCSI offload engine with a separate MAC address. As a result, the iBFT information is displaying a MAC address which does not relate to any MAC address from the network interfaces.
In addition, the iSCSI offload engine works independently on the NIC, so we do not need to enable the NIC for iSCSI offload to work.
This patch modifies the automatic iBFT detection to not set the 'ip=ibft' flag when bnx2i offload is detected.

References: bnc#855747

---
 modules.d/95iscsi/module-setup.sh | 26 +++++++++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)
modules.d/95iscsi/module-setup.sh +25 -1
index 3641fb8..d30e64f 100755
@@ -28,14 +28,38 @@ check() {
     return 0
 }
 
+get_ibft_mod() {
+    local ibft_mac=$1
+    # Return the iSCSI offload module for a given MAC address
+    iscsiadm -m iface | while read iface_name iface_desc ; do
+        IFS=$','
+        set -- $iface_desc
+        if [ "$ibft_mac" = "$2" ] ; then
+            echo $1
+            return 0
+        fi
+        unset IFS
+    done
+}
+
 install_ibft() {
     # When iBFT / iscsi_boot is detected:
     # - Use 'ip=ibft' to set up iBFT network interface
+    #   Note: bnx2i is using a different MAC address of iSCSI offloading
+    #         so the 'ip=ibft' parameter must not be set
     # - specify firmware booting cmdline parameter
 
     for d in /sys/firmware/* ; do
+        if [ -d ${d}/ethernet0 ] ; then
+            read ibft_mac < ${d}/ethernet0/mac
+            ibft_mod=$(get_ibft_mod $ibft_mac)
+        fi
+        if [ -z "$ibft_mod" ] && [ -d ${d}/ethernet1 ] ; then
+            read ibft_mac < ${d}/ethernet1/mac
+            ibft_mod=$(get_ibft_mod $ibft_mac)
+        fi
         if [ -d ${d}/initiator ] ; then
-            if [ ${d##*/} = "ibft" ] ; then
+            if [ ${d##*/} = "ibft" ] && [ "$ibft_mod" != "bnx2i" ] ; then
                 echo -n "ip=ibft "
             fi
             echo -n "rd.iscsi.firmware=1"
Signature · 1 line
1.8.5.2
#14 lore raw

PATCH 11/42 95iscsi: More empty cmdline fixes

In reply to a message not in the archive

From: Hannes Reinecke <[email protected]>

This fixes up some 95iscsi/module-setup.sh which might print out empty commandline files.

---
 modules.d/95iscsi/module-setup.sh | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
modules.d/95iscsi/module-setup.sh +7 -6
index d30e64f..29bba82 100755
@@ -76,12 +76,6 @@ depends() {
 installkernel() {
     local _arch=$(uname -m)
 
-    # Detect iBFT and perform mandatory steps
-    if [[ $hostonly_cmdline == "yes" ]] ; then
-        install_ibft > "${initdir}/etc/cmdline.d/95iscsi.conf"
-        echo >> "${initdir}/etc/cmdline.d/95iscsi.conf"
-    fi
-
     instmods bnx2i qla4xxx cxgb3i cxgb4i be2iscsi
     hostonly="" instmods iscsi_tcp iscsi_ibft crc32c iscsi_boot_sysfs
     iscsi_module_filter() {
@@ -131,6 +125,13 @@ install() {
     inst_multiple umount iscsistart hostname iscsi-iname
     inst_multiple -o iscsiuio
     inst_libdir_file 'libgcc_s.so*'
+
+    # Detect iBFT and perform mandatory steps
+    if [[ $hostonly_cmdline == "yes" ]] ; then
+        local _ibftconf=$(install_ibft)
+        [[ $_ibftconf ]] && printf "%s\n" "$_ibftconf" >> "${initdir}/etc/cmdline.d/95iscsi.conf"
+    fi
+
     inst_hook cmdline 90 "$moddir/parse-iscsiroot.sh"
     inst_hook cleanup 90 "$moddir/cleanup-iscsi.sh"
     inst "$moddir/iscsiroot.sh" "/sbin/iscsiroot"
Signature · 1 line
1.8.5.2
#15 lore raw

PATCH 12/42 95iscsi: generate commandline for software iscsi

In reply to a message not in the archive

From: Hannes Reinecke <[email protected]>

When installing on an software iscsi root we need to generate the correct commandline, otherwise the system cannot boot.

References: bnc#880108
Patch: 0093

When using software iscsi we should be using the existing configuration from the system for the time being.

References: bnc#884768
Patch: 0095

Avoid bad ip route call on empty address
Patch: 0143

---
 modules.d/95iscsi/module-setup.sh | 91 +++++++++++++++++++++++++++++++++++++--
 1 file changed, 88 insertions(+), 3 deletions(-)
modules.d/95iscsi/module-setup.sh +88 -3
index 29bba82..cd6cb4b 100755
@@ -67,6 +67,84 @@ install_ibft() {
     done
 }
 
+install_iscsiroot() {
+    local devpath=$1
+    local scsi_path iscsi_lun session c d conn
+    local iscsi_session iscsi_address iscsi_port iscsi_targetname iscsi_tpgt
+
+    scsi_path=${devpath%%/block*}
+    [ "$scsi_path" = "$devpath" ] && return 1
+    iscsi_lun=${scsi_path##*:}
+    [ "$iscsi_lun" = "$scsi_path" ] && return 1
+    session=${devpath%%/target*}
+    [ "$session" = "$devpath" ] && return 1
+    iscsi_session=${session##*/}
+    [ "$iscsi_session" = "$session" ] && return 1
+
+    for d in ${session}/* ; do
+        case $d in
+	    *connection*)
+	        c=${d##*/}
+	        conn=${d}/iscsi_connection/${c}
+	        if [ -d ${conn} ] ; then
+		    iscsi_address=$(cat ${conn}/persistent_address)
+		    iscsi_port=$(cat ${conn}/persistent_port)
+	        fi
+	        ;;
+	    *session)
+	        if [ -d ${d}/${iscsi_session} ] ; then
+                    iscsi_initiator=$(cat ${d}/${iscsi_session}/initiatorname)
+		    iscsi_targetname=$(cat ${d}/${iscsi_session}/targetname)
+	        fi
+	        ;;
+        esac
+    done
+
+    [ -z "$iscsi_address" ] && return
+    local_address=$(ip -o route get to $iscsi_address | sed -n 's/.*src \([0-9a-f.:]*\).*/\1/p')
+    ifname=$(ip -o route get to $iscsi_address | sed -n 's/.*dev \([^ ]*\).*/\1/p')
+    printf 'ip=%s:static ' ${ifname}
+
+    if [ -e /sys/class/net/$ifname/address ] ; then
+        ifmac=$(cat /sys/class/net/$ifname/address)
+        printf 'ifname=%s:%s ' ${ifname} ${ifmac}
+    fi
+
+    if [ -n "$iscsi_address" -a -n "$iscsi_targetname" ] ; then
+        if [ -n "$iscsi_port" -a "$iscsi_port" -eq 3260 ] ; then
+            iscsi_port=
+        fi
+        if [ -n "$iscsi_lun" -a "$iscsi_lun" -eq 0 ] ; then
+            iscsi_lun=
+        fi
+        # In IPv6 case rd.iscsi.initatior= must pass address in [] brackets
+        case "$iscsi_address" in
+            *:*)
+                iscsi_address="[$iscsi_address]"
+                ;;
+        esac
+        echo "rd.iscsi.initiator=${iscsi_initiator} netroot=iscsi:${iscsi_address}::${iscsi_port}:${iscsi_lun}:${iscsi_targetname}"
+    fi
+    return 0
+}
+
+
+install_softiscsi() {
+    [ -d /sys/firmware/ibft ] && return 0
+
+    is_softiscsi() {
+        local _dev=$1
+        local iscsi_dev
+
+        [[ -L "/sys/dev/block/$_dev" ]] || return
+        iscsi_dev=$(cd -P /sys/dev/block/$_dev; echo $PWD)
+        install_iscsiroot $iscsi_dev
+    }
+
+    for_each_host_dev_and_slaves_all is_softiscsi || return 255
+    return 0
+}
+
 # called by dracut
 depends() {
     echo network rootfs-block
@@ -117,7 +195,14 @@ installkernel() {
 
 # called by dracut
 cmdline() {
-    install_ibft
+    local _iscsiconf=$(install_ibft)
+    {
+        if [ "$_iscsiconf" ] ; then
+            echo ${_iscsiconf}
+        else
+            install_softiscsi
+        fi
+    } | sort | uniq
 }
 
 # called by dracut
@@ -128,8 +213,8 @@ install() {
 
     # Detect iBFT and perform mandatory steps
     if [[ $hostonly_cmdline == "yes" ]] ; then
-        local _ibftconf=$(install_ibft)
-        [[ $_ibftconf ]] && printf "%s\n" "$_ibftconf" >> "${initdir}/etc/cmdline.d/95iscsi.conf"
+        local _iscsiconf=$(cmdline)
+        [[ $_iscsiconf ]] && printf "%s\n" "$_iscsiconf" >> "${initdir}/etc/cmdline.d/95iscsi.conf"
     fi
 
     inst_hook cmdline 90 "$moddir/parse-iscsiroot.sh"
Signature · 1 line
1.8.5.2
#16 lore raw

PATCH 13/42 iscsi: iscsi.initiator and others can and must only show up once

In reply to a message not in the archive

Make sure duplicates of iscsi.initiator vanish.
Only get one rd.iscsi.* paramter value. If getargs is used and several parameters are parsed, one gets two values separated by whitespace in a variable which breaks later code and is not suppported.

---
 modules.d/95iscsi/iscsiroot.sh    | 18 +++++++++---------
 modules.d/95iscsi/module-setup.sh |  5 ++++-
 2 files changed, 13 insertions(+), 10 deletions(-)
modules.d/95iscsi/iscsiroot.sh +9 -9
index 7351427..5bfb017 100755
@@ -81,23 +81,23 @@ handle_netroot()
     local p
 
     # override conf settings by command line options
-    arg=$(getargs rd.iscsi.initiator -d iscsi_initiator=)
+    arg=$(getarg rd.iscsi.initiator -d iscsi_initiator=)
     [ -n "$arg" ] && iscsi_initiator=$arg
-    arg=$(getargs rd.iscsi.target.name -d iscsi_target_name=)
+    arg=$(getarg rd.iscsi.target.name -d iscsi_target_name=)
     [ -n "$arg" ] && iscsi_target_name=$arg
-    arg=$(getargs rd.iscsi.target.ip -d iscsi_target_ip)
+    arg=$(getarg rd.iscsi.target.ip -d iscsi_target_ip)
     [ -n "$arg" ] && iscsi_target_ip=$arg
-    arg=$(getargs rd.iscsi.target.port -d iscsi_target_port=)
+    arg=$(getarg rd.iscsi.target.port -d iscsi_target_port=)
     [ -n "$arg" ] && iscsi_target_port=$arg
-    arg=$(getargs rd.iscsi.target.group -d iscsi_target_group=)
+    arg=$(getarg rd.iscsi.target.group -d iscsi_target_group=)
     [ -n "$arg" ] && iscsi_target_group=$arg
-    arg=$(getargs rd.iscsi.username -d iscsi_username=)
+    arg=$(getarg rd.iscsi.username -d iscsi_username=)
     [ -n "$arg" ] && iscsi_username=$arg
-    arg=$(getargs rd.iscsi.password -d iscsi_password)
+    arg=$(getarg rd.iscsi.password -d iscsi_password)
     [ -n "$arg" ] && iscsi_password=$arg
-    arg=$(getargs rd.iscsi.in.username -d iscsi_in_username=)
+    arg=$(getarg rd.iscsi.in.username -d iscsi_in_username=)
     [ -n "$arg" ] && iscsi_in_username=$arg
-    arg=$(getargs rd.iscsi.in.password -d iscsi_in_password=)
+    arg=$(getarg rd.iscsi.in.password -d iscsi_in_password=)
     [ -n "$arg" ] && iscsi_in_password=$arg
     for p in $(getargs rd.iscsi.param -d iscsi_param); do
 	iscsi_param="$iscsi_param --param $p"
modules.d/95iscsi/module-setup.sh +4 -1
index cd6cb4b..9975e59 100755
@@ -123,7 +123,10 @@ install_iscsiroot() {
                 iscsi_address="[$iscsi_address]"
                 ;;
         esac
-        echo "rd.iscsi.initiator=${iscsi_initiator} netroot=iscsi:${iscsi_address}::${iscsi_port}:${iscsi_lun}:${iscsi_targetname}"
+        # Must be two separate lines, so that "sort | uniq" commands later
+        # can sort out rd.iscsi.initiator= duplicates
+        echo "rd.iscsi.initiator=${iscsi_initiator}"
+        echo "netroot=iscsi:${iscsi_address}::${iscsi_port}:${iscsi_lun}:${iscsi_targetname}"
     fi
     return 0
 }
Signature · 1 line
1.8.5.2
#17 lore raw

PATCH 14/42 Implement 'rd.timeout' to modify the device timeout

In reply to a message not in the archive

From: Hannes Reinecke <[email protected]>

When generating units for devices the administrator might want to use a different timeout than the default. So implement a new parameter 'rd.timeout' for this.

References: bnc#878770

---
 dracut.cmdline.7.asc                    | 7 ++++++-
 modules.d/98systemd/rootfs-generator.sh | 7 +++++--
 modules.d/99base/dracut-lib.sh          | 6 +++++-
 3 files changed, 16 insertions(+), 4 deletions(-)
dracut.cmdline.7.asc +6 -1
index 8e4835d..5ff84ef 100644
@@ -142,11 +142,16 @@ Misc
     have been loaded. This parameter can be specified multiple times.
 
 **rd.retry=**__<seconds>__::
-    specify how long dracut should wait for devices to appear.
+    specify how long dracut should retry the initqueue to configure devices.
     The default is 30 seconds. After 2/3 of the time, degraded raids are force
     started. If you have hardware, which takes a very long time to announce its
     drives, you might want to extend this value.
 
+**rd.timeout=**__<seconds>__::
+    specify how long dracut should wait for devices to appear. The
+    default is '0', which means 'forever'. Note that this timeout
+    should be longer than rd.retry to allow for proper configuration.
+
 **rd.noverifyssl**::
     accept self-signed certificates for ssl downloads.
 
modules.d/98systemd/rootfs-generator.sh +5 -2
index 9523729..5b06137 100755
@@ -5,8 +5,11 @@ type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
 generator_wait_for_dev()
 {
     local _name
+    local _timeout
 
     _name="$(str_replace "$1" '/' '\x2f')"
+    _timeout=$(getarg rd.timeout)
+    _timeout=${_timeout:-0}
 
     [ -e "$hookdir/initqueue/finished/devexists-${_name}.sh" ] && return 0
 
@@ -27,7 +30,7 @@ generator_wait_for_dev()
         mkdir -p /run/systemd/generator/${_name}.device.d
         {
             echo "[Unit]"
-            echo "JobTimeoutSec=0"
+            echo "JobTimeoutSec=$_timeout"
         } > /run/systemd/generator/${_name}.device.d/timeout.conf
     fi
 }
@@ -58,6 +61,6 @@ case "$root" in
         rootok=1 ;;
 esac
 
-[ "${root%%:*}" = "block" ] && generator_wait_for_dev "${root#block:}"
+[ "${root%%:*}" = "block" ] && generator_wait_for_dev "${root#block:}" "$RDRETRY"
 
 exit 0
modules.d/99base/dracut-lib.sh +5 -1
index 5fc5615..f7cffc4 100755
@@ -890,12 +890,16 @@ wait_for_dev()
     local _name
     local _needreload
     local _noreload
+    local _timeout
 
     if [ "$1" = "-n" ]; then
         _noreload=1
         shift
     fi
 
+    _timeout=$(getarg rd.timeout)
+    _timeout=${_timeout:-0}
+
     _name="$(str_replace "$1" '/' '\x2f')"
 
     type mark_hostonly >/dev/null 2>&1 && mark_hostonly "$hookdir/initqueue/finished/devexists-${_name}.sh"
@@ -922,7 +926,7 @@ wait_for_dev()
             mkdir -p ${PREFIX}/etc/systemd/system/${_name}.device.d
             {
                 echo "[Unit]"
-                echo "JobTimeoutSec=0"
+                echo "JobTimeoutSec=$_timeout"
             } > ${PREFIX}/etc/systemd/system/${_name}.device.d/timeout.conf
             type mark_hostonly >/dev/null 2>&1 && mark_hostonly /etc/systemd/system/${_name}.device.d/timeout.conf
             _needreload=1
Signature · 1 line
1.8.5.2
#18 lore raw

PATCH 15/42 Do not call 'lvm' for non-LVM device-mapper devices

In reply to a message not in the archive

From: Hannes Reinecke <[email protected]>

If a device-mapper device is not created by LVM it's pointless to call any 'lvm' programs got extract details; they'll be failing anyway. So check the UUID before calling 'lvm'. This speeds up initrd creation and avoids I/O errors on multipath devices.

---
 dracut-functions.sh | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
dracut-functions.sh +3 -1
index 17a71f0..edd8ea9 100755
@@ -698,10 +698,12 @@ for_each_host_dev_and_slaves()
 # but you cannot create the logical volume without the volume group.
 # And the volume group might be bigger than the devices the LV needs.
 check_vol_slaves() {
-    local _lv _vg _pv
+    local _lv _vg _pv _dm
     for i in /dev/mapper/*; do
         [[ $i == /dev/mapper/control ]] && continue
         _lv=$(get_maj_min $i)
+        _dm=/sys/dev/block/$_lv/dm
+        [[ -f $_dm/uuid  && $(<$_dm/uuid) =~ LVM-* ]] || continue
         if [[ $_lv = $2 ]]; then
             _vg=$(lvm lvs --noheadings -o vg_name $i 2>/dev/null)
             # strip space
Signature · 1 line
1.8.5.2
#19 lore raw

PATCH 16/42 Print stored dracut commandline during initramfs build

In reply to a message not in the archive

From: Hannes Reinecke <[email protected]>

When generating the initramfs we should be printing out the generated dracut commandline used for booting. This will simplify debugging.

---
 dracut.sh | 10 ++++++++++
 1 file changed, 10 insertions(+)
dracut.sh +10 -0
index a542f33..cda7955 100755
@@ -1584,6 +1584,16 @@ if ! ( echo $PARMS_TO_STORE > $initdir/lib/dracut/build-parameter.txt ); then
     exit 1
 fi
 
+if [[ $hostonly_cmdline ]] ; then
+    if [ -d $initdir/etc/cmdline.d ];then
+        dinfo "Stored kernel commandline:"
+        for conf in $initdir/etc/cmdline.d/*.conf ; do
+            dinfo "$(< $conf)"
+        done
+    else
+        dinfo "No dracut internal kernel commandline stored in initrd"
+    fi
+fi
 rm -f -- "$outfile"
 dinfo "*** Creating image file ***"
 
Signature · 1 line
1.8.5.2
#20 lore raw

PATCH 17/42 Align dev_unit_name() with systemd's function.

In reply to a message not in the archive

From: Thorsten Behrens <tbehrens-IBi9RG/[email protected]>

Add more corner cases from systemd's
unit_name_from_path_instance() C function.

---
 modules.d/99base/dracut-lib.sh | 24 ++++++++++++++++++------
 1 file changed, 18 insertions(+), 6 deletions(-)
modules.d/99base/dracut-lib.sh +18 -6
index f7cffc4..5c1504f 100755
@@ -866,18 +866,30 @@ wait_for_mount()
     } >> "$hookdir/emergency/90-${_name}.sh"
 }
 
+# get a systemd-compatible unit name from a path
+# (mimicks unit_name_from_path_instance())
 dev_unit_name()
 {
+    local dev="$1"
+
     if command -v systemd-escape >/dev/null; then
-        systemd-escape -p  "$1"
+        systemd-escape -p  "$dev"
         return
     fi
 
-    _name="${1%%/}"
-    _name="${_name##/}"
-    _name="$(str_replace "$_name" '-' '\x2d')"
-    _name="$(str_replace "$_name" '/' '-')"
-    echo "$_name"
+    if [ "$dev" = "/" -o -z "$dev" ]; then
+        printf -- "-"
+        exit 0
+    fi
+
+    dev="${1%%/}"
+    dev="${dev##/}"
+    dev="$(str_replace "$dev" '\' '\x5c')"
+    dev="$(str_replace "$dev" '-' '\x2d')"
+    dev=${dev/#\./\\x2e}
+    dev="$(str_replace "$dev" '/' '-')"
+
+    printf -- "%s" "$dev"
 }
 
 # wait_for_dev <dev>
Signature · 1 line
1.8.5.2

A message that is not in the archive (sent off-list or not yet received): 1418309193-11208-18-git-send-email-trenn-l3A5Bk7waGM@public.gmane.org

#22 lore raw

Re: [PATCH 17/42] Align dev_unit_name() with systemd's function.

Hello all!

В Thu, 11 Dec 2014 15:46:08 +0100
Thomas Renninger <[email protected]> пишет:

Quoted 36 lines

From: Thorsten Behrens <tbehrens-IBi9RG/[email protected]>

Add more corner cases from systemd's
unit_name_from_path_instance() C function.

---
 modules.d/99base/dracut-lib.sh | 24 ++++++++++++++++++------
 1 file changed, 18 insertions(+), 6 deletions(-)
(quoted diff) +0 -0

b/modules.d/99base/dracut-lib.sh index f7cffc4..5c1504f 100755

modules.d/99base/dracut-lib.sh +5 -6
@@ -866,18 +866,30 @@ wait_for_mount()
     } >> "$hookdir/emergency/90-${_name}.sh"
 }
 
+# get a systemd-compatible unit name from a path
+# (mimicks unit_name_from_path_instance())
 dev_unit_name()
 {
+    local dev="$1"
+
     if command -v systemd-escape >/dev/null; then
-        systemd-escape -p  "$1"
+        systemd-escape -p  "$dev"
         return
     fi
 
-    _name="${1%%/}"
-    _name="${_name##/}"
-    _name="$(str_replace "$_name" '-' '\x2d')"
-    _name="$(str_replace "$_name" '/' '-')"
-    echo "$_name"

modules.d/99base/dracut-lib.sh wait_for_mount() · line 889

Quoted 10 lines
modules.d/99base/dracut-lib.sh +10 -0
+    if [ "$dev" = "/" -o -z "$dev" ]; then
+        printf -- "-"
+        exit 0
+    fi
+
+    dev="${1%%/}"
+    dev="${dev##/}"
+    dev="$(str_replace "$dev" '\' '\x5c')"
+    dev="$(str_replace "$dev" '-' '\x2d')"
+    dev=${dev/#\./\\x2e}

The above string substitution works only in bash. With dash it gives the following warnings:

$ grep 'Bad subst' rdsosreport.txt 
[    2.493678] laptop dracut-cmdline[121]: /bin/dracut-cmdline:
889: //lib/dracut/hooks/cmdline/30-parse-lvm.sh: Bad substitution
[    2.537849] laptop dracut-cmdline[121]: /bin/dracut-cmdline:
889: //lib/dracut/hooks/cmdline/30-parse-lvm.sh: Bad substitution
[    2.578491] laptop dracut-cmdline[121]: /bin/dracut-cmdline:
889: //lib/dracut/hooks/cmdline/30-parse-lvm.sh: Bad substitution
[    3.854089] laptop dracut-initqueue[250]: /bin/dracut-initqueue:
889: /lib/dracut/hooks/initqueue/settled/systemd-cryptsetup-sda3.sh:
Bad substitution

Harald, is dash is still supported by dracut and do you accept patches to remove bashisms?

Quoted 6 lines
modules.d/99base/dracut-lib.sh +3 -0
+    dev="$(str_replace "$dev" '/' '-')"
+
+    printf -- "%s" "$dev"
 }
 
 # wait_for_dev <dev>
Signature · 1 line
Alexander Tsoy
#23 lore raw

PATCH 18/42 Generate fallback mount unit for root filesystem

In reply to a message not in the archive

From: Thorsten Behrens <tbehrens-IBi9RG/[email protected]>

If kernel cmdline has no root= provided, *and* the initrd carries a default value, create a systemd mount unit to have it available in /sysroot

References: bnc#855258

---
 modules.d/98systemd/rootfs-generator.sh | 34 ++++++++++++++++++++++++++++++++-
 1 file changed, 33 insertions(+), 1 deletion(-)
modules.d/98systemd/rootfs-generator.sh +33 -1
index 5b06137..f3c7d1f 100755
@@ -35,6 +35,35 @@ generator_wait_for_dev()
     fi
 }
 
+generator_mount_rootfs()
+{
+    local _type=$2
+    local _flags=$3
+    local _name
+
+    [ -z "$1" ] && return 0
+
+    _name=$(dev_unit_name "$1")
+    [ -d /run/systemd/generator ] || mkdir -p /run/systemd/generator
+    if ! [ -f /run/systemd/generator/sysroot.mount ]; then
+        {
+            echo "[Unit]"
+            echo "Before=initrd-root-fs.target"
+            echo "RequiresOverridable=systemd-fsck@${_name}.service"
+            echo "After=systemd-fsck@${_name}.service"
+            echo "[Mount]"
+            echo "Where=/sysroot"
+            echo "What=$1"
+            echo "Options=${_flags}"
+            echo "Type=${_type}"
+        } > /run/systemd/generator/sysroot.mount
+    fi
+    if ! [ -L /run/systemd/generator/initrd-root-fs.target.requires/sysroot.mount ]; then
+        [ -d /run/systemd/generator/initrd-root-fs.target.requires ] || mkdir -p /run/systemd/generator/initrd-root-fs.target.requires
+        ln -s ../sysroot.mount /run/systemd/generator/initrd-root-fs.target.requires/sysroot.mount
+    fi
+}
+
 root=$(getarg root=)
 case "$root" in
     block:LABEL=*|LABEL=*)
@@ -61,6 +90,9 @@ case "$root" in
         rootok=1 ;;
 esac
 
-[ "${root%%:*}" = "block" ] && generator_wait_for_dev "${root#block:}" "$RDRETRY"
+if [ "${root%%:*}" = "block" ]; then
+   generator_wait_for_dev "${root#block:}" "$RDRETRY"
+   grep -q 'root=' /proc/cmdline || generator_mount_rootfs "${root#block:}" "$(getarg rootfstype=)" "$(getarg rootflags=)"
+fi
 
 exit 0
Signature · 1 line
1.8.5.2
#24 lore raw

PATCH 19/42 99base: warn on invalid command for initqueue

In reply to a message not in the archive

From: Hannes Reinecke <[email protected]>

When 'initqueue' is called with an invalid command it'll generate invalid job scripts. This will lead to confusing error messages later on.
So abort in these cases and print out a warning.

---
 modules.d/99base/initqueue.sh | 4 ++++
 1 file changed, 4 insertions(+)
modules.d/99base/initqueue.sh +4 -0
index 4a07da3..193cc5c 100755
@@ -42,6 +42,10 @@ exe=$1
 shift
 
 [ -x "$exe" ] || exe=$(command -v $exe)
+if [ -z "$exe" ] ; then
+    echo "Invalid command"
+    exit 1
+fi
 
 {
     [ -n "$onetime" ] && echo '[ -e "$job" ] && rm -f -- "$job"'
Signature · 1 line
1.8.5.2
#25 lore raw

PATCH 20/42 Handle module alias properly

In reply to a message not in the archive

From: Hannes Reinecke <[email protected]>

Some modules (like ext4) provide aliases by which the modules can be accessed, too. But when using aliases directly dracut fails to include the correct module. So translate the alias into the correct module name before checking the module.

References: bnc#886839

---
 dracut-functions.sh | 7 +++++++
 1 file changed, 7 insertions(+)
dracut-functions.sh +7 -0
index edd8ea9..7a12a76 100755
@@ -1689,6 +1689,13 @@ instmods() {
             --*) _mpargs+=" $_mod" ;;
             *)
                 _mod=${_mod##*/}
+                # Check for aliased modules
+                _modalias=$(modinfo -k $kernel -F filename $_mod 2> /dev/null)
+                _modalias=${_modalias%.ko}
+                if [ "${_modalias##*/}" != "$_mod" ] ; then
+                    _mod=${_modalias##*/}
+                fi
+
                 # if we are already installed, skip this module and go on
                 # to the next one.
                 if [[ $DRACUT_KERNEL_LAZY_HASHDIR ]] && \
Signature · 1 line
1.8.5.2
#26 lore raw

PATCH 21/42 99base: Increase initqueue timeout in non systemd case

In reply to a message not in the archive

In case of systemd is used the timeout already is set to 180s, compare with file: modules.d/98systemd/dracut-initqueue.sh

Do the same if systemd is not used, e.g. in kdump case.

---
 modules.d/99base/init.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
modules.d/99base/init.sh +1 -1
index 7fcea4a..918dea5 100755
@@ -166,7 +166,7 @@ make_trace_mem "hook initqueue" '1:shortmem' '2+:mem' '3+:slab'
 getarg 'rd.break=initqueue' -d 'rdbreak=initqueue' && emergency_shell -n initqueue "Break before initqueue"
 
 RDRETRY=$(getarg rd.retry -d 'rd_retry=')
-RDRETRY=${RDRETRY:-30}
+RDRETRY=${RDRETRY:-180}
 RDRETRY=$(($RDRETRY*2))
 export RDRETRY
 main_loop=0
Signature · 1 line
1.8.5.2
#27 lore raw

PATCH 22/42 90lvm: Install dm-snapshot module

In reply to a message not in the archive

bnc#888530

---
 modules.d/90lvm/module-setup.sh | 4 ++++
 1 file changed, 4 insertions(+)
modules.d/90lvm/module-setup.sh +4 -0
index 9ddc56e..5515ac0 100755
@@ -42,6 +42,10 @@ cmdline() {
     done
 }
 
+installkernel() {
+    instmods dm-snapshot
+}
+
 # called by dracut
 install() {
     local _i
Signature · 1 line
1.8.5.2
#28 lore raw

PATCH 23/42 Check for logfile (--logfile option) and create it if necessary

In reply to a message not in the archive

From: jloeser <[email protected]>

If a logfile is passed to dracut via --logfile option and doesn't exist, dracut doesn't create it and logs nothing. Instead, dracut should try to touch the file and print a warning if creating fails.

References: bnc#892191

---
 dracut.sh | 10 ++++++++++
 1 file changed, 10 insertions(+)
dracut.sh +10 -0
index cda7955..79f36b6 100755
@@ -816,6 +816,16 @@ stdloglvl=$((stdloglvl + verbosity_mod_l))
 # eliminate IFS hackery when messing with fw_dir
 fw_dir=${fw_dir//:/ }
 
+# check for logfile and try to create one if it doesn't exist
+if [[ -n "$logfile" ]];then
+    if [[ ! -f "$logfile" ]];then
+        touch "$logfile"
+        if [ ! $? -eq 0 ] ;then
+            printf "%s\n" "dracut: touch $logfile failed." >&2
+        fi
+    fi
+fi
+
 # handle compression options.
 [[ $compress ]] || compress="gzip"
 case $compress in
Signature · 1 line
1.8.5.2
#29 lore raw

PATCH 24/42 dracut.sh: Avoid duplicate devices in host_devs

In reply to a message not in the archive
---
 dracut.sh | 26 ++++++++++++++++++--------
 1 file changed, 18 insertions(+), 8 deletions(-)
dracut.sh +18 -8
index 79f36b6..a4c7ce5 100755
@@ -219,6 +219,16 @@ push() {
     done
 }
 
+# Fills up host_devs stack variable and makes sure there are no duplicates
+push_host_devs() {
+    local _dev
+    for _dev in ${host_devs[@]}; do
+        [ "$_dev" = "$1" ] && return
+    done
+    push host_devs "$1"
+}
+
+
 # function pop()
 # pops the last value from a stack
 # assigns value to second argument variable
@@ -1062,25 +1072,25 @@ declare -A host_fs_types
 for line in "${fstab_lines[@]}"; do
     set -- $line
     #dev mp fs fsopts
-    push host_devs "$1"
+    push_host_devs "$1"
     host_fs_types["$1"]="$3"
 done
 
 for f in $add_fstab; do
     [[ -e $f ]] || continue
     while read dev rest; do
-        push host_devs "$dev"
+        push_host_devs "$dev"
     done < "$f"
 done
 
 for dev in $add_device; do
-    push host_devs "$dev"
+    push_host_devs "$dev"
 done
 
 if (( ${#add_device_l[@]} )); then
     while pop add_device_l val; do
         add_device+=" $val "
-        push host_devs "$val"
+        push_host_devs "$val"
     done
 fi
 
@@ -1109,9 +1119,9 @@ if [[ $hostonly ]]; then
         _dev=$(find_block_device "$mp")
         _bdev=$(readlink -f "/dev/block/$_dev")
         [[ -b $_bdev ]] && _dev=$_bdev
-        push host_devs $_dev
+        push_host_devs $_dev
         [[ "$mp" == "/" ]] && root_dev="$_dev"
-        push host_devs "$_dev"
+        push_host_devs "$_dev"
     done
 
     if [[ -f /proc/swaps ]] && [[ -f /etc/fstab ]]; then
@@ -1140,7 +1150,7 @@ if [[ $hostonly ]]; then
                     done < /etc/crypttab
                 fi
 
-                push host_devs "$(readlink -f "$dev")"
+                push_host_devs "$(readlink -f "$dev")"
                 break
             done < /etc/fstab
         done < /proc/swaps
@@ -1205,7 +1215,7 @@ for dev in "${!host_fs_types[@]}"; do
     fi
     if [[ $journaldev ]]; then
         dev="$(readlink -f "$dev")"
-        push host_devs "$dev"
+        push_host_devs "$dev"
         _get_fs_type "$dev"
         check_block_and_slaves_all _get_fs_type "$(get_maj_min "$dev")"
     fi
Signature · 1 line
1.8.5.2
#30 lore raw

PATCH 25/42 dracut.sh: Fix UUID= fstab parsing in case --mount option is passed

In reply to a message not in the archive

Dracut parses /etc/fstab when --mount is option is passed (e.g. kdump).

In host_devs variable the real block device must be stored, not UUID= There are other /etc/fstab syntax possibilities we now warn that they are not correctly parsed. This will be fixed by another patch when there is time to test this properly.

---
 dracut.sh | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)
dracut.sh +18 -2
index a4c7ce5..2eba19b 100755
@@ -1071,9 +1071,25 @@ declare -A host_fs_types
 
 for line in "${fstab_lines[@]}"; do
     set -- $line
+    dev="$1"
     #dev mp fs fsopts
-    push_host_devs "$1"
-    host_fs_types["$1"]="$3"
+    case "$dev" in
+        UUID=*)
+            dev=$(blkid -l -t UUID=${dev#UUID=} -o device)
+            ;;
+        LABEL=*)
+            dev=$(blkid -l -t LABEL=${dev#LABEL=} -o device)
+            ;;
+        PARTUUID=*)
+            dev=$(blkid -l -t PARTUUID=${dev#PARTUUID=} -o device)
+            ;;
+        PARTLABEL=*)
+            dev=$(blkid -l -t PARTLABEL=${dev#PARTLABEL=} -o device)
+            ;;
+    esac
+    [ -z "$dev" ] && dwarn "Bad fstab entry $@" && continue
+    push_host_devs "$dev"
+    host_fs_types["$dev"]="$3"
 done
 
 for f in $add_fstab; do
Signature · 1 line
1.8.5.2
#31 lore raw

PATCH 26/42 dracut.usage.asc: Remove distro specific help from manpage

In reply to a message not in the archive
---
 dracut.usage.asc | 19 +------------------
 1 file changed, 1 insertion(+), 18 deletions(-)
dracut.usage.asc +1 -18
index 9e788c1..b4a8663 100644
@@ -246,23 +246,6 @@ specified multiple times.
 If your root partition is on a network drive, you have to have the network
 dracut modules installed to create a network aware initramfs image.
 
-On a Red Hat Enterprise Linux or Fedora system, this means, you have to install
-the _dracut-network_ rpm package:
-
-
-----
-# yum install dracut-network
-----
-
-The resulting initramfs image can be served by a boot manager residing on your
-local hard drive or it can be served by a PXE/TFTP server.
-
-How to setup your PXE/TFTP server can be found in the
-http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/6/html/Storage_Administration_Guide/[Red
-Hat Enterprise Linux 6 Storage Administration Guide]
-or http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/6/html/Storage_Administration_Guide/[Red
-Hat Enterprise Linux 7 Storage Administration Guide].
-
 If you specify ip=dhcp on the kernel command line, then dracut asks a dhcp
 server about the ip adress for the machine. The dhcp server can also serve an
 additional root-path, which will set the root device for dracut. With this
@@ -302,7 +285,7 @@ This will reduce the size of the initramfs image significantly.
 If the boot process does not succeed, you have several options to debug the
 situation. Some of the basic operations are covered here. For more information
 you should also visit:
-http://fedoraproject.org/wiki/How_to_debug_Dracut_problems
+https://www.kernel.org/pub/linux/utils/boot/dracut/dracut.html
 
 
 [[identifying-your-problem-area]]
Signature · 1 line
1.8.5.2
#32 lore raw

PATCH 27/42 nfs: Add ip=... and root=nfs... parameters to internal dracut

In reply to a message not in the archive

cmdline

If the rootfs is an nfs mount, also know as nfsroot, add the correct parameter to the dracut cmdline.

---
 modules.d/95nfs/module-setup.sh | 44 +++++++++++++++++++++++++++++++++++++++--
 1 file changed, 42 insertions(+), 2 deletions(-)
modules.d/95nfs/module-setup.sh +42 -2
index e1340b3..8eb542c 100755
@@ -14,7 +14,6 @@ check() {
         done
         return 255
     }
-
     return 0
 }
 
@@ -29,6 +28,43 @@ installkernel() {
     instmods nfs sunrpc ipv6 nfsv2 nfsv3 nfsv4 nfs_acl nfs_layout_nfsv41_files
 }
 
+cmdline() {
+    local nfs_device
+    local nfs_options
+    local nfs_root
+    local nfs_address
+    local lookup
+    local ifname
+
+    ### nfsroot= ###
+    nfs_device=$(findmnt -t nfs4 -n -o SOURCE /)
+    if [ -n "$nfs_device" ];then
+        nfs_root="root=nfs4:$nfs_device"
+    else
+        nfs_device=$(findmnt -t nfs -n -o SOURCE /)
+        [ -z "$nfs_device" ] && return
+        nfs_root="root=nfs:$nfs_device"
+    fi
+    nfs_options=$(findmnt -t nfs4,nfs -n -o OPTIONS /)
+    [ -n "$nfs_options" ] && nfs_root="$nfs_root:$nfs_options"
+    echo "$nfs_root"
+
+    ### ip= ###
+    if [[ $nfs_device = [0-9]*\.[0-9]*\.[0-9]*.[0-9]* ]] || [[ $nfs_device = \[.*\] ]]; then
+        nfs_address="$nfs_device"
+    else
+        lookup=$(host $(echo ${nfs_device%%:*})| head -n1)
+        nfs_address=${lookup##* }
+    fi
+    ifname=$(ip -o route get to $nfs_address | sed -n 's/.*dev \([^ ]*\).*/\1/p')
+    if [ -e /sys/class/net/$ifname/address ] ; then
+        ifmac=$(cat /sys/class/net/$ifname/address)
+        printf 'ifname=%s:%s ' ${ifname} ${ifmac}
+    fi
+
+    printf 'ip=%s:static\n' ${ifname}
+}
+
 # called by dracut
 install() {
     local _i
@@ -37,6 +73,11 @@ install() {
         mount.nfs4 umount rpc.idmapd sed /etc/netconfig
     inst_multiple /etc/services /etc/nsswitch.conf /etc/rpc /etc/protocols /etc/idmapd.conf
 
+    if [[ $hostonly_cmdline == "yes" ]]; then
+        local _netconf="$(cmdline)"
+        [[ $_netconf ]] && printf "%s\n" "$_netconf" >> "${initdir}/etc/cmdline.d/95nfs.conf"
+    fi
+
     if [ -f /lib/modprobe.d/nfs.conf ]; then
         inst_multiple /lib/modprobe.d/nfs.conf
     else
@@ -75,4 +116,3 @@ install() {
         && chown rpc.rpc "$initdir/var/lib/rpcbind"
     dracut_need_initqueue
 }
-
Signature · 1 line
1.8.5.2
#33 lore raw

PATCH 28/42 95iscsi: parse output from iscsiadm correctly

In reply to a message not in the archive

From: Hannes Reinecke <[email protected]>

Due to some obsure reason the IFS parameter is not set correctly when evaluating get_ibft_mod(). So change the parsing to not rely on IFS altogether.

References: bnc#886199

---
 modules.d/95iscsi/module-setup.sh | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
modules.d/95iscsi/module-setup.sh +7 -6
index 9975e59..f13119f 100755
@@ -30,15 +30,16 @@ check() {
 
 get_ibft_mod() {
     local ibft_mac=$1
+    local iface_mac iface_mod
     # Return the iSCSI offload module for a given MAC address
-    iscsiadm -m iface | while read iface_name iface_desc ; do
-        IFS=$','
-        set -- $iface_desc
-        if [ "$ibft_mac" = "$2" ] ; then
-            echo $1
+    for iface_desc in $(iscsiadm -m iface | cut -f 2 -d ' '); do
+        iface_mod=${iface_desc%%,*}
+        iface_mac=${iface_desc#*,}
+        iface_mac=${iface_mac%%,*}
+        if [ "$ibft_mac" = "$iface_mac" ] ; then
+            echo $iface_mod
             return 0
         fi
-        unset IFS
     done
 }
 
Signature · 1 line
1.8.5.2
#34 lore raw

PATCH 29/42 dracut: Do not stop installing drivers if one fails

In reply to a message not in the archive

--add-drivers and --filesystems kernel drivers are added via:
instmods -c
The check option makes the function return if one driver could not get installed without trying to install further drivers which is bad.

The user is still informed ($_silent is by default no), but all modules passed to instmods are tried to be loaded, even if one fails.

---
 dracut-functions.sh | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
dracut-functions.sh +4 -6
index 7a12a76..b91d8dc 100755
@@ -1742,18 +1742,16 @@ instmods() {
         if (($# == 0)); then  # filenames from stdin
             while read _mod; do
                 inst1mod "${_mod%.ko*}" || {
-                    if [[ "$_check" == "yes" ]]; then
-                        [[ "$_silent" == "no" ]] && dfatal "Failed to install module $_mod"
-                        return 1
+                    if [[ "$_check" == "yes" ]] && [[ "$_silent" == "no" ]]; then
+                        dfatal "Failed to install module $_mod"
                     fi
                 }
             done
         fi
         while (($# > 0)); do  # filenames as arguments
             inst1mod ${1%.ko*} || {
-                if [[ "$_check" == "yes" ]]; then
-                    [[ "$_silent" == "no" ]] && dfatal "Failed to install module $1"
-                    return 1
+                if [[ "$_check" == "yes" ]] && [[ "$_silent" == "no" ]]; then
+                    dfatal "Failed to install module $1"
                 fi
             }
             shift
Signature · 1 line
1.8.5.2
#35 lore raw

PATCH 30/42 95fcoe: update fcoe interface check

In reply to a message not in the archive

From: Hannes Reinecke <[email protected]>

The 'create' sysfs entry has been removed for newer fcoe modules, so just check if the module directory exists.

References: bnc#877288

---
 modules.d/95fcoe/parse-fcoe.sh | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
modules.d/95fcoe/parse-fcoe.sh +1 -4
index 59de56f..9604503 100755
@@ -20,14 +20,11 @@
 
 
 # BRCM: Later, should check whether bnx2x is loaded first before loading bnx2fc so do not load bnx2fc when there are no Broadcom adapters
-[ -e /sys/module/fcoe/parameters/create ] || modprobe -a fcoe || die "FCoE requested but kernel/initrd does not support FCoE"
+[ -d /sys/module/fcoe ] || modprobe -a fcoe || die "FCoE requested but kernel/initrd does not support FCoE"
 
 modprobe bnx2fc >/dev/null 2>&1
 udevadm settle --timeout=30
 
-# FCoE actually supported?
-[ -e /sys/module/fcoe/parameters/create ] || modprobe fcoe || die "FCoE requested but kernel/initrd does not support FCoE"
-
 parse_fcoe_opts() {
     local IFS=:
     set $fcoe
Signature · 1 line
1.8.5.2
#36 lore raw

PATCH 31/42 95fcoe: Store current configuration in dracut cmdline

In reply to a message not in the archive

From: Hannes Reinecke <[email protected]>

When running with --hostonly-cmdline we should be storing the current configuration in /etc/cmdline.d so that dracut will be configure the system automatically.

References: bnc#877288

---
 modules.d/95fcoe/module-setup.sh | 52 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 52 insertions(+)
modules.d/95fcoe/module-setup.sh +52 -0
index b67aa04..174745a 100755
@@ -2,7 +2,16 @@
 
 # called by dracut
 check() {
+    [[ $hostonly ]] || [[ $mount_needs ]] && {
+        for c in /sys/bus/fcoe/devices/ctlr_* ; do
+            [ -L $c ] || continue
+            fcoe_ctlr=$c
+        done
+        [ -z "$fcoe_ctlr" ] && return 255
+    }
+
     require_binaries dcbtool fipvlan lldpad ip readlink || return 1
+
     return 0
 }
 
@@ -17,12 +26,55 @@ installkernel() {
     instmods fcoe 8021q edd
 }
 
+get_vlan_parent() {
+    local link=$1
+
+    [ -d $link ] || return
+    read iflink < $link/iflink
+    for if in /sys/class/net/* ; do
+	read idx < $if/ifindex
+	if [ $idx -eq $iflink ] ; then
+	    echo ${if##*/}
+	fi
+    done
+}
+
+# called by dracut
+cmdline() {
+
+    for c in /sys/bus/fcoe/devices/ctlr_* ; do
+        [ -L $c ] || continue
+        read enabled < $c/enabled
+        [ $enabled -eq 0 ] && continue
+        d=$(cd -P $c; echo $PWD)
+        i=${d%/*}
+        read mac < ${i}/address
+        s=$(dcbtool gc ${i##*/} dcb | sed -n 's/^DCB State:\t*\(.*\)/\1/p')
+        if [ -z "$s" ] ; then
+	    p=$(get_vlan_parent ${i})
+	    if [ "$p" ] ; then
+	        s=$(dcbtool gc ${p} dcb | sed -n 's/^DCB State:\t*\(.*\)/\1/p')
+	    fi
+        fi
+        if [ "$s" = "on" ] ; then
+	    dcb="dcb"
+        else
+	    dcb="nodcb"
+        fi
+        echo "fcoe=${mac}:${dcb}"
+    done
+}
+
 # called by dracut
 install() {
     inst_multiple ip dcbtool fipvlan lldpad readlink lldptool
 
     mkdir -m 0755 -p "$initdir/var/lib/lldpad"
 
+    if [[ $hostonly_cmdline == "yes" ]] ; then
+        local _fcoeconf=$(cmdline)
+        [[ $_fcoeconf ]] && printf "%s\n" "$_fcoeconf" >> "${initdir}/etc/cmdline.d/95fcoe.conf"
+    fi
     inst "$moddir/fcoe-up.sh" "/sbin/fcoe-up"
     inst "$moddir/fcoe-edd.sh" "/sbin/fcoe-edd"
     inst "$moddir/fcoe-genrules.sh" "/sbin/fcoe-genrules.sh"
Signature · 1 line
1.8.5.2

A message that is not in the archive (sent off-list or not yet received): 1418309193-11208-32-git-send-email-trenn-l3A5Bk7waGM@public.gmane.org

#38 lore raw

Re: [PATCH 31/42] 95fcoe: Store current configuration in dracut cmdline

Quoted 67 lines · Thomas Renninger

From: Hannes Reinecke <[email protected]>

When running with --hostonly-cmdline we should be storing the current configuration in /etc/cmdline.d so that dracut will be configure the system automatically.

References: bnc#877288

---
 modules.d/95fcoe/module-setup.sh | 52 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 52 insertions(+)
modules.d/95fcoe/module-setup.sh +37 -0
index b67aa04..174745a 100755
@@ -2,7 +2,16 @@
 
 # called by dracut
 check() {
+    [[ $hostonly ]] || [[ $mount_needs ]] && {
+        for c in /sys/bus/fcoe/devices/ctlr_* ; do
+            [ -L $c ] || continue
+            fcoe_ctlr=$c
+        done
+        [ -z "$fcoe_ctlr" ] && return 255
+    }
+
     require_binaries dcbtool fipvlan lldpad ip readlink || return 1
+
     return 0
 }
 
@@ -17,12 +26,55 @@ installkernel() {
     instmods fcoe 8021q edd
 }
 
+get_vlan_parent() {
+    local link=$1
+
+    [ -d $link ] || return
+    read iflink < $link/iflink
+    for if in /sys/class/net/* ; do
+	read idx < $if/ifindex
+	if [ $idx -eq $iflink ] ; then
+	    echo ${if##*/}
+	fi
+    done
+}
+
+# called by dracut
+cmdline() {
+
+    for c in /sys/bus/fcoe/devices/ctlr_* ; do
+        [ -L $c ] || continue
+        read enabled < $c/enabled
+        [ $enabled -eq 0 ] && continue
+        d=$(cd -P $c; echo $PWD)
+        i=${d%/*}
+        read mac < ${i}/address
+        s=$(dcbtool gc ${i##*/} dcb | sed -n 's/^DCB State:\t*\(.*\)/\1/p')
+        if [ -z "$s" ] ; then
+	    p=$(get_vlan_parent ${i})
+	    if [ "$p" ] ; then
+	        s=$(dcbtool gc ${p} dcb | sed -n 's/^DCB State:\t*\(.*\)/\1/p')

modules.d/95fcoe/module-setup.sh installkernel() { · line 66

Quoted 10 lines
modules.d/95fcoe/module-setup.sh +10 -0
+	    fi
+        fi
+        if [ "$s" = "on" ] ; then
+	    dcb="dcb"
+        else
+	    dcb="nodcb"
+        fi
+        echo "fcoe=${mac}:${dcb}"
+    done
+}

Hi Thomas,

Why do you need to do this? Usually a module should do the work based on its functionality. According to your change, how does a user specify NIC or vlan they only want to bring up?

Thanks
Baoquan

Quoted 21 lines
modules.d/95fcoe/module-setup.sh +5 -0
+
 # called by dracut
 install() {
     inst_multiple ip dcbtool fipvlan lldpad readlink lldptool
 
     mkdir -m 0755 -p "$initdir/var/lib/lldpad"
 
+    if [[ $hostonly_cmdline == "yes" ]] ; then
+        local _fcoeconf=$(cmdline)
+        [[ $_fcoeconf ]] && printf "%s\n" "$_fcoeconf" >> "${initdir}/etc/cmdline.d/95fcoe.conf"
+    fi
     inst "$moddir/fcoe-up.sh" "/sbin/fcoe-up"
     inst "$moddir/fcoe-edd.sh" "/sbin/fcoe-edd"
     inst "$moddir/fcoe-genrules.sh" "/sbin/fcoe-genrules.sh"
Signature · 6 lines
1.8.5.2

--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 20141212030201.GD1678-je1gSBvt1Tcx0jIIkfS+Ph/[email protected]

#40 lore raw

Re: [PATCH 31/42] 95fcoe: Store current configuration in dracut cmdline

Quoted 81 lines · Baoquan He
Quoted 67 lines · Thomas Renninger

From: Hannes Reinecke <[email protected]>

When running with --hostonly-cmdline we should be storing the current configuration in /etc/cmdline.d so that dracut will be configure the system automatically.

References: bnc#877288

---
 modules.d/95fcoe/module-setup.sh | 52 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 52 insertions(+)
modules.d/95fcoe/module-setup.sh +37 -0
index b67aa04..174745a 100755
@@ -2,7 +2,16 @@
 
 # called by dracut
 check() {
+    [[ $hostonly ]] || [[ $mount_needs ]] && {
+        for c in /sys/bus/fcoe/devices/ctlr_* ; do
+            [ -L $c ] || continue
+            fcoe_ctlr=$c
+        done
+        [ -z "$fcoe_ctlr" ] && return 255
+    }
+
     require_binaries dcbtool fipvlan lldpad ip readlink || return 1
+
     return 0
 }
 
@@ -17,12 +26,55 @@ installkernel() {
     instmods fcoe 8021q edd
 }
 
+get_vlan_parent() {
+    local link=$1
+
+    [ -d $link ] || return
+    read iflink < $link/iflink
+    for if in /sys/class/net/* ; do
+	read idx < $if/ifindex
+	if [ $idx -eq $iflink ] ; then
+	    echo ${if##*/}
+	fi
+    done
+}
+
+# called by dracut
+cmdline() {
+
+    for c in /sys/bus/fcoe/devices/ctlr_* ; do
+        [ -L $c ] || continue
+        read enabled < $c/enabled
+        [ $enabled -eq 0 ] && continue
+        d=$(cd -P $c; echo $PWD)
+        i=${d%/*}
+        read mac < ${i}/address
+        s=$(dcbtool gc ${i##*/} dcb | sed -n 's/^DCB State:\t*\(.*\)/\1/p')
+        if [ -z "$s" ] ; then
+	    p=$(get_vlan_parent ${i})
+	    if [ "$p" ] ; then
+	        s=$(dcbtool gc ${p} dcb | sed -n 's/^DCB State:\t*\(.*\)/\1/p')

modules.d/95fcoe/module-setup.sh installkernel() { · line 66

Quoted 10 lines
modules.d/95fcoe/module-setup.sh +10 -0
+	    fi
+        fi
+        if [ "$s" = "on" ] ; then
+	    dcb="dcb"
+        else
+	    dcb="nodcb"
+        fi
+        echo "fcoe=${mac}:${dcb}"
+    done
+}

Hi Thomas,

Quoted 4 lines

Why do you need to do this? Usually a module should do the work based on its functionality. According to your change, how does a user specify NIC or vlan they only want to bring up?

You don't. The current code checking for DCBx capabilities, and sets a default for that.
The FCoE mac address is basically fixed (derived from the network MAC address), and the VLAN is given by the DCBx information. If DCB is not running there's a fair chance you're FCoE connection won't run reliably, neither.
(Intel claims it FCoE would run without DCB in a Peer-to-Peer connection, but I've never seen that in real life).

Cheers,

Hannes

Signature · 4 lines
Dr. Hannes Reinecke		      zSeries & Storage
[email protected]			      +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: J. Hawn, J. Guild, F. Imendörffer, HRB 21284 (AG Nürnberg)
#41 lore raw

PATCH 32/42 95fcoe: skip VLAN devices in fcoe-up

In reply to a message not in the archive

From: Hannes Reinecke <[email protected]>

DCB & fipvlan can only be called on real devices, not VLAN ones. So skip any VLAN devices which might been added to the list of network interfaces.

References: bnc#878583

---
 modules.d/95fcoe/fcoe-up.sh | 8 ++++++++
 1 file changed, 8 insertions(+)
modules.d/95fcoe/fcoe-up.sh +8 -0
index b9d0411..7f6eb1b 100755
@@ -16,6 +16,14 @@ type ip_to_var >/dev/null 2>&1 || . /lib/net-lib.sh
 netif=$1
 dcb=$2
 
+iflink=$(cat /sys/class/net/$netif/iflink)
+ifindex=$(cat /sys/class/net/$netif/ifindex)
+if [ "$iflink" != "$ifindex" ] ; then
+    # Skip VLAN devices
+    exit 0
+fi
+
+ip link set dev $netif up
 linkup "$netif"
 
 netdriver=$(readlink -f /sys/class/net/$netif/device/driver)
Signature · 1 line
1.8.5.2
#42 lore raw

PATCH 33/42 95fcoe: start lldpad separately

In reply to a message not in the archive

From: Hannes Reinecke <[email protected]>

lldpad is a system-wide process, which must be started only once. So we should be separate it from fcoe-up, as it might be called several times.

---
 modules.d/95fcoe/fcoe-up.sh      |  8 --------
 modules.d/95fcoe/lldpad.sh       | 14 ++++++++++++++
 modules.d/95fcoe/module-setup.sh |  1 +
 3 files changed, 15 insertions(+), 8 deletions(-)
 create mode 100644 modules.d/95fcoe/lldpad.sh
modules.d/95fcoe/fcoe-up.sh +0 -8
index 7f6eb1b..43a0ad5 100755
@@ -30,10 +30,6 @@ netdriver=$(readlink -f /sys/class/net/$netif/device/driver)
 netdriver=${netdriver##*/}
 
 if [ "$dcb" = "dcb" ]; then
-    # Note lldpad will stay running after switchroot, the system initscripts
-    # are to kill it and start a new lldpad to take over. Data is transfered
-    # between the 2 using a shm segment
-    lldpad -d
     # wait for lldpad to be ready
     i=0
     while [ $i -lt 60 ]; do
@@ -43,10 +39,6 @@ if [ "$dcb" = "dcb" ]; then
         i=$(($i+1))
     done
 
-    # on some systems lldpad needs some time
-    # sleep until we find a better solution
-    sleep 30
-
     while [ $i -lt 60 ]; do
         dcbtool sc "$netif" dcb on && break
         info "Retrying to turn dcb on"
modules.d/95fcoe/lldpad.sh new file +14 -0
new file mode 100644
index 0000000..d06a3bd
@@ -0,0 +1,14 @@
+#!/bin/bash
+
+# Note lldpad will stay running after switchroot, the system initscripts
+# are to kill it and start a new lldpad to take over. Data is transfered
+# between the 2 using a shm segment
+lldpad -d
+# wait for lldpad to be ready
+i=0
+while [ $i -lt 60 ]; do
+    lldptool -p && break
+    info "Waiting for lldpad to be ready"
+    sleep 1
+    i=$(($i+1))
+done
modules.d/95fcoe/module-setup.sh +1 -0
index 174745a..9c67f17 100755
@@ -78,6 +78,7 @@ install() {
     inst "$moddir/fcoe-up.sh" "/sbin/fcoe-up"
     inst "$moddir/fcoe-edd.sh" "/sbin/fcoe-edd"
     inst "$moddir/fcoe-genrules.sh" "/sbin/fcoe-genrules.sh"
+    inst_hook pre-trigger 03 "$moddir/lldpad.sh"
     inst_hook cmdline 99 "$moddir/parse-fcoe.sh"
     dracut_need_initqueue
 }
Signature · 1 line
1.8.5.2
#43 lore raw

PATCH 34/42 Enhance suse.conf and debug module example with SUSE-specific settings

In reply to a message not in the archive

SUSE is using specific settings for dracut, so add them to the suse.conf.example file.

Add vi and find to the debug module add some help text to the suse.conf file when and how to use it.

---
 dracut.conf.d/suse.conf.example   | 21 +++++++++++++++++++++
 modules.d/95debug/module-setup.sh |  3 +--
 2 files changed, 22 insertions(+), 2 deletions(-)
dracut.conf.d/suse.conf.example +21 -0
index 1e7f80e..37ffd72 100644
@@ -1,3 +1,24 @@
+# SUSE specifc dracut settings
+#
+# SUSE by default always builds a as small as possible initrd for performance
+# and resource reasons.
+# If you like to build a generic initrd which works on other platforms than
+# on the one dracut/mkinitrd got called comment out below setting(s).
+hostonly="yes"
+hostonly_cmdline="yes"
+
+compress="xz -0 --check=crc32 --memlimit-compress=50%"
+
 i18n_vars="/etc/sysconfig/language:RC_LANG-LANG,RC_LC_ALL-LC_ALL /etc/sysconfig/console:CONSOLE_UNICODEMAP-FONT_UNIMAP,CONSOLE_FONT-FONT,CONSOLE_SCREENMAP-FONT_MAP /etc/sysconfig/keyboard:KEYTABLE-KEYMAP"
 omit_drivers+=" i2o_scsi"
 
+# Below adds additional tools to the initrd which are not urgently necessary to
+# bring up the system, but help to debug problems.
+# See /usr/lib/dracut/modules.d/95debug/module-setup.sh which additional tools
+# are installed and add more if you need them. This specifically helps if you
+# use:
+# rd.break=[cmdline|pre-udev|pre-trigger|initqueue|pre-mount|
+# mount|pre-pivot|cleanup]
+# boot parameter or if you are forced to enter the dracut emergency shell.
+
+# add_dracutmodules+=debug
modules.d/95debug/module-setup.sh +1 -2
index 625f7fb..5a9aaac 100755
@@ -14,8 +14,7 @@ depends() {
 # called by dracut
 install() {
     inst_multiple -o ps grep more cat rm strace free showmount \
-        ping netstat rpcinfo vi scp ping6 ssh \
+        ping netstat rpcinfo vi scp ping6 ssh find vi \
         fsck fsck.ext2 fsck.ext4 fsck.ext3 fsck.ext4dev fsck.vfat e2fsck
-
 }
 
Signature · 1 line
1.8.5.2
#44 lore raw

PATCH 35/42 40network: add missing _arch variable declaration

In reply to a message not in the archive

From: Hannes Reinecke <[email protected]>

The module_setup.sh script was missing an '_arch' declaration, causing network not to be installed on s390.

---
 modules.d/40network/module-setup.sh | 1 +
 1 file changed, 1 insertion(+)
modules.d/40network/module-setup.sh +1 -0
index 55bee4c..f7e0a87 100755
@@ -17,6 +17,7 @@ depends() {
 # called by dracut
 installkernel() {
     # Include wired net drivers, excluding wireless
+    local _arch=$(uname -m)
 
     net_module_filter() {
         local _net_drivers='eth_type_trans|register_virtio_device|usbnet_open'
Signature · 1 line
1.8.5.2
#45 lore raw

PATCH 36/42 99base: Add chown binary

In reply to a message not in the archive

From: Hannes Reinecke <[email protected]>

nvidia driver needs this via modprobe script.
Needs to do change the group after a device node got created. Add chown instead of chgrp which can also change the owner of a file.

Ask Stefand Dirsch <[email protected]> for details.

---
 modules.d/99base/module-setup.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
modules.d/99base/module-setup.sh +1 -1
index 7d30320..a1046af 100755
@@ -15,7 +15,7 @@ depends() {
 install() {
     local _d
 
-    inst_multiple mount mknod mkdir sleep chroot \
+    inst_multiple mount mknod mkdir sleep chroot chown \
         sed ls flock cp mv dmesg rm ln rmmod mkfifo umount readlink setsid
     inst $(command -v modprobe) /sbin/modprobe
 
Signature · 1 line
1.8.5.2
#46 lore raw

PATCH 37/42 90kernel-modules: install scsi_dh_alua

In reply to a message not in the archive

From: Hannes Reinecke <[email protected]>

Install the missing scsi_dh_alua module, too.

References: bnc#871617

---
 modules.d/90kernel-modules/module-setup.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
modules.d/90kernel-modules/module-setup.sh +1 -1
index 2fa263c..1a8fcff 100755
@@ -41,7 +41,7 @@ installkernel() {
             uhci-hcd \
             xhci-hcd
 
-        instmods yenta_socket scsi_dh_rdac scsi_dh_emc \
+        instmods yenta_socket scsi_dh_rdac scsi_dh_emc scsi_dh_alua \
             atkbd i8042 usbhid hid-apple hid-sunplus hid-cherry hid-logitech \
             hid-logitech-dj hid-microsoft hid-lcpower firewire-ohci \
             pcmcia hid-hyperv hv-vmbus hyperv-keyboard
Signature · 1 line
1.8.5.2
#47 lore raw

PATCH 38/42 Fix non-export of journal dev boot options.

In reply to a message not in the archive

From: Thorsten Behrens <tbehrens-IBi9RG/[email protected]>

cmdline_journal does not contain linefeeds anymore, so read silently skipped it altogether.

---
 modules.d/95rootfs-block/module-setup.sh | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
modules.d/95rootfs-block/module-setup.sh +2 -3
index 258b32f..c2f71bb 100755
@@ -43,9 +43,8 @@ cmdline() {
 # called by dracut
 install() {
     if [[ $hostonly_cmdline == "yes" ]]; then
-        cmdline_journal | while read journaldev; do
-            [[ $journaldev ]] && printf "%s\n" "$journaldev" >> "${initdir}/etc/cmdline.d/95root-journaldev.conf"
-        done
+        local _journaldev=$(cmdline_journal)
+        [[ $_journaldev ]] && printf "%s\n" "$_journaldev" >> "${initdir}/etc/cmdline.d/95root-journaldev.conf"
     fi
 
     inst_multiple umount
Signature · 1 line
1.8.5.2
#48 lore raw

PATCH 39/42 Also export root= boot param for hostonly-cmdline case.

In reply to a message not in the archive

From: Thorsten Behrens <tbehrens-IBi9RG/[email protected]>

If there's a root fallback, at least attempt to have it falling back to the last root filesystem this system ran off of.

---
 modules.d/95rootfs-block/module-setup.sh | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
modules.d/95rootfs-block/module-setup.sh +8 -2
index c2f71bb..81de177 100755
@@ -29,14 +29,18 @@ cmdline_journal() {
     return 0
 }
 
-# called by dracut
-cmdline() {
+cmdline_rootfs() {
     local dev=/dev/block/$(find_root_block_device)
     if [ -e $dev ]; then
         printf " root=%s" "$(shorten_persistent_dev "$(get_persistent_dev "$dev")")"
         printf " rootflags=%s" "$(find_mp_fsopts /)"
         printf " rootfstype=%s" "$(find_mp_fstype /)"
     fi
+}
+
+# called by dracut
+cmdline() {
+    cmdline_rootfs
     cmdline_journal
 }
 
@@ -45,6 +49,8 @@ install() {
     if [[ $hostonly_cmdline == "yes" ]]; then
         local _journaldev=$(cmdline_journal)
         [[ $_journaldev ]] && printf "%s\n" "$_journaldev" >> "${initdir}/etc/cmdline.d/95root-journaldev.conf"
+        local _rootdev=$(cmdline_rootfs)
+        [[ $_rootdev ]] && printf "%s\n" "$_rootdev" >> "${initdir}/etc/cmdline.d/95root-dev.conf"
     fi
 
     inst_multiple umount
Signature · 1 line
1.8.5.2
#49 lore raw

PATCH 40/42 Don't create lots of empty cmdline files for hostonly-cmdline case

In reply to a message not in the archive

From: Thorsten Behrens <tbehrens-IBi9RG/[email protected]>

This aligns other places piping cmdline() output to cmdline.d files with the earlier fix for 95rootfs-block.

---
 modules.d/90crypt/module-setup.sh  | 4 ++--
 modules.d/90dmraid/module-setup.sh | 4 ++--
 modules.d/90lvm/module-setup.sh    | 4 ++--
 modules.d/90mdraid/module-setup.sh | 4 ++--
 modules.d/95resume/module-setup.sh | 4 ++--
 5 files changed, 10 insertions(+), 10 deletions(-)
modules.d/90crypt/module-setup.sh +2 -2
index 37ae859..ea1e340 100755
@@ -50,8 +50,8 @@ cmdline() {
 install() {
 
     if [[ $hostonly_cmdline == "yes" ]]; then
-        cmdline >> "${initdir}/etc/cmdline.d/90crypt.conf"
-        echo >> "${initdir}/etc/cmdline.d/90crypt.conf"
+        local _cryptconf=$(cmdline)
+        [[ $_cryptconf ]] && printf "%s\n" "$_cryptconf" >> "${initdir}/etc/cmdline.d/90crypt.conf"
     fi
 
     inst_multiple cryptsetup rmdir readlink umount
modules.d/90dmraid/module-setup.sh +2 -2
index 508598b..044e01f 100755
@@ -64,8 +64,8 @@ install() {
     local _i
 
     if [[ $hostonly_cmdline == "yes" ]]; then
-        cmdline >> "${initdir}/etc/cmdline.d/90dmraid.conf"
-        echo >> "${initdir}/etc/cmdline.d/90dmraid.conf"
+        local _raidconf=$(cmdline)
+        [[ $_raidconf ]] && printf "%s\n" "$_raidconf" >> "${initdir}/etc/cmdline.d/90dmraid.conf"
     fi
 
     inst_multiple dmraid
modules.d/90lvm/module-setup.sh +2 -2
index 5515ac0..592a2e2 100755
@@ -53,8 +53,8 @@ install() {
     inst lvm
 
     if [[ $hostonly_cmdline == "yes" ]]; then
-        cmdline >> "${initdir}/etc/cmdline.d/90lvm.conf"
-        echo >> "${initdir}/etc/cmdline.d/90lvm.conf"
+        local _lvmconf=$(cmdline)
+        [[ $_lvmconf ]] && printf "%s\n" "$_lvmconf" >> "${initdir}/etc/cmdline.d/90lvm.conf"
     fi
 
     inst_rules "$moddir/64-lvm.rules"
modules.d/90mdraid/module-setup.sh +2 -2
index ce3394a..747ea8a 100755
@@ -71,8 +71,8 @@ install() {
     inst $(command -v mdadm) /sbin/mdadm
 
     if [[ $hostonly_cmdline == "yes" ]]; then
-        cmdline  >> "${initdir}/etc/cmdline.d/90mdraid.conf"
-        echo  >> "${initdir}/etc/cmdline.d/90mdraid.conf"
+        local _raidconf=$(cmdline)
+        [[ $_raidconf ]] && printf "%s\n" "$_raidconf" >> "${initdir}/etc/cmdline.d/90mdraid.conf"
     fi
 
     # <mdadm-3.3 udev rule
modules.d/95resume/module-setup.sh +2 -2
index 1ddb6e4..dfd4350 100755
@@ -29,8 +29,8 @@ install() {
     local _bin
 
     if [[ $hostonly_cmdline == "yes" ]]; then
-        cmdline  >> "${initdir}/etc/cmdline.d/95resume.conf"
-        echo  >> "${initdir}/etc/cmdline.d/95resume.conf"
+	local _resumeconf=$(cmdline)
+	[[ $_resumeconf ]] && printf "%s\n" "$_resumeconf" >> "${initdir}/etc/cmdline.d/95resume.conf"
     fi
 
     # Optional uswsusp support
Signature · 1 line
1.8.5.2
#50 lore raw

PATCH 41/42 95rootfs-block: Correctly terminate commandline parameter

In reply to a message not in the archive

From: Hannes Reinecke <[email protected]>

95rootfs-block would not terminate the commandline parameter with a space or newline, instead it'll rely on the main routine from dracut.sh to do this.
Which will cause unexpected problems for any modules called after this.

So terminate the commandline parameters correctly here and remove the newline from dracut.sh.

---
 dracut.sh                                | 1 -
 modules.d/95rootfs-block/module-setup.sh | 8 ++++----
 2 files changed, 4 insertions(+), 5 deletions(-)
dracut.sh +0 -1
index 2eba19b..f384d2d 100755
@@ -1299,7 +1299,6 @@ if [[ $print_cmdline ]]; then
         module_cmdline "$_d_mod"
     done
     unset moddir
-    printf "\n"
     exit 0
 fi
 
modules.d/95rootfs-block/module-setup.sh +4 -4
index 81de177..33875f8 100755
@@ -22,7 +22,7 @@ cmdline_journal() {
             fi
 
             if [ -n "$journaldev" ]; then
-                printf " root.journaldev=%s" "$journaldev"
+                echo "root.journaldev=${journaldev}"
             fi
         done
     fi
@@ -32,9 +32,9 @@ cmdline_journal() {
 cmdline_rootfs() {
     local dev=/dev/block/$(find_root_block_device)
     if [ -e $dev ]; then
-        printf " root=%s" "$(shorten_persistent_dev "$(get_persistent_dev "$dev")")"
-        printf " rootflags=%s" "$(find_mp_fsopts /)"
-        printf " rootfstype=%s" "$(find_mp_fstype /)"
+        printf "root=%s" "$(shorten_persistent_dev "$(get_persistent_dev "$dev")")"
+        printf "rootflags=%s" "$(find_mp_fsopts /)"
+        printf "rootfstype=%s\n" "$(find_mp_fstype /)"
     fi
 }
 
Signature · 1 line
1.8.5.2

A message that is not in the archive (sent off-list or not yet received): 1418309193-11208-42-git-send-email-trenn-l3A5Bk7waGM@public.gmane.org

#52 lore raw

Re: [PATCH 41/42] 95rootfs-block: Correctly terminate commandline parameter

I reverted this patch.

$ ./dracut.sh -l --print-cmdline
root=UUID=d5e53483-30bc-4119-8c0c-841d47a2f76brootflags=rw,noatime,compress=lzo,ssd,discard,space_cache,autodefrag,inode_cacherootfstype=btrfs

instead of:

$ ./dracut.sh -l --print-cmdline
 root=UUID=d5e53483-30bc-4119-8c0c-841d47a2f76b
rootflags=rw,noatime,compress=lzo,ssd,discard,space_cache,autodefrag,inode_cache rootfstype=btrfs

and also

$ make testimage
…
 *** Store current command line parameters ***
Stored kernel commandline:
root=UUID=d5e53483-30bc-4119-8c0c-841d47a2f76brootflags=rw,noatime,compress=lzo,ssd,discard,space_cache,autodefrag,inode_cacherootfstype=btrfs
…
Quoted 57 lines · Thomas Renninger

From: Hannes Reinecke <[email protected]>

95rootfs-block would not terminate the commandline parameter with a space or newline, instead it'll rely on the main routine from dracut.sh to do this.
Which will cause unexpected problems for any modules called after this.

So terminate the commandline parameters correctly here and remove the newline from dracut.sh.

---
 dracut.sh                                | 1 -
 modules.d/95rootfs-block/module-setup.sh | 8 ++++----
 2 files changed, 4 insertions(+), 5 deletions(-)
dracut.sh +0 -1
index 2eba19b..f384d2d 100755
@@ -1299,7 +1299,6 @@ if [[ $print_cmdline ]]; then
         module_cmdline "$_d_mod"
     done
     unset moddir
-    printf "\n"
     exit 0
 fi
 
modules.d/95rootfs-block/module-setup.sh +4 -4
index 81de177..33875f8 100755
@@ -22,7 +22,7 @@ cmdline_journal() {
             fi
 
             if [ -n "$journaldev" ]; then
-                printf " root.journaldev=%s" "$journaldev"
+                echo "root.journaldev=${journaldev}"
             fi
         done
     fi
@@ -32,9 +32,9 @@ cmdline_journal() {
 cmdline_rootfs() {
     local dev=/dev/block/$(find_root_block_device)
     if [ -e $dev ]; then
-        printf " root=%s" "$(shorten_persistent_dev "$(get_persistent_dev "$dev")")"
-        printf " rootflags=%s" "$(find_mp_fsopts /)"
-        printf " rootfstype=%s" "$(find_mp_fstype /)"
+        printf "root=%s" "$(shorten_persistent_dev "$(get_persistent_dev "$dev")")"
+        printf "rootflags=%s" "$(find_mp_fsopts /)"
+        printf "rootfstype=%s\n" "$(find_mp_fstype /)"
     fi
 }
 

A message that is not in the archive (sent off-list or not yet received): [email protected]

#54 lore raw

Re: [PATCH 41/42] 95rootfs-block: Correctly terminate commandline parameter

Quoted 11 lines · Harald Hoyer

I reverted this patch.

$ ./dracut.sh -l --print-cmdline
root=UUID=d5e53483-30bc-4119-8c0c-841d47a2f76brootflags=rw,noatime,compress=lzo,ssd,discard,space_cache,autodefrag,inode_cacherootfstype=btrfs

instead of:

$ ./dracut.sh -l --print-cmdline
 root=UUID=d5e53483-30bc-4119-8c0c-841d47a2f76b
rootflags=rw,noatime,compress=lzo,ssd,discard,space_cache,autodefrag,inode_cache rootfstype=btrfs
Quoted 9 lines

and also

$ make testimage
…
 *** Store current command line parameters ***
Stored kernel commandline:
root=UUID=d5e53483-30bc-4119-8c0c-841d47a2f76brootflags=rw,noatime,compress=lzo,ssd,discard,space_cache,autodefrag,inode_cacherootfstype=btrfs
…

Any specific reason for this?
Errors, failures?

Cheers,

Hannes

Signature · 5 lines
Dr. Hannes Reinecke		               zSeries & Storage
[email protected]			               +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)

A message that is not in the archive (sent off-list or not yet received): [email protected]

#56 lore raw

Re: [PATCH 41/42] 95rootfs-block: Correctly terminate commandline parameter

Quoted 21 lines · Hannes Reinecke
Quoted 11 lines · Harald Hoyer

I reverted this patch.

$ ./dracut.sh -l --print-cmdline
root=UUID=d5e53483-30bc-4119-8c0c-841d47a2f76brootflags=rw,noatime,compress=lzo,ssd,discard,space_cache,autodefrag,inode_cacherootfstype=btrfs

instead of:

$ ./dracut.sh -l --print-cmdline
 root=UUID=d5e53483-30bc-4119-8c0c-841d47a2f76b
rootflags=rw,noatime,compress=lzo,ssd,discard,space_cache,autodefrag,inode_cache rootfstype=btrfs
Quoted 9 lines

and also

$ make testimage
…
 *** Store current command line parameters ***
Stored kernel commandline:
root=UUID=d5e53483-30bc-4119-8c0c-841d47a2f76brootflags=rw,noatime,compress=lzo,ssd,discard,space_cache,autodefrag,inode_cacherootfstype=btrfs
…
Quoted 2 lines

Any specific reason for this?
Errors, failures?

reread what I wrote above... The parameters are _not_ separated by whitespace and I really don't know, what you wanted to accomplish with your patch. Are newlines missing in your patch?

#57 lore raw

PATCH 42/42 dracut: nbd: Only complain of missing binary in hostonly mode if

In reply to a message not in the archive

rootfs is on nbd

In not hostonly mode, require_binaries will still complain. If in hostonly mode and the module is explicitly added via -a nbd, then install() section will still complain later:
dracut-install: ERROR: installing 'nbd-client'

---
 modules.d/95nbd/module-setup.sh | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
modules.d/95nbd/module-setup.sh +1 -2
index 4f9e350..3cb6f49 100755
@@ -3,8 +3,6 @@
 # called by dracut
 check() {
     local _rootdev
-    # If our prerequisites are not met, fail.
-    require_binaries nbd-client || return 1
 
     # if an nbd device is not somewhere in the chain of devices root is
     # mounted on, fail the hostonly check.
@@ -15,6 +13,7 @@ check() {
         [[ -b /dev/block/$_rootdev ]] || return 1
         check_block_and_slaves is_nbd "$_rootdev" || return 255
     }
+    require_binaries nbd-client || return 1
 
     return 0
 }
Signature · 1 line
1.8.5.2
#58 lore raw
In reply to a message not in the archive
Quoted 19 lines · Thomas Renninger

Hi,

Changes to last post:
- Removed unnecessary IFS variable restoring
- Removed inst_multiple sed and host from nfs module
- Removed warpclock patch/module (according Chao Wang this is done by systemd by copying /etc/{localtime,adjtime} to initramfs)

One cleanup for the future I have in mind:
As udev rules are often moved around in timeline (just the number changes), it would be nice if systemd enforces that udev rules must be unique. That would mean this is forbidden:
01-ruleXXX
05-ruleXXX
Then dracut could implement:
inst_rule ruleXXX
and it would work for all distros and versions.
But this needs clarification with systemd people first.

Quoted 8 lines

Would be great to see as many of these applied already. E.g. mkinitrd-suse: Update to sles12 SUSE state should not be a big deal to apply.

Thanks a lot,

Thomas

Reviewed the patches, added one patch for module handling. Test suite passed!

Pushed! Many thanks!

A message that is not in the archive (sent off-list or not yet received): [email protected]

#60 lore raw
Quoted 6 lines · Harald Hoyer

On 11.12.2014 15:45, Thomas Renninger wrote:

Reviewed the patches, added one patch for module handling. Test suite passed!

Pushed! Many thanks!

Thanks a lot!
Please add me to CC if related problems should get reported, I'll try to help as good as I can...

Hannes mentioned that this one still might be needed:
95rootfs-block: Correctly terminate commandline parameter I can try to reproduce and repost with a new series after cleaning up and moving forward to a latest version (next year).

Those won't be by far that many any more then.

Enjoy Christmas everybody and a happy new year!

Thomas