import dracut-049-209.git20220815.el8

This commit is contained in:
CentOS Sources 2022-11-08 01:56:37 -05:00 committed by Stepan Oksanichenko
parent bcf92c509e
commit cbd9e20e57
8 changed files with 444 additions and 1 deletions

34
SOURCES/0202.patch Normal file
View File

@ -0,0 +1,34 @@
From 4b9978afff2a8b084858c630032a3452bdca05c3 Mon Sep 17 00:00:00 2001
From: Jan Macku <jamacku@redhat.com>
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

26
SOURCES/0203.patch Normal file
View File

@ -0,0 +1,26 @@
From f7663f39ea7858e08597694da329c1c94e778060 Mon Sep 17 00:00:00 2001
From: Jan Macku <jamacku@redhat.com>
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 }}

55
SOURCES/0204.patch Normal file
View File

@ -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 <kasong@redhat.com>
(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

29
SOURCES/0205.patch Normal file
View File

@ -0,0 +1,29 @@
From 4db9f93bde030993f2777a4dacfcb72cab387b43 Mon Sep 17 00:00:00 2001
From: David Tardon <dtardon@redhat.com>
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]

140
SOURCES/0206.patch Normal file
View File

@ -0,0 +1,140 @@
From d5027d43ea3969426ba64423b3c0bb38491cc880 Mon Sep 17 00:00:00 2001
From: Tao Liu <ltao@redhat.com>
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 <ltao@redhat.com>
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

90
SOURCES/0207.patch Normal file
View File

@ -0,0 +1,90 @@
From ec2e4e70a1037b2df535e48ef7389b7b76b5a29a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Renaud=20M=C3=A9trich?= <rmetrich@redhat.com>
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
-------

54
SOURCES/0208.patch Normal file
View File

@ -0,0 +1,54 @@
From 9914a76e5748beae9662a0e44b1674249b778424 Mon Sep 17 00:00:00 2001
From: Pavel Valena <pvalena@redhat.com>
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 <file>
+# 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

View File

@ -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 209.git20220815
Name: dracut
Version: 049
@ -229,6 +229,13 @@ 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
Source1: https://www.gnu.org/licenses/lgpl-2.1.txt
@ -552,6 +559,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 +613,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 +690,12 @@ echo '# Since rhel-8.3 dracut moved to use NetworkManager
add_dracutmodules+=" network-legacy "' > /etc/dracut.conf.d/50-network-legacy.conf
%changelog
* Mon Aug 15 2022 Pavel Valena <pvalena@redhat.com> - 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 <pvalena@redhat.com> - 049-202.git20220511
- fix(fips): start iterating from 0 over BOOT_IMAGE entries