dracut-055-30.git20220216

also enhance .gitignore file.

Resolves: #1947892,#1992464,#2017787,#2017846,#2024502,#2050556,#2050560,#2050562,#2050567,#2050570
This commit is contained in:
Pavel Valena 2022-02-16 21:42:49 +01:00
parent b6d5cc59a7
commit c3acc2ce2d
22 changed files with 969 additions and 48 deletions

41
.gitignore vendored
View File

@ -1,40 +1 @@
/dracut-011-9b30d47.tar.bz2
/dracut-011.tar.bz2
/dracut-013.tar.bz2
/dracut-014.tar.bz2
/dracut-015.tar.bz2
/dracut-016.tar.bz2
/dracut-017.tar.bz2
/dracut-018.tar.bz2
/dracut-019.tar.bz2
/dracut-020.tar.bz2
/dracut-021.tar.bz2
/dracut-022.tar.bz2
/dracut-023.tar.bz2
/dracut-025.tar.bz2
/dracut-026.tar.bz2
/dracut-027.tar.bz2
/dracut-028.tar.bz2
/dracut-029.tar.bz2
/dracut-030.tar.bz2
/dracut-031.tar.bz2
/dracut-032.tar.bz2
/dracut-033.tar.bz2
/dracut-034.tar.bz2
/dracut-036.tar.xz
/dracut-037.tar.xz
/dracut-038.tar.xz
/dracut-040.tar.xz
/dracut-041.tar.xz
/dracut-042.tar.xz
/dracut-043.tar.xz
/dracut-044.tar.xz
/dracut-045.tar.xz
/dracut-046.tar.xz
/dracut-047.tar.xz
/dracut-048.tar.xz
/dracut-049.tar.xz
/dracut-050.tar.xz
/dracut-051.tar.xz
/dracut-053.tar.xz
/dracut-055.tar.xz
/dracut-*.tar.xz

35
0010.patch Normal file
View File

@ -0,0 +1,35 @@
From 324e6ba13d8abef22c636e64ad0cbd8018704c93 Mon Sep 17 00:00:00 2001
From: Frantisek Sumsal <frantisek@sumsal.cz>
Date: Tue, 9 Nov 2021 12:39:19 +0100
Subject: [PATCH] ci: use C9S chroots for Packit/TFT
---
.packit.yml | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)
diff --git a/.packit.yml b/.packit.yml
index acc1f968..1b1809ab 100644
--- a/.packit.yml
+++ b/.packit.yml
@@ -29,17 +29,12 @@ jobs:
trigger: pull_request
metadata:
targets:
- - epel-8-x86_64
- - epel-8-aarch64
- # FIXME: change to CentOS 9 once it's available
- - fedora-34-x86_64
- - fedora-34-aarch64
- - fedora-34-s390x
+ - centos-stream-9-x86_64
+ - centos-stream-9-aarch64
# Run tests (via testing farm)
- job: tests
trigger: pull_request
metadata:
targets:
- # FIXME: change to CentOS 9 once it's available
- - fedora-34-x86_64
+ - centos-stream-9-x86_64

23
0011.patch Normal file
View File

@ -0,0 +1,23 @@
From 816891a11e3a3b4a792b68257eff4af7df411064 Mon Sep 17 00:00:00 2001
From: Frantisek Sumsal <frantisek@sumsal.cz>
Date: Tue, 9 Nov 2021 12:45:47 +0100
Subject: [PATCH] ci: drop patches from the C9S spec before using it
---
.packit.yml | 2 ++
1 file changed, 2 insertions(+)
diff --git a/.packit.yml b/.packit.yml
index 1b1809ab..dd3a1fa6 100644
--- a/.packit.yml
+++ b/.packit.yml
@@ -21,6 +21,8 @@ actions:
- "git clone https://gitlab.com/redhat/centos-stream/rpms/dracut .packit_rpm --depth=1"
# Drop the "sources" file so rebase-helper doesn't think we're a dist-git$
- "rm -fv .packit_rpm/sources"
+ # Drop all patches (since they're already applied in this repository)
+ - "sed -ri '/^Patch[0-9]+:/d' .packit_rpm/dracut.spec"
# Available targets can be listed via `copr-cli list-chroots`
jobs:

88
0012.patch Normal file
View File

@ -0,0 +1,88 @@
From d19ca83f909ed695f199aa688406f62e3eecadcd Mon Sep 17 00:00:00 2001
From: Frantisek Sumsal <frantisek@sumsal.cz>
Date: Tue, 9 Nov 2021 16:01:51 +0100
Subject: [PATCH] ci: bump C8 jobs to C9S
rhel-only
---
.github/workflows/container.yml | 2 +-
.github/workflows/integration.yml | 4 ++--
...ockerfile-CentOS-8-Stream => Dockerfile-CentOS-9-Stream} | 13 ++-----------
3 files changed, 5 insertions(+), 14 deletions(-)
diff --git a/.github/workflows/container.yml b/.github/workflows/container.yml
index a8b3f9b8..adcec4f6 100644
--- a/.github/workflows/container.yml
+++ b/.github/workflows/container.yml
@@ -33,7 +33,7 @@ jobs:
- { dockerfile: 'Dockerfile-Fedora-rawhide', tag: 'fedora:rawhide' }
- { dockerfile: 'Dockerfile-OpenSuse-latest', tag: 'opensuse:latest' }
- { dockerfile: 'Dockerfile-Arch', tag: 'arch:latest' }
- - { dockerfile: 'Dockerfile-CentOS-8-Stream', tag: 'centos:stream8' }
+ - { dockerfile: 'Dockerfile-CentOS-9-Stream', tag: 'centos:stream9' }
steps:
- name: Check out the repo
uses: actions/checkout@v2
diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml
index 9ea718f1..990dd079 100644
--- a/.github/workflows/integration.yml
+++ b/.github/workflows/integration.yml
@@ -79,7 +79,7 @@ jobs:
- name: "${{ matrix.container }} TEST-${{ matrix.test }}"
run: ./tools/test-github.sh "TEST-${{ matrix.test }}" ${{ matrix.test }}
- centos-8-stream:
+ centos-9-stream:
runs-on: ubuntu-latest
timeout-minutes: 45
concurrency:
@@ -88,7 +88,7 @@ jobs:
strategy:
matrix:
container: [
- "centos:stream8",
+ "centos:stream9",
]
# Disabled tests (due to dropped packages in RHEL/CentOS):
# 03, 04, 15: requires btrfs
diff --git a/test/container/Dockerfile-CentOS-8-Stream b/test/container/Dockerfile-CentOS-9-Stream
similarity index 65%
rename from test/container/Dockerfile-CentOS-8-Stream
rename to test/container/Dockerfile-CentOS-9-Stream
index b14cc64a..da94f134 100644
--- a/test/container/Dockerfile-CentOS-8-Stream
+++ b/test/container/Dockerfile-CentOS-9-Stream
@@ -1,4 +1,4 @@
-FROM quay.io/centos/centos:stream8
+FROM quay.io/centos/centos:stream9
MAINTAINER https://github.com/dracutdevs/dracut
@@ -7,17 +7,8 @@ LABEL RUN="docker run -it --name NAME --privileged --ipc=host --net=host --pid=h
RUN echo 'export DRACUT_NO_XATTR=1 KVERSION=$(cd /lib/modules; ls -1 | tail -1)' > /etc/profile.d/dracut-test.sh
-# FIXME: the mirrors were desynchronized at the time of writing, leading to several
-# conflicts when installing dependencies below
-RUN sed -i -e 's/^mirrorlist=/#mirrorlist=/g' -e 's/^#baseurl=/baseurl=/g' /etc/yum.repos.d/*.repo
-
# Install needed packages for the dracut CI container
RUN dnf -y install epel-release && \
- `# FIXME: this is required to work around a bug in e2fsprogs, remove when CentOS 8.5 is out` && \
- dnf -y install dnf-plugins-core && \
- dnf -y copr enable mrc0mmand/systemd-centos-ci-centos8 && \
- dnf -y install e2fsprogs && \
- `# End of FIXME` && \
dnf -y install --enablerepo powertools --enablerepo epel --setopt=install_weak_deps=False \
qemu-kvm \
NetworkManager \
@@ -54,7 +45,7 @@ RUN dnf -y install epel-release && \
xz \
&& dnf -y update && dnf clean all
-# CentOS 8 ships only qemu-kvm, but it disables the KVM accel when it's not
+# C9S ships only qemu-kvm, but it disables the KVM accel when it's not
# available
RUN ln -sv /usr/libexec/qemu-kvm /usr/bin/qemu-kvm && \
ln -sv /usr/libexec/qemu-kvm /usr/bin/qemu-system-$(uname -m)

27
0013.patch Normal file
View File

@ -0,0 +1,27 @@
From cc4e8d16b743b8b720b502174df7c934a2d5c5dc Mon Sep 17 00:00:00 2001
From: Frantisek Sumsal <frantisek@sumsal.cz>
Date: Tue, 9 Nov 2021 16:40:17 +0100
Subject: [PATCH] ci: drop `epel-release`
since it's not available (yet) for C9S.
rhel-only
---
test/container/Dockerfile-CentOS-9-Stream | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/test/container/Dockerfile-CentOS-9-Stream b/test/container/Dockerfile-CentOS-9-Stream
index da94f134..3f643e88 100644
--- a/test/container/Dockerfile-CentOS-9-Stream
+++ b/test/container/Dockerfile-CentOS-9-Stream
@@ -8,8 +8,7 @@ LABEL RUN="docker run -it --name NAME --privileged --ipc=host --net=host --pid=h
RUN echo 'export DRACUT_NO_XATTR=1 KVERSION=$(cd /lib/modules; ls -1 | tail -1)' > /etc/profile.d/dracut-test.sh
# Install needed packages for the dracut CI container
-RUN dnf -y install epel-release && \
- dnf -y install --enablerepo powertools --enablerepo epel --setopt=install_weak_deps=False \
+RUN dnf -y install --enablerepo powertools --setopt=install_weak_deps=False \
qemu-kvm \
NetworkManager \
asciidoc \

24
0014.patch Normal file
View File

@ -0,0 +1,24 @@
From 33170038ddc5affa14e9464337983cfad033b8a4 Mon Sep 17 00:00:00 2001
From: Frantisek Sumsal <frantisek@sumsal.cz>
Date: Tue, 9 Nov 2021 16:46:31 +0100
Subject: [PATCH] ci: the PowerTools repo was renamed back to CRB in C9S
rhel-only
---
test/container/Dockerfile-CentOS-9-Stream | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/test/container/Dockerfile-CentOS-9-Stream b/test/container/Dockerfile-CentOS-9-Stream
index 3f643e88..9d0e81e3 100644
--- a/test/container/Dockerfile-CentOS-9-Stream
+++ b/test/container/Dockerfile-CentOS-9-Stream
@@ -8,7 +8,7 @@ LABEL RUN="docker run -it --name NAME --privileged --ipc=host --net=host --pid=h
RUN echo 'export DRACUT_NO_XATTR=1 KVERSION=$(cd /lib/modules; ls -1 | tail -1)' > /etc/profile.d/dracut-test.sh
# Install needed packages for the dracut CI container
-RUN dnf -y install --enablerepo powertools --setopt=install_weak_deps=False \
+RUN dnf -y install --enablerepo crb --setopt=install_weak_deps=False \
qemu-kvm \
NetworkManager \
asciidoc \

41
0015.patch Normal file
View File

@ -0,0 +1,41 @@
From d8f6162d3d86c81744c5f2c8215959aac3a2f9e9 Mon Sep 17 00:00:00 2001
From: Frantisek Sumsal <frantisek@sumsal.cz>
Date: Tue, 9 Nov 2021 17:13:37 +0100
Subject: [PATCH] ci: temporarily use an F34 dash package until C9S EPEL is
available
rhel-only
---
test/container/Dockerfile-CentOS-9-Stream | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/test/container/Dockerfile-CentOS-9-Stream b/test/container/Dockerfile-CentOS-9-Stream
index 9d0e81e3..c9a96020 100644
--- a/test/container/Dockerfile-CentOS-9-Stream
+++ b/test/container/Dockerfile-CentOS-9-Stream
@@ -8,14 +8,15 @@ LABEL RUN="docker run -it --name NAME --privileged --ipc=host --net=host --pid=h
RUN echo 'export DRACUT_NO_XATTR=1 KVERSION=$(cd /lib/modules; ls -1 | tail -1)' > /etc/profile.d/dracut-test.sh
# Install needed packages for the dracut CI container
+# FIXME: properly re-add dash once C9S EPEL is available
RUN dnf -y install --enablerepo crb --setopt=install_weak_deps=False \
+ http://mirrors.kernel.org/fedora/releases/34/Everything/x86_64/os/Packages/d/dash-0.5.10.2-8.fc34.x86_64.rpm \
qemu-kvm \
NetworkManager \
asciidoc \
bash-completion \
bzip2 \
cryptsetup \
- dash \
dbus-daemon \
dhcp-client \
dhcp-server \
@@ -33,7 +34,6 @@ RUN dnf -y install --enablerepo crb --setopt=install_weak_deps=False \
mdadm \
nfs-utils \
pigz \
- python3-imgcreate \
rpm-build \
strace \
sudo \

59
0016.patch Normal file
View File

@ -0,0 +1,59 @@
From 6e304517801fdfb58df582e37cd4df04b5adc1b6 Mon Sep 17 00:00:00 2001
From: Frantisek Sumsal <frantisek@sumsal.cz>
Date: Fri, 12 Nov 2021 21:43:12 +0100
Subject: [PATCH] test: don't use `-cpu max` in GH Actions
There appears to be an issue with newer QEMU versions (spotted with Arch
Linux and C9S containers) which causes the respective GH Action to hang
when booting a QEMU VM in combination with the `-cpu max` parameter.
During (a particularly painful) debugging session I once managed to get
some output from such "frozen" machine (using `earlycon` and
`earlyprintk` kernel cmdline options), and in that particular case the
VM died with a trap caused by an invalid opcode.
I couldn't reproduce this locally, only in GH Actions environment with
Arch Linux and C9S containers. Also, so far I haven't found out which
specific CPUID flag causes this, but using the `IvyBridge-v2` feature
set seems to mitigate the issue.
(cherry picked from commit 3f56d481e8a3c67c2e795686e6ec3bfc4ea08e1d)
---
test/run-qemu | 5 +++--
tools/test-github.sh | 1 +
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/test/run-qemu b/test/run-qemu
index 3c521a14..5dc61037 100755
--- a/test/run-qemu
+++ b/test/run-qemu
@@ -3,13 +3,14 @@
# We prefer kvm, kqemu, userspace in that order.
export PATH=/usr/sbin:/usr/bin:/sbin:/bin
+QEMU_CPU="${QEMU_CPU:-max}"
-[[ -x /usr/bin/qemu ]] && BIN=/usr/bin/qemu && ARGS=(-cpu max)
+[[ -x /usr/bin/qemu ]] && BIN=/usr/bin/qemu && ARGS=(-cpu "$QEMU_CPU")
(lsmod | grep -q '^kqemu ') && BIN=/usr/bin/qemu && ARGS=(-kernel-kqemu -cpu host)
[[ -c /dev/kvm && -x /usr/bin/kvm ]] && BIN=/usr/bin/kvm && ARGS=(-cpu host)
[[ -c /dev/kvm && -x /usr/bin/qemu-kvm ]] && BIN=/usr/bin/qemu-kvm && ARGS=(-cpu host)
[[ -c /dev/kvm && -x /usr/libexec/qemu-kvm ]] && BIN=/usr/libexec/qemu-kvm && ARGS=(-cpu host)
-[[ -x /usr/bin/qemu-system-$(uname -m) ]] && BIN=/usr/bin/qemu-system-$(uname -m) && ARGS=(-cpu max)
+[[ -x /usr/bin/qemu-system-$(uname -m) ]] && BIN=/usr/bin/qemu-system-$(uname -m) && ARGS=(-cpu "$QEMU_CPU")
[[ -c /dev/kvm && -x /usr/bin/qemu-system-$(uname -m) ]] && BIN=/usr/bin/qemu-system-$(uname -m) && ARGS=(-enable-kvm -cpu host)
[[ $BIN ]] || {
diff --git a/tools/test-github.sh b/tools/test-github.sh
index eab59dcc..1d61b8e3 100755
--- a/tools/test-github.sh
+++ b/tools/test-github.sh
@@ -41,6 +41,7 @@ else
cd /lib/modules
ls -1 | tail -1
)" \
+ QEMU_CPU="IvyBridge-v2" \
DRACUT_NO_XATTR=1 \
TEST_RUN_ID="$RUN_ID" \
${TESTS:+TESTS="$TESTS"} \

41
0017.patch Normal file
View File

@ -0,0 +1,41 @@
From cecc1fbae879c189739691ecff3df67d20b0899a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Renaud=20M=C3=A9trich?= <rmetrich@redhat.com>
Date: Tue, 16 Nov 2021 11:15:52 +0100
Subject: [PATCH] fix(shutdown): be robust against forced shutdown
When a forced shutdown is issued through sending a burst of Ctrl-Alt-Del
keys, systemd sends SIGTERM to all processes. This ends up killing
dracut-initramfs-restore as well, preventing the script from detecting
that the unpack of the initramfs is incomplete, which later causes a
crash to happen when "shutdown" tries to execute from the unpacked
initramfs.
This fix makes sure dracut-initramfs-restore remains alive to detect
the unpack failed (because cpio was killed by systemd too).
Refs:
* https://bugzilla.redhat.com/show_bug.cgi?id=2023665
(cherry picked from commit b9ba3c8bb8f0f1328cd1ffaa8dbf64585b28c474)
Resolves: #2024502
---
dracut-initramfs-restore.sh | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/dracut-initramfs-restore.sh b/dracut-initramfs-restore.sh
index abe6b1e2..d97030a3 100644
--- a/dracut-initramfs-restore.sh
+++ b/dracut-initramfs-restore.sh
@@ -6,6 +6,11 @@ set -e
[ -e /run/initramfs/bin/sh ] && exit 0
[ -e /run/initramfs/.need_shutdown ] || exit 0
+# SIGTERM signal is received upon forced shutdown: ignore the signal
+# We want to remain alive to be able to trap unpacking errors to avoid
+# switching root to an incompletely unpacked initramfs
+trap 'echo "Received SIGTERM signal, ignoring!" >&2' TERM
+
KERNEL_VERSION="$(uname -r)"
[[ $dracutbasedir ]] || dracutbasedir=/usr/lib/dracut

38
0018.patch Normal file
View File

@ -0,0 +1,38 @@
From 9e17bed7c0f30f6c557f837592772522c384779b Mon Sep 17 00:00:00 2001
From: Lukas Nykryn <lnykryn@redhat.com>
Date: Tue, 15 Feb 2022 13:44:16 +0100
Subject: [PATCH] Revert "95resume: always install this module"
This reverts commit 058ffa90669a4dbd2af16e025f22312408ed4ba9.
Resolves: #2017787
---
modules.d/95resume/module-setup.sh | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/modules.d/95resume/module-setup.sh b/modules.d/95resume/module-setup.sh
index 4f68e947..f0507b13 100755
--- a/modules.d/95resume/module-setup.sh
+++ b/modules.d/95resume/module-setup.sh
@@ -2,6 +2,20 @@
# called by dracut
check() {
+ swap_on_netdevice() {
+ local _dev
+ for _dev in "${swap_devs[@]}"; do
+ block_is_netdevice "$_dev" && return 0
+ done
+ return 1
+ }
+
+ # Only support resume if hibernation is currently on
+ # and no swap is mounted on a net device
+ [[ $hostonly ]] || [[ $mount_needs ]] && {
+ swap_on_netdevice || [[ "$(cat /sys/power/resume)" == "0:0" ]] && return 255
+ }
+
return 0
}

28
0019.patch Normal file
View File

@ -0,0 +1,28 @@
From 8b1252ce33d45340a3420568c66790fb53b14d0a Mon Sep 17 00:00:00 2001
From: Lukas Nykryn <lnykryn@redhat.com>
Date: Tue, 15 Feb 2022 13:47:40 +0100
Subject: [PATCH] 95resume: only exclude this module, when swap is netdev
Resolves: #2017787
---
modules.d/95resume/module-setup.sh | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/modules.d/95resume/module-setup.sh b/modules.d/95resume/module-setup.sh
index f0507b13..ccf2493f 100755
--- a/modules.d/95resume/module-setup.sh
+++ b/modules.d/95resume/module-setup.sh
@@ -10,10 +10,9 @@ check() {
return 1
}
- # Only support resume if hibernation is currently on
- # and no swap is mounted on a net device
+ # Only support resume if no swap is mounted on a net device
[[ $hostonly ]] || [[ $mount_needs ]] && {
- swap_on_netdevice || [[ "$(cat /sys/power/resume)" == "0:0" ]] && return 255
+ swap_on_netdevice && return 255
}
return 0

36
0020.patch Normal file
View File

@ -0,0 +1,36 @@
From eff17c61ba358d03461b62c95ef593e3b8d65e26 Mon Sep 17 00:00:00 2001
From: Coiby Xu <coxu@redhat.com>
Date: Wed, 14 Jul 2021 15:26:10 +0800
Subject: [PATCH] fix(qeth_rules): check the existence of
/sys/devices/qeth/*/online beforehand
On s390x KVM machines, the follow errors occurred,
$ kdumpctl rebuild
kdump: Rebuilding /boot/initramfs-4.18.0-321.el8.s390xkdump.img
/usr/lib/dracut/modules.d/95qeth_rules/module-setup.sh: line 13: /sys/devices/qeth/*/online: No such file or directory
/usr/lib/dracut/modules.d/95qeth_rules/module-setup.sh: line 13: /sys/devices/qeth/*/online: No such file or directory
because s390x KVM uses virtual devices and /sys/devices/qeth/*/online
doesn't exist. Eliminate this error by checking the existence
beforehand.
(cherry picked from commit 6c71ba4121ae64ccd13fefba68ca327ac623810f)
Resolves: #2050570
---
modules.d/95qeth_rules/module-setup.sh | 1 +
1 file changed, 1 insertion(+)
diff --git a/modules.d/95qeth_rules/module-setup.sh b/modules.d/95qeth_rules/module-setup.sh
index 914a28ce..884ae072 100755
--- a/modules.d/95qeth_rules/module-setup.sh
+++ b/modules.d/95qeth_rules/module-setup.sh
@@ -10,6 +10,7 @@ check() {
[[ $hostonly ]] && {
for i in /sys/devices/qeth/*/online; do
+ [ ! -f "$i" ] && continue
read -r _online < "$i"
[ "$_online" -eq 1 ] && return 0
done

85
0021.patch Normal file
View File

@ -0,0 +1,85 @@
From a0d8caa8090a78f627f26fcd9b47c4b099cbc1ba Mon Sep 17 00:00:00 2001
From: Jonathan Lebon <jonathan@jlebon.com>
Date: Thu, 17 Jun 2021 10:47:33 -0400
Subject: [PATCH] fix(fips): handle s390x OSTree systems
On s390x, the `BOOT_IMAGE` karg injected by the bootloader is not a path
to the kernel image, but rather an integer describing the index of the
menu entry selected. Because of the way the s390x bootloader works,
there is no information retained about e.g. the path of the kernel that
was loaded.
This causes issues for the FIPS code which assumes that `BOOT_IMAGE` is
a path to the kernel image to derive the HMAC path. In non-OSTree
systems, this ends up working anyway, because the kernel is located at
the root of the boot partition. In OSTree systems, this is not the
case. However, OSTree systems use BLS configs, and they are named in
reverse order of precedence (i.e. menu ordering). So from the
`BOOT_IMAGE` integer, we can figure out which BLS entry was selected.
Add some code to do just this on s390x. This isn't completely foolproof,
because it presumes that (1) BLS configs were used to populate the
bootloader (and that they were exactly in the same state they currently
are when `zipl` was run), and (2) there are no other menu entries
originating from outside the BLS configs. However, if these assumptions
are wrong we would simply fail the boot, which is currently what is
happening anyway.
See also:
https://github.com/openshift/os/pull/546
https://github.com/ibm-s390-linux/s390-tools/issues/78
Tested-by: Muhammad Adeel <muhammad.adeel@ibm.com>
Resolves: rhbz#2050567
---
modules.d/01fips/fips.sh | 21 +++++++++++++++++++++
modules.d/01fips/module-setup.sh | 2 +-
2 files changed, 22 insertions(+), 1 deletion(-)
diff --git a/modules.d/01fips/fips.sh b/modules.d/01fips/fips.sh
index 821c26a2..3297cb17 100755
--- a/modules.d/01fips/fips.sh
+++ b/modules.d/01fips/fips.sh
@@ -124,6 +124,27 @@ do_fips() {
else
BOOT_IMAGE="$(getarg BOOT_IMAGE)"
+ # On s390x, BOOT_IMAGE isn't a path but an integer representing the
+ # entry number selected. Let's try the root of /boot first, and
+ # otherwise fallback to trying to parse the BLS entries if it's a
+ # BLS-based system.
+ if [ "$(uname -m)" = s390x ]; then
+ if [ -e "/boot/vmlinuz-${KERNEL}" ]; then
+ BOOT_IMAGE="vmlinuz-${KERNEL}"
+ elif [ -d /boot/loader/entries ]; then
+ i=0
+ for bls in $(ls -d /boot/loader/entries/*.conf | sort -rV); do
+ ((i++))
+
+ if [ $i -eq ${BOOT_IMAGE:-0} ] && [ -r "$bls" ]; then
+ BOOT_IMAGE="$(grep -e '^linux' "$bls" | grep -o ' .*$')"
+ BOOT_IMAGE=${BOOT_IMAGE:1}
+ break
+ fi
+ done
+ fi
+ fi
+
# Trim off any leading GRUB boot device (e.g. ($root) )
BOOT_IMAGE="$(echo "${BOOT_IMAGE}" | sed 's/^(.*)//')"
diff --git a/modules.d/01fips/module-setup.sh b/modules.d/01fips/module-setup.sh
index a1e499af..913a660c 100755
--- a/modules.d/01fips/module-setup.sh
+++ b/modules.d/01fips/module-setup.sh
@@ -67,7 +67,7 @@ install() {
inst_hook pre-udev 01 "$moddir/fips-load-crypto.sh"
inst_script "$moddir/fips.sh" /sbin/fips.sh
- inst_multiple sha512hmac rmmod insmod mount uname umount
+ inst_multiple sha512hmac rmmod insmod mount uname umount grep sort
inst_simple /etc/system-fips
[ -c "${initdir}"/dev/random ] || mknod "${initdir}"/dev/random c 1 8 \

70
0022.patch Normal file
View File

@ -0,0 +1,70 @@
From 94ec96c35678f56bc74b9c12c3229971bc40c9b3 Mon Sep 17 00:00:00 2001
From: Pavel Valena <pvalena@redhat.com>
Date: Mon, 22 Nov 2021 16:40:39 +0100
Subject: [PATCH] fix(network): add errors and warnings when network interface
does not exist
End with error, or show a warning when nonexistent device is specified for network setup like
`ip=10.12.8.12::10.12.255.254:255.255.0.0:xk12:eth0:off`.
I've added the error only for `write-ifcfg.sh`, as I think no such setup should be written.
(cherry picked from commit 7938935267dd8824f074adf84c219340ad4c8db6)
Resolves: #2050562
---
modules.d/35network-legacy/ifup.sh | 6 +++++-
modules.d/35network-legacy/parse-ip-opts.sh | 5 +++++
modules.d/45ifcfg/write-ifcfg.sh | 5 +++++
3 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/modules.d/35network-legacy/ifup.sh b/modules.d/35network-legacy/ifup.sh
index a05c4698..0dc9541c 100755
--- a/modules.d/35network-legacy/ifup.sh
+++ b/modules.d/35network-legacy/ifup.sh
@@ -446,7 +446,11 @@ for p in $(getargs ip=); do
# If this option isn't directed at our interface, skip it
if [ -n "$dev" ]; then
- [ "$dev" != "$netif" ] && continue
+ if [ "$dev" != "$netif" ]; then
+ [ ! -e "/sys/class/net/$dev" ] \
+ && warn "Network interface '$dev' does not exist!"
+ continue
+ fi
else
iface_is_enslaved "$netif" && continue
fi
diff --git a/modules.d/35network-legacy/parse-ip-opts.sh b/modules.d/35network-legacy/parse-ip-opts.sh
index 35917bbf..19af8789 100755
--- a/modules.d/35network-legacy/parse-ip-opts.sh
+++ b/modules.d/35network-legacy/parse-ip-opts.sh
@@ -97,6 +97,11 @@ for p in $(getargs ip=); do
fi
# IFACES list for later use
IFACES="$IFACES $dev"
+
+ # Interface should exist
+ if [ ! -e "/sys/class/net/$dev" ]; then
+ warn "Network interface '$dev' does not exist"
+ fi
fi
# Do we need to check for specific options?
diff --git a/modules.d/45ifcfg/write-ifcfg.sh b/modules.d/45ifcfg/write-ifcfg.sh
index 5f71515a..345863f9 100755
--- a/modules.d/45ifcfg/write-ifcfg.sh
+++ b/modules.d/45ifcfg/write-ifcfg.sh
@@ -103,6 +103,11 @@ interface_bind() {
local _netif="$1"
local _macaddr="$2"
+ if [ ! -e "/sys/class/net/$_netif" ]; then
+ derror "Cannot find network interface '$_netif'!"
+ return 1
+ fi
+
# see, if we can bind it to some hw parms
if hw_bind "$_netif" "$_macaddr"; then
# only print out DEVICE, if it's user assigned

31
0023.patch Normal file
View File

@ -0,0 +1,31 @@
From cccc1e9ff2d80c7277563fd8fa35f44db48d2fd9 Mon Sep 17 00:00:00 2001
From: The Plumber <50238977+systemd-rhel-bot@users.noreply.github.com>
Date: Tue, 15 Feb 2022 20:26:33 +0100
Subject: [PATCH] (#2050560) fix(url-lib): make pre-pivot hook separetely per
nfs mount (#24)
* fix(url-lib): make pre-pivot hook separetely per nfs mount
(cherry picked from commit 2f091b17075f81ff490b05d3d566d736fc32f0be)
(cherry picked from commit acb18869e98687a3f8c172d7e7befaa5326cf67a)
(cherry picked from commit ec50cec3bd9169410df409e077d0487c63c2a627)
Resolves: #2050560
---
modules.d/45url-lib/url-lib.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/modules.d/45url-lib/url-lib.sh b/modules.d/45url-lib/url-lib.sh
index e1e7d5af..b68f72b0 100755
--- a/modules.d/45url-lib/url-lib.sh
+++ b/modules.d/45url-lib/url-lib.sh
@@ -159,7 +159,7 @@ nfs_fetch_url() {
mntdir="$(mkuniqdir /run nfs_mnt)"
mount_nfs "$nfs:$server:$filepath${options:+:$options}" "$mntdir"
# lazy unmount during pre-pivot hook
- inst_hook --hook pre-pivot --name 99url-lib-umount-nfs umount -l -- "$mntdir"
+ inst_hook --hook pre-pivot --name 99url-lib-umount-nfs-"$(basename "$mntdir")" umount -l -- "$mntdir"
fi
if [ -z "$outloc" ]; then

51
0024.patch Normal file
View File

@ -0,0 +1,51 @@
From 8d3b5eeb684f0872069fbab9e3b6470aa6a04729 Mon Sep 17 00:00:00 2001
From: Pavel Valena <pvalena@redhat.com>
Date: Tue, 15 Feb 2022 21:06:21 +0100
Subject: [PATCH] Fix shellcheck for a0d8caa8090a78f627f26fcd9b47c4b099cbc1ba
In modules.d/01fips/fips.sh line 137:
((i++))
^-----^ SC3006: In POSIX sh, standalone ((..)) is undefined.
^-- SC3018: In POSIX sh, ++ is undefined.
In modules.d/01fips/fips.sh line 139:
if [ $i -eq ${BOOT_IMAGE:-0} ] && [ -r "$bls" ]; then
^-- SC2086: Double quote to prevent globbing and word splitting.
^--------------^ SC2086: Double quote to prevent globbing and word splitting.
In modules.d/01fips/fips.sh line 141:
BOOT_IMAGE=${BOOT_IMAGE:1}
^-------------^ SC3057: In POSIX sh, string indexing is undefined.
Related: rhbz#2050567
---
modules.d/01fips/fips.sh | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/modules.d/01fips/fips.sh b/modules.d/01fips/fips.sh
index 3297cb17..bee061ab 100755
--- a/modules.d/01fips/fips.sh
+++ b/modules.d/01fips/fips.sh
@@ -133,14 +133,15 @@ do_fips() {
BOOT_IMAGE="vmlinuz-${KERNEL}"
elif [ -d /boot/loader/entries ]; then
i=0
+ # shellcheck disable=SC2012
for bls in $(ls -d /boot/loader/entries/*.conf | sort -rV); do
- ((i++))
+ i=$((i + 1))
- if [ $i -eq ${BOOT_IMAGE:-0} ] && [ -r "$bls" ]; then
- BOOT_IMAGE="$(grep -e '^linux' "$bls" | grep -o ' .*$')"
- BOOT_IMAGE=${BOOT_IMAGE:1}
- break
- fi
+ if [ "$i" -eq "${BOOT_IMAGE:-0}" ] && [ -r "$bls" ]; then
+ BOOT_IMAGE="$(grep -e '^linux' "$bls" | grep -o ' .*$')"
+ BOOT_IMAGE=${BOOT_IMAGE## }
+ break
+ fi
done
fi
fi

94
0025.patch Normal file
View File

@ -0,0 +1,94 @@
From 865d74e9388dcc6ac6eff21a44e8229ffa8283e9 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.
See also RHBZ #1924587 (https://bugzilla.redhat.com/show_bug.cgi?id=1924587).
(cherry picked from commit 7ab1d00227cad6f1b86ba01fdc766769faebb031)
Resolves: #2050556
---
Makefile | 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 +++
pkgbuild/dracut.spec | 1 +
5 files changed, 19 insertions(+)
diff --git a/Makefile b/Makefile
index e7d69e10..1e1d093e 100644
--- a/Makefile
+++ b/Makefile
@@ -168,6 +168,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/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 81043b2d..7c36f14f 100644
--- a/modules.d/98dracut-systemd/dracut-shutdown.service
+++ b/modules.d/98dracut-systemd/dracut-shutdown.service
@@ -10,6 +10,7 @@ Wants=local-fs.target
Conflicts=shutdown.target umount.target
DefaultDependencies=no
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/pkgbuild/dracut.spec b/pkgbuild/dracut.spec
index 04c61f90..d35bbe37 100644
--- a/pkgbuild/dracut.spec
+++ b/pkgbuild/dracut.spec
@@ -414,6 +414,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

51
0026.patch Normal file
View File

@ -0,0 +1,51 @@
From edce5bac8f65cee78fcf6c960ffb4e5924f81f78 Mon Sep 17 00:00:00 2001
From: David Tardon <dtardon@redhat.com>
Date: Tue, 1 Jun 2021 15:06:01 +0200
Subject: [PATCH] fix(multipath): get config. dir from configuration
(cherry picked from commit 2e3c5444d271cb8f05955858b8fdc367c4ea5c48)
Resolves: #1992464
---
modules.d/90multipath/module-setup.sh | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/modules.d/90multipath/module-setup.sh b/modules.d/90multipath/module-setup.sh
index b6002c6a..05222389 100755
--- a/modules.d/90multipath/module-setup.sh
+++ b/modules.d/90multipath/module-setup.sh
@@ -63,6 +63,7 @@ installkernel() {
# called by dracut
install() {
local -A _allow
+ local config_dir
add_hostonly_mpath_conf() {
if is_mpath "$1"; then
@@ -74,6 +75,16 @@ install() {
fi
}
+ local k v
+ while read -r k v; do
+ if [[ $k == "config_dir" ]]; then
+ v="${v#\"}"
+ config_dir="${v%\"}"
+ break
+ fi
+ done < <(multipath -t 2> /dev/null)
+ [[ -d $config_dir ]] || config_dir=/etc/multipath/conf.d
+
inst_multiple \
pkill \
pidof \
@@ -91,7 +102,7 @@ install() {
/etc/xdrdevices.conf \
/etc/multipath.conf \
/etc/multipath/* \
- /etc/multipath/conf.d/*
+ "$config_dir"/*
[[ $hostonly ]] && [[ $hostonly_mode == "strict" ]] && {
for_each_host_dev_and_slaves_all add_hostonly_mpath_conf

34
0027.patch Normal file
View File

@ -0,0 +1,34 @@
From 955222afe5bd7f23da48b94087ad7a4256d47605 Mon Sep 17 00:00:00 2001
From: Jan Macku <jamacku@redhat.com>
Date: Tue, 15 Feb 2022 15:29:03 +0100
Subject: [PATCH] ci: Add Differential ShellCheck action
Related: #2050567
---
.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..095c3fe6
--- /dev/null
+++ b/.github/workflows/differential-shellcheck.yml
@@ -0,0 +1,17 @@
+name: Differential ShellCheck
+on:
+ push:
+ branches: [main]
+ pull_request:
+ branches: [main]
+
+jobs:
+ test:
+ runs-on: ubuntu-20.04
+
+ steps:
+ - name: Repository checkout
+ uses: actions/checkout@v2
+
+ - name: Differential ShellCheck
+ uses: redhat-plumbers-in-action/differential-shellcheck@v1

40
0028.patch Normal file
View File

@ -0,0 +1,40 @@
From c988ca3aa81026c008bce69810584a651a0e75b3 Mon Sep 17 00:00:00 2001
From: Pavel Valena <pvalena@redhat.com>
Date: Wed, 16 Feb 2022 02:42:11 +0100
Subject: [PATCH] Do not use recommends for base packages
Resolves: rhbz#1947892
---
pkgbuild/dracut.spec | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/pkgbuild/dracut.spec b/pkgbuild/dracut.spec
index d35bbe37..4c9b1da3 100644
--- a/pkgbuild/dracut.spec
+++ b/pkgbuild/dracut.spec
@@ -71,20 +71,17 @@ Requires: kmod
Requires: sed
Requires: xz
Requires: gzip
+Requires: hardlink
+Requires: pigz
+Requires: kpartx
%if 0%{?fedora} || 0%{?rhel}
-Recommends: memstrack
-Recommends: hardlink
-Recommends: pigz
-Recommends: kpartx
+Suggests: memstrack
Requires: util-linux >= 2.21
Requires: systemd >= 219
Requires: systemd-udev >= 219
Requires: procps-ng
%else
-Requires: hardlink
-Requires: gzip
-Requires: kpartx
Requires: udev > 166
Requires: util-linux-ng >= 2.21
%endif

34
0029.patch Normal file
View File

@ -0,0 +1,34 @@
From b4f4c927d25b273498d96ee0d367669ee011400e Mon Sep 17 00:00:00 2001
From: Lukas Nykryn <lnykryn@redhat.com>
Date: Mon, 19 Jul 2021 11:27:28 +0200
Subject: [PATCH] 95nfs: set correct ownership and permissions for statd
directory
The directory ownership for the statd directory should be
rpcuser:rpcuser.
Resolves: #2017846
---
modules.d/95nfs/module-setup.sh | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/modules.d/95nfs/module-setup.sh b/modules.d/95nfs/module-setup.sh
index 38da5957..1c5f780e 100755
--- a/modules.d/95nfs/module-setup.sh
+++ b/modules.d/95nfs/module-setup.sh
@@ -120,8 +120,13 @@ install() {
mkdir -m 0755 -p "$initdir/var/lib/nfs"
mkdir -m 0755 -p "$initdir/var/lib/nfs/rpc_pipefs"
mkdir -m 0770 -p "$initdir/var/lib/rpcbind"
- [ -d "/var/lib/nfs/statd/sm" ] && mkdir -m 0755 -p "$initdir/var/lib/nfs/statd/sm"
- [ -d "/var/lib/nfs/sm" ] && mkdir -m 0755 -p "$initdir/var/lib/nfs/sm"
+ [ -d "$dracutsysrootdir/var/lib/nfs/statd/sm" ] \
+ && mkdir -m 0700 -p "$initdir/var/lib/nfs/statd" \
+ && mkdir -m 0755 -p "$initdir/var/lib/nfs/statd/sm" \
+ && chown -R rpcuser:rpcuser "$initdir/var/lib/nfs/statd"
+ [ -d "$dracutsysrootdir/var/lib/nfs/sm" ] \
+ && mkdir -m 0755 -p "$initdir/var/lib/nfs/sm" \
+ && chown -R rpcuser:rpcuser "$initdir/var/lib/nfs/sm"
# Rather than copy the passwd file in, just set a user for rpcbind
# We'll save the state and restart the daemon from the root anyway

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 10.git20210824
%define dist_free_release 30.git20220216
Name: dracut
Version: 055
@ -38,6 +38,26 @@ Patch6: 0006.patch
Patch7: 0007.patch
Patch8: 0008.patch
Patch9: 0009.patch
Patch10: 0010.patch
Patch11: 0011.patch
Patch12: 0012.patch
Patch13: 0013.patch
Patch14: 0014.patch
Patch15: 0015.patch
Patch16: 0016.patch
Patch17: 0017.patch
Patch18: 0018.patch
Patch19: 0019.patch
Patch20: 0020.patch
Patch21: 0021.patch
Patch22: 0022.patch
Patch23: 0023.patch
Patch24: 0024.patch
Patch25: 0025.patch
Patch26: 0026.patch
Patch27: 0027.patch
Patch28: 0028.patch
Patch29: 0029.patch
Source1: https://www.gnu.org/licenses/lgpl-2.1.txt
@ -81,20 +101,17 @@ Requires: kmod
Requires: sed
Requires: xz
Requires: gzip
Requires: hardlink
Requires: pigz
Requires: kpartx
%if 0%{?fedora} || 0%{?rhel}
Recommends: memstrack
Recommends: hardlink
Recommends: pigz
Recommends: kpartx
Suggests: memstrack
Requires: util-linux >= 2.21
Requires: systemd >= 219
Requires: systemd-udev >= 219
Requires: procps-ng
%else
Requires: hardlink
Requires: gzip
Requires: kpartx
Requires: udev > 166
Requires: util-linux-ng >= 2.21
%endif
@ -424,6 +441,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
@ -493,6 +511,18 @@ echo 'dracut_rescue_image="yes"' > $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/
%{_prefix}/lib/kernel/install.d/51-dracut-rescue.install
%changelog
* Wed Feb 16 2022 Pavel Valena <pvalena@redhat.com> - 055-30.git20220216
- fix(shutdown): be robust against forced shutdown
- 95resume: only exclude this module, when swap is netdev
- fix(qeth_rules): check the existence of
- fix(fips): handle s390x OSTree systems
- fix(network): add errors and warnings when network interface
- fix(url-lib): make pre-pivot hook separetely per
- fix(dracut-shutdown): add cleanup handler on failure
- fix(multipath): get config. dir from configuration
- Do not use recommends for base packages
- 95nfs: set correct ownership and permissions for statd
* Tue Aug 24 2021 Lukas Nykryn <lnykryn@redhat.com> - 055-10.git20210824
- 95resume: always install this module