import dracut-049-191.git20210920.el8

This commit is contained in:
CentOS Sources 2021-11-09 05:05:29 -05:00 committed by Stepan Oksanichenko
parent 2080f69af9
commit effa8aa0f4
58 changed files with 3714 additions and 12 deletions

View File

@ -40,3 +40,4 @@ index 8bb55c6e..86f4331e 100755
info "rd.nofcoe=0: skipping fcoe"
return 0
fi

116
SOURCES/0135.patch Normal file
View File

@ -0,0 +1,116 @@
From 2fe454f21b6b3890b02f52810a662530ec019968 Mon Sep 17 00:00:00 2001
From: mulhern <amulhern@redhat.com>
Date: Wed, 19 Aug 2020 11:11:14 -0400
Subject: [PATCH] Remove stratis module
It is obsolete. An approach which does not start the daemon is being worked
on.
Signed-off-by: mulhern <amulhern@redhat.com>
(cherry picked from commit fe761330e5db60f19f0ab2d937ea71a5b2438656)
Cherry-picked from: fe761330e5db60f19f0ab2d937ea71a5b2438656
Resolves: #1950572
---
dracut.spec | 1 -
modules.d/90stratis/module-setup.sh | 33 -------------------------------
modules.d/90stratis/stratisd-init.service | 15 --------------
modules.d/90stratis/stratisd-start.sh | 3 ---
modules.d/90stratis/stratisd-stop.sh | 6 ------
5 files changed, 58 deletions(-)
diff --git a/dracut.spec b/dracut.spec
index fa3e4b99..dcaafa61 100644
--- a/dracut.spec
+++ b/dracut.spec
@@ -365,7 +365,6 @@ install -m 0755 51-dracut-rescue-postinst.sh $RPM_BUILD_ROOT%{_sysconfdir}/kerne
%{dracutlibdir}/modules.d/90lvm
%{dracutlibdir}/modules.d/90mdraid
%{dracutlibdir}/modules.d/90multipath
-%{dracutlibdir}/modules.d/90stratis
%{dracutlibdir}/modules.d/90qemu
%{dracutlibdir}/modules.d/91crypt-gpg
%{dracutlibdir}/modules.d/91crypt-loop
diff --git a/modules.d/90stratis/module-setup.sh b/modules.d/90stratis/module-setup.sh
deleted file mode 100755
index 943f572e..00000000
--- a/modules.d/90stratis/module-setup.sh
+++ /dev/null
@@ -1,33 +0,0 @@
-#!/bin/bash
-
-# called by dracut
-check() {
- require_binaries stratisd-init thin_check thin_repair mkfs.xfs xfs_admin xfs_growfs || return 1
- return 255
-}
-
-# called by dracut
-depends() {
- echo dm
- return 0
-}
-
-# called by dracut
-installkernel() {
- instmods xfs
-}
-
-# called by dracut
-install() {
-
- inst_multiple stratisd-init thin_check thin_repair mkfs.xfs xfs_admin xfs_growfs
-
- if dracut_module_included "systemd"; then
- inst_simple "${moddir}/stratisd-init.service" "${systemdsystemunitdir}/stratisd-init.service"
- systemctl -q --root "$initdir" enable stratisd-init.service
- else
- inst_hook cmdline 25 "$moddir/stratisd-start.sh"
- inst_hook cleanup 25 "$moddir/stratisd-stop.sh"
- fi
-}
-
diff --git a/modules.d/90stratis/stratisd-init.service b/modules.d/90stratis/stratisd-init.service
deleted file mode 100644
index 318e8c27..00000000
--- a/modules.d/90stratis/stratisd-init.service
+++ /dev/null
@@ -1,15 +0,0 @@
-[Unit]
-Description=A daemon that manages a pool of block devices to create flexible file systems
-Documentation=man:stratisd(8)
-Before=local-fs-pre.target
-DefaultDependencies=no
-
-[Service]
-Type=simple
-ExecStart=/sbin/stratisd-init --debug
-KillSignal=SIGINT
-StandardOutput=syslog
-StandardError=syslog
-
-[Install]
-WantedBy=sysinit.target
diff --git a/modules.d/90stratis/stratisd-start.sh b/modules.d/90stratis/stratisd-start.sh
deleted file mode 100755
index afcd81fd..00000000
--- a/modules.d/90stratis/stratisd-start.sh
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/sh
-
-stratisd-init --debug > /dev/kmsg 2>&1 &
\ No newline at end of file
diff --git a/modules.d/90stratis/stratisd-stop.sh b/modules.d/90stratis/stratisd-stop.sh
deleted file mode 100755
index f394a843..00000000
--- a/modules.d/90stratis/stratisd-stop.sh
+++ /dev/null
@@ -1,6 +0,0 @@
-#!/bin/sh
-
-[ -f /lib/dracut-lib.sh ] && . /lib/dracut-lib.sh
-
-pid=$(pidof stratisd-init)
-[ -n "$pid" ] && kill ${pid}

60
SOURCES/0136.patch Normal file
View File

@ -0,0 +1,60 @@
From 7c6839180cd616cebaeefd0cb05b60d022388277 Mon Sep 17 00:00:00 2001
From: Adam Williamson <awilliam@redhat.com>
Date: Thu, 26 Nov 2020 11:29:45 -0800
Subject: [PATCH] Drop 51-dracut-rescue-postinst.sh entirely
It is only installed on RHEL 8+, but as noted in the first commit
that tried to do this - 0bb9a683 - we already have branches for
all RHEL releases, so there's no point keeping such a conditional
on the master branch. After 0bb9a683, 51-dracut-rescue-postinst.sh
was re-added because Fedora 30 needed it, with a FIXME saying to
remove it after F30 was released. But instead of that happening, it
got changed to a conditional to install it on Fedora <= 30 or RHEL
<= 8 in 9e68789d and the FIXME was removed, then in 9eb1d1ed that
conditional was simplified to only refer to RHEL, so we wound up
with this situation.
Note the last two commits were never ported to the RHEL-8 branch,
so it's broken, I will send a separate PR for that.
Signed-off-by: Adam Williamson <awilliam@redhat.com>
Cherry-picked from: b3e55bde30b8d34c7ed888794ef3f5e9f028b267
Resolves: #1771517
---
dracut.spec | 10 ----------
1 file changed, 10 deletions(-)
diff --git a/dracut.spec b/dracut.spec
index dcaafa61..c8783699 100644
--- a/dracut.spec
+++ b/dracut.spec
@@ -277,15 +277,9 @@ rm -f -- $RPM_BUILD_ROOT%{_bindir}/mkinitrd
rm -f -- $RPM_BUILD_ROOT%{_bindir}/lsinitrd
%endif
-%if 0%{?fedora} || 0%{?rhel}
echo 'hostonly="no"' > $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/02-generic-image.conf
echo 'dracut_rescue_image="yes"' > $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/02-rescue.conf
-# FIXME: remove after F30
-mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/kernel/postinst.d
-install -m 0755 51-dracut-rescue-postinst.sh $RPM_BUILD_ROOT%{_sysconfdir}/kernel/postinst.d/51-dracut-rescue-postinst.sh
-%endif
-
%files
%if %{with doc}
%doc README HACKING TODO AUTHORS NEWS dracut.html dracut.png dracut.svg
@@ -477,11 +471,7 @@ install -m 0755 51-dracut-rescue-postinst.sh $RPM_BUILD_ROOT%{_sysconfdir}/kerne
%files config-rescue
%{dracutlibdir}/dracut.conf.d/02-rescue.conf
-%if 0%{?fedora} || 0%{?rhel}
%{_prefix}/lib/kernel/install.d/51-dracut-rescue.install
-# FIXME: remove after F30
-%{_sysconfdir}/kernel/postinst.d/51-dracut-rescue-postinst.sh
-%endif
%triggerin network -- dracut-network < 049-83.git20200525
echo '# Since rhel-8.3 dracut moved to use NetworkManager

26
SOURCES/0137.patch Normal file
View File

@ -0,0 +1,26 @@
From 862c5a97a69d61ff9122072d8c7bb2e828086650 Mon Sep 17 00:00:00 2001
From: David Tardon <dtardon@redhat.com>
Date: Wed, 5 May 2021 16:05:17 +0200
Subject: [PATCH] fix(fips): add dh and ecdh ciphers
(cherry picked from commit 543b8014fc10fc6a92ba83db0dfc994fc1d2129b)
Resolves: #1775692
---
modules.d/01fips/module-setup.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/modules.d/01fips/module-setup.sh b/modules.d/01fips/module-setup.sh
index f011f15d..8800a49e 100755
--- a/modules.d/01fips/module-setup.sh
+++ b/modules.d/01fips/module-setup.sh
@@ -24,7 +24,7 @@ installkernel() {
_fipsmodules+="crc32c crct10dif ghash "
# Ciphers:
- _fipsmodules+="cipher_null des3_ede aes cfb "
+ _fipsmodules+="cipher_null des3_ede aes cfb dh ecdh "
# Modes/templates:
_fipsmodules+="ecb cbc ctr xts gcm ccm authenc hmac cmac "

33
SOURCES/0138.patch Normal file
View File

@ -0,0 +1,33 @@
From 68826ecc8d1b0605cd69a4f679c0cd4de4e12b18 Mon Sep 17 00:00:00 2001
From: David Tardon <dtardon@redhat.com>
Date: Tue, 9 Feb 2021 16:46:07 +0100
Subject: [PATCH] 35network-legacy: discard pointless RTNETLINK message
This command prints
RTNETLINK answers: Network is unreachable
to stderr if IP is not assigned yet, but that's the thing we are
checking for, so there's no point in showing the message.
(cherry picked from commit c46ed697a20798c09ead362443691d810e122996)
Resolves: #1879597
---
modules.d/35network-legacy/ifup.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/modules.d/35network-legacy/ifup.sh b/modules.d/35network-legacy/ifup.sh
index 61838741..bd560379 100755
--- a/modules.d/35network-legacy/ifup.sh
+++ b/modules.d/35network-legacy/ifup.sh
@@ -106,7 +106,7 @@ do_static() {
return 1
fi
- ip route get "$ip" | {
+ ip route get "$ip" 2>/dev/null | {
read a rest
if [ "$a" = "local" ]; then
warn "Not assigning $ip to interface $netif, cause it is already assigned!"

74
SOURCES/0139.patch Normal file
View File

@ -0,0 +1,74 @@
From 809423a5731e4433f3fa08e97ddf152e49cd00bf Mon Sep 17 00:00:00 2001
From: Kairui Song <kasong@redhat.com>
Date: Fri, 13 Nov 2020 18:08:47 +0800
Subject: [PATCH] 95fcoe: don't install if there is no FCoE hostonly devices
When in hostonly mode, 95fcoe module will still be installed even there
is no FCoE hostonly device. So use the new block_is_fcoe helper to check
for hostonly device in hostonly mode, avoid installing unneccessary module.
Signed-off-by: Kairui Song <kasong@redhat.com>
(cherry picked from commit 8c8af8a2cd728e917be8465c79b12149e6877aef)
Resolves: #1899456
---
modules.d/95fcoe-uefi/module-setup.sh | 17 +++++------------
modules.d/95fcoe/module-setup.sh | 11 +++++------
2 files changed, 10 insertions(+), 18 deletions(-)
diff --git a/modules.d/95fcoe-uefi/module-setup.sh b/modules.d/95fcoe-uefi/module-setup.sh
index a464df5a..9e5719df 100755
--- a/modules.d/95fcoe-uefi/module-setup.sh
+++ b/modules.d/95fcoe-uefi/module-setup.sh
@@ -2,22 +2,15 @@
# called by dracut
check() {
- local _fcoe_ctlr
- [[ $hostonly ]] || [[ $mount_needs ]] && {
- for c in /sys/bus/fcoe/devices/ctlr_* ; do
- [ -L $c ] || continue
- _fcoe_ctlr=$c
- done
- [ -z "$_fcoe_ctlr" ] && return 255
+ is_fcoe() {
+ block_is_fcoe $1 || return 1
}
+
[[ $hostonly ]] || [[ $mount_needs ]] && {
+ for_each_host_dev_and_slaves is_fcoe || return 255
[ -d /sys/firmware/efi ] || return 255
- for c in /sys/bus/fcoe/devices/ctlr_* ; do
- [ -L $c ] || continue
- fcoe_ctlr=$c
- done
- [ -z "$fcoe_ctlr" ] && return 255
}
+
require_binaries dcbtool fipvlan lldpad ip readlink || return 1
return 0
}
diff --git a/modules.d/95fcoe/module-setup.sh b/modules.d/95fcoe/module-setup.sh
index c2224ec1..f5df705b 100755
--- a/modules.d/95fcoe/module-setup.sh
+++ b/modules.d/95fcoe/module-setup.sh
@@ -2,13 +2,12 @@
# called by dracut
check() {
- local _fcoe_ctlr
+ is_fcoe() {
+ block_is_fcoe $1 || return 1
+ }
+
[[ $hostonly ]] || [[ $mount_needs ]] && {
- for c in /sys/bus/fcoe/devices/ctlr_* ; do
- [ -L $c ] || continue
- _fcoe_ctlr=$c
- done
- [ -z "$_fcoe_ctlr" ] && return 255
+ for_each_host_dev_and_slaves is_fcoe || return 255
}
require_binaries dcbtool fipvlan lldpad ip readlink fcoemon fcoeadm || return 1

36
SOURCES/0140.patch Normal file
View File

@ -0,0 +1,36 @@
From 7a6dfe638d1ef92dfe830094db6b09cb0956c189 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.
Fixes: 5840c466 95nfs: /var/lib/nfs/statd/sm is /var/lib/nfs/sm on SUSE
Resolves: #1924950
---
modules.d/95nfs/module-setup.sh | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/modules.d/95nfs/module-setup.sh b/modules.d/95nfs/module-setup.sh
index 2ca75d07..ac6d1761 100755
--- a/modules.d/95nfs/module-setup.sh
+++ b/modules.d/95nfs/module-setup.sh
@@ -104,7 +104,13 @@ install() {
inst "$moddir/nfs-lib.sh" "/lib/nfs-lib.sh"
mkdir -m 0755 -p "$initdir/var/lib/nfs/rpc_pipefs"
mkdir -m 0770 -p "$initdir/var/lib/rpcbind"
- mkdir -m 0755 -p "$initdir/var/lib/nfs/statd/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

52
SOURCES/0141.patch Normal file
View File

@ -0,0 +1,52 @@
From eaba11eff1156f7a0324a1aa46e43396c7ec3628 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Renaud=20M=C3=A9trich?= <rmetrich@redhat.com>
Date: Mon, 1 Mar 2021 17:43:10 +0100
Subject: [PATCH] fix(dracut.sh): harden dracut against GZIP environment
variable
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
When a GZIP environment variable is set, this leads to various breakage:
In case 'pigz' is installed and GZIP is defined as a path, e.g.
/usr/local/bin/gzip, then dracut will fail with the following message:
"
pigz: abort: cannot provide files in GZIP environment variable
"
In case 'pigz' isn't installed and regular 'gzip' is used and GZIP is
defined as a path, e.g. /usr/local/bin/gzip, then the path will be
zipped and dracut will fail for no obvious reason. Trying again, dracut
will then fail with following message:
"
gzip: /usr/local/bin/gzip.gz already exists; not overwritten
"
In any case, GZIP environment should be unset to avoid breakage or
unwanted behaviour. This variable is anyway obsolescent, from gzip(1)
manpage.
Signed-off-by: Renaud Métrich <rmetrich@redhat.com>
(cherry picked from commit d8e47e201af4646e2a82e11220ea9c993bd2ed48)
Resolves: #1933773
---
dracut.sh | 1 +
1 file changed, 1 insertion(+)
diff --git a/dracut.sh b/dracut.sh
index 01abe7a4..4340e646 100755
--- a/dracut.sh
+++ b/dracut.sh
@@ -24,6 +24,7 @@
# store for logging
unset BASH_ENV
+unset GZIP
# Verify bash version, current minimum is 4
if (( BASH_VERSINFO[0] < 4 )); then

36
SOURCES/0142.patch Normal file
View File

@ -0,0 +1,36 @@
From 3789ef258ecced4b91139b10e71dc787e48519e7 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Fri, 23 Apr 2021 11:11:27 +0200
Subject: [PATCH] fix(multipath): stop multipath before udev db cleanup
All device-mapper based devices, including device-mapper-multipath,
do reuse the udev db from the initramfs after switching to the root fs.
Therefore device-mapper devices have to be correctly initialized before
the udev daemon is stopped, to have the correct entries in the udev db.
See also https://bugzilla.redhat.com/show_bug.cgi?id=1949076
(cherry picked from commit 3c244c7ca3555b526883dc20104c469b39085cbe)
Resolves: #1949076
---
modules.d/90multipath/multipathd.service | 2 ++
1 file changed, 2 insertions(+)
diff --git a/modules.d/90multipath/multipathd.service b/modules.d/90multipath/multipathd.service
index 646c7c14..b544de21 100644
--- a/modules.d/90multipath/multipathd.service
+++ b/modules.d/90multipath/multipathd.service
@@ -4,8 +4,10 @@ Before=iscsi.service iscsid.service lvm2-activation-early.service
Wants=systemd-udev-trigger.service systemd-udev-settle.service local-fs-pre.target
After=systemd-udev-trigger.service systemd-udev-settle.service
Before=local-fs-pre.target
+Before=initrd-cleanup.service
DefaultDependencies=no
Conflicts=shutdown.target
+Conflicts=initrd-cleanup.service
ConditionKernelCommandLine=!nompath
ConditionKernelCommandLine=!rd.multipath=0
ConditionKernelCommandLine=!rd_NO_MULTIPATH

89
SOURCES/0143.patch Normal file
View File

@ -0,0 +1,89 @@
From f03ee48fab36a9fe55082f15111771b698081598 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Renaud=20M=C3=A9trich?= <rmetrich@redhat.com>
Date: Wed, 5 May 2021 15:46:08 +0200
Subject: [PATCH] fix(dracut-functions): implement a cache for get_maj_min
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
On systems with a large number of devices, usually multipath devices,
dracut can spend a lot of time stat'ing the devices to collect the
major/minor numbers, leading to huge slowness rebuilding the initramfs
when stat'ing devices is slow (seen with oracleasm file systems in
particular).
This commit implements a basic cache stored in a file under
DRACUT_TMPDIR storing the major:minor corresponding to the specified
device.
Reproducer: create N loopback devices used as a LVM extension to volume
group hosting the root file system
# LVMVG="rhel"
# NDEVICES=200
# mkdir devices; for i in $(seq 1 $NDEVICES); do
truncate -s 10m devices/$i; losetup loop$i devices/$i
done
# vgextend $LVMVG $(/bin/ls -1 /dev/loop[0-9]*)
With standard code (tested with RHEL8.3 dracut):
# dracut -f --debug /tmp/initramfs.img $(uname -r) >/tmp/debug 2>&1
# grep -c "stat -L -c" /tmp/debug
2440
With this code:
# dracut -f --debug /tmp/initramfs.img $(uname -r) >/tmp/debug_optim 2>&1
# grep -c "stat -L -c" /tmp/debug_optim
205
Signed-off-by: Renaud Métrich <rmetrich@redhat.com>
(cherry picked from commit c3bb9d18dceed7db6d16f9c2a7f682c5934099d7)
Cherry-picked from: c3bb9d18dceed7db6d16f9c2a7f682c5934099d7
Resolves: #1957622
---
dracut-functions.sh | 10 +++++++---
dracut.sh | 4 ++++
2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/dracut-functions.sh b/dracut-functions.sh
index 1431dd18..a221967c 100755
--- a/dracut-functions.sh
+++ b/dracut-functions.sh
@@ -199,12 +199,16 @@ get_fs_env() {
# $ get_maj_min /dev/sda2
# 8:2
get_maj_min() {
- local _maj _min _majmin
+ local _majmin
+ out="$(grep -m1 -oP "^$1 \K\S+$" "${get_maj_min_cache_file:?}")"
+ if [ -z "$out" ]; then
_majmin="$(stat -L -c '%t:%T' "$1" 2>/dev/null)"
- printf "%s" "$((0x${_majmin%:*})):$((0x${_majmin#*:}))"
+ out="$(printf "%s" "$((0x${_majmin%:*})):$((0x${_majmin#*:}))")"
+ echo "$1 $out" >> "${get_maj_min_cache_file:?}"
+ fi
+ echo -n "$out"
}
-
# get_devpath_block <device>
# get the DEVPATH in /sys of a block device
get_devpath_block() {
diff --git a/dracut.sh b/dracut.sh
index 4340e646..f8e68ccb 100755
--- a/dracut.sh
+++ b/dracut.sh
@@ -901,6 +901,10 @@ readonly DRACUT_TMPDIR="$(mktemp -p "$TMPDIR/" -d -t dracut.XXXXXX)"
exit 1
}
+# Cache file used to optimize get_maj_min()
+declare -x -r get_maj_min_cache_file="${DRACUT_TMPDIR}/majmin_cache"
+: > "$get_maj_min_cache_file"
+
# clean up after ourselves no matter how we die.
trap '
ret=$?;

48
SOURCES/0144.patch Normal file
View File

@ -0,0 +1,48 @@
From 6ed9cff05fb1015fe50951c93430052004d22b01 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Fri, 21 May 2021 12:19:32 +0200
Subject: [PATCH] fix(dracut-functions): get_maj_min without
get_maj_min_cache_file set
If `get_maj_min_cache_file` is unset `get_maj_min()` would error out.
Fix it to work without a cache file set.
(cherry picked from commit a277a5fc7acc0a9e8d853f09671495f9d27645c1)
Cherry-picked from: a277a5fc7acc0a9e8d853f09671495f9d27645c1
Resolves: #1957622
---
dracut-functions.sh | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/dracut-functions.sh b/dracut-functions.sh
index a221967c..eb2ce748 100755
--- a/dracut-functions.sh
+++ b/dracut-functions.sh
@@ -200,13 +200,20 @@ get_fs_env() {
# 8:2
get_maj_min() {
local _majmin
- out="$(grep -m1 -oP "^$1 \K\S+$" "${get_maj_min_cache_file:?}")"
- if [ -z "$out" ]; then
+ local _out
+
+ if [[ $get_maj_min_cache_file ]]; then
+ _out="$(grep -m1 -oP "^$1 \K\S+$" "$get_maj_min_cache_file")"
+ fi
+
+ if ! [[ "$_out" ]]; then
_majmin="$(stat -L -c '%t:%T' "$1" 2>/dev/null)"
out="$(printf "%s" "$((0x${_majmin%:*})):$((0x${_majmin#*:}))")"
- echo "$1 $out" >> "${get_maj_min_cache_file:?}"
+ if [[ $get_maj_min_cache_file ]]; then
+ echo "$1 $_out" >> "$get_maj_min_cache_file"
+ fi
fi
- echo -n "$out"
+ echo -n "$_out"
}
# get_devpath_block <device>

43
SOURCES/0145.patch Normal file
View File

@ -0,0 +1,43 @@
From 21b746743c146c94235c93611519db6d47c8c0c1 Mon Sep 17 00:00:00 2001
From: Lukas Nykryn <lnykryn@redhat.com>
Date: Thu, 18 Feb 2021 11:01:31 +0100
Subject: [PATCH] fix(fcoe): rd.nofcoe=0 should disable fcoe
8446c8f9 Changed the default behavior, but also flipped meaning of 0/1.
Right now rd.nofcoe=0 enables fcoe, which is the opposite what manpage
says.
(cherry picked from commit 805b46c2a81e04d69fc3af912942568516d05ee7)
Resolves: #1929201
---
modules.d/95fcoe/lldpad.sh | 2 +-
modules.d/95fcoe/parse-fcoe.sh | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/modules.d/95fcoe/lldpad.sh b/modules.d/95fcoe/lldpad.sh
index 7faa2e19..6b1844b0 100755
--- a/modules.d/95fcoe/lldpad.sh
+++ b/modules.d/95fcoe/lldpad.sh
@@ -1,6 +1,6 @@
#!/bin/bash
-if getargbool 0 rd.nofcoe ; then
+if ! getargbool 1 rd.nofcoe ; then
info "rd.nofcoe=0: skipping lldpad activation"
return 0
fi
diff --git a/modules.d/95fcoe/parse-fcoe.sh b/modules.d/95fcoe/parse-fcoe.sh
index 86f4331e..5553602f 100755
--- a/modules.d/95fcoe/parse-fcoe.sh
+++ b/modules.d/95fcoe/parse-fcoe.sh
@@ -13,7 +13,7 @@
# fcoe=eth0:nodcb:vn2vn
# fcoe=4a:3f:4c:04:f8:d7:nodcb:fabric
-if getargbool 0 rd.nofcoe ; then
+if ! getargbool 1 rd.nofcoe ; then
info "rd.nofcoe=0: skipping fcoe"
return 0
fi

63
SOURCES/0146.patch Normal file
View File

@ -0,0 +1,63 @@
From c588aea59c9a2441596b84722c6c32449676f07d Mon Sep 17 00:00:00 2001
From: Lukas Nykryn <lnykryn@redhat.com>
Date: Thu, 18 Feb 2021 11:23:41 +0100
Subject: [PATCH] fix(fcoe): rename rd.nofcoe to rd.fcoe
The current name of this bool is kinda stupid. Based on the manpage
setting it to 0 turns off fcoe, which means that nofcoe=1 should mean
that it is on.
Let's just do the same thing as with rd.lvm=0, rd.luks=0,....
(cherry picked from commit 6f7823bce65dd4b52497dbb94892b637fd06471a)
Resolves: #1929201
---
dracut.cmdline.7.asc | 2 +-
modules.d/95fcoe/lldpad.sh | 4 ++--
modules.d/95fcoe/parse-fcoe.sh | 4 ++--
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/dracut.cmdline.7.asc b/dracut.cmdline.7.asc
index bf745575..327f85de 100644
--- a/dracut.cmdline.7.asc
+++ b/dracut.cmdline.7.asc
@@ -779,7 +779,7 @@ iscsistart -b --param node.session.timeo.replacement_timeout=30
FCoE
~~~~
-**rd.nofcoe=0**::
+**rd.fcoe=0**::
disable FCoE and lldpad
**fcoe=**__<edd|interface|MAC>__:__{dcb|nodcb}__:__{fabric|vn2vn}__::
diff --git a/modules.d/95fcoe/lldpad.sh b/modules.d/95fcoe/lldpad.sh
index 6b1844b0..c860035f 100755
--- a/modules.d/95fcoe/lldpad.sh
+++ b/modules.d/95fcoe/lldpad.sh
@@ -1,7 +1,7 @@
#!/bin/bash
-if ! getargbool 1 rd.nofcoe ; then
- info "rd.nofcoe=0: skipping lldpad activation"
+if ! getargbool 1 rd.fcoe -d -n rd.nofcoe ; then
+ info "rd.fcoe=0: skipping lldpad activation"
return 0
fi
diff --git a/modules.d/95fcoe/parse-fcoe.sh b/modules.d/95fcoe/parse-fcoe.sh
index 5553602f..0a8067f5 100755
--- a/modules.d/95fcoe/parse-fcoe.sh
+++ b/modules.d/95fcoe/parse-fcoe.sh
@@ -13,8 +13,8 @@
# fcoe=eth0:nodcb:vn2vn
# fcoe=4a:3f:4c:04:f8:d7:nodcb:fabric
-if ! getargbool 1 rd.nofcoe ; then
- info "rd.nofcoe=0: skipping fcoe"
+if ! getargbool 1 rd.fcoe -d -n rd.nofcoe ; then
+ info "rd.fcoe=0: skipping fcoe"
return 0
fi

170
SOURCES/0147.patch Normal file
View File

@ -0,0 +1,170 @@
From dc316701f752f5197a6a926a9a401688ffdb9bca Mon Sep 17 00:00:00 2001
From: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
Date: Thu, 26 Nov 2020 13:04:44 +0100
Subject: [PATCH] fix(mdraid): remove offroot
offroot is deprecated and can be safety removed.
Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
(cherry picked from commit 30e49d51751c695be85782cfc162de2a63db471c)
Resolves: #1958899
---
modules.d/90mdraid/65-md-incremental-imsm.rules | 2 +-
modules.d/90mdraid/md-shutdown.sh | 5 ++---
modules.d/90mdraid/mdraid-cleanup.sh | 7 +++----
modules.d/90mdraid/mdraid-waitclean.sh | 7 +++----
modules.d/90mdraid/mdraid_start.sh | 10 +++-------
modules.d/90mdraid/parse-md.sh | 2 --
6 files changed, 12 insertions(+), 21 deletions(-)
diff --git a/modules.d/90mdraid/65-md-incremental-imsm.rules b/modules.d/90mdraid/65-md-incremental-imsm.rules
index 52f5b195..6697f159 100644
--- a/modules.d/90mdraid/65-md-incremental-imsm.rules
+++ b/modules.d/90mdraid/65-md-incremental-imsm.rules
@@ -39,6 +39,6 @@ RUN+="/sbin/initqueue --timeout --name 50-mdraid_start --onetime --unique /sbin/
#
LABEL="md_incremental"
-RUN+="/sbin/mdadm $env{rd_MD_OFFROOT} -I $env{DEVNAME}"
+RUN+="/sbin/mdadm -I $env{DEVNAME}"
LABEL="md_end"
diff --git a/modules.d/90mdraid/md-shutdown.sh b/modules.d/90mdraid/md-shutdown.sh
index 400bb003..40c82570 100755
--- a/modules.d/90mdraid/md-shutdown.sh
+++ b/modules.d/90mdraid/md-shutdown.sh
@@ -3,12 +3,11 @@
_do_md_shutdown() {
local ret
local final=$1
- local _offroot=$(strstr "$(mdadm --help-options 2>&1)" offroot && echo --offroot)
info "Waiting for mdraid devices to be clean."
- mdadm $_offroot -vv --wait-clean --scan| vinfo
+ mdadm -vv --wait-clean --scan| vinfo
ret=$?
info "Disassembling mdraid devices."
- mdadm $_offroot -vv --stop --scan | vinfo
+ mdadm -vv --stop --scan | vinfo
ret=$(($ret+$?))
if [ "x$final" != "x" ]; then
info "/proc/mdstat:"
diff --git a/modules.d/90mdraid/mdraid-cleanup.sh b/modules.d/90mdraid/mdraid-cleanup.sh
index 565449a5..007e581b 100755
--- a/modules.d/90mdraid/mdraid-cleanup.sh
+++ b/modules.d/90mdraid/mdraid-cleanup.sh
@@ -2,7 +2,6 @@
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
-_offroot=$(strstr "$(mdadm --help-options 2>&1)" offroot && echo --offroot)
containers=""
for md in /dev/md[0-9_]*; do
[ -b "$md" ] || continue
@@ -12,11 +11,11 @@ for md in /dev/md[0-9_]*; do
containers="$containers $md"
continue
fi
- mdadm $_offroot -S "$md" >/dev/null 2>&1
+ mdadm -S "$md" >/dev/null 2>&1
done
for md in $containers; do
- mdadm $_offroot -S "$md" >/dev/null 2>&1
+ mdadm -S "$md" >/dev/null 2>&1
done
-unset containers udevinfo _offroot
+unset containers udevinfo
diff --git a/modules.d/90mdraid/mdraid-waitclean.sh b/modules.d/90mdraid/mdraid-waitclean.sh
index 5c901982..0a7480f7 100755
--- a/modules.d/90mdraid/mdraid-waitclean.sh
+++ b/modules.d/90mdraid/mdraid-waitclean.sh
@@ -1,7 +1,6 @@
#!/bin/sh
if getargbool 0 rd.md.waitclean; then
- _offroot=$(strstr "$(mdadm --help-options 2>&1)" offroot && echo --offroot)
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
containers=""
for md in /dev/md[0-9_]*; do
@@ -13,13 +12,13 @@ if getargbool 0 rd.md.waitclean; then
continue
fi
info "Waiting for $md to become clean"
- mdadm $_offroot -W "$md" >/dev/null 2>&1
+ mdadm -W "$md" >/dev/null 2>&1
done
for md in $containers; do
info "Waiting for $md to become clean"
- mdadm $_offroot -W "$md" >/dev/null 2>&1
+ mdadm -W "$md" >/dev/null 2>&1
done
- unset containers udevinfo _offroot
+ unset containers udevinfo
fi
diff --git a/modules.d/90mdraid/mdraid_start.sh b/modules.d/90mdraid/mdraid_start.sh
index 77e843d7..ed8d8dfe 100755
--- a/modules.d/90mdraid/mdraid_start.sh
+++ b/modules.d/90mdraid/mdraid_start.sh
@@ -7,7 +7,6 @@ _md_start() {
local _path_s
local _path_d
local _md="$1"
- local _offroot="$2"
_udevinfo="$(udevadm info --query=env --name="${_md}")"
strstr "$_udevinfo" "MD_LEVEL=container" && continue
@@ -19,7 +18,7 @@ _md_start() {
# inactive ?
[ "$(cat "$_path_s")" != "inactive" ] && continue
- mdadm $_offroot -R "${_md}" 2>&1 | vinfo
+ mdadm -R "${_md}" 2>&1 | vinfo
# still inactive ?
[ "$(cat "$_path_s")" = "inactive" ] && continue
@@ -30,14 +29,11 @@ _md_start() {
}
_md_force_run() {
- local _offroot
local _md
local _UUID
local _MD_UUID=$(getargs rd.md.uuid -d rd_MD_UUID=)
[ -n "$_MD_UUID" ] || getargbool 0 rd.auto || return
- _offroot=$(strstr "$(mdadm --help-options 2>&1)" offroot && echo --offroot)
-
if [ -n "$_MD_UUID" ]; then
_MD_UUID=$(str_replace "$_MD_UUID" "-" "")
_MD_UUID=$(str_replace "$_MD_UUID" ":" "")
@@ -58,13 +54,13 @@ _md_force_run() {
# check if we should handle this device
strstr " $_MD_UUID " " $_UUID " || continue
- _md_start "${_md}" "${_offroot}"
+ _md_start "${_md}"
done
else
# try to force-run anything not running yet
for _md in /dev/md[0-9_]*; do
[ -b "$_md" ] || continue
- _md_start "${_md}" "${_offroot}"
+ _md_start "${_md}"
done
fi
}
diff --git a/modules.d/90mdraid/parse-md.sh b/modules.d/90mdraid/parse-md.sh
index 4d9baa52..2cce9769 100755
--- a/modules.d/90mdraid/parse-md.sh
+++ b/modules.d/90mdraid/parse-md.sh
@@ -60,5 +60,3 @@ if ! getargbool 1 rd.md.ddf -n rd_NO_MDDDF -n noddfmd -n nodmraid; then
info "no MD RAID for SNIA ddf raids"
udevproperty rd_NO_MDDDF=1
fi
-
-strstr "$(mdadm --help-options 2>&1)" offroot && udevproperty rd_MD_OFFROOT=--offroot

35
SOURCES/0148.patch Normal file
View File

@ -0,0 +1,35 @@
From 5818f56e99aecca0664f779c29c569f116f907e4 Mon Sep 17 00:00:00 2001
From: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
Date: Thu, 26 Nov 2020 12:51:47 +0100
Subject: [PATCH] fix(mdraid): add grow continue service
During raid assembly mdadm will call mdadm-grow-continue.service if
reshape is in progress.
If service doesn't exist then it is done via fork and systemd will kill
it unconditionally after processing all events.
Add proper service to allow systemd to manage reshape correctly.
Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
(cherry picked from commit 29e269a5225ad8f658a8d7ef64d77d0c02f8e31d)
Resolves: #1958899
---
modules.d/90mdraid/module-setup.sh | 3 +++
1 file changed, 3 insertions(+)
diff --git a/modules.d/90mdraid/module-setup.sh b/modules.d/90mdraid/module-setup.sh
index 98a4ef5d..2e043041 100755
--- a/modules.d/90mdraid/module-setup.sh
+++ b/modules.d/90mdraid/module-setup.sh
@@ -136,6 +136,9 @@ install() {
if [ -e $systemdsystemunitdir/mdadm-last-resort@.timer ]; then
inst_simple $systemdsystemunitdir/mdadm-last-resort@.timer
fi
+ if [ -e $dracutsysrootdir$systemdsystemunitdir/mdadm-grow-continue@.service ]; then
+ inst_simple $systemdsystemunitdir/mdadm-grow-continue@.service
+ fi
fi
inst_hook pre-shutdown 30 "$moddir/mdmon-pre-shutdown.sh"
dracut_need_initqueue

32
SOURCES/0149.patch Normal file
View File

@ -0,0 +1,32 @@
From 7b5182a572c03279b65f0c6abd434edd513e956d Mon Sep 17 00:00:00 2001
From: Thomas Blume <Thomas.Blume@suse.com>
Date: Fri, 7 Aug 2020 08:39:26 +0200
Subject: [PATCH] net-lib.sh: support infiniband network mac addresses
Infiniband MAC addresses have 20 octets.
Reference: bsc#996146
(cherry picked from commit 376ce85105121936666349aa5a777768d52516f7)
Resolves: #1964538
---
modules.d/40network/net-lib.sh | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/modules.d/40network/net-lib.sh b/modules.d/40network/net-lib.sh
index f0c1c041..128d6343 100755
--- a/modules.d/40network/net-lib.sh
+++ b/modules.d/40network/net-lib.sh
@@ -570,6 +570,11 @@ parse_ifname_opts() {
# udev requires MAC addresses to be lower case
ifname_mac=$(echo $2:$3:$4:$5:$6:$7 | sed 'y/ABCDEF/abcdef/')
;;
+ 21)
+ ifname_if=$1
+ # udev requires MAC addresses to be lower case
+ ifname_mac=$(echo $2:$3:$4:$5:$6:$7:$8:$9:${10}:${11}:${12}:${13}:${14}:${15}:${16}:${17}:${18}:${19}:${20}:${21} | sed 'y/ABCDEF/abcdef/')
+ ;;
*)
die "Invalid arguments for ifname="
;;

55
SOURCES/0150.patch Normal file
View File

@ -0,0 +1,55 @@
From 81f38303351391b054e28d91cb101756233d2b64 Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.com>
Date: Mon, 28 Sep 2020 13:39:07 +0200
Subject: [PATCH] 95nvmf: add nvmf-autoconnect script
Add a script to run FC autoconnect.
Signed-off-by: Hannes Reinecke <hare@suse.de>
(cherry picked from commit 0e2ef80993858992f6219b5162289568937a1fac)
Cherry-picked from: 0e2ef80993858992f6219b5162289568937a1fac
Resolves: #1975707
---
modules.d/95nvmf/module-setup.sh | 2 ++
modules.d/95nvmf/nvmf-autoconnect.sh | 5 +++++
modules.d/95nvmf/parse-nvmf-boot-connections.sh | 2 +-
3 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/modules.d/95nvmf/module-setup.sh b/modules.d/95nvmf/module-setup.sh
index 418b5e0c..3923451b 100755
--- a/modules.d/95nvmf/module-setup.sh
+++ b/modules.d/95nvmf/module-setup.sh
@@ -79,6 +79,8 @@ install() {
inst_multiple ip sed
+ inst_script "${moddir}/nvmf-autoconnect.sh" /sbin/nvmf-autoconnect.sh
+
inst_multiple nvme
inst_multiple -o \
"$systemdsystemunitdir/nvm*-connect@.service" \
diff --git a/modules.d/95nvmf/nvmf-autoconnect.sh b/modules.d/95nvmf/nvmf-autoconnect.sh
new file mode 100644
index 00000000..c8f676a7
--- /dev/null
+++ b/modules.d/95nvmf/nvmf-autoconnect.sh
@@ -0,0 +1,5 @@
+#!/bin/bash
+
+[ -f /sys/class/fc/fc_udev_device/nvme_discovery ] || exit 1
+echo add > /sys/class/fc/fc_udev_device/nvme_discovery
+exit 0
diff --git a/modules.d/95nvmf/parse-nvmf-boot-connections.sh b/modules.d/95nvmf/parse-nvmf-boot-connections.sh
index 61c6dec1..ceb52f1e 100755
--- a/modules.d/95nvmf/parse-nvmf-boot-connections.sh
+++ b/modules.d/95nvmf/parse-nvmf-boot-connections.sh
@@ -133,6 +133,6 @@ else
/sbin/initqueue --settled --onetime --unique /usr/sbin/nvme connect-all -t tcp -a $traddr -s $trsvcid
> /tmp/net.$ifname.did-setup
else
- /sbin/initqueue --finished --unique --name nvme-fc-autoconnect echo 1 > /sys/class/fc/fc_udev_device/nvme_discovery
+ /sbin/initqueue --finished --onetime --unique --name nvme-fc-autoconnect /sbin/nvmf-autoconnect.sh
fi
fi

24
SOURCES/0151.patch Normal file
View File

@ -0,0 +1,24 @@
From a1b8660316c7d0a541d9e4139df5c5efe2532365 Mon Sep 17 00:00:00 2001
From: Lukas Nykryn <lnykryn@redhat.com>
Date: Thu, 29 Jul 2021 17:40:26 +0200
Subject: [PATCH] dracut-functions: fix botched backport
Resolves: #1957622
---
dracut-functions.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dracut-functions.sh b/dracut-functions.sh
index eb2ce748..d75696fd 100755
--- a/dracut-functions.sh
+++ b/dracut-functions.sh
@@ -208,7 +208,7 @@ get_maj_min() {
if ! [[ "$_out" ]]; then
_majmin="$(stat -L -c '%t:%T' "$1" 2>/dev/null)"
- out="$(printf "%s" "$((0x${_majmin%:*})):$((0x${_majmin#*:}))")"
+ _out="$(printf "%s" "$((0x${_majmin%:*})):$((0x${_majmin#*:}))")"
if [[ $get_maj_min_cache_file ]]; then
echo "$1 $_out" >> "$get_maj_min_cache_file"
fi

75
SOURCES/0152.patch Normal file
View File

@ -0,0 +1,75 @@
From 20ea91703b98708579f3d531823ec56bcec2bf1a Mon Sep 17 00:00:00 2001
From: Kairui Song <kasong@redhat.com>
Date: Fri, 9 Nov 2018 10:48:28 +0800
Subject: [PATCH] squash: unsquash the root image instead of mounting it on
shutdown
When building squash image, squash module forgot to install the new
shutdown.sh, and the shutdown hooks are always skipped on ordinary
shutdown if squash module is enabled.
The new shutdown.sh will remount the squash image and then everything
will just work, but currently re-mounting the squash image on shutdown
may have selinux problem and make the system hang, and there is no
easy way to fix it.
So skip fixing the shutdown.sh not being install problem, instead
just drop the new shutdown.sh, and unsquash the image on ordinary
shutdown, which is safer and should always work.
Signed-off-by: Kairui Song <kasong@redhat.com>
(cherry picked from commit a60af534132828fd46fa017291f7ed7cfeab1dc3)
Resolves: #1959336
---
dracut-initramfs-restore.sh | 9 +++++++++
dracut.sh | 2 --
modules.d/99squash/shutdown.sh | 7 -------
3 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/dracut-initramfs-restore.sh b/dracut-initramfs-restore.sh
index 94794804..67fc88fa 100644
--- a/dracut-initramfs-restore.sh
+++ b/dracut-initramfs-restore.sh
@@ -40,4 +40,13 @@ else
exit 1
fi
+if [[ -d squash ]]; then
+ unsquashfs -no-xattrs -f -d . squash/root.img >/dev/null
+ if [ $? -ne 0 ]; then
+ echo "Squash module is enabled for this initramfs but failed to unpack squash/root.img" >&2
+ rm -f -- /run/initramfs/shutdown
+ exit 1
+ fi
+fi
+
exit 0
diff --git a/dracut.sh b/dracut.sh
index f8e68ccb..966350c5 100755
--- a/dracut.sh
+++ b/dracut.sh
@@ -1817,9 +1817,7 @@ if dracut_module_included "squash"; then
done
mv $initdir/init $initdir/init.stock
- mv $initdir/shutdown $initdir/shutdown.stock
ln -s squash/init.sh $initdir/init
- ln -s squash/shutdown.sh $initdir/shutdown
# Reinstall required files for the squash image setup script.
# We have moved them inside the squashed image, but they need to be
diff --git a/modules.d/99squash/shutdown.sh b/modules.d/99squash/shutdown.sh
deleted file mode 100755
index 535779f4..00000000
--- a/modules.d/99squash/shutdown.sh
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/bin/sh
-/squash/setup-squash.sh
-
-exec /shutdown.stock
-
-echo "Something went wrong when trying to start original shutdown executable!"
-exit 1

33
SOURCES/0153.patch Normal file
View File

@ -0,0 +1,33 @@
From 309c4b0a1756399d9bfd5576d904be63c0a9a8c8 Mon Sep 17 00:00:00 2001
From: Kairui Song <kasong@redhat.com>
Date: Tue, 25 Dec 2018 17:53:24 +0800
Subject: [PATCH] 99squash: fail early if can't install require modules in
initramfs
insmods will consider all arguments as optional modules by default, but
for squash module, all listed modules are required, if any of them is
missing the initramfs won't boot. So pass the '-c' argument to let instmos
know all those modules are mandatory, it will fail and give an error if
it failed to install any of those modules.
(cherry picked from commit 90ac0a2d772ec0d4f90ea16fc5a31be10bdf205e)
Resolves: #1959336
---
modules.d/99squash/module-setup.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/modules.d/99squash/module-setup.sh b/modules.d/99squash/module-setup.sh
index 7aa0b447..72fa81f0 100644
--- a/modules.d/99squash/module-setup.sh
+++ b/modules.d/99squash/module-setup.sh
@@ -10,7 +10,7 @@ depends() {
}
installkernel() {
- hostonly="" instmods squashfs loop overlay
+ hostonly="" instmods -c squashfs loop overlay
}
install() {

36
SOURCES/0154.patch Normal file
View File

@ -0,0 +1,36 @@
From 776ee36e59f6f2cb97f6cd2bca4c989b89a727d2 Mon Sep 17 00:00:00 2001
From: Kairui Song <kasong@redhat.com>
Date: Mon, 8 Jun 2020 15:31:56 +0800
Subject: [PATCH] 99squash: Don't hardcode the squash sub directories
Signed-off-by: Kairui Song <kasong@redhat.com>
(cherry picked from commit 3a2beb037c822e1567f86b63ac24194bffeea991)
Resolves: #1959336
---
modules.d/99squash/setup-squash.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/modules.d/99squash/setup-squash.sh b/modules.d/99squash/setup-squash.sh
index d2740e7c..d0000b6f 100755
--- a/modules.d/99squash/setup-squash.sh
+++ b/modules.d/99squash/setup-squash.sh
@@ -4,7 +4,6 @@ PATH=/bin:/sbin
SQUASH_IMG=/squash/root.img
SQUASH_MNT=/squash/root
SQUASH_MNT_REC=/squash/mounts
-SQUASHED_MNT="usr etc"
echo $SQUASH_MNT > $SQUASH_MNT_REC
@@ -45,7 +44,8 @@ if [ $? != 0 ]; then
echo "Unable to mount squashed initramfs image"
fi
-for file in $SQUASHED_MNT; do
+for file in $SQUASH_MNT/*; do
+ file=${file#$SQUASH_MNT/}
lowerdir=$SQUASH_MNT/$file
workdir=/squash/overlay-work/$file
upperdir=/$file

56
SOURCES/0155.patch Normal file
View File

@ -0,0 +1,56 @@
From a5b46f9fad27954206fe47dedcef350f77f244a0 Mon Sep 17 00:00:00 2001
From: Kairui Song <kasong@redhat.com>
Date: Mon, 8 Jun 2020 17:00:00 +0800
Subject: [PATCH] 99squash: improve pre-requirements check
Check for systemd-initrd and squashfs-tools in check() to fail early if
it won't work.
Signed-off-by: Kairui Song <kasong@redhat.com>
(cherry picked from commit cfd872392c59c96665c558899880d6b2980065bb)
Resolves: #1959336
---
modules.d/99squash/module-setup.sh | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/modules.d/99squash/module-setup.sh b/modules.d/99squash/module-setup.sh
index 72fa81f0..6307377c 100644
--- a/modules.d/99squash/module-setup.sh
+++ b/modules.d/99squash/module-setup.sh
@@ -1,11 +1,21 @@
#!/bin/bash
check() {
+ if ! dracut_module_included "systemd-initrd"; then
+ derror "dracut-squash only supports systemd bases initramfs"
+ return 1
+ fi
+
+ if ! type -P mksquashfs >/dev/null || ! type -P unsquashfs >/dev/null ; then
+ derror "dracut-squash module requires squashfs-tools"
+ return 1
+ fi
+
return 255
}
depends() {
- echo "bash systemd systemd-initrd"
+ echo "bash systemd-initrd"
return 0
}
@@ -14,11 +24,6 @@ installkernel() {
}
install() {
- if ! type -P mksquashfs >/dev/null || ! type -P unsquashfs >/dev/null ; then
- derror "squash module requires squashfs-tools to be installed."
- return 1
- fi
-
inst_multiple kmod modprobe mount mkdir ln echo
inst $moddir/setup-squash.sh /squash/setup-squash.sh
inst $moddir/clear-squash.sh /squash/clear-squash.sh

159
SOURCES/0156.patch Normal file
View File

@ -0,0 +1,159 @@
From 8272fd2f1b676abe22abaacfe7c1ebd24b56fcb6 Mon Sep 17 00:00:00 2001
From: Pedro Monreal <pmgdeb@gmail.com>
Date: Thu, 8 Nov 2018 14:15:38 +0100
Subject: [PATCH] Fixed some SUSE specific typos and outputs
(cherry picked from commit f18d069d4664c148df8563139b358806ecfe6799)
Resolves: #1959336
---
dracut.conf.5.asc | 2 +-
dracut.conf.d/suse.conf.example | 4 ++--
dracut.sh | 4 ++--
dracut.usage.asc | 6 +++---
mkinitrd-suse.sh | 4 ++--
modules.d/98dracut-systemd/dracut-shutdown.service.8.asc | 2 +-
modules.d/98syslog/README | 2 +-
modules.d/99base/dracut-lib.sh | 2 +-
8 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/dracut.conf.5.asc b/dracut.conf.5.asc
index 1dfa28f6..081ed70c 100644
--- a/dracut.conf.5.asc
+++ b/dracut.conf.5.asc
@@ -157,7 +157,7 @@ provide a valid _/etc/fstab_.
archive. This cpio archive gets glued (concatenated, uncompressed one
must be the first one) to the compressed cpio archive. The first,
uncompressed cpio archive is for data which the kernel must be able
- to access very early (and cannot make use of uncompress alogrithms yet)
+ to access very early (and cannot make use of uncompress algorithms yet)
like microcode or ACPI tables (default=no).
*acpi_table_dir=*"__<dir>__"::
diff --git a/dracut.conf.d/suse.conf.example b/dracut.conf.d/suse.conf.example
index 37ffd72b..b5d962db 100644
--- a/dracut.conf.d/suse.conf.example
+++ b/dracut.conf.d/suse.conf.example
@@ -1,6 +1,6 @@
-# SUSE specifc dracut settings
+# SUSE specific dracut settings
#
-# SUSE by default always builds a as small as possible initrd for performance
+# SUSE by default always builds as small as possible initrd for performance
# and resource reasons.
# If you like to build a generic initrd which works on other platforms than
# on the one dracut/mkinitrd got called comment out below setting(s).
diff --git a/dracut.sh b/dracut.sh
index 966350c5..b9657dc6 100755
--- a/dracut.sh
+++ b/dracut.sh
@@ -1679,7 +1679,7 @@ if [[ $early_microcode = yes ]]; then
for _fwdir in $fw_dir; do
if [[ -d $_fwdir && -d $_fwdir/$_fw ]]; then
_src="*"
- dinfo "*** Constructing ${ucode_dest[$idx]} ****"
+ dinfo "*** Constructing ${ucode_dest[$idx]} ***"
if [[ $hostonly ]]; then
_src=$(get_ucode_file)
[[ $_src ]] || break
@@ -1762,7 +1762,7 @@ if dracut_module_included "squash"; then
# Move some files out side of the squash image, including:
# - Files required to boot and mount the squashfs image
- # - Files need to be accessable without mounting the squash image
+ # - Files need to be accessible without mounting the squash image
required_in_root() {
local file=$1
local _sqsh_file=$squash_dir/$file
diff --git a/dracut.usage.asc b/dracut.usage.asc
index 2b598ee6..0f219fc9 100644
--- a/dracut.usage.asc
+++ b/dracut.usage.asc
@@ -83,7 +83,7 @@ on the command line:
=== Adding Kernel Modules
If you need a special kernel module in the initramfs, which is not
automatically picked up by dracut, you have the use the --add-drivers option
-on the command line or the drivers vaiable in the _/etc/dracut.conf_
+on the command line or the drivers variable in the _/etc/dracut.conf_
or _/etc/dracut.conf.d/myconf.conf_ configuration file (see *dracut.conf*(5)):
----
# dracut --add-drivers mymod initramfs-with-mymod.img
@@ -94,7 +94,7 @@ An initramfs generated without the "hostonly" mode, does not contain any system
configuration files (except for some special exceptions), so the configuration
has to be done on the kernel command line. With this flexibility, you can easily
boot from a changed root partition, without the need to recompile the initramfs
-image. So, you could completly change your root partition (move it inside a md
+image. So, you could completely change your root partition (move it inside a md
raid with encryption and LVM on top), as long as you specify the correct
filesystem LABEL or UUID on the kernel command line for your root device, dracut
will find it and boot from it.
@@ -185,7 +185,7 @@ This turns off every automatic assembly of LVM, MD raids, DM raids and
crypto LUKS.
Of course, you could also omit the dracut modules in the initramfs creation
-process, but then you would lose the posibility to turn it on on demand.
+process, but then you would lose the possibility to turn it on on demand.
[[Injecting]]
diff --git a/mkinitrd-suse.sh b/mkinitrd-suse.sh
index 20d85da1..b6af2b19 100755
--- a/mkinitrd-suse.sh
+++ b/mkinitrd-suse.sh
@@ -1,6 +1,6 @@
#!/bin/bash --norc
#
-# mkinitrd compability wrapper for SUSE.
+# mkinitrd compatibility wrapper for SUSE.
#
# Copyright (c) 2013 SUSE Linux Products GmbH. All rights reserved.
#
@@ -62,7 +62,7 @@ usage () {
$cmd " /etc/sysconfig/kernel."
$cmd " -d root_device Root device. Defaults to the device from"
$cmd " which / is mounted. Overrides the rootdev"
- $cmd " enviroment variable if set."
+ $cmd " environment variable if set."
$cmd " -j device Journal device"
$cmd " -D interface Run dhcp on the specified interface."
$cmd " -I interface Configure the specified interface statically."
diff --git a/modules.d/98dracut-systemd/dracut-shutdown.service.8.asc b/modules.d/98dracut-systemd/dracut-shutdown.service.8.asc
index f4fbb618..ba80b187 100644
--- a/modules.d/98dracut-systemd/dracut-shutdown.service.8.asc
+++ b/modules.d/98dracut-systemd/dracut-shutdown.service.8.asc
@@ -15,7 +15,7 @@ dracut-shutdown.service
DESCRIPTION
-----------
This service unpacks the initramfs image to /run/initramfs.
-systemd pivots into /run/initramfs at shutdown, so the root filesytem
+systemd pivots into /run/initramfs at shutdown, so the root filesystem
can be safely unmounted.
The following steps are executed during a shutdown:
diff --git a/modules.d/98syslog/README b/modules.d/98syslog/README
index 30a819c0..9eb5adee 100644
--- a/modules.d/98syslog/README
+++ b/modules.d/98syslog/README
@@ -11,7 +11,7 @@ Then if syslog is configured it is started and will forward all
kernel messages to the given syslog server.
The syslog implementation is detected automatically by finding the
-apropriate binary with the following order:
+appropriate binary with the following order:
rsyslogd
syslogd
syslog-ng
diff --git a/modules.d/99base/dracut-lib.sh b/modules.d/99base/dracut-lib.sh
index 96dd55ad..89a1d69a 100755
--- a/modules.d/99base/dracut-lib.sh
+++ b/modules.d/99base/dracut-lib.sh
@@ -620,7 +620,7 @@ nfsroot_to_var() {
# prints:
# ENV{ID_FS_LABEL}="boot"
#
-# TOOD: symlinks
+# TODO: symlinks
udevmatch() {
case "$1" in
UUID=????????-????-????-????-????????????|LABEL=*|PARTLABEL=*|PARTUUID=????????-????-????-????-????????????)

141
SOURCES/0157.patch Normal file
View File

@ -0,0 +1,141 @@
From 9a6b40f023db3763694fb99a820f11017cc56811 Mon Sep 17 00:00:00 2001
From: Kairui Song <kasong@redhat.com>
Date: Tue, 9 Jun 2020 00:41:24 +0800
Subject: [PATCH] 99squash: simplify the code
The new dracutsysrootdir could be used to replace the shell function
required_in_root, so drop it and also simplify the code.
Signed-off-by: Kairui Song <kasong@redhat.com>
(cherry picked from commit 4159819fbb20fca8c0a80ddb17e211f481ec7717)
Resolves: #1959336
---
dracut.sh | 89 ++++++++++++++-------------------------------------------------
1 file changed, 20 insertions(+), 69 deletions(-)
diff --git a/dracut.sh b/dracut.sh
index b9657dc6..176b2259 100755
--- a/dracut.sh
+++ b/dracut.sh
@@ -1736,23 +1736,19 @@ fi
if dracut_module_included "squash"; then
dinfo "*** Install squash loader ***"
- if ! check_kernel_config CONFIG_SQUASHFS; then
- dfatal "CONFIG_SQUASHFS have to be enabled for dracut squash module to work"
- exit 1
- fi
- if ! check_kernel_config CONFIG_OVERLAY_FS; then
- dfatal "CONFIG_OVERLAY_FS have to be enabled for dracut squash module to work"
- exit 1
- fi
- if ! check_kernel_config CONFIG_DEVTMPFS; then
- dfatal "CONFIG_DEVTMPFS have to be enabled for dracut squash module to work"
+ for config in \
+ CONFIG_SQUASHFS \
+ CONFIG_OVERLAY_FS \
+ CONFIG_DEVTMPFS;
+ do
+ if ! check_kernel_config $config; then
+ dfatal "$config have to be enabled for dracut squash module to work"
exit 1
- fi
+ fi
+ done
readonly squash_dir="$initdir/squash/root"
- readonly squash_img=$initdir/squash/root.img
-
- # Currently only move "usr" "etc" to squashdir
+ readonly squash_img="$initdir/squash/root.img"
readonly squash_candidate=( "usr" "etc" )
mkdir -m 0755 -p $squash_dir
@@ -1763,57 +1759,15 @@ if dracut_module_included "squash"; then
# Move some files out side of the squash image, including:
# - Files required to boot and mount the squashfs image
# - Files need to be accessible without mounting the squash image
- required_in_root() {
- local file=$1
- local _sqsh_file=$squash_dir/$file
- local _init_file=$initdir/$file
-
- if [[ -e $_init_file ]]; then
- return
- fi
-
- if [[ ! -e $_sqsh_file ]] && [[ ! -L $_sqsh_file ]]; then
- derror "$file is required to boot a squashed initramfs but it's not installed!"
- return
- fi
-
- if [[ ! -d $(dirname $_init_file) ]]; then
- required_in_root $(dirname $file)
- fi
-
- if [[ -L $_sqsh_file ]]; then
- cp --preserve=all -P $_sqsh_file $_init_file
- _sqsh_file=$(realpath $_sqsh_file 2>/dev/null)
- if [[ -e $_sqsh_file ]] && [[ "$_sqsh_file" == "$squash_dir"* ]]; then
- # Relative symlink
- required_in_root ${_sqsh_file#$squash_dir/}
- return
- fi
- if [[ -e $squash_dir$_sqsh_file ]]; then
- # Absolute symlink
- required_in_root ${_sqsh_file#/}
- return
- fi
- required_in_root ${module_spec#$squash_dir/}
- else
- if [[ -d $_sqsh_file ]]; then
- mkdir $_init_file
- else
- mv $_sqsh_file $_init_file
- fi
- fi
- }
-
- required_in_root etc/initrd-release
-
- for module_spec in $squash_dir/usr/lib/modules/*/modules.*;
- do
- required_in_root ${module_spec#$squash_dir/}
- done
-
- for dracut_spec in $squash_dir/usr/lib/dracut/*;
+ # - Initramfs marker
+ for file in \
+ $squash_dir/usr/lib/modules/*/modules.* \
+ $squash_dir/usr/lib/dracut/* \
+ $squash_dir/etc/initrd-release
do
- required_in_root ${dracut_spec#$squash_dir/}
+ [[ -d $file ]] && continue
+ DRACUT_RESOLVE_DEPS=1 dracutsysrootdir=$squash_dir inst ${file#$squash_dir}
+ rm $file
done
mv $initdir/init $initdir/init.stock
@@ -1824,17 +1778,14 @@ if dracut_module_included "squash"; then
# accessible before mounting the image.
inst_multiple "echo" "sh" "mount" "modprobe" "mkdir"
hostonly="" instmods "loop" "squashfs" "overlay"
-
# Only keep systemctl outsite if we need switch root
if [[ ! -f "$initdir/lib/dracut/no-switch-root" ]]; then
inst "systemctl"
fi
+ # Remove duplicated files
for folder in "${squash_candidate[@]}"; do
- # Remove duplicated files in squashfs image, save some more space
- [[ ! -d $initdir/$folder/ ]] && continue
- for file in $(find $initdir/$folder/ -not -type d);
- do
+ for file in $(find $initdir/$folder/ -not -type d); do
if [[ -e $squash_dir${file#$initdir} ]]; then
mv $squash_dir${file#$initdir} $file
fi

58
SOURCES/0158.patch Normal file
View File

@ -0,0 +1,58 @@
From debb3b29ca103e2dac8a3ccafe73f7f815b54979 Mon Sep 17 00:00:00 2001
From: Kairui Song <kasong@redhat.com>
Date: Mon, 12 Oct 2020 15:23:30 +0800
Subject: [PATCH] 99squash: Check require module earlier, and properly
Let 99squash fail earlier if required modules are not enabled or
missing, using the new added helper.
Signed-off-by: Kairui Song <kasong@redhat.com>
(cherry picked from commit 83c65fd3db9f5f3436cfe74ec67d2894dedda397)
Resolves: #1959336
---
dracut.sh | 11 -----------
modules.d/99squash/module-setup.sh | 7 +++++++
2 files changed, 7 insertions(+), 11 deletions(-)
diff --git a/dracut.sh b/dracut.sh
index 176b2259..2090d89f 100755
--- a/dracut.sh
+++ b/dracut.sh
@@ -1736,17 +1736,6 @@ fi
if dracut_module_included "squash"; then
dinfo "*** Install squash loader ***"
- for config in \
- CONFIG_SQUASHFS \
- CONFIG_OVERLAY_FS \
- CONFIG_DEVTMPFS;
- do
- if ! check_kernel_config $config; then
- dfatal "$config have to be enabled for dracut squash module to work"
- exit 1
- fi
- done
-
readonly squash_dir="$initdir/squash/root"
readonly squash_img="$initdir/squash/root.img"
readonly squash_candidate=( "usr" "etc" )
diff --git a/modules.d/99squash/module-setup.sh b/modules.d/99squash/module-setup.sh
index 6307377c..e2fe3dd4 100644
--- a/modules.d/99squash/module-setup.sh
+++ b/modules.d/99squash/module-setup.sh
@@ -11,6 +11,13 @@ check() {
return 1
fi
+ for i in squashfs loop overlay; do
+ if ! check_kernel_module $i; then
+ derror "dracut-squash module requires kernel module $i"
+ return 1
+ fi
+ done
+
return 255
}

35
SOURCES/0159.patch Normal file
View File

@ -0,0 +1,35 @@
From be22f63f7d7c62d88edb5a24dccfff2774094773 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zolt=C3=A1n=20B=C3=B6sz=C3=B6rm=C3=A9nyi?= <zboszor@pr.hu>
Date: Tue, 19 Jan 2021 15:17:05 +0100
Subject: [PATCH] fix(99squash): use kernel config instead of modprobe to check
modules
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Zoltán Böszörményi <zboszor@pr.hu>
(cherry picked from commit 911c2de9c34a2e96be3973954d368d3a14eb6785)
Resolves: #1959336
---
modules.d/99squash/module-setup.sh | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/modules.d/99squash/module-setup.sh b/modules.d/99squash/module-setup.sh
index e2fe3dd4..d3680d63 100644
--- a/modules.d/99squash/module-setup.sh
+++ b/modules.d/99squash/module-setup.sh
@@ -11,9 +11,9 @@ check() {
return 1
fi
- for i in squashfs loop overlay; do
- if ! check_kernel_module $i; then
- derror "dracut-squash module requires kernel module $i"
+ for i in CONFIG_SQUASHFS CONFIG_BLK_DEV_LOOP CONFIG_OVERLAY_FS ; do
+ if ! check_kernel_config $i; then
+ derror "dracut-squash module requires kernel configuration $i (y or m)"
return 1
fi
done

29
SOURCES/0160.patch Normal file
View File

@ -0,0 +1,29 @@
From 3c9656769d33db55f6a9390a0f6d2c0be14d85c8 Mon Sep 17 00:00:00 2001
From: Thierry Vignaud <thierry.vignaud@gmail.com>
Date: Fri, 30 Nov 2018 15:41:05 +0100
Subject: [PATCH] kill bogus comment
should have been killed in commit 4a855e6bebed956c108865823bcc131ebea2841a
(cherry picked from commit a6bc200c28ac841edd12211c96dad8516095a68d)
Resolves: #1959336
---
modules.d/05busybox/module-setup.sh | 3 ---
1 file changed, 3 deletions(-)
diff --git a/modules.d/05busybox/module-setup.sh b/modules.d/05busybox/module-setup.sh
index 14d401c2..ecbd6a13 100755
--- a/modules.d/05busybox/module-setup.sh
+++ b/modules.d/05busybox/module-setup.sh
@@ -22,9 +22,6 @@ install() {
_progs="$_progs $_i"
done
- # FIXME: switch_root should be in the above list, but busybox version hangs
- # (using busybox-1.15.1-7.fc14.i686 at the time of writing)
-
for _i in $_progs; do
_path=$(find_binary "$_i")
[ -z "$_path" ] && continue

42
SOURCES/0161.patch Normal file
View File

@ -0,0 +1,42 @@
From c2f193cc422eac475bbc17261413c83ff13172d4 Mon Sep 17 00:00:00 2001
From: Alexander Tsoy <alexander@tsoy.me>
Date: Mon, 25 May 2020 17:49:20 +0300
Subject: [PATCH] busybox: simplify listing of supported utilities
'--list' option is supported since busybox-1.20.0, which was released
in 2010.
(cherry picked from commit 50cc23ba32b0fda63eff7623b529dbeb4e6a38c6)
Resolves: #1959336
---
modules.d/05busybox/module-setup.sh | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/modules.d/05busybox/module-setup.sh b/modules.d/05busybox/module-setup.sh
index ecbd6a13..5d88c5d1 100755
--- a/modules.d/05busybox/module-setup.sh
+++ b/modules.d/05busybox/module-setup.sh
@@ -14,15 +14,16 @@ depends() {
# called by dracut
install() {
- local _i _progs _path _busybox
+ local _i _path _busybox
+ local _progs=()
_busybox=$(type -P busybox)
inst $_busybox /usr/bin/busybox
- for _i in $($_busybox | sed -ne '1,/Currently/!{s/,//g; s/busybox//g; p}')
- do
- _progs="$_progs $_i"
+ for _i in $($_busybox --list); do
+ [[ ${_i} == busybox ]] && continue
+ _progs+=("${_i}")
done
- for _i in $_progs; do
+ for _i in "${_progs[@]}"; do
_path=$(find_binary "$_i")
[ -z "$_path" ] && continue
ln_r /usr/bin/busybox $_path

154
SOURCES/0162.patch Normal file
View File

@ -0,0 +1,154 @@
From 47bc3efe3e3d2b97b4a47e9380c061db0bc368c6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zolt=C3=A1n=20B=C3=B6sz=C3=B6rm=C3=A9nyi?= <zboszor@pr.hu>
Date: Sun, 7 Feb 2021 15:01:49 +0100
Subject: [PATCH] fix: use find_binary
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Use find_binary instead of type -P because the former works if
dracutsysrootdir is set.
Signed-off-by: Zoltán Böszörményi <zboszor@pr.hu>
(cherry picked from commit 433a9ec0147e578b91b4c6e20629a0dbeb9d0725)
Resolves: #1959336
---
modules.d/00systemd/module-setup.sh | 4 ++--
modules.d/02caps/module-setup.sh | 2 +-
modules.d/05busybox/module-setup.sh | 2 +-
modules.d/50gensplash/module-setup.sh | 2 +-
modules.d/50plymouth/module-setup.sh | 2 +-
modules.d/90lvm/module-setup.sh | 2 +-
modules.d/98syslog/module-setup.sh | 6 +++---
modules.d/99memstrack/module-setup.sh | 2 +-
modules.d/99squash/module-setup.sh | 2 +-
9 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/modules.d/00systemd/module-setup.sh b/modules.d/00systemd/module-setup.sh
index 1f0b5dad..38c244a2 100755
--- a/modules.d/00systemd/module-setup.sh
+++ b/modules.d/00systemd/module-setup.sh
@@ -209,8 +209,8 @@ install() {
ln_r $systemdutildir/systemd "/sbin/init"
inst_binary true
- ln_r $(type -P true) "/usr/bin/loginctl"
- ln_r $(type -P true) "/bin/loginctl"
+ ln_r $(find_binary true) "/usr/bin/loginctl"
+ ln_r $(find_binary true) "/bin/loginctl"
inst_rules \
70-uaccess.rules \
71-seat.rules \
diff --git a/modules.d/02caps/module-setup.sh b/modules.d/02caps/module-setup.sh
index fb16526a..d1ce6cdc 100755
--- a/modules.d/02caps/module-setup.sh
+++ b/modules.d/02caps/module-setup.sh
@@ -15,7 +15,7 @@ depends() {
install() {
if ! dracut_module_included "systemd"; then
inst_hook pre-pivot 00 "$moddir/caps.sh"
- inst $(type -P capsh 2>/dev/null) /usr/sbin/capsh
+ inst $(find_binary capsh 2>/dev/null) /usr/sbin/capsh
# capsh wants bash and we need bash also
inst /bin/bash
else
diff --git a/modules.d/05busybox/module-setup.sh b/modules.d/05busybox/module-setup.sh
index 5d88c5d1..20b36c16 100755
--- a/modules.d/05busybox/module-setup.sh
+++ b/modules.d/05busybox/module-setup.sh
@@ -16,7 +16,7 @@ depends() {
install() {
local _i _path _busybox
local _progs=()
- _busybox=$(type -P busybox)
+ _busybox=$(find_binary busybox)
inst $_busybox /usr/bin/busybox
for _i in $($_busybox --list); do
[[ ${_i} == busybox ]] && continue
diff --git a/modules.d/50gensplash/module-setup.sh b/modules.d/50gensplash/module-setup.sh
index d2fccc26..d0aa4a78 100755
--- a/modules.d/50gensplash/module-setup.sh
+++ b/modules.d/50gensplash/module-setup.sh
@@ -40,7 +40,7 @@ install() {
return ${_ret}
}
- type -P splash_geninitramfs >/dev/null || return 1
+ find_binary splash_geninitramfs >/dev/null || return 1
_opts=''
if [[ ${DRACUT_GENSPLASH_THEME} ]]; then
diff --git a/modules.d/50plymouth/module-setup.sh b/modules.d/50plymouth/module-setup.sh
index b51913e8..0568d21c 100755
--- a/modules.d/50plymouth/module-setup.sh
+++ b/modules.d/50plymouth/module-setup.sh
@@ -2,7 +2,7 @@
pkglib_dir() {
local _dirs="/usr/lib/plymouth /usr/libexec/plymouth/"
- if type -P dpkg-architecture &>/dev/null; then
+ if find_binary dpkg-architecture &>/dev/null; then
_dirs+=" /usr/lib/$(dpkg-architecture -qDEB_HOST_MULTIARCH)/plymouth"
fi
for _dir in $_dirs; do
diff --git a/modules.d/90lvm/module-setup.sh b/modules.d/90lvm/module-setup.sh
index 6ca4ee44..fffcbe31 100755
--- a/modules.d/90lvm/module-setup.sh
+++ b/modules.d/90lvm/module-setup.sh
@@ -119,7 +119,7 @@ install() {
inst_libdir_file "libdevmapper-event-lvm*.so"
- if [[ $hostonly ]] && type -P lvs &>/dev/null; then
+ if [[ $hostonly ]] && find_binary lvs &>/dev/null; then
for dev in "${!host_fs_types[@]}"; do
[ -e /sys/block/${dev#/dev/}/dm/name ] || continue
dev=$(</sys/block/${dev#/dev/}/dm/name)
diff --git a/modules.d/98syslog/module-setup.sh b/modules.d/98syslog/module-setup.sh
index aa0c8eaf..2435c4d5 100755
--- a/modules.d/98syslog/module-setup.sh
+++ b/modules.d/98syslog/module-setup.sh
@@ -15,12 +15,12 @@ depends() {
install() {
local _i
local _installs
- if type -P rsyslogd >/dev/null; then
+ if find_binary rsyslogd >/dev/null; then
_installs="rsyslogd"
inst_libdir_file rsyslog/lmnet.so rsyslog/imklog.so rsyslog/imuxsock.so rsyslog/imjournal.so
- elif type -P syslogd >/dev/null; then
+ elif find_binary syslogd >/dev/null; then
_installs="syslogd"
- elif type -P syslog-ng >/dev/null; then
+ elif find_binary syslog-ng >/dev/null; then
_installs="syslog-ng"
else
derror "Could not find any syslog binary although the syslogmodule" \
diff --git a/modules.d/99memstrack/module-setup.sh b/modules.d/99memstrack/module-setup.sh
index d5bacb4d..e156290c 100755
--- a/modules.d/99memstrack/module-setup.sh
+++ b/modules.d/99memstrack/module-setup.sh
@@ -1,7 +1,7 @@
#!/usr/bin/bash
check() {
- if type -P memstrack >/dev/null; then
+ if find_binary memstrack >/dev/null; then
dinfo "memstrack is available"
return 0
fi
diff --git a/modules.d/99squash/module-setup.sh b/modules.d/99squash/module-setup.sh
index d3680d63..b183daf7 100644
--- a/modules.d/99squash/module-setup.sh
+++ b/modules.d/99squash/module-setup.sh
@@ -6,7 +6,7 @@ check() {
return 1
fi
- if ! type -P mksquashfs >/dev/null || ! type -P unsquashfs >/dev/null ; then
+ if ! find_binary mksquashfs >/dev/null || ! find_binary unsquashfs >/dev/null ; then
derror "dracut-squash module requires squashfs-tools"
return 1
fi

23
SOURCES/0163.patch Normal file
View File

@ -0,0 +1,23 @@
From 1fd68d6bf5a8752eec83ac19e29df6832ba3c48f Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Thu, 11 Feb 2021 09:10:42 +0100
Subject: [PATCH] fix: shellcheck for modules.d/99squash/setup-squash.sh
(cherry picked from commit 836e2ffac6695201e334c8ef13488e2492b58db0)
Resolves: #1959336
---
modules.d/99squash/setup-squash.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/modules.d/99squash/setup-squash.sh b/modules.d/99squash/setup-squash.sh
index d0000b6f..253e6101 100755
--- a/modules.d/99squash/setup-squash.sh
+++ b/modules.d/99squash/setup-squash.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
PATH=/bin:/sbin
SQUASH_IMG=/squash/root.img

30
SOURCES/0164.patch Normal file
View File

@ -0,0 +1,30 @@
From 1fd29d8550d7d1573b2d2a60b41d6a5f3ca5003f Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Fri, 12 Feb 2021 13:26:14 +0100
Subject: [PATCH] fix: shellcheck for modules.d/99squash/clear-squash.sh
(cherry picked from commit 73f5cc7c3754f9561abe948b4b080a84b34c7d1a)
Resolves: #1959336
---
modules.d/99squash/clear-squash.sh | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/modules.d/99squash/clear-squash.sh b/modules.d/99squash/clear-squash.sh
index 34cb4cf5..1d626f98 100755
--- a/modules.d/99squash/clear-squash.sh
+++ b/modules.d/99squash/clear-squash.sh
@@ -1,9 +1,6 @@
-#!/bin/sh
+#!/bin/bash
SQUASH_MNT_REC=/squash/mounts
-SQUASH_MNTS=( )
-while read mnt; do
- SQUASH_MNTS+=( "$mnt" )
-done <<< "$(cat $SQUASH_MNT_REC)"
+mapfile -t SQUASH_MNTS < $SQUASH_MNT_REC
-umount --lazy -- ${SQUASH_MNTS[@]}
+umount --lazy -- "${SQUASH_MNTS[@]}"

30
SOURCES/0165.patch Normal file
View File

@ -0,0 +1,30 @@
From 0ebfdeafe3d2b023bd52704c6f7a8a2082379da5 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Fri, 12 Feb 2021 13:26:14 +0100
Subject: [PATCH] fix: shellcheck for modules.d/99squash/module-setup.sh
(cherry picked from commit 6510ab3f9d6ce555435cf57b716702b5b7663772)
Resolves: #1959336
---
modules.d/99squash/module-setup.sh | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/modules.d/99squash/module-setup.sh b/modules.d/99squash/module-setup.sh
index b183daf7..5b2435cc 100644
--- a/modules.d/99squash/module-setup.sh
+++ b/modules.d/99squash/module-setup.sh
@@ -32,9 +32,9 @@ installkernel() {
install() {
inst_multiple kmod modprobe mount mkdir ln echo
- inst $moddir/setup-squash.sh /squash/setup-squash.sh
- inst $moddir/clear-squash.sh /squash/clear-squash.sh
- inst $moddir/init.sh /squash/init.sh
+ inst "$moddir"/setup-squash.sh /squash/setup-squash.sh
+ inst "$moddir"/clear-squash.sh /squash/clear-squash.sh
+ inst "$moddir"/init.sh /squash/init.sh
inst "$moddir/squash-mnt-clear.service" "$systemdsystemunitdir/squash-mnt-clear.service"
systemctl -q --root "$initdir" add-wants initrd-switch-root.target squash-mnt-clear.service

28
SOURCES/0166.patch Normal file
View File

@ -0,0 +1,28 @@
From 58e04fa657c09322feaa195d465514a850acfcb7 Mon Sep 17 00:00:00 2001
From: Kairui Song <kasong@redhat.com>
Date: Fri, 4 Dec 2020 15:37:27 +0800
Subject: [PATCH] fix(squash): this module shouldn't depend on bash
Any other shell should just work.
(cherry picked from commit c552c99ef8e5251e35242e0a3c09eafcd917b31a)
Resolves: #1959336
---
modules.d/99squash/module-setup.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/modules.d/99squash/module-setup.sh b/modules.d/99squash/module-setup.sh
index 5b2435cc..ba9d52ff 100644
--- a/modules.d/99squash/module-setup.sh
+++ b/modules.d/99squash/module-setup.sh
@@ -22,7 +22,7 @@ check() {
}
depends() {
- echo "bash systemd-initrd"
+ echo "systemd-initrd"
return 0
}

154
SOURCES/0167.patch Normal file
View File

@ -0,0 +1,154 @@
From 3b3dea36edc66300b84bb3887f8a5be971be959a Mon Sep 17 00:00:00 2001
From: Kairui Song <kasong@redhat.com>
Date: Mon, 15 Feb 2021 22:22:08 +0800
Subject: [PATCH] refactor(squash): move the post install scripts into the
module-setup.sh
No function change, just move the post install code to 99squash to clean
up dracut.sh.
(cherry picked from commit 95ea16aa606912b7cc8f9942481c8a889b640c15)
Cherry-picked from: 95ea16aa
Resolves: #1959336
---
dracut.sh | 44 ++-------------------------------
modules.d/99squash/init.sh | 2 +-
modules.d/99squash/module-setup.sh | 50 +++++++++++++++++++++++++++++++++++---
3 files changed, 50 insertions(+), 46 deletions(-)
diff --git a/dracut.sh b/dracut.sh
index 2090d89f..669bc6ce 100755
--- a/dracut.sh
+++ b/dracut.sh
@@ -1735,51 +1735,11 @@ if [[ $hostonly_cmdline == "yes" ]] ; then
fi
if dracut_module_included "squash"; then
- dinfo "*** Install squash loader ***"
readonly squash_dir="$initdir/squash/root"
readonly squash_img="$initdir/squash/root.img"
- readonly squash_candidate=( "usr" "etc" )
-
- mkdir -m 0755 -p $squash_dir
- for folder in "${squash_candidate[@]}"; do
- mv $initdir/$folder $squash_dir/$folder
- done
-
- # Move some files out side of the squash image, including:
- # - Files required to boot and mount the squashfs image
- # - Files need to be accessible without mounting the squash image
- # - Initramfs marker
- for file in \
- $squash_dir/usr/lib/modules/*/modules.* \
- $squash_dir/usr/lib/dracut/* \
- $squash_dir/etc/initrd-release
- do
- [[ -d $file ]] && continue
- DRACUT_RESOLVE_DEPS=1 dracutsysrootdir=$squash_dir inst ${file#$squash_dir}
- rm $file
- done
- mv $initdir/init $initdir/init.stock
- ln -s squash/init.sh $initdir/init
-
- # Reinstall required files for the squash image setup script.
- # We have moved them inside the squashed image, but they need to be
- # accessible before mounting the image.
- inst_multiple "echo" "sh" "mount" "modprobe" "mkdir"
- hostonly="" instmods "loop" "squashfs" "overlay"
- # Only keep systemctl outsite if we need switch root
- if [[ ! -f "$initdir/lib/dracut/no-switch-root" ]]; then
- inst "systemctl"
- fi
-
- # Remove duplicated files
- for folder in "${squash_candidate[@]}"; do
- for file in $(find $initdir/$folder/ -not -type d); do
- if [[ -e $squash_dir${file#$initdir} ]]; then
- mv $squash_dir${file#$initdir} $file
- fi
- done
- done
+ dinfo "*** Install squash loader ***"
+ DRACUT_SQUASH_POST_INST=1 module_install "squash"
fi
if [[ $kernel_only != yes ]]; then
diff --git a/modules.d/99squash/init.sh b/modules.d/99squash/init.sh
index bca49db5..d8b2cbba 100755
--- a/modules.d/99squash/init.sh
+++ b/modules.d/99squash/init.sh
@@ -1,7 +1,7 @@
#!/bin/sh
/squash/setup-squash.sh
-exec /init.stock
+exec /init.orig
echo "Something went wrong when trying to start original init executable!"
exit 1
diff --git a/modules.d/99squash/module-setup.sh b/modules.d/99squash/module-setup.sh
index ba9d52ff..0acf7c3a 100644
--- a/modules.d/99squash/module-setup.sh
+++ b/modules.d/99squash/module-setup.sh
@@ -30,11 +30,55 @@ installkernel() {
hostonly="" instmods -c squashfs loop overlay
}
-install() {
- inst_multiple kmod modprobe mount mkdir ln echo
+installpost() {
+ local squash_candidate=( "usr" "etc" )
+
+ # shellcheck disable=SC2174
+ mkdir -m 0755 -p "$squash_dir"
+ for folder in "${squash_candidate[@]}"; do
+ mv "$initdir/$folder" "$squash_dir/$folder"
+ done
+
+ # Move some files out side of the squash image, including:
+ # - Files required to boot and mount the squashfs image
+ # - Files need to be accessible without mounting the squash image
+ # - Initramfs marker
+ for file in \
+ "$squash_dir"/usr/lib/modules/*/modules.* \
+ "$squash_dir"/usr/lib/dracut/* \
+ "$squash_dir"/etc/initrd-release
+ do
+ [[ -f $file ]] || continue
+ DRACUT_RESOLVE_DEPS=1 dracutsysrootdir="$squash_dir" inst "${file#$squash_dir}"
+ rm "$file"
+ done
+
+ # Install required files for the squash image setup script.
+ hostonly="" instmods "loop" "squashfs" "overlay"
+ inst_multiple modprobe mount mkdir ln echo
inst "$moddir"/setup-squash.sh /squash/setup-squash.sh
inst "$moddir"/clear-squash.sh /squash/clear-squash.sh
- inst "$moddir"/init.sh /squash/init.sh
+
+ mv "$initdir"/init "$initdir"/init.orig
+ inst "$moddir"/init.sh "$initdir"/init
+
+ # Keep systemctl outsite if we need switch root
+ if [[ ! -f "$initdir/lib/dracut/no-switch-root" ]]; then
+ inst "systemctl"
+ fi
+
+ # Remove duplicated files
+ for folder in "${squash_candidate[@]}"; do
+ find "$initdir/$folder/" -not -type d \
+ -exec bash -c 'mv -f "$squash_dir${1#$initdir}" "$1"' -- "{}" \;
+ done
+}
+
+install() {
+ if [[ $DRACUT_SQUASH_POST_INST ]]; then
+ installpost
+ return
+ fi
inst "$moddir/squash-mnt-clear.service" "$systemdsystemunitdir/squash-mnt-clear.service"
systemctl -q --root "$initdir" add-wants initrd-switch-root.target squash-mnt-clear.service

37
SOURCES/0168.patch Normal file
View File

@ -0,0 +1,37 @@
From 4a0aa64ecdcaf47e17e27c59e6ea4efc19359c00 Mon Sep 17 00:00:00 2001
From: Lukas Nykryn <lnykryn@redhat.com>
Date: Fri, 23 Jul 2021 16:24:51 +0200
Subject: [PATCH] fix: revise squash module checks
Based on 16efdfa25c65c31acc97d91b7baf4f7bb4ea8510
---
modules.d/99squash/module-setup.sh | 12 ++----------
1 file changed, 2 insertions(+), 10 deletions(-)
diff --git a/modules.d/99squash/module-setup.sh b/modules.d/99squash/module-setup.sh
index 0acf7c3a..dd4f3ecf 100644
--- a/modules.d/99squash/module-setup.sh
+++ b/modules.d/99squash/module-setup.sh
@@ -1,19 +1,11 @@
#!/bin/bash
check() {
- if ! dracut_module_included "systemd-initrd"; then
- derror "dracut-squash only supports systemd bases initramfs"
- return 1
- fi
-
- if ! find_binary mksquashfs >/dev/null || ! find_binary unsquashfs >/dev/null ; then
- derror "dracut-squash module requires squashfs-tools"
- return 1
- fi
+ require_binaries mksquashfs unsquashfs || return 1
for i in CONFIG_SQUASHFS CONFIG_BLK_DEV_LOOP CONFIG_OVERLAY_FS ; do
if ! check_kernel_config $i; then
- derror "dracut-squash module requires kernel configuration $i (y or m)"
+ dinfo "dracut-squash module requires kernel configuration $i (y or m)"
return 1
fi
done

52
SOURCES/0169.patch Normal file
View File

@ -0,0 +1,52 @@
From ba8f0e0502d3cda2f4222745eebed37f45a4c5a1 Mon Sep 17 00:00:00 2001
From: Kairui Song <kasong@redhat.com>
Date: Thu, 11 Feb 2021 00:39:17 +0800
Subject: [PATCH] fix(squash): post install should be the last step before
stripping
Ensure dracut squash module doesn't effect other steps, and stripping
can cover the new binaries installed by it.
(cherry picked from commit 8c8aecdc63c9389038e78ee712d4809e49add5e1)
Cherry-picked from: 8c8aecdc
Resolves: #1959336
---
dracut.sh | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/dracut.sh b/dracut.sh
index 669bc6ce..1168fc16 100755
--- a/dracut.sh
+++ b/dracut.sh
@@ -1734,14 +1734,6 @@ if [[ $hostonly_cmdline == "yes" ]] ; then
fi
fi
-if dracut_module_included "squash"; then
- readonly squash_dir="$initdir/squash/root"
- readonly squash_img="$initdir/squash/root.img"
-
- dinfo "*** Install squash loader ***"
- DRACUT_SQUASH_POST_INST=1 module_install "squash"
-fi
-
if [[ $kernel_only != yes ]]; then
# libpthread workaround: pthread_cancel wants to dlopen libgcc_s.so
for _dir in $libdirs; do
@@ -1764,6 +1756,14 @@ if [[ $kernel_only != yes ]]; then
fi
fi
+if dracut_module_included "squash"; then
+ readonly squash_dir="$initdir/squash/root"
+ readonly squash_img="$initdir/squash/root.img"
+
+ dinfo "*** Install squash loader ***"
+ DRACUT_SQUASH_POST_INST=1 module_install "squash"
+fi
+
if [[ $do_strip = yes ]] && ! [[ $DRACUT_FIPS_MODE ]]; then
dinfo "*** Stripping files ***"
find "$initdir" -type f \

64
SOURCES/0170.patch Normal file
View File

@ -0,0 +1,64 @@
From 8c31ef8476d302d11bbad81644e82872bd1e86f3 Mon Sep 17 00:00:00 2001
From: Kairui Song <kasong@redhat.com>
Date: Mon, 15 Feb 2021 22:52:47 +0800
Subject: [PATCH] refactor(squash): move all setup code to init-squash.sh
Seperate of init.sh and setup-squash.sh is pointless, merge them into one.
(cherry picked from commit f9f4264d038816990aa0a830b31e31d2e8b84cad)
Resolves: #1959336
---
modules.d/99squash/{setup-squash.sh => init-squash.sh} | 5 +++++
modules.d/99squash/init.sh | 7 -------
modules.d/99squash/module-setup.sh | 5 ++---
3 files changed, 7 insertions(+), 10 deletions(-)
diff --git a/modules.d/99squash/setup-squash.sh b/modules.d/99squash/init-squash.sh
similarity index 93%
rename from modules.d/99squash/setup-squash.sh
rename to modules.d/99squash/init-squash.sh
index 253e6101..449585f0 100755
--- a/modules.d/99squash/setup-squash.sh
+++ b/modules.d/99squash/init-squash.sh
@@ -59,3 +59,8 @@ for file in $SQUASH_MNT/*; do
echo $mntdir >> $SQUASH_MNT_REC
done
+
+exec /init.orig
+
+echo "Something went wrong when trying to exec original init!"
+exit 1
diff --git a/modules.d/99squash/init.sh b/modules.d/99squash/init.sh
deleted file mode 100755
index d8b2cbba..00000000
--- a/modules.d/99squash/init.sh
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/bin/sh
-/squash/setup-squash.sh
-
-exec /init.orig
-
-echo "Something went wrong when trying to start original init executable!"
-exit 1
diff --git a/modules.d/99squash/module-setup.sh b/modules.d/99squash/module-setup.sh
index dd4f3ecf..c0eb4acd 100644
--- a/modules.d/99squash/module-setup.sh
+++ b/modules.d/99squash/module-setup.sh
@@ -48,11 +48,10 @@ installpost() {
# Install required files for the squash image setup script.
hostonly="" instmods "loop" "squashfs" "overlay"
inst_multiple modprobe mount mkdir ln echo
- inst "$moddir"/setup-squash.sh /squash/setup-squash.sh
- inst "$moddir"/clear-squash.sh /squash/clear-squash.sh
mv "$initdir"/init "$initdir"/init.orig
- inst "$moddir"/init.sh "$initdir"/init
+ inst "$moddir"/init-squash.sh /init
+ inst "$moddir"/clear-squash.sh /squash/clear-squash.sh
# Keep systemctl outsite if we need switch root
if [[ ! -f "$initdir/lib/dracut/no-switch-root" ]]; then

78
SOURCES/0171.patch Normal file
View File

@ -0,0 +1,78 @@
From 39d06b934fd4bec88b0945b5277407d7b5510c22 Mon Sep 17 00:00:00 2001
From: Kairui Song <kasong@redhat.com>
Date: Mon, 15 Feb 2021 22:58:20 +0800
Subject: [PATCH] feat(squash): install and depmod modules seperately
Separately install the modules required for squash image setup.
These modules can be deleted after squash image setup to save
memory.
Signed-off-by: Kairui Song <kasong@redhat.com>
(cherry picked from commit 5a18b24a8b9c20c98f711963ce5407ceb2f3d57b)
Cherry-picked from: 5a18b24a8b9c20c98f711963ce5407ceb2f3d57b
Resolves: #1959336
---
modules.d/99squash/init-squash.sh | 3 +++
modules.d/99squash/module-setup.sh | 12 +++++-------
2 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/modules.d/99squash/init-squash.sh b/modules.d/99squash/init-squash.sh
index 449585f0..ecb6cc58 100755
--- a/modules.d/99squash/init-squash.sh
+++ b/modules.d/99squash/init-squash.sh
@@ -34,6 +34,9 @@ if [ $? != 0 ]; then
echo "Unable to setup overlay module"
fi
+# These modules are no longer needed, delete to save memory
+rm -rf /usr/lib/modules/
+
[ ! -d "$SQUASH_MNT" ] && \
mkdir -m 0755 -p $SQUASH_MNT
diff --git a/modules.d/99squash/module-setup.sh b/modules.d/99squash/module-setup.sh
index c0eb4acd..ad619176 100644
--- a/modules.d/99squash/module-setup.sh
+++ b/modules.d/99squash/module-setup.sh
@@ -18,10 +18,6 @@ depends() {
return 0
}
-installkernel() {
- hostonly="" instmods -c squashfs loop overlay
-}
-
installpost() {
local squash_candidate=( "usr" "etc" )
@@ -36,7 +32,6 @@ installpost() {
# - Files need to be accessible without mounting the squash image
# - Initramfs marker
for file in \
- "$squash_dir"/usr/lib/modules/*/modules.* \
"$squash_dir"/usr/lib/dracut/* \
"$squash_dir"/etc/initrd-release
do
@@ -46,8 +41,7 @@ installpost() {
done
# Install required files for the squash image setup script.
- hostonly="" instmods "loop" "squashfs" "overlay"
- inst_multiple modprobe mount mkdir ln echo
+ inst_multiple modprobe mount mkdir ln echo rm
mv "$initdir"/init "$initdir"/init.orig
inst "$moddir"/init-squash.sh /init
@@ -63,6 +57,10 @@ installpost() {
find "$initdir/$folder/" -not -type d \
-exec bash -c 'mv -f "$squash_dir${1#$initdir}" "$1"' -- "{}" \;
done
+
+ # Install required modules for the squash image init script.
+ hostonly="" instmods "loop" "squashfs" "overlay"
+ dracut_kernel_post
}
install() {

67
SOURCES/0172.patch Normal file
View File

@ -0,0 +1,67 @@
From 122da496446405e60a6eb5b037af263b5fd14378 Mon Sep 17 00:00:00 2001
From: Kairui Song <kasong@redhat.com>
Date: Mon, 15 Feb 2021 23:05:08 +0800
Subject: [PATCH] refactor(squash): don't record mount points in text file
The squasn mount points are recorded in text file so later clean up
script can umount them, this is not needed, the mount points are fixed
so just detect the umount by hardcoded pattern.
(cherry picked from commit bdd194bb8c0427921b87b4dce16c05e18e0c2fb0)
Resolves: #1959336
---
modules.d/99squash/clear-squash.sh | 10 +++++-----
modules.d/99squash/init-squash.sh | 8 --------
2 files changed, 5 insertions(+), 13 deletions(-)
diff --git a/modules.d/99squash/clear-squash.sh b/modules.d/99squash/clear-squash.sh
index 1d626f98..4f357817 100755
--- a/modules.d/99squash/clear-squash.sh
+++ b/modules.d/99squash/clear-squash.sh
@@ -1,6 +1,6 @@
#!/bin/bash
-SQUASH_MNT_REC=/squash/mounts
-
-mapfile -t SQUASH_MNTS < $SQUASH_MNT_REC
-
-umount --lazy -- "${SQUASH_MNTS[@]}"
+mnt="/squash/root"
+for dir in jsquash/root/*; do
+ mnt="$mnt ${dir#$SQUASH_MNT}"
+done
+umount --lazy -- $mnt
diff --git a/modules.d/99squash/init-squash.sh b/modules.d/99squash/init-squash.sh
index ecb6cc58..fee0105e 100755
--- a/modules.d/99squash/init-squash.sh
+++ b/modules.d/99squash/init-squash.sh
@@ -3,9 +3,6 @@ PATH=/bin:/sbin
SQUASH_IMG=/squash/root.img
SQUASH_MNT=/squash/root
-SQUASH_MNT_REC=/squash/mounts
-
-echo $SQUASH_MNT > $SQUASH_MNT_REC
# Following mount points are neccessary for mounting a squash image
@@ -34,9 +31,6 @@ if [ $? != 0 ]; then
echo "Unable to setup overlay module"
fi
-# These modules are no longer needed, delete to save memory
-rm -rf /usr/lib/modules/
-
[ ! -d "$SQUASH_MNT" ] && \
mkdir -m 0755 -p $SQUASH_MNT
@@ -59,8 +53,6 @@ for file in $SQUASH_MNT/*; do
mount -t overlay overlay -o\
lowerdir=$lowerdir,upperdir=$upperdir,workdir=$workdir $mntdir
-
- echo $mntdir >> $SQUASH_MNT_REC
done
exec /init.orig

53
SOURCES/0173.patch Normal file
View File

@ -0,0 +1,53 @@
From 0c2ac6b7503661948ead031f745736e35fef2e3f Mon Sep 17 00:00:00 2001
From: Kairui Song <kasong@redhat.com>
Date: Wed, 26 Dec 2018 17:38:02 +0800
Subject: [PATCH] lsinitrd: list squash content as well
When the initramfs is built with squash module enabled, the content
inside squash image will be invisible from the lsinitrd tool. This
commit make lsinitrd detect and list the content of the squash image as
well to avoid possible confusion.
Signed-off-by: Kairui Song <kasong@redhat.com>
(cherry picked from commit 1ff306a3964840fc548188a8aa4862143b347e8a)
Resolves: #1959336
---
lsinitrd.sh | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/lsinitrd.sh b/lsinitrd.sh
index a2fa4d7a..0b42b9a4 100755
--- a/lsinitrd.sh
+++ b/lsinitrd.sh
@@ -160,6 +160,21 @@ list_files()
echo "========================================================================"
}
+list_squash_content()
+{
+ SQUASH_IMG="squash/root.img"
+ SQUASH_TMPFILE="$(mktemp -t --suffix=.root.sqsh lsinitrd.XXXXXX)"
+ trap "rm -f '$SQUASH_TMPFILE'" EXIT
+ $CAT "$image" 2>/dev/null | cpio --extract --verbose --quiet --to-stdout -- \
+ $SQUASH_IMG > "$SQUASH_TMPFILE" 2>/dev/null
+ if [[ -s $SQUASH_TMPFILE ]]; then
+ echo "Squashed content ($SQUASH_IMG):"
+ echo "========================================================================"
+ unsquashfs -ll "$SQUASH_TMPFILE" | tail -n +4
+ echo "========================================================================"
+ fi
+}
+
unpack_files()
{
if (( ${#filenames[@]} > 0 )); then
@@ -287,6 +302,7 @@ else
echo
list_modules
list_files
+ list_squash_content
fi
fi

286
SOURCES/0174.patch Normal file
View File

@ -0,0 +1,286 @@
From 5e4bc6e2d6b6829c45f4e25cce4d81661b798587 Mon Sep 17 00:00:00 2001
From: Lukas Nykryn <lnykryn@redhat.com>
Date: Thu, 29 Jul 2021 15:16:39 +0200
Subject: [PATCH] refactor(squash): structure in a cleaner way
Simplify the squash mount layout. Instead of overlay on each top
directory (/etc, /usr), just mount and switch_root into the squash
image, with a overlay on top of it.
Also install the binaries and setup scripts separately, so the squash
setup code and the squash image content is independent of each other,
all squash setup script and binaries can be deleted safely upon
switch_root.
With this change, previous squash clean up service and other tricky
implementations are all gone.
This commit depends on systemd commits from:
https://github.com/systemd/systemd/pull/18124
Previouly systemd doesn't recognize non-ramfs initramfs, now this is
doable with SYSTEMD_IN_INITRD=lenient
Signed-off-by: Kairui Song <kasong@redhat.com>
(cherry picked from commit 8f7c332e488f88e5845a3c7954af7934c2f1e37b)
Cherry-picked from: 8f7c332e
Resolves: #1959336
---
dracut-initramfs-restore.sh | 4 +-
dracut.sh | 4 +-
lsinitrd.sh | 6 +--
modules.d/99squash/clear-squash.sh | 6 ---
modules.d/99squash/init-squash.sh | 70 ++++++++---------------------
modules.d/99squash/module-setup.sh | 56 ++++++++---------------
modules.d/99squash/squash-mnt-clear.service | 17 -------
7 files changed, 44 insertions(+), 119 deletions(-)
diff --git a/dracut-initramfs-restore.sh b/dracut-initramfs-restore.sh
index 67fc88fa..74a952c4 100644
--- a/dracut-initramfs-restore.sh
+++ b/dracut-initramfs-restore.sh
@@ -41,9 +41,9 @@ else
fi
if [[ -d squash ]]; then
- unsquashfs -no-xattrs -f -d . squash/root.img >/dev/null
+ unsquashfs -no-xattrs -f -d . squash-root.img >/dev/null
if [ $? -ne 0 ]; then
- echo "Squash module is enabled for this initramfs but failed to unpack squash/root.img" >&2
+ echo "Squash module is enabled for this initramfs but failed to unpack squash-root.img" >&2
rm -f -- /run/initramfs/shutdown
exit 1
fi
diff --git a/dracut.sh b/dracut.sh
index 1168fc16..b403f401 100755
--- a/dracut.sh
+++ b/dracut.sh
@@ -1758,8 +1758,8 @@ fi
if dracut_module_included "squash"; then
readonly squash_dir="$initdir/squash/root"
- readonly squash_img="$initdir/squash/root.img"
-
+ readonly squash_img="$initdir/squash-root.img"
+ mkdir -p "$squash_dir"
dinfo "*** Install squash loader ***"
DRACUT_SQUASH_POST_INST=1 module_install "squash"
fi
diff --git a/lsinitrd.sh b/lsinitrd.sh
index 0b42b9a4..04ce9e8b 100755
--- a/lsinitrd.sh
+++ b/lsinitrd.sh
@@ -162,9 +162,9 @@ list_files()
list_squash_content()
{
- SQUASH_IMG="squash/root.img"
- SQUASH_TMPFILE="$(mktemp -t --suffix=.root.sqsh lsinitrd.XXXXXX)"
- trap "rm -f '$SQUASH_TMPFILE'" EXIT
+ SQUASH_IMG="squash-root.img"
+ SQUASH_TMPFILE="$TMPDIR/initrd.root.sqsh"
+
$CAT "$image" 2>/dev/null | cpio --extract --verbose --quiet --to-stdout -- \
$SQUASH_IMG > "$SQUASH_TMPFILE" 2>/dev/null
if [[ -s $SQUASH_TMPFILE ]]; then
diff --git a/modules.d/99squash/clear-squash.sh b/modules.d/99squash/clear-squash.sh
deleted file mode 100755
index 4f357817..00000000
--- a/modules.d/99squash/clear-squash.sh
+++ /dev/null
@@ -1,6 +0,0 @@
-#!/bin/bash
-mnt="/squash/root"
-for dir in jsquash/root/*; do
- mnt="$mnt ${dir#$SQUASH_MNT}"
-done
-umount --lazy -- $mnt
diff --git a/modules.d/99squash/init-squash.sh b/modules.d/99squash/init-squash.sh
index fee0105e..3de6f819 100755
--- a/modules.d/99squash/init-squash.sh
+++ b/modules.d/99squash/init-squash.sh
@@ -1,61 +1,29 @@
-#!/bin/bash
+#!/bin/sh
PATH=/bin:/sbin
-SQUASH_IMG=/squash/root.img
-SQUASH_MNT=/squash/root
+# Basic mounts for mounting a squash image
+mkdir /proc /sys /dev /run
+mount -t proc -o nosuid,noexec,nodev proc /proc
+mount -t sysfs -o nosuid,noexec,nodev sysfs /sys
+mount -t devtmpfs -o mode=755,noexec,nosuid,strictatime devtmpfs /dev
+mount -t tmpfs -o mode=755,nodev,nosuid,strictatime tmpfs /run
-# Following mount points are neccessary for mounting a squash image
-
-[ ! -d /proc/self ] && \
- mount -t proc -o nosuid,noexec,nodev proc /proc
-
-[ ! -d /sys/kernel ] && \
- mount -t sysfs -o nosuid,noexec,nodev sysfs /sys
-
-[ ! -e /dev/loop-control ] && \
- mount -t devtmpfs -o mode=0755,noexec,nosuid,strictatime devtmpfs /dev
-
-# Need a loop device backend, overlayfs, and squashfs module
+# Load required modules
modprobe loop
-if [ $? != 0 ]; then
- echo "Unable to setup loop module"
-fi
-
modprobe squashfs
-if [ $? != 0 ]; then
- echo "Unable to setup squashfs module"
-fi
-
modprobe overlay
-if [ $? != 0 ]; then
- echo "Unable to setup overlay module"
-fi
-
-[ ! -d "$SQUASH_MNT" ] && \
- mkdir -m 0755 -p $SQUASH_MNT
-
-# Mount the squashfs image
-mount -t squashfs -o ro,loop $SQUASH_IMG $SQUASH_MNT
-
-if [ $? != 0 ]; then
- echo "Unable to mount squashed initramfs image"
-fi
-
-for file in $SQUASH_MNT/*; do
- file=${file#$SQUASH_MNT/}
- lowerdir=$SQUASH_MNT/$file
- workdir=/squash/overlay-work/$file
- upperdir=/$file
- mntdir=/$file
- mkdir -m 0755 -p $workdir
- mkdir -m 0755 -p $mntdir
+# Mount the squash image
+mount -t ramfs ramfs /squash
+mkdir -p /squash/root /squash/overlay/upper /squash/overlay/work
+mount -t squashfs -o ro,loop /squash-root.img /squash/root
- mount -t overlay overlay -o\
- lowerdir=$lowerdir,upperdir=$upperdir,workdir=$workdir $mntdir
-done
+# Setup new root overlay
+mkdir /newroot
+mount -t overlay overlay -o lowerdir=/squash/root,upperdir=/squash/overlay/upper,workdir=/squash/overlay/work/ /newroot/
-exec /init.orig
+# Move all mount points to new root to prepare chroot
+mount --move /squash /newroot/squash
-echo "Something went wrong when trying to exec original init!"
-exit 1
+# Jump to new root and clean setup files
+SYSTEMD_IN_INITRD=lenient exec switch_root /newroot /init
diff --git a/modules.d/99squash/module-setup.sh b/modules.d/99squash/module-setup.sh
index ad619176..50c92c31 100644
--- a/modules.d/99squash/module-setup.sh
+++ b/modules.d/99squash/module-setup.sh
@@ -19,56 +19,36 @@ depends() {
}
installpost() {
- local squash_candidate=( "usr" "etc" )
-
- # shellcheck disable=SC2174
- mkdir -m 0755 -p "$squash_dir"
- for folder in "${squash_candidate[@]}"; do
- mv "$initdir/$folder" "$squash_dir/$folder"
+ # Move everything under $initdir except $squash_dir
+ # itself into squash image
+ for i in "$initdir"/*; do
+ [[ "$squash_dir" == "$i"/* ]] || mv "$i" "$squash_dir"/
done
- # Move some files out side of the squash image, including:
- # - Files required to boot and mount the squashfs image
- # - Files need to be accessible without mounting the squash image
- # - Initramfs marker
- for file in \
- "$squash_dir"/usr/lib/dracut/* \
- "$squash_dir"/etc/initrd-release
- do
+ # Create mount points for squash loader
+ mkdir -p "$initdir"/squash/
+ mkdir -p "$squash_dir"/squash/
+
+ # Copy dracut spec files out side of the squash image
+ # so dracut rebuild and lsinitrd can work
+ for file in "$squash_dir"/usr/lib/dracut/*; do
[[ -f $file ]] || continue
DRACUT_RESOLVE_DEPS=1 dracutsysrootdir="$squash_dir" inst "${file#$squash_dir}"
- rm "$file"
- done
-
- # Install required files for the squash image setup script.
- inst_multiple modprobe mount mkdir ln echo rm
-
- mv "$initdir"/init "$initdir"/init.orig
- inst "$moddir"/init-squash.sh /init
- inst "$moddir"/clear-squash.sh /squash/clear-squash.sh
-
- # Keep systemctl outsite if we need switch root
- if [[ ! -f "$initdir/lib/dracut/no-switch-root" ]]; then
- inst "systemctl"
- fi
-
- # Remove duplicated files
- for folder in "${squash_candidate[@]}"; do
- find "$initdir/$folder/" -not -type d \
- -exec bash -c 'mv -f "$squash_dir${1#$initdir}" "$1"' -- "{}" \;
done
- # Install required modules for the squash image init script.
+ # Install required modules and binaries for the squash image init script.
+ DRACUT_RESOLVE_DEPS=1 inst_multiple sh mount modprobe mkdir switch_root
hostonly="" instmods "loop" "squashfs" "overlay"
dracut_kernel_post
+
+ # Install squash image init script.
+ ln -sfn /usr/bin "$initdir/bin"
+ ln -sfn /usr/sbin "$initdir/sbin"
+ inst_simple "$moddir"/init-squash.sh /init
}
install() {
if [[ $DRACUT_SQUASH_POST_INST ]]; then
installpost
- return
fi
-
- inst "$moddir/squash-mnt-clear.service" "$systemdsystemunitdir/squash-mnt-clear.service"
- systemctl -q --root "$initdir" add-wants initrd-switch-root.target squash-mnt-clear.service
}
diff --git a/modules.d/99squash/squash-mnt-clear.service b/modules.d/99squash/squash-mnt-clear.service
deleted file mode 100644
index 84441f60..00000000
--- a/modules.d/99squash/squash-mnt-clear.service
+++ /dev/null
@@ -1,17 +0,0 @@
-# This file is part of dracut.
-#
-
-[Unit]
-Description=Cleanup squashfs mounts when switch root
-DefaultDependencies=no
-Before=initrd-switch-root.service
-After=initrd-switch-root.target
-ConditionPathExists=/squash/root
-
-[Service]
-Type=oneshot
-RemainAfterExit=no
-StandardInput=null
-StandardOutput=syslog+console
-StandardError=syslog+console
-ExecStart=/squash/clear-squash.sh

80
SOURCES/0175.patch Normal file
View File

@ -0,0 +1,80 @@
From f462176a19f463861fea7a26af6288403785eb9b Mon Sep 17 00:00:00 2001
From: Kairui Song <kasong@redhat.com>
Date: Mon, 15 Feb 2021 14:04:05 +0800
Subject: [PATCH] feat(squash): use busybox for early setup if available
Use busybox can help reduce the size of early setup environment.
With this change, everything is packed in the squash image, and
the setup files will be dropped once squash image setup is done,
so initramfs stage memory usage is reduced to the minimun,
and initramfs decompress is also faster.
File layout of a squash initramfs looks like this:
========================================================================
drwxr-xr-x 1 root root 0 Feb 15 14:07 .
-rwxr-xr-x 1 root root 946 Feb 15 14:07 init
lrwxrwxrwx 1 root root 7 Feb 15 14:07 lib -> usr/lib
drwxr-xr-x 1 root root 0 Feb 15 14:07 squash
-rw-r--r-- 1 root root 91000832 Feb 15 14:07 squash-root.img
drwxr-xr-x 1 root root 0 Feb 15 14:07 usr
drwxr-xr-x 1 root root 0 Feb 15 14:07 usr/bin
-rwxr-xr-x 1 root root 1293688 Jul 27 2020 usr/bin/busybox
lrwxrwxrwx 1 root root 7 Feb 15 14:07 usr/bin/echo -> busybox
lrwxrwxrwx 1 root root 7 Feb 15 14:07 usr/bin/mkdir -> busybox
lrwxrwxrwx 1 root root 7 Feb 15 14:07 usr/bin/modprobe -> busybox
lrwxrwxrwx 1 root root 7 Feb 15 14:07 usr/bin/mount -> busybox
lrwxrwxrwx 1 root root 7 Feb 15 14:07 usr/bin/sh -> busybox
lrwxrwxrwx 1 root root 7 Feb 15 14:07 usr/bin/switch_root -> busybox
drwxr-xr-x 1 root root 0 Feb 15 14:07 usr/lib
drwxr-xr-x 1 root root 0 Feb 15 14:07 usr/lib/dracut
-rw-r--r-- 1 root root 23 Feb 15 14:07 usr/lib/dracut/build-parameter.txt
-rw-r--r-- 1 root root 31 Feb 15 14:07 usr/lib/dracut/dracut-051-93.git20210215.fc33
-rw-r--r-- 1 root root 358 Feb 15 14:07 usr/lib/dracut/modules.txt
-rw-r--r-- 1 root root 0 Feb 15 14:07 usr/lib/dracut/need-initqueue
drwxr-xr-x 1 root root 0 Feb 15 14:07 usr/lib/modules
drwxr-xr-x 1 root root 0 Feb 15 14:07 usr/lib/modules/5.10.11-200.fc33.x86_64
drwxr-xr-x 1 root root 0 Feb 15 14:07 usr/lib/modules/5.10.11-200.fc33.x86_64/kernel
<... kernel module misc files skipped ... >
========================================================================
(cherry picked from commit 90f269f6afe409925bad86f0bd7e9322ad9b4fb0)
Resolves: #1959336
---
modules.d/99squash/module-setup.sh | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/modules.d/99squash/module-setup.sh b/modules.d/99squash/module-setup.sh
index 50c92c31..72cc83ad 100644
--- a/modules.d/99squash/module-setup.sh
+++ b/modules.d/99squash/module-setup.sh
@@ -19,6 +19,9 @@ depends() {
}
installpost() {
+ local _busybox
+ _busybox=$(find_binary busybox)
+
# Move everything under $initdir except $squash_dir
# itself into squash image
for i in "$initdir"/*; do
@@ -37,7 +40,15 @@ installpost() {
done
# Install required modules and binaries for the squash image init script.
- DRACUT_RESOLVE_DEPS=1 inst_multiple sh mount modprobe mkdir switch_root
+ if [[ $_busybox ]]; then
+ inst "$_busybox" /usr/bin/busybox
+ for _i in sh echo mount modprobe mkdir switch_root; do
+ ln_r /usr/bin/busybox /usr/bin/$_i
+ done
+ else
+ DRACUT_RESOLVE_DEPS=1 inst_multiple sh mount modprobe mkdir switch_root
+ fi
+
hostonly="" instmods "loop" "squashfs" "overlay"
dracut_kernel_post

51
SOURCES/0176.patch Normal file
View File

@ -0,0 +1,51 @@
From 0a2f7b1779ddcac1c4e79aa58212c7ee528ac6e1 Mon Sep 17 00:00:00 2001
From: Kairui Song <kasong@redhat.com>
Date: Mon, 15 Feb 2021 23:15:26 +0800
Subject: [PATCH] feat: squash module follow --compress option
Try to make mksquashfs follow --compress option if squash module is
included, if not specified or invalid, fall back to use mksquashfs's
default compressor.
(cherry picked from commit 5d05ffbd87bc27e27f517ebc3454d50729c687e6)
Cherry-picked from: 5d05ffbd
Resolves: #1959336
---
dracut.sh | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/dracut.sh b/dracut.sh
index b403f401..d9a66c5a 100755
--- a/dracut.sh
+++ b/dracut.sh
@@ -1781,14 +1781,25 @@ fi
if dracut_module_included "squash"; then
dinfo "*** Squashing the files inside the initramfs ***"
- mksquashfs $squash_dir $squash_img -no-xattrs -no-exports -noappend -always-use-fragments -comp xz -Xdict-size 100% -no-progress 1> /dev/null
+ declare squash_compress_arg
+ # shellcheck disable=SC2086
+ if [[ $compress ]]; then
+ if ! mksquashfs /dev/null "$DRACUT_TMPDIR"/.squash-test.img -no-progress -comp $compress &>/dev/null; then
+ dwarn "mksquashfs doesn't support compressor '$compress', failing back to default compressor."
+ else
+ squash_compress_arg="$compress"
+ fi
+ fi
- if [[ $? != 0 ]]; then
+ # shellcheck disable=SC2086
+ if ! mksquashfs "$squash_dir" "$squash_img" \
+ -no-xattrs -no-exports -noappend -no-recovery -always-use-fragments \
+ -no-progress ${squash_compress_arg:+-comp $squash_compress_arg} 1> /dev/null; then
dfatal "dracut: Failed making squash image"
exit 1
fi
- rm -rf $squash_dir
+ rm -rf "$squash_dir"
dinfo "*** Squashing the files inside the initramfs done ***"
fi

31
SOURCES/0177.patch Normal file
View File

@ -0,0 +1,31 @@
From 878384403378526535a737acfdbf4154f7af5f50 Mon Sep 17 00:00:00 2001
From: Kairui Song <kasong@redhat.com>
Date: Mon, 1 Feb 2021 01:49:54 +0800
Subject: [PATCH] perf: disable initrd compression when squash module is
enabled
With squash module, the initramfs is double compressed, which slow down
the build progress and doesn't shrink the size much.
(cherry picked from commit 7c0bc0b2fd167da42035020dae49af94844f053c)
Resolves: #1959336
---
dracut.sh | 3 +++
1 file changed, 3 insertions(+)
diff --git a/dracut.sh b/dracut.sh
index d9a66c5a..bf79568c 100755
--- a/dracut.sh
+++ b/dracut.sh
@@ -1801,6 +1801,9 @@ if dracut_module_included "squash"; then
rm -rf "$squash_dir"
dinfo "*** Squashing the files inside the initramfs done ***"
+
+ # Skip initramfs compress
+ compress="cat"
fi
dinfo "*** Creating image file '$outfile' ***"

16
SOURCES/0178.patch Normal file
View File

@ -0,0 +1,16 @@
From 9795be398d697d9b5346f4e398b1a5511830546b Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Fri, 26 Mar 2021 10:29:35 +0100
Subject: [PATCH] fix(squash): shellcheck for modules.d/99squash
(cherry picked from commit cbef7cf3dac79f014200017e9b13e012f2a53f47)
Resolves: #1959336
---
modules.d/99squash/.shchkdir | 0
1 file changed, 0 insertions(+), 0 deletions(-)
diff --git a/modules.d/99squash/.shchkdir b/modules.d/99squash/.shchkdir
new file mode 100644
index 00000000..e69de29b

64
SOURCES/0179.patch Normal file
View File

@ -0,0 +1,64 @@
From 3f7410e7f3c08866c84e01ccfb423d7cff4eb5a3 Mon Sep 17 00:00:00 2001
From: Kairui Song <kasong@redhat.com>
Date: Wed, 7 Apr 2021 02:11:41 +0800
Subject: [PATCH] fix(squash): don't mount the mount points if already mounted
It is possible that user setup some early mount in the rootfs even
earlier, so just be more robust and cover that case too.
Signed-off-by: Kairui Song <kasong@redhat.com>
(cherry picked from commit 636d6df3134dde1dac72241937724bc59deb9303)
Resolves: #1959336
---
modules.d/99squash/init-squash.sh | 17 +++++++++++------
modules.d/99squash/module-setup.sh | 4 ++--
2 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/modules.d/99squash/init-squash.sh b/modules.d/99squash/init-squash.sh
index 3de6f819..59769f62 100755
--- a/modules.d/99squash/init-squash.sh
+++ b/modules.d/99squash/init-squash.sh
@@ -1,12 +1,17 @@
#!/bin/sh
PATH=/bin:/sbin
-# Basic mounts for mounting a squash image
-mkdir /proc /sys /dev /run
-mount -t proc -o nosuid,noexec,nodev proc /proc
-mount -t sysfs -o nosuid,noexec,nodev sysfs /sys
-mount -t devtmpfs -o mode=755,noexec,nosuid,strictatime devtmpfs /dev
-mount -t tmpfs -o mode=755,nodev,nosuid,strictatime tmpfs /run
+[ -e /proc/self/mounts ] \
+ || (mkdir -p /proc && mount -t proc -o nosuid,noexec,nodev proc /proc)
+
+grep -q '^sysfs /sys sysfs' /proc/self/mounts \
+ || (mkdir -p /sys && mount -t sysfs -o nosuid,noexec,nodev sysfs /sys)
+
+grep -q '^devtmpfs /dev devtmpfs' /proc/self/mounts \
+ || (mkdir -p /dev && mount -t devtmpfs -o mode=755,noexec,nosuid,strictatime devtmpfs /dev)
+
+grep -q '^tmpfs /run tmpfs' /proc/self/mounts \
+ || (mkdir -p /run && mount -t tmpfs -o mode=755,noexec,nosuid,strictatime tmpfs /run)
# Load required modules
modprobe loop
diff --git a/modules.d/99squash/module-setup.sh b/modules.d/99squash/module-setup.sh
index 72cc83ad..81a5b3f7 100644
--- a/modules.d/99squash/module-setup.sh
+++ b/modules.d/99squash/module-setup.sh
@@ -42,11 +42,11 @@ installpost() {
# Install required modules and binaries for the squash image init script.
if [[ $_busybox ]]; then
inst "$_busybox" /usr/bin/busybox
- for _i in sh echo mount modprobe mkdir switch_root; do
+ for _i in sh echo mount modprobe mkdir switch_root grep; do
ln_r /usr/bin/busybox /usr/bin/$_i
done
else
- DRACUT_RESOLVE_DEPS=1 inst_multiple sh mount modprobe mkdir switch_root
+ DRACUT_RESOLVE_DEPS=1 inst_multiple sh mount modprobe mkdir switch_root grep
fi
hostonly="" instmods "loop" "squashfs" "overlay"

36
SOURCES/0180.patch Normal file
View File

@ -0,0 +1,36 @@
From faadc1cbcd1ca35393b75f93757a89621957453c Mon Sep 17 00:00:00 2001
From: Kairui Song <kasong@redhat.com>
Date: Tue, 22 Jun 2021 21:49:20 +0800
Subject: [PATCH] feat(squash): install umount util
Also install umount binary, make it possible to cleanup squash overlay
mounts. This is useful for other tools reusing the dracut initramfs built
with squash module enabled.
Signed-off-by: Kairui Song <kasong@redhat.com>
(cherry picked from commit 563f543424c66bf38e6cbd3f489655d45ad9b5c5)
Resolves: #1959336
---
modules.d/99squash/module-setup.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/modules.d/99squash/module-setup.sh b/modules.d/99squash/module-setup.sh
index 81a5b3f7..9bb30b2e 100644
--- a/modules.d/99squash/module-setup.sh
+++ b/modules.d/99squash/module-setup.sh
@@ -42,11 +42,11 @@ installpost() {
# Install required modules and binaries for the squash image init script.
if [[ $_busybox ]]; then
inst "$_busybox" /usr/bin/busybox
- for _i in sh echo mount modprobe mkdir switch_root grep; do
+ for _i in sh echo mount modprobe mkdir switch_root grep umount; do
ln_r /usr/bin/busybox /usr/bin/$_i
done
else
- DRACUT_RESOLVE_DEPS=1 inst_multiple sh mount modprobe mkdir switch_root grep
+ DRACUT_RESOLVE_DEPS=1 inst_multiple sh mount modprobe mkdir switch_root grep umount
fi
hostonly="" instmods "loop" "squashfs" "overlay"

32
SOURCES/0181.patch Normal file
View File

@ -0,0 +1,32 @@
From 487d2686a78cfa52419b330fa2b62af715c4356b Mon Sep 17 00:00:00 2001
From: Kairui Song <kasong@redhat.com>
Date: Thu, 10 Jun 2021 16:45:03 +0800
Subject: [PATCH] fix(squash): create relative symlinks
Don't use absolute path, or it may resolve to wrong files after unpack
the initramfs to a sub path on a running system.
Signed-off-by: Kairui Song <kasong@redhat.com>
(cherry picked from commit a2b6be44792b68218e3378a7d844b0f8527a4805)
Resolves: #1959336
---
modules.d/99squash/module-setup.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/modules.d/99squash/module-setup.sh b/modules.d/99squash/module-setup.sh
index 9bb30b2e..8c9982c0 100644
--- a/modules.d/99squash/module-setup.sh
+++ b/modules.d/99squash/module-setup.sh
@@ -53,8 +53,8 @@ installpost() {
dracut_kernel_post
# Install squash image init script.
- ln -sfn /usr/bin "$initdir/bin"
- ln -sfn /usr/sbin "$initdir/sbin"
+ ln_r /usr/bin /bin
+ ln_r /usr/sbin /sbin
inst_simple "$moddir"/init-squash.sh /init
}

85
SOURCES/0182.patch Normal file
View File

@ -0,0 +1,85 @@
From f0f83da2c608202205f1092289a64de044ecc130 Mon Sep 17 00:00:00 2001
From: Hari Bathini <hbathini@linux.ibm.com>
Date: Fri, 11 Jun 2021 15:20:28 +0530
Subject: [PATCH] fix(dracut.sh): handle '-i' option to include files beginning
with '.'
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
While including a directory using '--include' option, the file and
subdirectory names that begin with '.' are not included. Also, dracut
throws a warning message when a subdirectory is empty or only has
files or subdirectories that begin with '.'.
For example, while trying to include /tmpdata directory with the
below tree:
# tree -a /tmpdata
/tmpdata
├── .anothertestdir
├── testdir
│   └── .testsubdir
└── .testfile
dracut throws the below warning message:
# dracut --include /tmpdata /root
cp: cannot stat '/tmpdata/testdir/*': No such file or directory
#
and this is how the included /tmpdata directory tree looks:
# tree -a root
root
└── testdir
No file or directory beginning with '.' is included & also, copying
/tmpdata/testdir reported "No such file or directory" warning. Using
'.' instead of '*' in the below command will fix the warning whether
the directory being copied is empty or only has files or directories
that begin with dot:
$DRACUT_CP -t "$object_destdir" "$dracutsysrootdir$objectname"/*
Also, enable 'dotglob' temporarily to include files and directories
beginning with a `.' in the results of pathname expansion of source
directory being included.
Signed-off-by: Hari Bathini <hbathini@linux.ibm.com>
(cherry picked from commit f1138012c9dc44e6614466c0a8e929fc55e4a5dd)
Cherry-picked from: f1138012
Resolves: #1959336
---
dracut.sh | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/dracut.sh b/dracut.sh
index bf79568c..3fd31e21 100755
--- a/dracut.sh
+++ b/dracut.sh
@@ -1606,6 +1606,8 @@ for ((i=0; i < ${#include_src[@]}; i++)); do
# check for preexisting symlinks, so we can cope with the
# symlinks to $prefix
# Objectname is a file or a directory
+ reset_dotglob="$(shopt -p dotglob)"
+ shopt -q -s dotglob
for objectname in "$src"/*; do
[[ -e "$objectname" || -h "$objectname" ]] || continue
if [[ -d "$objectname" ]]; then
@@ -1615,11 +1617,12 @@ for ((i=0; i < ${#include_src[@]}; i++)); do
mkdir -m 0755 -p "$object_destdir"
chmod --reference="$objectname" "$object_destdir"
fi
- $DRACUT_CP -t "$object_destdir" "$objectname"/*
+ $DRACUT_CP -t "$object_destdir" "$objectname"/.
else
$DRACUT_CP -t "$destdir" "$objectname"
fi
done
+ eval "$reset_dotglob"
fi
fi
done

35
SOURCES/0183.patch Normal file
View File

@ -0,0 +1,35 @@
From 9fdbd56ecef7498d2d61fc7123b958add945f46b Mon Sep 17 00:00:00 2001
From: Kairui Song <kasong@redhat.com>
Date: Sat, 12 Jun 2021 02:25:09 +0800
Subject: [PATCH] fix(dracut.sh): handle symlinks appropriately while using
'-i' option
[[ -d $symlink ]] will return true if the symlink points to a directory.
So the symlink will not be copied, instead a directory is created with
the symlink name and the content is copied.
Signed-off-by: Kairui Song <kasong@redhat.com>
(cherry picked from commit c7fbc0c8901917baf0d1f0822568e65c6ec00d18)
Cherry-picked from: c7fbc0c8
Resolves: #1959336
---
dracut.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/dracut.sh b/dracut.sh
index 3fd31e21..fa14e3ce 100755
--- a/dracut.sh
+++ b/dracut.sh
@@ -1609,8 +1609,8 @@ for ((i=0; i < ${#include_src[@]}; i++)); do
reset_dotglob="$(shopt -p dotglob)"
shopt -q -s dotglob
for objectname in "$src"/*; do
- [[ -e "$objectname" || -h "$objectname" ]] || continue
- if [[ -d "$objectname" ]]; then
+ [[ -e $objectname || -L $objectname ]] || continue
+ if [[ -d $objectname ]] && [[ ! -L $objectname ]]; then
# objectname is a directory, let's compute the final directory name
object_destdir=${destdir}/${objectname#$src/}
if ! [[ -e "$object_destdir" ]]; then

76
SOURCES/0184.patch Normal file
View File

@ -0,0 +1,76 @@
From c6d8832f86bc2ef7fbab6f703479816dd6078902 Mon Sep 17 00:00:00 2001
From: Pingfan Liu <piliu@redhat.com>
Date: Fri, 9 Jul 2021 11:55:16 +0800
Subject: [PATCH] fix(squash): keep ld cache under initdir
When running kdump on PowerPC, the following bug is hit:
[ 0.391629] Freeing unused kernel memory: 5568K
[ 0.391634] This architecture does not have kernel memory protection.
/bin/sh: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory
[ 0.392214] Kernel panic - not syncing: Attempted to kill init! exitcode=0x00007f00
[ 0.392214]
[ 0.392223] CPU: 6 PID: 1 Comm: init Not tainted 4.18.0-319.el8.ppc64le #1
[ 0.392228] Call Trace:
[ 0.392234] [c00000000c703c10] [c000000008ecb94c] dump_stack+0xb0/0xf4 (unreliable)
[ 0.392243] [c00000000c703c50] [c000000008167324] panic+0x148/0x3c4
[ 0.392249] [c00000000c703cf0] [c000000008170474] do_exit+0xcd4/0xd40
[ 0.392255] [c00000000c703dc0] [c0000000081705b0] do_group_exit+0x60/0x110
[ 0.392261] [c00000000c703e00] [c000000008170684] sys_exit_group+0x24/0x30
[ 0.392268] [c00000000c703e20] [c00000000800b408] system_call+0x5c/0x70
This is due to the non-conventional library path:
ldd /bin/bash
linux-vdso64.so.1 (0x00007fffbdc90000)
libtinfo.so.6 => /lib64/libtinfo.so.6 (0x00007fffbda80000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007fffbda50000)
libc.so.6 => /lib64/glibc-hwcaps/power9/libc-2.28.so (0x00007fffbd830000)
^^^
/lib64/ld64.so.2 (0x00007fffbdcb0000)
ldd finds the path by libc.so.6 -> /usr/lib64/libc.so.6 ->
/usr/lib64/glibc-hwcaps/power9/libc-2.28.so and cache the result. So
when dracut_install, it only saw
'/usr/lib64/glibc-hwcaps/power9/libc-2.28.so' and blind to
'/usr/lib64/libc.so.6'
In the final kdumpimg, the symlink /usr/lib64/libc.so.6 is not created,
hence ld.so can not find the /usr/lib64/glibc-hwcaps/power9/libc-2.28.so
On the other hand, during the process of building kdumpimg, all of dynamic library info
have been cached in ld.so.cache. Hence this bug can be simplely resolved
by keeping ld cache under $initdir/etc.
Signed-off-by: Pingfan Liu <piliu@redhat.com>
---
v3 -> v4:
use inst() instead of copy
v2 -> v3:
fix format by shfmt -s -w modules.d/99squash/module-setup.sh
v1 -> v2:
cp -r /etc/ld.so* instead of move, since after switch-root, initdir
can not be seen any longer
(cherry picked from commit dc21638c3f0acbb54417f3bfb6294ad5514bf2db)
Resolves: #1959336
---
modules.d/99squash/module-setup.sh | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/modules.d/99squash/module-setup.sh b/modules.d/99squash/module-setup.sh
index 8c9982c0..14790ce8 100644
--- a/modules.d/99squash/module-setup.sh
+++ b/modules.d/99squash/module-setup.sh
@@ -28,6 +28,11 @@ installpost() {
[[ "$squash_dir" == "$i"/* ]] || mv "$i" "$squash_dir"/
done
+ # initdir also needs ld.so.* to make ld.so work
+ inst /etc/ld.so.cache
+ inst /etc/ld.so.conf
+ inst_dir /etc/ld.so.conf.d/
+
# Create mount points for squash loader
mkdir -p "$initdir"/squash/
mkdir -p "$squash_dir"/squash/

67
SOURCES/0185.patch Normal file
View File

@ -0,0 +1,67 @@
From bc6b4ffd4e7babd34e207c2aa8bed7f0fd8bafcf Mon Sep 17 00:00:00 2001
From: Lukas Nykryn <lnykryn@redhat.com>
Date: Mon, 2 Aug 2021 12:42:09 +0200
Subject: [PATCH] dracut-functions: backport block_is_* functions
Based on 480aa9695f8c2e2b30c8f41ae8483140020d23db
RHEL-only
Related: #1959336
---
dracut-functions.sh | 44 ++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 44 insertions(+)
diff --git a/dracut-functions.sh b/dracut-functions.sh
index d75696fd..14e60a9c 100755
--- a/dracut-functions.sh
+++ b/dracut-functions.sh
@@ -718,3 +718,47 @@ btrfs_devs() {
printf -- "%s\n" "$_dev"
done
}
+
+# block_is_nbd <maj:min>
+# Check whether $1 is an nbd device
+block_is_nbd() {
+ [[ -b /dev/block/$1 && $1 == 43:* ]]
+}
+
+# block_is_iscsi <maj:min>
+# Check whether $1 is an nbd device
+block_is_iscsi() {
+ local _dir
+ local _dev=$1
+ [[ -L "/sys/dev/block/$_dev" ]] || return
+ _dir="$(readlink -f "/sys/dev/block/$_dev")" || return
+ until [[ -d "$_dir/sys" || -d "$_dir/iscsi_session" ]]; do
+ _dir="$_dir/.."
+ done
+ [[ -d "$_dir/iscsi_session" ]]
+}
+
+# block_is_fcoe <maj:min>
+# Check whether $1 is an FCoE device
+# Will not work for HBAs that hide the ethernet aspect
+# completely and present a pure FC device
+block_is_fcoe() {
+ local _dir
+ local _dev=$1
+ [[ -L "/sys/dev/block/$_dev" ]] || return
+ _dir="$(readlink -f "/sys/dev/block/$_dev")"
+ until [[ -d "$_dir/sys" ]]; do
+ _dir="$_dir/.."
+ if [[ -d "$_dir/subsystem" ]]; then
+ subsystem=$(basename $(readlink $_dir/subsystem))
+ [[ $subsystem == "fcoe" ]] && return 0
+ fi
+ done
+ return 1
+}
+
+# block_is_netdevice <maj:min>
+# Check whether $1 is a net device
+block_is_netdevice() {
+ block_is_nbd "$1" || block_is_iscsi "$1" || block_is_fcoe "$1"
+}
\ No newline at end of file

143
SOURCES/0186.patch Normal file
View File

@ -0,0 +1,143 @@
From f24f363eb329f8ce4b2435fb5d14786c104dec99 Mon Sep 17 00:00:00 2001
From: Kairui Song <kasong@redhat.com>
Date: Mon, 2 Aug 2021 13:33:18 +0200
Subject: [PATCH] fix(squash): fixes related to squash module rebase
fix fro missing dracutsysrootdir
move the $compress args parsing to later part after mksquashfs, so mksquashfs can use $compress as the original parameter value
Related:#1959336
---
dracut.sh | 94 +++++++++++++++++++-------------------
modules.d/99squash/module-setup.sh | 3 +-
2 files changed, 49 insertions(+), 48 deletions(-)
diff --git a/dracut.sh b/dracut.sh
index fa14e3ce..e559bb96 100755
--- a/dracut.sh
+++ b/dracut.sh
@@ -825,53 +825,6 @@ if [[ $_no_compress_l = "cat" ]]; then
compress="cat"
fi
-if ! [[ $compress ]]; then
- # check all known compressors, if none specified
- for i in pigz gzip lz4 lzop zstd lzma xz lbzip2 bzip2 cat; do
- command -v "$i" &>/dev/null || continue
- compress="$i"
- break
- done
- if [[ $compress = cat ]]; then
- printf "%s\n" "dracut: no compression tool available. Initramfs image is going to be big." >&2
- fi
-fi
-
-# choose the right arguments for the compressor
-case $compress in
- bzip2|lbzip2)
- if [[ "$compress" = lbzip2 ]] || command -v lbzip2 &>/dev/null; then
- compress="lbzip2 -9"
- else
- compress="bzip2 -9"
- fi
- ;;
- lzma)
- compress="lzma -9 -T0"
- ;;
- xz)
- compress="xz --check=crc32 --lzma2=dict=1MiB -T0"
- ;;
- gzip|pigz)
- if [[ "$compress" = pigz ]] || command -v pigz &>/dev/null; then
- compress="pigz -9 -n -T -R"
- elif command -v gzip &>/dev/null && gzip --help 2>&1 | grep -q rsyncable; then
- compress="gzip -n -9 --rsyncable"
- else
- compress="gzip -n -9"
- fi
- ;;
- lzo|lzop)
- compress="lzop -9"
- ;;
- lz4)
- compress="lz4 -l -9"
- ;;
- zstd)
- compress="zstd -15 -q -T0"
- ;;
-esac
-
[[ $hostonly = yes ]] && hostonly="-h"
[[ $hostonly != "-h" ]] && unset hostonly
@@ -1848,6 +1801,53 @@ if [[ $create_early_cpio = yes ]]; then
fi
fi
+if ! [[ $compress ]]; then
+ # check all known compressors, if none specified
+ for i in pigz gzip lz4 lzop zstd lzma xz lbzip2 bzip2 cat; do
+ command -v "$i" &>/dev/null || continue
+ compress="$i"
+ break
+ done
+ if [[ $compress = cat ]]; then
+ printf "%s\n" "dracut: no compression tool available. Initramfs image is going to be big." >&2
+ fi
+fi
+
+# choose the right arguments for the compressor
+case $compress in
+ bzip2|lbzip2)
+ if [[ "$compress" = lbzip2 ]] || command -v lbzip2 &>/dev/null; then
+ compress="lbzip2 -9"
+ else
+ compress="bzip2 -9"
+ fi
+ ;;
+ lzma)
+ compress="lzma -9 -T0"
+ ;;
+ xz)
+ compress="xz --check=crc32 --lzma2=dict=1MiB -T0"
+ ;;
+ gzip|pigz)
+ if [[ "$compress" = pigz ]] || command -v pigz &>/dev/null; then
+ compress="pigz -9 -n -T -R"
+ elif command -v gzip &>/dev/null && gzip --help 2>&1 | grep -q rsyncable; then
+ compress="gzip -n -9 --rsyncable"
+ else
+ compress="gzip -n -9"
+ fi
+ ;;
+ lzo|lzop)
+ compress="lzop -9"
+ ;;
+ lz4)
+ compress="lz4 -l -9"
+ ;;
+ zstd)
+ compress="zstd -15 -q -T0"
+ ;;
+esac
+
if ! (
umask 077; cd "$initdir"
find . -print0 | sort -z \
diff --git a/modules.d/99squash/module-setup.sh b/modules.d/99squash/module-setup.sh
index 14790ce8..11964b97 100644
--- a/modules.d/99squash/module-setup.sh
+++ b/modules.d/99squash/module-setup.sh
@@ -39,9 +39,10 @@ installpost() {
# Copy dracut spec files out side of the squash image
# so dracut rebuild and lsinitrd can work
+ mkdir -p "$initdir/usr/lib/dracut/"
for file in "$squash_dir"/usr/lib/dracut/*; do
[[ -f $file ]] || continue
- DRACUT_RESOLVE_DEPS=1 dracutsysrootdir="$squash_dir" inst "${file#$squash_dir}"
+ cp "$file" "$initdir/${file#$squash_dir}"
done
# Install required modules and binaries for the squash image init script.

31
SOURCES/0187.patch Normal file
View File

@ -0,0 +1,31 @@
From 094514ae8383e03d95869a98ba8858ad74da1f0d Mon Sep 17 00:00:00 2001
From: Kairui Song <kasong@redhat.com>
Date: Fri, 30 Jul 2021 21:54:11 +0800
Subject: [PATCH] fix(squash): remove tailing '/' when installing ld.so.conf.d
This tailing '/' will result in following error:
dracut-install: ERROR: installing '/etc/ld.so.conf.d/'
dracut: FAILED: /usr/lib/dracut/dracut-install -D /var/tmp/dracut.kEFQLs/initramfs -d /etc/ld.so.conf.d/
Signed-off-by: Kairui Song <kasong@redhat.com>
Related:#1959336
---
modules.d/99squash/module-setup.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/modules.d/99squash/module-setup.sh b/modules.d/99squash/module-setup.sh
index 11964b97..7f5d365a 100644
--- a/modules.d/99squash/module-setup.sh
+++ b/modules.d/99squash/module-setup.sh
@@ -31,7 +31,7 @@ installpost() {
# initdir also needs ld.so.* to make ld.so work
inst /etc/ld.so.cache
inst /etc/ld.so.conf
- inst_dir /etc/ld.so.conf.d/
+ inst_dir /etc/ld.so.conf.d
# Create mount points for squash loader
mkdir -p "$initdir"/squash/

32
SOURCES/0188.patch Normal file
View File

@ -0,0 +1,32 @@
From 090aa276b8d4b5041472743ea7472a3a1d398a92 Mon Sep 17 00:00:00 2001
From: Kairui Song <kasong@redhat.com>
Date: Tue, 10 Aug 2021 17:37:08 +0800
Subject: [PATCH] fix(lsinitrd): TMP_DIR doesn't exist in RHEL8
lsinitrd should create a seperate temp file for extracting squash image
when squash module is enabled.
Signed-off-by: Kairui Song <kasong@redhat.com>
(cherry picked from commit 52fcd3373f0cf715b3744f832643dc3170aefbf5)
Resolves: #1991647
---
lsinitrd.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lsinitrd.sh b/lsinitrd.sh
index 04ce9e8b..85981e58 100755
--- a/lsinitrd.sh
+++ b/lsinitrd.sh
@@ -163,8 +163,8 @@ list_files()
list_squash_content()
{
SQUASH_IMG="squash-root.img"
- SQUASH_TMPFILE="$TMPDIR/initrd.root.sqsh"
-
+ SQUASH_TMPFILE="$(mktemp -t --suffix=.root.sqsh lsinitrd.XXXXXX)"
+ trap "rm -f '$SQUASH_TMPFILE'" EXIT
$CAT "$image" 2>/dev/null | cpio --extract --verbose --quiet --to-stdout -- \
$SQUASH_IMG > "$SQUASH_TMPFILE" 2>/dev/null
if [[ -s $SQUASH_TMPFILE ]]; then

41
SOURCES/0189.patch Normal file
View File

@ -0,0 +1,41 @@
From 2ee3efdfa0c7f12c2f8446721937bfe713858854 Mon Sep 17 00:00:00 2001
From: Kairui Song <kasong@redhat.com>
Date: Mon, 9 Aug 2021 18:23:43 +0800
Subject: [PATCH] fix(squash): apply FIPS and libpthread workaround
There are some workarounds in dracut.sh for FIPS/libpthread covering
some hidden lib dependency issues. These workarounds didn't take effect
for the squash loader since the squash loader is installed
independently. So apply these workarounds again.
Also skip the lib detection code, since these extra installed libs
are small, and squash loader contents are dropped after switch root,
won't be an issue to be always installed. And this makes the code
cleaner.
Signed-off-by: Kairui Song <kasong@redhat.com>
(cherry picked from commit 5ab18dee996f0eeb2b0bfe354570e1b1af46d025)
Resolves: #1990847
---
modules.d/99squash/module-setup.sh | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/modules.d/99squash/module-setup.sh b/modules.d/99squash/module-setup.sh
index 7f5d365a..e73d3184 100644
--- a/modules.d/99squash/module-setup.sh
+++ b/modules.d/99squash/module-setup.sh
@@ -53,6 +53,12 @@ installpost() {
done
else
DRACUT_RESOLVE_DEPS=1 inst_multiple sh mount modprobe mkdir switch_root grep umount
+
+ # libpthread workaround: pthread_cancel wants to dlopen libgcc_s.so
+ inst_libdir_file -o "libgcc_s.so*"
+
+ # FIPS workaround for Fedora/RHEL: libcrypto needs libssl when FIPS is enabled
+ [[ $DRACUT_FIPS_MODE ]] && inst_libdir_file -o "libssl.so*"
fi
hostonly="" instmods "loop" "squashfs" "overlay"

58
SOURCES/0190.patch Normal file
View File

@ -0,0 +1,58 @@
From e6cb22f2d12dfe61abf32389fa7d8927105081e2 Mon Sep 17 00:00:00 2001
From: David Tardon <dtardon@redhat.com>
Date: Mon, 30 Aug 2021 10:02:22 +0200
Subject: [PATCH] fix(install): extend hwcaps library handling to libraries
under glibc-hwcaps/
(cherry picked from commit 10ed204f873f454dcd15ffcc82dc3a1c781c1514)
Resolves: #1983030
---
install/dracut-install.c | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/install/dracut-install.c b/install/dracut-install.c
index baf6dcff..4962316d 100644
--- a/install/dracut-install.c
+++ b/install/dracut-install.c
@@ -335,8 +335,8 @@ static int cp(const char *src, const char *dst)
static int library_install(const char *src, const char *lib)
{
_cleanup_free_ char *p = NULL;
- _cleanup_free_ char *pdir = NULL, *ppdir = NULL, *clib = NULL;
- char *q;
+ _cleanup_free_ char *pdir = NULL, *ppdir = NULL, *pppdir = NULL, *clib = NULL;
+ char *q, *clibdir;
int r, ret = 0;
p = strdup(lib);
@@ -358,7 +358,8 @@ static int library_install(const char *src, const char *lib)
log_debug("Lib install: '%s'", p);
}
- /* Also try to install the same library from one directory above.
+ /* Also try to install the same library from one directory above
+ * or from one directory above glibc-hwcaps.
This fixes the case, where only the HWCAP lib would be installed
# ldconfig -p|grep -F libc.so
libc.so.6 (libc6,64bit, hwcap: 0x0000001000000000, OS ABI: Linux 2.6.32) => /lib64/power6/libc.so.6
@@ -379,10 +380,18 @@ static int library_install(const char *src, const char *lib)
return ret;
ppdir = strdup(ppdir);
+ pppdir = dirname(ppdir);
+ if (!pppdir)
+ return ret;
+
+ pppdir = strdup(pppdir);
+ if (!pppdir)
+ return ret;
strcpy(p, lib);
- clib = strjoin(ppdir, "/", basename(p), NULL);
+ clibdir = streq(basename(ppdir), "glibc-hwcaps") ? pppdir : ppdir;
+ clib = strjoin(clibdir, "/", basename(p), NULL);
if (dracut_install(clib, clib, false, false, true) == 0)
log_debug("Lib install: '%s'", clib);
/* also install lib.so for lib.so.* files */

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 135.git20210121
%define dist_free_release 191.git20210920
Name: dracut
Version: 049
@ -162,6 +162,62 @@ Patch131: 0131.patch
Patch132: 0132.patch
Patch133: 0133.patch
Patch134: 0134.patch
Patch135: 0135.patch
Patch136: 0136.patch
Patch137: 0137.patch
Patch138: 0138.patch
Patch139: 0139.patch
Patch140: 0140.patch
Patch141: 0141.patch
Patch142: 0142.patch
Patch143: 0143.patch
Patch144: 0144.patch
Patch145: 0145.patch
Patch146: 0146.patch
Patch147: 0147.patch
Patch148: 0148.patch
Patch149: 0149.patch
Patch150: 0150.patch
Patch151: 0151.patch
Patch152: 0152.patch
Patch153: 0153.patch
Patch154: 0154.patch
Patch155: 0155.patch
Patch156: 0156.patch
Patch157: 0157.patch
Patch158: 0158.patch
Patch159: 0159.patch
Patch160: 0160.patch
Patch161: 0161.patch
Patch162: 0162.patch
Patch163: 0163.patch
Patch164: 0164.patch
Patch165: 0165.patch
Patch166: 0166.patch
Patch167: 0167.patch
Patch168: 0168.patch
Patch169: 0169.patch
Patch170: 0170.patch
Patch171: 0171.patch
Patch172: 0172.patch
Patch173: 0173.patch
Patch174: 0174.patch
Patch175: 0175.patch
Patch176: 0176.patch
Patch177: 0177.patch
Patch178: 0178.patch
Patch179: 0179.patch
Patch180: 0180.patch
Patch181: 0181.patch
Patch182: 0182.patch
Patch183: 0183.patch
Patch184: 0184.patch
Patch185: 0185.patch
Patch186: 0186.patch
Patch187: 0187.patch
Patch188: 0188.patch
Patch189: 0189.patch
Patch190: 0190.patch
Source1: https://www.gnu.org/licenses/lgpl-2.1.txt
@ -412,15 +468,9 @@ rm -f -- $RPM_BUILD_ROOT%{_bindir}/mkinitrd
rm -f -- $RPM_BUILD_ROOT%{_bindir}/lsinitrd
%endif
%if 0%{?fedora} || 0%{?rhel}
echo 'hostonly="no"' > $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/02-generic-image.conf
echo 'dracut_rescue_image="yes"' > $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/02-rescue.conf
# FIXME: remove after F30
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/kernel/postinst.d
install -m 0755 51-dracut-rescue-postinst.sh $RPM_BUILD_ROOT%{_sysconfdir}/kernel/postinst.d/51-dracut-rescue-postinst.sh
%endif
%files
%if %{with doc}
%doc README HACKING TODO AUTHORS NEWS dracut.html dracut.png dracut.svg
@ -500,7 +550,6 @@ install -m 0755 51-dracut-rescue-postinst.sh $RPM_BUILD_ROOT%{_sysconfdir}/kerne
%{dracutlibdir}/modules.d/90lvm
%{dracutlibdir}/modules.d/90mdraid
%{dracutlibdir}/modules.d/90multipath
%{dracutlibdir}/modules.d/90stratis
%{dracutlibdir}/modules.d/90qemu
%{dracutlibdir}/modules.d/91crypt-gpg
%{dracutlibdir}/modules.d/91crypt-loop
@ -613,11 +662,7 @@ install -m 0755 51-dracut-rescue-postinst.sh $RPM_BUILD_ROOT%{_sysconfdir}/kerne
%files config-rescue
%{dracutlibdir}/dracut.conf.d/02-rescue.conf
%if 0%{?fedora} || 0%{?rhel}
%{_prefix}/lib/kernel/install.d/51-dracut-rescue.install
# FIXME: remove after F30
%{_sysconfdir}/kernel/postinst.d/51-dracut-rescue-postinst.sh
%endif
%triggerin network -- dracut-network < 049-83.git20200525
echo '# Since rhel-8.3 dracut moved to use NetworkManager
@ -625,6 +670,72 @@ echo '# Since rhel-8.3 dracut moved to use NetworkManager
add_dracutmodules+=" network-legacy "' > /etc/dracut.conf.d/50-network-legacy.conf
%changelog
* Mon Sep 20 2021 Lukas Nykryn <lnykryn@redhat.com> - 049-191.git20210920
- fix(install): extend hwcaps library handling to libraries
* Wed Aug 11 2021 Lukas Nykryn <lnykryn@redhat.com> - 049-190.git20210811
- fix(lsinitrd): TMP_DIR doesn't exist in RHEL8
- fix(squash): apply FIPS and libpthread workaround
* Mon Aug 02 2021 Lukas Nykryn <lnykryn@redhat.com> - 049-188.git20210802
- dracut-functions: fix botched backport
- squash: unsquash the root image instead of mounting it on
- 99squash: fail early if can't install require modules in
- 99squash: Don't hardcode the squash sub directories
- 99squash: improve pre-requirements check
- Fixed some SUSE specific typos and outputs
- 99squash: simplify the code
- 99squash: Check require module earlier, and properly
- fix(99squash): use kernel config instead of modprobe to check
- kill bogus comment
- busybox: simplify listing of supported utilities
- fix: use find_binary
- fix: shellcheck for modules.d/99squash/setup-squash.sh
- fix: shellcheck for modules.d/99squash/clear-squash.sh
- fix: shellcheck for modules.d/99squash/module-setup.sh
- fix(squash): this module shouldn't depend on bash
- refactor(squash): move the post install scripts into the
- fix: revise squash module checks
- fix(squash): post install should be the last step before
- refactor(squash): move all setup code to init-squash.sh
- feat(squash): install and depmod modules seperately
- refactor(squash): don't record mount points in text file
- lsinitrd: list squash content as well
- refactor(squash): structure in a cleaner way
- feat(squash): use busybox for early setup if available
- feat: squash module follow --compress option
- perf: disable initrd compression when squash module is
- fix(squash): shellcheck for modules.d/99squash
- fix(squash): don't mount the mount points if already mounted
- feat(squash): install umount util
- fix(squash): create relative symlinks
- fix(dracut.sh): handle '-i' option to include files beginning
- fix(dracut.sh): handle symlinks appropriately while using
- fix(squash): keep ld cache under initdir
- dracut-functions: backport block_is_* functions
- fix(squash): fixes related to squash module rebase
- fix(squash): remove tailing '/' when installing ld.so.conf.d
* Mon Jul 19 2021 Lukas Nykryn <lnykryn@redhat.com> - 049-151.git20210719
- Drop 51-dracut-rescue-postinst.sh entirely
- fix(fips): add dh and ecdh ciphers
- 35network-legacy: discard pointless RTNETLINK message
- 95fcoe: don't install if there is no FCoE hostonly devices
- 95nfs: set correct ownership and permissions for statd
- fix(dracut.sh): harden dracut against GZIP environment
- fix(multipath): stop multipath before udev db cleanup
- fix(dracut-functions): implement a cache for get_maj_min
- fix(dracut-functions): get_maj_min without
- fix(fcoe): rd.nofcoe=0 should disable fcoe
- fix(fcoe): rename rd.nofcoe to rd.fcoe
- fix(mdraid): remove offroot
- fix(mdraid): add grow continue service
- net-lib.sh: support infiniband network mac addresses
- 95nvmf: add nvmf-autoconnect script
* Mon Apr 26 2021 Lukas Nykryn <lnykryn@redhat.com> - 049-136.git20210426
- Remove stratis module
* Thu Jan 21 2021 Lukas Nykryn <lnykryn@redhat.com> - 049-135.git20210121
- 95fcoe: default rd.nofcoe to false