From 584ae37456d010187f20a908408773dd180bbdb8 Mon Sep 17 00:00:00 2001 From: Renbo Date: Mon, 30 Jan 2023 17:20:20 +0800 Subject: [PATCH] update to dracut-049-218.git20221019.el8_7 Signed-off-by: Renbo --- 0202.patch | 34 +++++++++++++ 0203.patch | 26 ++++++++++ 0204.patch | 55 +++++++++++++++++++++ 0205.patch | 29 +++++++++++ 0206.patch | 140 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 0207.patch | 90 +++++++++++++++++++++++++++++++++ 0208.patch | 54 ++++++++++++++++++++ 0209.patch | 66 +++++++++++++++++++++++++ 0210.patch | 39 +++++++++++++++ 0211.patch | 24 +++++++++ 0212.patch | 39 +++++++++++++++ 0213.patch | 42 ++++++++++++++++ 0214.patch | 55 +++++++++++++++++++++ 0215.patch | 77 +++++++++++++++++++++++++++++ 0216.patch | 44 +++++++++++++++++ 0217.patch | 37 ++++++++++++++ dist | 1 + dracut.spec | 37 +++++++++++++- 18 files changed, 888 insertions(+), 1 deletion(-) create mode 100644 0202.patch create mode 100644 0203.patch create mode 100644 0204.patch create mode 100644 0205.patch create mode 100644 0206.patch create mode 100644 0207.patch create mode 100644 0208.patch create mode 100644 0209.patch create mode 100644 0210.patch create mode 100644 0211.patch create mode 100644 0212.patch create mode 100644 0213.patch create mode 100644 0214.patch create mode 100644 0215.patch create mode 100644 0216.patch create mode 100644 0217.patch create mode 100644 dist diff --git a/0202.patch b/0202.patch new file mode 100644 index 0000000..ba50de6 --- /dev/null +++ b/0202.patch @@ -0,0 +1,34 @@ +From 4b9978afff2a8b084858c630032a3452bdca05c3 Mon Sep 17 00:00:00 2001 +From: Jan Macku +Date: Tue, 15 Feb 2022 16:09:38 +0100 +Subject: [PATCH] ci: Add Differential ShellCheck action + +Related: #2054725 +--- + .github/workflows/differential-shellcheck.yml | 17 +++++++++++++++++ + 1 file changed, 17 insertions(+) + +diff --git a/.github/workflows/differential-shellcheck.yml b/.github/workflows/differential-shellcheck.yml +new file mode 100644 +index 00000000..b8b10eaa +--- /dev/null ++++ b/.github/workflows/differential-shellcheck.yml +@@ -0,0 +1,17 @@ ++name: Differential ShellCheck ++on: ++ pull_request: ++ branches: [main] ++ ++jobs: ++ test: ++ runs-on: ubuntu-20.04 ++ ++ steps: ++ - name: Repository checkout ++ uses: actions/checkout@v3 ++ with: ++ fetch-depth: 0 ++ ++ - name: Differential ShellCheck ++ uses: redhat-plumbers-in-action/differential-shellcheck@v1 + diff --git a/0203.patch b/0203.patch new file mode 100644 index 0000000..716aa8d --- /dev/null +++ b/0203.patch @@ -0,0 +1,26 @@ +From f7663f39ea7858e08597694da329c1c94e778060 Mon Sep 17 00:00:00 2001 +From: Jan Macku +Date: Thu, 23 Jun 2022 13:25:09 +0200 +Subject: [PATCH] (#2054725) ci: Use Differential ShellCheck action `v2` + +differential-shellcheck@v2 uses SARIF format that drastically +improves user experience. + +Related: #2054725 +--- + .github/workflows/differential-shellcheck.yml | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/.github/workflows/differential-shellcheck.yml b/.github/workflows/differential-shellcheck.yml +index b8b10eaa..55273b3d 100644 +--- a/.github/workflows/differential-shellcheck.yml ++++ b/.github/workflows/differential-shellcheck.yml +@@ -14,4 +14,6 @@ jobs: + fetch-depth: 0 + + - name: Differential ShellCheck +- uses: redhat-plumbers-in-action/differential-shellcheck@v1 ++ uses: redhat-plumbers-in-action/differential-shellcheck@v2 ++ with: ++ token: ${{ secrets.GITHUB_TOKEN }} + diff --git a/0204.patch b/0204.patch new file mode 100644 index 0000000..6d59607 --- /dev/null +++ b/0204.patch @@ -0,0 +1,55 @@ +From 93b0bbd54736259792ca77746ac8a6440c3ccd39 Mon Sep 17 00:00:00 2001 +From: The Plumber <50238977+systemd-rhel-bot@users.noreply.github.com> +Date: Thu, 11 Aug 2022 09:49:54 +0200 +Subject: [PATCH] (#1933679) 95iscsi: Fix network setup + +* 95iscsi: Fix network setup code for iscsi + +- The network script and config could be in + "/etc/sysconfig/network-scripts", so try look for network config in + all possible path. + +- The regex used for sed is not working, so fix it too. + +- Make bootproto a local variable + +* Update modules.d/95iscsi/module-setup.sh + +Signed-off-by: Kairui Song +(cherry picked from commit 7b76fa924dfd20d3fd4433baa8292f0112282aac) + +Resolves: #1933679 +--- + modules.d/95iscsi/module-setup.sh | 11 +++++++++-- + 1 file changed, 9 insertions(+), 2 deletions(-) + +diff --git a/modules.d/95iscsi/module-setup.sh b/modules.d/95iscsi/module-setup.sh +index 618d1dc2..5bb97df6 100755 +--- a/modules.d/95iscsi/module-setup.sh ++++ b/modules.d/95iscsi/module-setup.sh +@@ -72,6 +72,7 @@ install_iscsiroot() { + local devpath=$1 + local scsi_path iscsi_lun session c d conn host flash + local iscsi_session iscsi_address iscsi_port iscsi_targetname iscsi_tpgt ++ local bootproto + + scsi_path=${devpath%%/block*} + [ "$scsi_path" = "$devpath" ] && return 1 +@@ -120,8 +121,14 @@ install_iscsiroot() { + 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') + +- #follow ifcfg settings for boot protocol +- bootproto=$(sed -n "/BOOTPROTO/s/BOOTPROTO='\([[:alpha:]]*6\?\)4\?'/\1/p" /etc/sysconfig/network/ifcfg-$ifname) ++ # follow ifcfg settings for boot protocol ++ for _path in \ ++ "/etc/sysconfig/network-scripts/ifcfg-$ifname" \ ++ "/etc/sysconfig/network/ifcfg-$ifname" \ ++ ; do ++ [ -r "$_path" ] && bootproto=$(sed -n "s/BOOTPROTO='\?\([[:alpha:]]*6\?\)4\?/\1/p" "$_path") ++ done ++ + if [ $bootproto ]; then + printf 'ip=%s:%s ' ${ifname} ${bootproto} + else + diff --git a/0205.patch b/0205.patch new file mode 100644 index 0000000..d569b84 --- /dev/null +++ b/0205.patch @@ -0,0 +1,29 @@ +From 4db9f93bde030993f2777a4dacfcb72cab387b43 Mon Sep 17 00:00:00 2001 +From: David Tardon +Date: Mon, 14 Mar 2022 10:48:44 +0100 +Subject: [PATCH] fix(dracut-systemd): correct service dependencies + +dracut-systemd.service is not an early boot service, therefore it should +not use DefaultDependencies=no. This also fixes the service's ordering +dependencies, as in its current state it is missing +Before=shutdown.target umount.target + +Resolves: #1924587, #1717323 +--- + modules.d/98dracut-systemd/dracut-shutdown.service | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/modules.d/98dracut-systemd/dracut-shutdown.service b/modules.d/98dracut-systemd/dracut-shutdown.service +index 81043b2d..b7324586 100644 +--- a/modules.d/98dracut-systemd/dracut-shutdown.service ++++ b/modules.d/98dracut-systemd/dracut-shutdown.service +@@ -7,8 +7,6 @@ Description=Restore /run/initramfs on shutdown + Documentation=man:dracut-shutdown.service(8) + After=local-fs.target boot.mount boot.automount + Wants=local-fs.target +-Conflicts=shutdown.target umount.target +-DefaultDependencies=no + ConditionPathExists=!/run/initramfs/bin/sh + + [Service] + diff --git a/0206.patch b/0206.patch new file mode 100644 index 0000000..8340c91 --- /dev/null +++ b/0206.patch @@ -0,0 +1,140 @@ +From d5027d43ea3969426ba64423b3c0bb38491cc880 Mon Sep 17 00:00:00 2001 +From: Tao Liu +Date: Fri, 10 Jun 2022 16:39:31 +0800 +Subject: [PATCH] feat(lvm): add new module lvmthinpool-monitor + +Previously dracut didn't support the feature of lvm thinpool autoextend. + +The feature is useful to cases such as kdump, when vmcore to be saved to a +lvm thin volume. The thinpool should be able to autoextend, otherwise an +IO error will be caused and leaves an incomplete vmcore. + +There is lvm2-monitor.service and dmeventd avaliable, however +considering [1], it is not suitable for kdump and memory limited cases. + +This patch achieves the same by parallel looping a shell function in the +background, which calls lvextend periodically. If thredshold reaches, +autoextend it, if not then nothing happens. + +[1]: https://lists.fedoraproject.org/archives/list/kexec@lists.fedoraproject.org/message/YF254ZO3PJ3U56P4OKHV3JNYP2PJUMYX/ + +Signed-off-by: Tao Liu + +Resolves: #2098502 +--- + dracut.spec | 1 + + modules.d/80lvmthinpool-monitor/module-setup.sh | 24 +++++++++++++ + .../start-thinpool-monitor.service | 14 ++++++++ + .../start-thinpool-monitor.sh | 41 ++++++++++++++++++++++ + 4 files changed, 80 insertions(+) + +diff --git a/dracut.spec b/dracut.spec +index c8783699..e1c22256 100644 +--- a/dracut.spec ++++ b/dracut.spec +@@ -350,6 +350,7 @@ echo 'dracut_rescue_image="yes"' > $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/ + %{dracutlibdir}/modules.d/50drm + %{dracutlibdir}/modules.d/50plymouth + %{dracutlibdir}/modules.d/80lvmmerge ++%{dracutlibdir}/modules.d/80lvmthinpool-monitor + %{dracutlibdir}/modules.d/90btrfs + %{dracutlibdir}/modules.d/90crypt + %{dracutlibdir}/modules.d/90dm +diff --git a/modules.d/80lvmthinpool-monitor/module-setup.sh b/modules.d/80lvmthinpool-monitor/module-setup.sh +new file mode 100755 +index 00000000..ca015bdc +--- /dev/null ++++ b/modules.d/80lvmthinpool-monitor/module-setup.sh +@@ -0,0 +1,24 @@ ++#!/bin/bash ++ ++# called by dracut ++check() { ++ # No point trying to support lvm if the binaries are missing ++ require_binaries lvm sort tr awk || return 1 ++ ++ return 255 ++} ++ ++# called by dracut ++depends() { ++ echo lvm ++ return 0 ++} ++ ++# called by dracut ++install() { ++ inst_multiple sort tr awk ++ inst_script "$moddir/start-thinpool-monitor.sh" "/bin/start-thinpool-monitor" ++ ++ inst "$moddir/start-thinpool-monitor.service" "$systemdsystemunitdir/start-thinpool-monitor.service" ++ $SYSTEMCTL -q --root "$initdir" add-wants initrd.target start-thinpool-monitor.service ++} +diff --git a/modules.d/80lvmthinpool-monitor/start-thinpool-monitor.service b/modules.d/80lvmthinpool-monitor/start-thinpool-monitor.service +new file mode 100644 +index 00000000..97f5f1f4 +--- /dev/null ++++ b/modules.d/80lvmthinpool-monitor/start-thinpool-monitor.service +@@ -0,0 +1,14 @@ ++[Unit] ++Description=Lvm thinpool monitor service ++Before=initrd.target ++After=initrd-fs.target ++Conflicts=shutdown.target emergency.target ++ ++[Service] ++Type=forking ++ExecStart=/bin/start-thinpool-monitor ++PIDFile=/run/thinpool-moni.pid ++StandardInput=null ++StandardOutput=journal+console ++StandardError=journal+console ++KillSignal=SIGHUP +diff --git a/modules.d/80lvmthinpool-monitor/start-thinpool-monitor.sh b/modules.d/80lvmthinpool-monitor/start-thinpool-monitor.sh +new file mode 100755 +index 00000000..75d8eada +--- /dev/null ++++ b/modules.d/80lvmthinpool-monitor/start-thinpool-monitor.sh +@@ -0,0 +1,41 @@ ++#!/bin/sh ++ ++type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh ++ ++LVS=$(getargs rd.lvm.lv -d rd_LVM_LV=) ++ ++is_lvm2_thinp_device() { ++ _device_path=$1 ++ _lvm2_thin_device=$(lvm lvs -S 'lv_layout=sparse && lv_layout=thin' \ ++ --nosuffix --noheadings -o vg_name,lv_name "$_device_path" 2> /dev/null) ++ ++ [ -n "$_lvm2_thin_device" ] && return $? ++} ++ ++for LV in $LVS; do ++ if is_lvm2_thinp_device "/dev/$LV"; then ++ THIN_POOLS="$(lvm lvs -S 'lv_layout=sparse && lv_layout=thin' \ ++ --nosuffix --noheadings -o vg_name,pool_lv "$LV" \ ++ | awk '{printf("%s/%s",$1,$2);}') $THIN_POOLS" ++ fi ++done ++ ++THIN_POOLS=$(echo "$THIN_POOLS" | tr ' ' '\n' | sort -u | tr '\n' ' ') ++ ++if [ -n "$THIN_POOLS" ]; then ++ if [ -e "/etc/lvm/lvm.conf" ]; then ++ # Use 'monitoring=0' to override the value in lvm.conf, in case ++ # dmeventd monitoring been started after the calling. ++ CONFIG="activation {monitoring=0}" ++ else ++ CONFIG="activation {monitoring=0 thin_pool_autoextend_threshold=70 thin_pool_autoextend_percent=20}" ++ fi ++ ++ while true; do ++ for THIN_POOL in $THIN_POOLS; do ++ lvm lvextend --use-policies --config "$CONFIG" "$THIN_POOL" ++ done ++ sleep 5 ++ done & ++ echo $! > /run/thinpool-moni.pid ++fi + diff --git a/0207.patch b/0207.patch new file mode 100644 index 0000000..1ad6684 --- /dev/null +++ b/0207.patch @@ -0,0 +1,90 @@ +From ec2e4e70a1037b2df535e48ef7389b7b76b5a29a Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Renaud=20M=C3=A9trich?= +Date: Thu, 13 Jan 2022 17:35:59 +0100 +Subject: [PATCH] fix(dracut-shutdown): add cleanup handler on failure + +It may happen that dracut-shutdown.service fails, for example on timeout +due to very low bandwidth. +In such case, for hardening purposes, a new dracut-shutdown-onfailure.service +unit doing dracut-shutdown.service cleanup needs to execute to make sure +switching root to an incomplete initramfs won't occur later. + +Resolves: #1924587 +--- + Makefile | 1 + + dracut.spec | 1 + + .../98dracut-systemd/dracut-shutdown-onfailure.service | 13 +++++++++++++ + modules.d/98dracut-systemd/dracut-shutdown.service | 1 + + modules.d/98dracut-systemd/dracut-shutdown.service.8.asc | 3 +++ + 5 files changed, 19 insertions(+) + +diff --git a/Makefile b/Makefile +index 503d069f..1c0f48ad 100644 +--- a/Makefile ++++ b/Makefile +@@ -142,6 +142,7 @@ ifneq ($(enable_documentation),no) + endif + if [ -n "$(systemdsystemunitdir)" ]; then \ + mkdir -p $(DESTDIR)$(systemdsystemunitdir); \ ++ ln -srf $(DESTDIR)$(pkglibdir)/modules.d/98dracut-systemd/dracut-shutdown-onfailure.service $(DESTDIR)$(systemdsystemunitdir)/dracut-shutdown-onfailure.service; \ + ln -srf $(DESTDIR)$(pkglibdir)/modules.d/98dracut-systemd/dracut-shutdown.service $(DESTDIR)$(systemdsystemunitdir)/dracut-shutdown.service; \ + mkdir -p $(DESTDIR)$(systemdsystemunitdir)/sysinit.target.wants; \ + ln -s ../dracut-shutdown.service \ +diff --git a/dracut.spec b/dracut.spec +index e1c22256..90fa903a 100644 +--- a/dracut.spec ++++ b/dracut.spec +@@ -404,6 +404,7 @@ echo 'dracut_rescue_image="yes"' > $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/ + %dir %{_sharedstatedir}/initramfs + %if %{defined _unitdir} + %{_unitdir}/dracut-shutdown.service ++%{_unitdir}/dracut-shutdown-onfailure.service + %{_unitdir}/sysinit.target.wants/dracut-shutdown.service + %{_unitdir}/dracut-cmdline.service + %{_unitdir}/dracut-initqueue.service +diff --git a/modules.d/98dracut-systemd/dracut-shutdown-onfailure.service b/modules.d/98dracut-systemd/dracut-shutdown-onfailure.service +new file mode 100644 +index 00000000..96de58c5 +--- /dev/null ++++ b/modules.d/98dracut-systemd/dracut-shutdown-onfailure.service +@@ -0,0 +1,13 @@ ++# This file is part of dracut. ++# ++# See dracut.bootup(7) for details ++ ++[Unit] ++Description=Service executing upon dracut-shutdown failure to perform cleanup ++Documentation=man:dracut-shutdown.service(8) ++DefaultDependencies=no ++ ++[Service] ++Type=oneshot ++ExecStart=-/bin/rm /run/initramfs/shutdown ++StandardError=null +diff --git a/modules.d/98dracut-systemd/dracut-shutdown.service b/modules.d/98dracut-systemd/dracut-shutdown.service +index b7324586..dd4cf81e 100644 +--- a/modules.d/98dracut-systemd/dracut-shutdown.service ++++ b/modules.d/98dracut-systemd/dracut-shutdown.service +@@ -8,6 +8,7 @@ Documentation=man:dracut-shutdown.service(8) + After=local-fs.target boot.mount boot.automount + Wants=local-fs.target + ConditionPathExists=!/run/initramfs/bin/sh ++OnFailure=dracut-shutdown-onfailure.service + + [Service] + RemainAfterExit=yes +diff --git a/modules.d/98dracut-systemd/dracut-shutdown.service.8.asc b/modules.d/98dracut-systemd/dracut-shutdown.service.8.asc +index ba80b187..21ec88ca 100644 +--- a/modules.d/98dracut-systemd/dracut-shutdown.service.8.asc ++++ b/modules.d/98dracut-systemd/dracut-shutdown.service.8.asc +@@ -40,6 +40,9 @@ by injecting "rd.break=pre-shutdown rd.shell" or "rd.break=shutdown rd.shell". + # touch /run/initramfs/.need_shutdown + ---- + ++In case the unpack of the initramfs fails, dracut-shutdown-onfailure.service ++executes to make sure switch root doesn't happen, since it would result in ++switching to an incomplete initramfs. + + AUTHORS + ------- + diff --git a/0208.patch b/0208.patch new file mode 100644 index 0000000..6003e09 --- /dev/null +++ b/0208.patch @@ -0,0 +1,54 @@ +From 9914a76e5748beae9662a0e44b1674249b778424 Mon Sep 17 00:00:00 2001 +From: Pavel Valena +Date: Mon, 15 Aug 2022 10:44:35 +0200 +Subject: [PATCH] ci: check out .shellcheckrc from upstream + +To avoid ShellCheck false positives. + +https://github.com/redhat-plumbers/dracut-rhel8/pull/18 + +rhel-only +--- + .shellcheckrc | 34 ++++++++++++++++++++++++++++++++++ + 1 file changed, 34 insertions(+) + +diff --git a/.shellcheckrc b/.shellcheckrc +new file mode 100644 +index 00000000..ce5c883b +--- /dev/null ++++ b/.shellcheckrc +@@ -0,0 +1,34 @@ ++# SC2039: In POSIX sh, 'local' is undefined. ++# https://github.com/koalaman/shellcheck/wiki/SC2039 ++disable=SC2039 ++ ++# SC2166: Prefer [ p ] || [ q ] as [ p -o q ] is not well defined. ++# https://github.com/koalaman/shellcheck/wiki/SC2166 ++disable=SC2166 ++ ++# SC2154: Variable is referenced but not assigned ++# https://github.com/koalaman/shellcheck/wiki/SC2154 ++disable=SC2154 ++ ++# SC1091: Not following ++# https://github.com/koalaman/shellcheck/wiki/SC1091 ++disable=SC1091 ++ ++# SC2174: When used with -p, -m only applies to the deepest directory. ++# https://github.com/koalaman/shellcheck/wiki/SC2174 ++disable=SC2174 ++ ++# SC3043: In POSIX sh, 'local' is undefined. ++# https://github.com/koalaman/shellcheck/wiki/SC3043 ++# ... but dash supports it ++disable=SC3043 ++ ++# SC3013: In POSIX sh, -ef is undefined. ++# https://github.com/koalaman/shellcheck/wiki/SC3013 ++# ... but dash supports it ++disable=SC3013 ++ ++# SC3045: In POSIX sh, read -p is undefined. ++# https://github.com/koalaman/shellcheck/wiki/SC3045 ++# ... but dash supports it ++disable=SC3045 diff --git a/0209.patch b/0209.patch new file mode 100644 index 0000000..263d09e --- /dev/null +++ b/0209.patch @@ -0,0 +1,66 @@ +From 7e148e3b6f922e5eb1dcb7fc3c1fed715004e2ab Mon Sep 17 00:00:00 2001 +From: Lee Duncan +Date: Mon, 25 Mar 2019 16:49:19 -0700 +Subject: [PATCH] Dracut: only login to one target at a time + +For handling the configuration where there are two +paths to an iscsi root target, each using a different +NIC. In such a case, the initramfs was trying to configure +the first NIC, then call iscsiroot to login to both targets, +which would fail for the 2nd target, since the path to the +2nd target was not yet configured. This would eventually +work after a timeout. But it's better to login to just +one target at a time. +This change makes the initramfs handle multiple paths to an +iscsi target better by logging into only one target at a time, +rather than trying to login to all targets when only one of +several NICs is up. + +This can be further optimized by using the initrd parameter +"rd.iscsi.testroute", which would skip iscsiadm login attempts +for targets to which no route exists. + +If the script is called again via the timeout initqueue, +we try "iscsiadm -L onboot" again, hoping that some targets +may now have become reachable. +--- + modules.d/95iscsi/iscsiroot.sh | 12 +++++++++--- + 1 file changed, 9 insertions(+), 3 deletions(-) + +diff --git a/modules.d/95iscsi/iscsiroot.sh b/modules.d/95iscsi/iscsiroot.sh +index 4efc1d12..f3f88259 100755 +--- a/modules.d/95iscsi/iscsiroot.sh ++++ b/modules.d/95iscsi/iscsiroot.sh +@@ -228,7 +228,7 @@ handle_netroot() + fi + [ -n "$iscsi_param" ] && for param in $iscsi_param; do EXTRA="$EXTRA --name=${param%=*} --value=${param#*=}"; done + +- iscsiadm -m node -T $target \ ++ CMD="iscsiadm -m node -T $target \ + ${iscsi_iface_name:+-I $iscsi_iface_name} \ + -p $iscsi_target_ip${iscsi_target_port:+:$iscsi_target_port} \ + --op=update \ +@@ -238,14 +238,20 @@ handle_netroot() + ${iscsi_in_username:+--name=node.session.auth.username_in --value=$iscsi_in_username} \ + ${iscsi_in_password:+--name=node.session.auth.password_in --value=$iscsi_in_password} \ + $EXTRA \ +- $NULL ++ $NULL" ++ $CMD ++ if [ "$netif" != "timeout" ]; then ++ $CMD --login ++ fi + ;; + *) + ;; + esac + done + +- iscsiadm -m node -L onboot || : ++ if [ "$netif" = "timeout" ]; then ++ iscsiadm -m node -L onboot || : ++ fi + > $hookdir/initqueue/work + + netroot_enc=$(str_replace "$1" '/' '\2f') + diff --git a/0210.patch b/0210.patch new file mode 100644 index 0000000..ba85405 --- /dev/null +++ b/0210.patch @@ -0,0 +1,39 @@ +From 96fc660c9170fbea5ac80235ab7d0e7cfdbe243e Mon Sep 17 00:00:00 2001 +From: Martin Wilck +Date: Thu, 21 Mar 2019 16:27:04 +0100 +Subject: [PATCH] iscsi: don't continue waiting if the root device is present + +dracut waits for every iscsiroot connection to be established +before switching root. This is not necessary in multipath scenarios, +where a single path is usually sufficient to set up the root device, +and where users expect booting to succeed unless all paths are down. + +Don't wait for the iscsi portal to start if the root device has +already been found. +--- + modules.d/95iscsi/parse-iscsiroot.sh | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/modules.d/95iscsi/parse-iscsiroot.sh b/modules.d/95iscsi/parse-iscsiroot.sh +index f00a83bb..8d6e3e8c 100755 +--- a/modules.d/95iscsi/parse-iscsiroot.sh ++++ b/modules.d/95iscsi/parse-iscsiroot.sh +@@ -84,7 +84,7 @@ if [ -n "$iscsi_firmware" ]; then + modprobe -b -q iscsi_boot_sysfs 2>/dev/null + modprobe -b -q iscsi_ibft + # if no ip= is given, but firmware +- echo "[ -f '/tmp/iscsistarted-firmware' ]" > $hookdir/initqueue/finished/iscsi_started.sh ++ echo "${DRACUT_SYSTEMD+systemctl is-active initrd-root-device.target || }[ -f '/tmp/iscsistarted-firmware' ]" > $hookdir/initqueue/finished/iscsi_started.sh + initqueue --unique --online /sbin/iscsiroot online "iscsi:" "$NEWROOT" + initqueue --unique --onetime --timeout /sbin/iscsiroot timeout "iscsi:" "$NEWROOT" + initqueue --unique --onetime --settled /sbin/iscsiroot online "iscsi:" "'$NEWROOT'" +@@ -145,7 +145,7 @@ for nroot in $(getargs netroot); do + type parse_iscsi_root >/dev/null 2>&1 || . /lib/net-lib.sh + parse_iscsi_root "$nroot" || return 1 + netroot_enc=$(str_replace "$nroot" '/' '\2f') +- echo "[ -f '/tmp/iscsistarted-$netroot_enc' ]" > $hookdir/initqueue/finished/iscsi_started.sh ++ echo "${DRACUT_SYSTEMD+systemctl is-active initrd-root-device.target || }[ -f '/tmp/iscsistarted-$netroot_enc' ]" > $hookdir/initqueue/finished/iscsi_started.sh + done + + # Done, all good! + diff --git a/0211.patch b/0211.patch new file mode 100644 index 0000000..59fe258 --- /dev/null +++ b/0211.patch @@ -0,0 +1,24 @@ +From 5e06ab6cc6398fb82b8cd1dbc8da9969d874bb75 Mon Sep 17 00:00:00 2001 +From: Martin Wilck +Date: Thu, 21 Mar 2019 21:31:15 +0100 +Subject: [PATCH] network: stop waiting for interfaces if root device is + present + +--- + modules.d/35network-legacy/net-genrules.sh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/modules.d/35network-legacy/net-genrules.sh b/modules.d/35network-legacy/net-genrules.sh +index e6035e5e..0d4ef27b 100755 +--- a/modules.d/35network-legacy/net-genrules.sh ++++ b/modules.d/35network-legacy/net-genrules.sh +@@ -96,7 +96,7 @@ command -v fix_bootif >/dev/null || . /lib/net-lib.sh + + for iface in $IFACES; do + if [ "$bootdev" = "$iface" ] || [ "$NEEDNET" = "1" ]; then +- echo "[ -f /tmp/net.${iface}.did-setup ]" >$hookdir/initqueue/finished/wait-$iface.sh ++ echo "${DRACUT_SYSTEMD+systemctl is-active initrd-root-device.target || }[ -f /tmp/net.${iface}.did-setup ]" >$hookdir/initqueue/finished/wait-$iface.sh + fi + done + # Default: We don't know the interface to use, handle all + diff --git a/0212.patch b/0212.patch new file mode 100644 index 0000000..d3dc6de --- /dev/null +++ b/0212.patch @@ -0,0 +1,39 @@ +From 032129d0eb47d08eff7bd8b4c82a835a8929e9d3 Mon Sep 17 00:00:00 2001 +From: Martin Wilck +Date: Thu, 4 Apr 2019 15:29:04 +0200 +Subject: [PATCH] iscsiroot: parse_iscsi_root overwrites command line args + +iscsi_target_name, iscsi_target_ip, iscsi_target_port are +unconditionally overwritten by parse_iscsi_root. Don't set +them here, for code clarity. +--- + modules.d/95iscsi/iscsiroot.sh | 8 ++------ + 1 file changed, 2 insertions(+), 6 deletions(-) + +diff --git a/modules.d/95iscsi/iscsiroot.sh b/modules.d/95iscsi/iscsiroot.sh +index f3f88259..45db89c1 100755 +--- a/modules.d/95iscsi/iscsiroot.sh ++++ b/modules.d/95iscsi/iscsiroot.sh +@@ -92,12 +92,6 @@ handle_netroot() + # override conf settings by command line options + arg=$(getarg rd.iscsi.initiator -d iscsi_initiator=) + [ -n "$arg" ] && iscsi_initiator=$arg +- arg=$(getargs rd.iscsi.target.name -d iscsi_target_name=) +- [ -n "$arg" ] && iscsi_target_name=$arg +- arg=$(getarg rd.iscsi.target.ip -d iscsi_target_ip) +- [ -n "$arg" ] && iscsi_target_ip=$arg +- arg=$(getarg rd.iscsi.target.port -d iscsi_target_port=) +- [ -n "$arg" ] && iscsi_target_port=$arg + arg=$(getarg rd.iscsi.target.group -d iscsi_target_group=) + [ -n "$arg" ] && iscsi_target_group=$arg + arg=$(getarg rd.iscsi.username -d iscsi_username=) +@@ -112,6 +106,8 @@ handle_netroot() + iscsi_param="$iscsi_param $p" + done + ++ # this sets iscsi_target_name and possibly overwrites most ++ # parameters read from the command line above + parse_iscsi_root "$1" || return 1 + + # Bail out early, if there is no route to the destination + diff --git a/0213.patch b/0213.patch new file mode 100644 index 0000000..ae02bfa --- /dev/null +++ b/0213.patch @@ -0,0 +1,42 @@ +From a590dfb3670a68b9eebc3e0ea617c5cf192c51ae Mon Sep 17 00:00:00 2001 +From: Martin Wilck +Date: Thu, 4 Apr 2019 15:40:14 +0200 +Subject: [PATCH] iscsiroot: there's never more than one target per call + +iscsi_target_name is set by iscsi_root, and thus can't have +more than one member. This allows us to get rid of one bashism +in iscsiroot.sh. +--- + modules.d/95iscsi/iscsiroot.sh | 11 +++-------- + 1 file changed, 3 insertions(+), 8 deletions(-) + +diff --git a/modules.d/95iscsi/iscsiroot.sh b/modules.d/95iscsi/iscsiroot.sh +index 45db89c1..a334b76e 100755 +--- a/modules.d/95iscsi/iscsiroot.sh ++++ b/modules.d/95iscsi/iscsiroot.sh +@@ -213,10 +213,8 @@ handle_netroot() + targets=$(iscsiadm -m discovery -t st -p $iscsi_target_ip:${iscsi_target_port:+$iscsi_target_port} | sed 's/^.*iqn/iqn/') + [ -z "$targets" ] && echo "Target discovery to $iscsi_target_ip:${iscsi_target_port:+$iscsi_target_port} failed with status $?" && exit 1 + +- for target in $iscsi_target_name; do +- case "$targets" in +- *$target*) +- EXTRA="" ++ for target in $targets; do ++ if [ "$target" = "$iscsi_target_name" ]; then + if [ -n "$iscsi_iface_name" ]; then + iscsiadm -m iface -I $iscsi_iface_name --op=new + EXTRA=" ${iscsi_netdev_name:+--name=iface.net_ifacename --value=$iscsi_netdev_name} " +@@ -239,10 +237,7 @@ handle_netroot() + if [ "$netif" != "timeout" ]; then + $CMD --login + fi +- ;; +- *) +- ;; +- esac ++ fi + done + + if [ "$netif" = "timeout" ]; then + diff --git a/0214.patch b/0214.patch new file mode 100644 index 0000000..5a5df3a --- /dev/null +++ b/0214.patch @@ -0,0 +1,55 @@ +From 261d278332e0af85a0311a75d7b81c6cf35e4816 Mon Sep 17 00:00:00 2001 +From: Martin Wilck +Date: Thu, 4 Apr 2019 16:16:40 +0200 +Subject: [PATCH] iscsiroot: try targets only once + +In multipath scenarios, "iscsiadm -m node" may contain +several records with the same target. +There's no point in trying "iscsiadm --login" multiple +time for the same target, through the same portal. + +Moreover, warn if the desired target is not on the node +list. +--- + modules.d/95iscsi/iscsiroot.sh | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/modules.d/95iscsi/iscsiroot.sh b/modules.d/95iscsi/iscsiroot.sh +index a334b76e..e8e0b4b8 100755 +--- a/modules.d/95iscsi/iscsiroot.sh ++++ b/modules.d/95iscsi/iscsiroot.sh +@@ -87,7 +87,7 @@ handle_netroot() + local iscsi_in_username iscsi_in_password + local iscsi_iface_name iscsi_netdev_name + local iscsi_param param +- local p ++ local p found + + # override conf settings by command line options + arg=$(getarg rd.iscsi.initiator -d iscsi_initiator=) +@@ -213,6 +213,7 @@ handle_netroot() + targets=$(iscsiadm -m discovery -t st -p $iscsi_target_ip:${iscsi_target_port:+$iscsi_target_port} | sed 's/^.*iqn/iqn/') + [ -z "$targets" ] && echo "Target discovery to $iscsi_target_ip:${iscsi_target_port:+$iscsi_target_port} failed with status $?" && exit 1 + ++ found= + for target in $targets; do + if [ "$target" = "$iscsi_target_name" ]; then + if [ -n "$iscsi_iface_name" ]; then +@@ -237,11 +238,16 @@ handle_netroot() + if [ "$netif" != "timeout" ]; then + $CMD --login + fi ++ found=yes ++ break + fi + done + + if [ "$netif" = "timeout" ]; then + iscsiadm -m node -L onboot || : ++ elif [ "$found" != yes ]; then ++ warn "iSCSI target \"$iscsi_target_name\" not found on portal $iscsi_target_ip:$iscsi_target_port" ++ return 1 + fi + > $hookdir/initqueue/work + + diff --git a/0215.patch b/0215.patch new file mode 100644 index 0000000..496a7ac --- /dev/null +++ b/0215.patch @@ -0,0 +1,77 @@ +From 0df65c3c001fb5656838274b172c247c41dc0442 Mon Sep 17 00:00:00 2001 +From: Martin Wilck +Date: Thu, 4 Apr 2019 17:12:07 +0200 +Subject: [PATCH] iscsiroot: remove bashisms + +According to the dracut README, module code to be run in +the initrd must be POSIX-compliant. Replace remaining +bashisms (as reported by checkbashisms) with POSIX compliant +code. + +The use of "type" is not strictly POSIX compliant, but it's +all over the place in dracut code. dash supports it, anyway. +--- + modules.d/95iscsi/iscsiroot.sh | 26 +++++++++++++------------- + 1 file changed, 13 insertions(+), 13 deletions(-) + +diff --git a/modules.d/95iscsi/iscsiroot.sh b/modules.d/95iscsi/iscsiroot.sh +index e8e0b4b8..4ab0b6a0 100755 +--- a/modules.d/95iscsi/iscsiroot.sh ++++ b/modules.d/95iscsi/iscsiroot.sh +@@ -54,11 +54,11 @@ handle_firmware() + if ! iscsiadm -m fw; then + warn "iscsiadm: Could not get list of targets from firmware." + else +- ifaces=( $(echo /sys/firmware/ibft/ethernet*) ) ++ ifaces=$(set -- /sys/firmware/ibft/ethernet*; echo $#) + retry=$(cat /tmp/session-retry) + +- if [ $retry -lt ${#ifaces[*]} ]; then +- let retry++ ++ if [ $retry -lt $ifaces ]; then ++ retry=$((retry+1)) + echo $retry > /tmp/session-retry + return 1 + else +@@ -88,6 +88,7 @@ handle_netroot() + local iscsi_iface_name iscsi_netdev_name + local iscsi_param param + local p found ++ local login_retry_max_seen= + + # override conf settings by command line options + arg=$(getarg rd.iscsi.initiator -d iscsi_initiator=) +@@ -103,7 +104,9 @@ handle_netroot() + 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 $p" ++ [ "${p%=*}" = node.session.initial_login_retry_max ] && \ ++ login_retry_max_seen=yes ++ iscsi_param="$iscsi_param $p" + done + + # this sets iscsi_target_name and possibly overwrites most +@@ -116,15 +119,12 @@ handle_netroot() + fi + + #limit iscsistart login retries +- case "$iscsi_param" in +- *node.session.initial_login_retry_max*) ;; +- *) +- retries=$(getargnum 3 0 10000 rd.iscsi.login_retry_max) +- if [ $retries -gt 0 ]; then +- iscsi_param="${iscsi_param% } node.session.initial_login_retry_max=$retries" +- fi +- ;; +- esac ++ if [ "$login_retry_max_seen" != yes ]; then ++ retries=$(getargnum 3 0 10000 rd.iscsi.login_retry_max) ++ if [ $retries -gt 0 ]; then ++ iscsi_param="${iscsi_param% } node.session.initial_login_retry_max=$retries" ++ fi ++ fi + + # XXX is this needed? + getarg ro && iscsirw=ro + diff --git a/0216.patch b/0216.patch new file mode 100644 index 0000000..3e51ddb --- /dev/null +++ b/0216.patch @@ -0,0 +1,44 @@ +From ee0bba8d350920b8beb4c0629262ec359983ad65 Mon Sep 17 00:00:00 2001 +From: Martin Wilck +Date: Tue, 1 Oct 2019 12:02:04 +0200 +Subject: [PATCH] fixup "Dracut: only login to one target at a time" + +On SLE15-SP1 at least, iscsiadm doesn't support combining --op and --login": + +> # iscsiadm -m node -T iqn.2018-06.de.suse.zeus:01 --op=update --name=node.startup --value=onboot --login +> iscsiadm: Invalid parameters. Login/logout and op passed in + +This breaks iSCSI login in initrd, and thus, iSCSI boot. + +Fix it by not coalescing everything into a single iscsiadm command. +Fixes: a59b776bc215 ("Dracut: only login to one target at a time") +References: bsc#1152650 +--- + modules.d/95iscsi/iscsiroot.sh | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/modules.d/95iscsi/iscsiroot.sh b/modules.d/95iscsi/iscsiroot.sh +index 4ab0b6a0..6a12a108 100755 +--- a/modules.d/95iscsi/iscsiroot.sh ++++ b/modules.d/95iscsi/iscsiroot.sh +@@ -225,8 +225,8 @@ handle_netroot() + + CMD="iscsiadm -m node -T $target \ + ${iscsi_iface_name:+-I $iscsi_iface_name} \ +- -p $iscsi_target_ip${iscsi_target_port:+:$iscsi_target_port} \ +- --op=update \ ++ -p $iscsi_target_ip${iscsi_target_port:+:$iscsi_target_port}" ++ __op="--op=update \ + --name=node.startup --value=onboot \ + ${iscsi_username:+ --name=node.session.auth.username --value=$iscsi_username} \ + ${iscsi_password:+ --name=node.session.auth.password --value=$iscsi_password} \ +@@ -234,7 +234,7 @@ handle_netroot() + ${iscsi_in_password:+--name=node.session.auth.password_in --value=$iscsi_in_password} \ + $EXTRA \ + $NULL" +- $CMD ++ $CMD $__op + if [ "$netif" != "timeout" ]; then + $CMD --login + fi + diff --git a/0217.patch b/0217.patch new file mode 100644 index 0000000..f80cc76 --- /dev/null +++ b/0217.patch @@ -0,0 +1,37 @@ +From 934e69b64f4eff5df84d0d94a39aca1933bf3419 Mon Sep 17 00:00:00 2001 +From: Martin Wilck +Date: Fri, 27 Sep 2019 13:26:10 +0200 +Subject: [PATCH] 35network-legacy: only skip waiting for interfaces if netroot + is set + +Commmit 8a33e52e2f94 assumes that dracut's work is done if a root device +is found. This holds usually for booting computers, but it may be wrong +for other environments. + +Only short-cut the waiting if $netroot is also set. + +Fixes: 8a33e52e2f94 ("network: stop waiting for interfaces if root device is present") +References: bsc#1152006 + +Resolves: rhbz#2115199 +--- + modules.d/35network-legacy/net-genrules.sh | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/modules.d/35network-legacy/net-genrules.sh b/modules.d/35network-legacy/net-genrules.sh +index 0d4ef27b..d531bb56 100755 +--- a/modules.d/35network-legacy/net-genrules.sh ++++ b/modules.d/35network-legacy/net-genrules.sh +@@ -96,7 +96,11 @@ command -v fix_bootif >/dev/null || . /lib/net-lib.sh + + for iface in $IFACES; do + if [ "$bootdev" = "$iface" ] || [ "$NEEDNET" = "1" ]; then +- echo "${DRACUT_SYSTEMD+systemctl is-active initrd-root-device.target || }[ -f /tmp/net.${iface}.did-setup ]" >$hookdir/initqueue/finished/wait-$iface.sh ++ if [ -n "$netroot" ] && [ -n "$DRACUT_SYSTEMD" ]; then ++ echo "systemctl is-active initrd-root-device.target || [ -f /tmp/net.${iface}.did-setup ]" ++ else ++ echo "[ -f /tmp/net.${iface}.did-setup ]" ++ fi >$hookdir/initqueue/finished/wait-$iface.sh + fi + done + # Default: We don't know the interface to use, handle all diff --git a/dist b/dist new file mode 100644 index 0000000..535c690 --- /dev/null +++ b/dist @@ -0,0 +1 @@ +an8_7 diff --git a/dracut.spec b/dracut.spec index e6b91d6..4fb3b7c 100644 --- a/dracut.spec +++ b/dracut.spec @@ -5,7 +5,7 @@ # strip the automatically generated dep here and instead co-own the # directory. %global __requires_exclude pkg-config -%define dist_free_release 202.git20220511 +%define dist_free_release 218.git20221019 Name: dracut Version: 049 @@ -229,6 +229,22 @@ Patch198: 0198.patch Patch199: 0199.patch Patch200: 0200.patch Patch201: 0201.patch +Patch202: 0202.patch +Patch203: 0203.patch +Patch204: 0204.patch +Patch205: 0205.patch +Patch206: 0206.patch +Patch207: 0207.patch +Patch208: 0208.patch +Patch209: 0209.patch +Patch210: 0210.patch +Patch211: 0211.patch +Patch212: 0212.patch +Patch213: 0213.patch +Patch214: 0214.patch +Patch215: 0215.patch +Patch216: 0216.patch +Patch217: 0217.patch Source1: https://www.gnu.org/licenses/lgpl-2.1.txt @@ -552,6 +568,7 @@ echo 'dracut_rescue_image="yes"' > $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/ %{dracutlibdir}/modules.d/50drm %{dracutlibdir}/modules.d/50plymouth %{dracutlibdir}/modules.d/80lvmmerge +%{dracutlibdir}/modules.d/80lvmthinpool-monitor %{dracutlibdir}/modules.d/90btrfs %{dracutlibdir}/modules.d/90crypt %{dracutlibdir}/modules.d/90dm @@ -605,6 +622,7 @@ echo 'dracut_rescue_image="yes"' > $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/ %dir %{_sharedstatedir}/initramfs %if %{defined _unitdir} %{_unitdir}/dracut-shutdown.service +%{_unitdir}/dracut-shutdown-onfailure.service %{_unitdir}/sysinit.target.wants/dracut-shutdown.service %{_unitdir}/dracut-cmdline.service %{_unitdir}/dracut-initqueue.service @@ -681,6 +699,23 @@ echo '# Since rhel-8.3 dracut moved to use NetworkManager add_dracutmodules+=" network-legacy "' > /etc/dracut.conf.d/50-network-legacy.conf %changelog +* Thu Oct 20 2022 Pavel Valena - 049-218.git20221019 +- Dracut: only login to one target at a time +- iscsi: don't continue waiting if the root device is present +- network: stop waiting for interfaces if root device is +- iscsiroot: parse_iscsi_root overwrites command line args +- iscsiroot: there's never more than one target per call +- iscsiroot: try targets only once +- iscsiroot: remove bashisms +- fixup "Dracut: only login to one target at a time" +- 35network-legacy: only skip waiting for interfaces if netroot + +* Mon Aug 15 2022 Pavel Valena - 049-209.git20220815 +- fix(95iscsi): Fix network setup +- fix(dracut-systemd): correct service dependencies +- feat(lvm): add new module lvmthinpool-monitor +- fix(dracut-shutdown): add cleanup handler on failure + * Wed May 11 2022 Pavel Valena - 049-202.git20220511 - fix(fips): start iterating from 0 over BOOT_IMAGE entries -- Gitee