import dracut-049-95.git20200804.el8

This commit is contained in:
CentOS Sources 2020-11-03 06:45:36 -05:00 committed by Andrew Lukoshko
parent eecd3756ca
commit f32d83f96a
27 changed files with 2009 additions and 1 deletions

View File

@ -56,3 +56,4 @@ index eb7d2eb4..61838741 100755
exit $ret exit $ret
fi fi
done done

38
SOURCES/0070.patch Normal file
View File

@ -0,0 +1,38 @@
From 07e7e84ebea1d76aeaa77d097b34503ec3c8f2e1 Mon Sep 17 00:00:00 2001
From: Lubomir Rintel <lkundrak@v3.sk>
Date: Wed, 30 Oct 2019 19:25:51 +0100
Subject: [PATCH] network-manager: fix getting of ifname from the sysfs path
commit 5e0f8c8a4ced ('network-manager: remove useless use of basename')
somewhat carelessly didn't take into account that $_i has a slash at
the end which made the result of the ## substitution be just an empty
string.
The slash was put to the end of /sys/class/net/*/ to make sure we're only
iterating directories, but it's not strictly necessary. In an unlikely case
something else than a directory appears in /sys/class/net/, we'll already deal
with it gracefully. Remove it.
This fixes the TEST-30-ISCSI test.
(cherry picked from commit 687e17aa7f2f40d21717be9a04302c749e139d4a)
Resolves: #1826061
---
modules.d/35network-manager/nm-run.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/modules.d/35network-manager/nm-run.sh b/modules.d/35network-manager/nm-run.sh
index a539d5b2..b33e0992 100755
--- a/modules.d/35network-manager/nm-run.sh
+++ b/modules.d/35network-manager/nm-run.sh
@@ -6,7 +6,7 @@ else
/usr/sbin/NetworkManager --configure-and-quit=initrd --no-daemon
fi
-for _i in /sys/class/net/*/
+for _i in /sys/class/net/*
do
state=/run/NetworkManager/devices/$(cat $_i/ifindex)
grep -q connection-uuid= $state 2>/dev/null || continue

47
SOURCES/0071.patch Normal file
View File

@ -0,0 +1,47 @@
From 02c096d138cc8c788daf5fae75408059cbc7e283 Mon Sep 17 00:00:00 2001
From: Lubomir Rintel <lkundrak@v3.sk>
Date: Mon, 2 Dec 2019 02:19:51 +0100
Subject: [PATCH] network-manager: don't run NetworkManager when there are no
connections
NetworkManager would unnecessarily bring up the devices, colliding with
further attempts to rename the devices.
This is arguably a NetworkManager bug and should eventually be fixed there.
Running NetworkManager without the connection is unnecessary regardless.
(cherry picked from commit 5965710e018989b02a56e8d190b71740ca3b5463)
Resolves: #1826061
---
modules.d/35network-manager/nm-run.sh | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/modules.d/35network-manager/nm-run.sh b/modules.d/35network-manager/nm-run.sh
index b33e0992..4079b735 100755
--- a/modules.d/35network-manager/nm-run.sh
+++ b/modules.d/35network-manager/nm-run.sh
@@ -1,10 +1,17 @@
#!/bin/sh
-if getargbool 0 rd.debug -d -y rdinitdebug -d -y rdnetdebug; then
- /usr/sbin/NetworkManager --configure-and-quit=initrd --debug --log-level=trace
-else
- /usr/sbin/NetworkManager --configure-and-quit=initrd --no-daemon
-fi
+for i in /usr/lib/NetworkManager/system-connections/* \
+ /run/NetworkManager/system-connections/* \
+ /etc/NetworkManager/system-connections/* \
+ /etc/sysconfig/network-scripts/ifcfg-*; do
+ [ -f "$i" ] || continue
+ if getargbool 0 rd.debug -d -y rdinitdebug -d -y rdnetdebug; then
+ /usr/sbin/NetworkManager --configure-and-quit=initrd --debug --log-level=trace
+ else
+ /usr/sbin/NetworkManager --configure-and-quit=initrd --no-daemon
+ fi
+ break
+done
for _i in /sys/class/net/*
do

49
SOURCES/0072.patch Normal file
View File

@ -0,0 +1,49 @@
From b692dbc7f2c6a3fb4fa587d9d63b80e4626dafae Mon Sep 17 00:00:00 2001
From: Beniamino Galvani <bgalvani@redhat.com>
Date: Wed, 11 Mar 2020 09:40:50 +0100
Subject: [PATCH] network-manager: ensure that nm-run.sh is executed when
needed
The network-manager command line hook must install a
initqueue/finished hook to ensure that nm-run.sh is executed when
there are network connections to activate.
Fixes: #694
(cherry picked from commit 3dcaa97ca4dcfa8092252a22df62c60941e59ce3)
Resolves: #1826061
---
modules.d/35network-manager/nm-config.sh | 11 +++++++++++
modules.d/35network-manager/nm-run.sh | 2 ++
2 files changed, 13 insertions(+)
diff --git a/modules.d/35network-manager/nm-config.sh b/modules.d/35network-manager/nm-config.sh
index 1efa737c..39a1c8bd 100755
--- a/modules.d/35network-manager/nm-config.sh
+++ b/modules.d/35network-manager/nm-config.sh
@@ -5,3 +5,14 @@ if [ -n "$netroot" ] || [ -e /tmp/net.ifaces ]; then
fi
/usr/libexec/nm-initrd-generator -- $(getcmdline)
+
+if getargbool 0 rd.neednet; then
+ for i in /usr/lib/NetworkManager/system-connections/* \
+ /run/NetworkManager/system-connections/* \
+ /etc/NetworkManager/system-connections/* \
+ /etc/sysconfig/network-scripts/ifcfg-*; do
+ [ -f "$i" ] || continue
+ echo '[ -f /tmp/nm.done ]' >$hookdir/initqueue/finished/nm.sh
+ break
+ done
+fi
diff --git a/modules.d/35network-manager/nm-run.sh b/modules.d/35network-manager/nm-run.sh
index 4079b735..fc5280a1 100755
--- a/modules.d/35network-manager/nm-run.sh
+++ b/modules.d/35network-manager/nm-run.sh
@@ -22,3 +22,5 @@ do
source_hook initqueue/online $ifname
/sbin/netroot $ifname
done
+
+> /tmp/nm.done

32
SOURCES/0073.patch Normal file
View File

@ -0,0 +1,32 @@
From 1ade0d247fda747ed33632a7746f9278b74feaa8 Mon Sep 17 00:00:00 2001
From: Beniamino Galvani <bgalvani@redhat.com>
Date: Mon, 23 Mar 2020 22:57:35 +0100
Subject: [PATCH] network-manager: install libnss DNS and mDNS plugins
Install libnss_dns.so and libnss_mdns4_minimal.so plugins for the Name
Service Switch (NSS) functionality of glibc so that name resolution
through /etc/resolv.conf and mDNS works in the initrd.
Fixes: #772
Cherry-picked from: 87bffc36e72c121024df033e1a78799456c73523
Resolves: #1826061
---
modules.d/35network-manager/module-setup.sh | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/modules.d/35network-manager/module-setup.sh b/modules.d/35network-manager/module-setup.sh
index d6d0f9ce..8fc3114d 100755
--- a/modules.d/35network-manager/module-setup.sh
+++ b/modules.d/35network-manager/module-setup.sh
@@ -51,4 +51,9 @@ install() {
if ! [[ -d "$initdir/etc/sysconfig/network-scripts" ]]; then
inst_libdir_file "NetworkManager/$_nm_version/libnm-settings-plugin-ifcfg-rh.so"
fi
+
+ _arch=${DRACUT_ARCH:-$(uname -m)}
+
+ inst_libdir_file {"tls/$_arch/",tls/,"$_arch/",}"libnss_dns.so.*" \
+ {"tls/$_arch/",tls/,"$_arch/",}"libnss_mdns4_minimal.so.*"
}

33
SOURCES/0074.patch Normal file
View File

@ -0,0 +1,33 @@
From 0945c8070e436eef908a1f88c946df6c27d3bc41 Mon Sep 17 00:00:00 2001
From: Peter Georg <peter.georg@physik.uni-regensburg.de>
Date: Tue, 21 Apr 2020 21:34:38 +0200
Subject: [PATCH] Always pull in machinery to read ifcfg files
So far machinery is only pulled in if the user has not yet included any
ifcfg files.
(cherry picked from commit faea4e4ddb10f697590b80f8f17181341c537262)
Resolves: #1826061
---
modules.d/35network-manager/module-setup.sh | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/modules.d/35network-manager/module-setup.sh b/modules.d/35network-manager/module-setup.sh
index 8fc3114d..ad2a1534 100755
--- a/modules.d/35network-manager/module-setup.sh
+++ b/modules.d/35network-manager/module-setup.sh
@@ -47,10 +47,8 @@ install() {
fi
# We don't install the ifcfg files from the host automatically.
- # But if the user chooses to include them, we pull in the machinery to read them.
- if ! [[ -d "$initdir/etc/sysconfig/network-scripts" ]]; then
- inst_libdir_file "NetworkManager/$_nm_version/libnm-settings-plugin-ifcfg-rh.so"
- fi
+ # But the user might choose to include them, so we pull in the machinery to read them.
+ inst_libdir_file "NetworkManager/$_nm_version/libnm-settings-plugin-ifcfg-rh.so"
_arch=${DRACUT_ARCH:-$(uname -m)}

426
SOURCES/0075.patch Normal file
View File

@ -0,0 +1,426 @@
From cf74193cc37f2ace1197b1e6ebacc6fe542767c8 Mon Sep 17 00:00:00 2001
From: Kairui Song <kasong@redhat.com>
Date: Wed, 8 Apr 2020 16:39:52 +0800
Subject: [PATCH] Remove memtrace-ko and rd.memdebug=4 support in dracut
This feature could be off loaded to memstrack, which have better
accurecy, better performance, and have more detailed tracing features.
Also simplify make_trace_mem a bit.
And currently rd.memdebug=4 is unstable, fails from time to time.
(cherry picked from commit 49c4172f4eef6e2015615e132b199a7ec0699ffc)
Resolves: #1829528
---
dracut.cmdline.7.asc | 4 +-
modules.d/98dracut-systemd/dracut-cmdline.sh | 2 +-
modules.d/98dracut-systemd/dracut-pre-mount.sh | 2 +-
modules.d/98dracut-systemd/dracut-pre-pivot.sh | 2 +-
modules.d/98dracut-systemd/dracut-pre-trigger.sh | 2 +-
modules.d/99base/dracut-lib.sh | 44 +-----
modules.d/99base/init.sh | 8 +-
modules.d/99base/memtrace-ko.sh | 191 -----------------------
modules.d/99base/module-setup.sh | 1 -
9 files changed, 18 insertions(+), 238 deletions(-)
diff --git a/dracut.cmdline.7.asc b/dracut.cmdline.7.asc
index ab9a24ad..0dc58d1a 100644
--- a/dracut.cmdline.7.asc
+++ b/dracut.cmdline.7.asc
@@ -187,9 +187,9 @@ It should be attached to any report about dracut problems.
_/run/initramfs/init.log_.
If "quiet" is set, it also logs to the console.
-**rd.memdebug=[0-4]**::
+**rd.memdebug=[0-3]**::
Print memory usage info at various points, set the verbose level from 0 to 4.
-+
++
Higher level means more debugging output:
+
----
diff --git a/modules.d/98dracut-systemd/dracut-cmdline.sh b/modules.d/98dracut-systemd/dracut-cmdline.sh
index bff9435a..6c6ee026 100755
--- a/modules.d/98dracut-systemd/dracut-cmdline.sh
+++ b/modules.d/98dracut-systemd/dracut-cmdline.sh
@@ -42,7 +42,7 @@ export root
export rflags
export fstype
-make_trace_mem "hook cmdline" '1+:mem' '1+:iomem' '3+:slab' '4+:komem'
+make_trace_mem "hook cmdline" '1+:mem' '1+:iomem' '3+:slab'
# run scriptlets to parse the command line
getarg 'rd.break=cmdline' -d 'rdbreak=cmdline' && emergency_shell -n cmdline "Break before cmdline"
source_hook cmdline
diff --git a/modules.d/98dracut-systemd/dracut-pre-mount.sh b/modules.d/98dracut-systemd/dracut-pre-mount.sh
index a3b9d291..ae511286 100755
--- a/modules.d/98dracut-systemd/dracut-pre-mount.sh
+++ b/modules.d/98dracut-systemd/dracut-pre-mount.sh
@@ -8,7 +8,7 @@ type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
source_conf /etc/conf.d
-make_trace_mem "hook pre-mount" '1:shortmem' '2+:mem' '3+:slab' '4+:komem'
+make_trace_mem "hook pre-mount" '1:shortmem' '2+:mem' '3+:slab'
# pre pivot scripts are sourced just before we doing cleanup and switch over
# to the new root.
getarg 'rd.break=pre-mount' 'rdbreak=pre-mount' && emergency_shell -n pre-mount "Break pre-mount"
diff --git a/modules.d/98dracut-systemd/dracut-pre-pivot.sh b/modules.d/98dracut-systemd/dracut-pre-pivot.sh
index dc9a2504..96e6f8ca 100755
--- a/modules.d/98dracut-systemd/dracut-pre-pivot.sh
+++ b/modules.d/98dracut-systemd/dracut-pre-pivot.sh
@@ -8,7 +8,7 @@ type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
source_conf /etc/conf.d
-make_trace_mem "hook pre-pivot" '1:shortmem' '2+:mem' '3+:slab' '4+:komem'
+make_trace_mem "hook pre-pivot" '1:shortmem' '2+:mem' '3+:slab'
# pre pivot scripts are sourced just before we doing cleanup and switch over
# to the new root.
getarg 'rd.break=pre-pivot' 'rdbreak=pre-pivot' && emergency_shell -n pre-pivot "Break pre-pivot"
diff --git a/modules.d/98dracut-systemd/dracut-pre-trigger.sh b/modules.d/98dracut-systemd/dracut-pre-trigger.sh
index 7cd821ed..a1a33960 100755
--- a/modules.d/98dracut-systemd/dracut-pre-trigger.sh
+++ b/modules.d/98dracut-systemd/dracut-pre-trigger.sh
@@ -8,7 +8,7 @@ type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
source_conf /etc/conf.d
-make_trace_mem "hook pre-trigger" '1:shortmem' '2+:mem' '3+:slab' '4+:komem'
+make_trace_mem "hook pre-trigger" '1:shortmem' '2+:mem' '3+:slab'
source_hook pre-trigger
diff --git a/modules.d/99base/dracut-lib.sh b/modules.d/99base/dracut-lib.sh
index f71e757c..502c7568 100755
--- a/modules.d/99base/dracut-lib.sh
+++ b/modules.d/99base/dracut-lib.sh
@@ -1220,50 +1220,25 @@ are_lists_eq() {
setmemdebug() {
if [ -z "$DEBUG_MEM_LEVEL" ]; then
- export DEBUG_MEM_LEVEL=$(getargnum 0 0 4 rd.memdebug)
+ export DEBUG_MEM_LEVEL=$(getargnum 0 0 3 rd.memdebug)
fi
}
setmemdebug
-cleanup_trace_mem()
-{
- # tracekomem based on kernel trace needs cleanup after use.
- if [ "$DEBUG_MEM_LEVEL" -eq 4 ]; then
- tracekomem --cleanup
- fi
-}
-
-# parameters: msg [trace_level:trace]...
-make_trace_mem()
-{
- local msg
- msg="$1"
- shift
- if [ -n "$DEBUG_MEM_LEVEL" ] && [ "$DEBUG_MEM_LEVEL" -gt 0 ]; then
- make_trace show_memstats $DEBUG_MEM_LEVEL "[debug_mem]" "$msg" "$@" >&2
- fi
-}
-
# parameters: func log_level prefix msg [trace_level:trace]...
-make_trace()
+make_trace_mem()
{
- local func log_level prefix msg msg_printed
+ local log_level prefix msg msg_printed
local trace trace_level trace_in_higher_levels insert_trace
- func=$1
- shift
-
- log_level=$1
- shift
-
- prefix=$1
- shift
-
msg=$1
shift
- if [ -z "$log_level" ]; then
+ prefix='[debug_mem]'
+ log_level=$DEBUG_MEM_LEVEL
+
+ if [ -z "$log_level" ] || [ "$log_level" -le 0 ]; then
return
fi
@@ -1296,7 +1271,7 @@ make_trace()
echo "$prefix $msg"
msg_printed=1
fi
- $func $trace
+ show_memstats $trace
fi
shift
done
@@ -1318,9 +1293,6 @@ show_memstats()
iomem)
cat /proc/iomem
;;
- komem)
- tracekomem
- ;;
esac
}
diff --git a/modules.d/99base/init.sh b/modules.d/99base/init.sh
index e4f7cff1..2c0ccd66 100755
--- a/modules.d/99base/init.sh
+++ b/modules.d/99base/init.sh
@@ -131,7 +131,7 @@ if ! getargbool 1 'rd.hostonly'; then
fi
# run scriptlets to parse the command line
-make_trace_mem "hook cmdline" '1+:mem' '1+:iomem' '3+:slab' '4+:komem'
+make_trace_mem "hook cmdline" '1+:mem' '1+:iomem' '3+:slab'
getarg 'rd.break=cmdline' -d 'rdbreak=cmdline' && emergency_shell -n cmdline "Break before cmdline"
source_hook cmdline
@@ -160,7 +160,7 @@ fi
udevproperty "hookdir=$hookdir"
-make_trace_mem "hook pre-trigger" '1:shortmem' '2+:mem' '3+:slab' '4+:komem'
+make_trace_mem "hook pre-trigger" '1:shortmem' '2+:mem' '3+:slab'
getarg 'rd.break=pre-trigger' -d 'rdbreak=pre-trigger' && emergency_shell -n pre-trigger "Break before pre-trigger"
source_hook pre-trigger
@@ -230,7 +230,7 @@ unset RDRETRY
# pre-mount happens before we try to mount the root filesystem,
# and happens once.
-make_trace_mem "hook pre-mount" '1:shortmem' '2+:mem' '3+:slab' '4+:komem'
+make_trace_mem "hook pre-mount" '1:shortmem' '2+:mem' '3+:slab'
getarg 'rd.break=pre-mount' -d 'rdbreak=pre-mount' && emergency_shell -n pre-mount "Break pre-mount"
source_hook pre-mount
@@ -266,7 +266,7 @@ done
# pre pivot scripts are sourced just before we doing cleanup and switch over
# to the new root.
-make_trace_mem "hook pre-pivot" '1:shortmem' '2+:mem' '3+:slab' '4+:komem'
+make_trace_mem "hook pre-pivot" '1:shortmem' '2+:mem' '3+:slab'
getarg 'rd.break=pre-pivot' -d 'rdbreak=pre-pivot' && emergency_shell -n pre-pivot "Break pre-pivot"
source_hook pre-pivot
diff --git a/modules.d/99base/memtrace-ko.sh b/modules.d/99base/memtrace-ko.sh
deleted file mode 100755
index ee035e15..00000000
--- a/modules.d/99base/memtrace-ko.sh
+++ /dev/null
@@ -1,191 +0,0 @@
-#!/bin/sh
-
-# Try to find out kernel modules with large total memory allocation during loading.
-# For large slab allocation, it will fall into buddy, also not trace "mm_page_free"
-# considering large free is quite rare for module_init, thus saving tons of events
-# to avoid trace data overwritten.
-#
-# Therefore, tracing "mm_page_alloc"alone should be enough for the purpose.
-
-# "sys/kernel/tracing" has the priority if exists.
-get_trace_base() {
- # trace access through debugfs would be obsolete if "/sys/kernel/tracing" is available.
- if [ -d "/sys/kernel/tracing" ]; then
- echo "/sys/kernel"
- else
- echo "/sys/kernel/debug"
- fi
-}
-
-# We want to enable these trace events.
-get_want_events() {
- echo "module:module_put module:module_load kmem:mm_page_alloc"
-}
-
-get_event_filter() {
- echo "comm == systemd-udevd || comm == modprobe || comm == insmod"
-}
-
-is_trace_ready() {
- local trace_base want_events current_events
-
- trace_base=$(get_trace_base)
- ! [ -f "$trace_base/tracing/trace" ] && return 1
-
- [ "$(cat $trace_base/tracing/tracing_on)" -eq 0 ] && return 1
-
- # Also check if trace events were properly setup.
- want_events=$(get_want_events)
- current_events=$(echo $(cat $trace_base/tracing/set_event))
- [ "$current_events" != "$want_events" ] && return 1
-
- return 0
-}
-
-prepare_trace() {
- local trace_base
-
- trace_base=$(get_trace_base)
- # old debugfs interface case.
- if ! [ -d "$trace_base/tracing" ]; then
- mount none -t debugfs $trace_base
- # new tracefs interface case.
- elif ! [ -f "$trace_base/tracing/trace" ]; then
- mount none -t tracefs "$trace_base/tracing"
- fi
-
- if ! [ -f "$trace_base/tracing/trace" ]; then
- echo "WARN: Mount trace failed for kernel module memory analyzing."
- return 1
- fi
-
- # Active all the wanted trace events.
- echo "$(get_want_events)" > $trace_base/tracing/set_event
-
- # There are three kinds of known applications for module loading:
- # "systemd-udevd", "modprobe" and "insmod".
- # Set them as the global events filter.
- # NOTE: Some kernel may not support this format of filter, anyway
- # the operation will fail and it doesn't matter.
- echo "$(get_event_filter)" > $trace_base/tracing/events/kmem/filter 2>&1
- echo "$(get_event_filter)" > $trace_base/tracing/events/module/filter 2>&1
-
- # Set the number of comm-pid if supported.
- if [ -f "$trace_base/tracing/saved_cmdlines_size" ]; then
- # Thanks to filters, 4096 is big enough(also well supported).
- echo 4096 > $trace_base/tracing/saved_cmdlines_size
- fi
-
- # Enable and clear trace data for the first time.
- echo 1 > $trace_base/tracing/tracing_on
- echo > $trace_base/tracing/trace
- echo "Prepare trace success."
- return 0
-}
-
-order_to_pages()
-{
- local pages=1
- local order=$1
-
- while [ "$order" != 0 ]; do
- order=$((order-1))
- pages=$(($pages*2))
- done
-
- echo $pages
-}
-
-parse_trace_data() {
- local module_name tmp_eval pages
-
- cat "$(get_trace_base)/tracing/trace" | while read pid cpu flags ts function args
- do
- # Skip comment lines
- if [ "$pid" = "#" ]; then
- continue
- fi
-
- pid=${pid##*-}
- function=${function%:}
- if [ "$function" = "module_load" ]; then
- # One module is being loaded, save the task pid for tracking.
- # Remove the trailing after whitespace, there may be the module flags.
- module_name=${args%% *}
- # Mark current_module to track the task.
- eval current_module_$pid="$module_name"
- tmp_eval=$(eval echo '${module_loaded_'${module_name}'}')
- if [ -n "$tmp_eval" ]; then
- echo "WARN: \"$module_name\" was loaded multiple times!"
- fi
- eval unset module_loaded_$module_name
- eval nr_alloc_pages_$module_name=0
- continue
- fi
-
- module_name=$(eval echo '${current_module_'${pid}'}')
- if [ -z "$module_name" ]; then
- continue
- fi
-
- # Once we get here, the task is being tracked(is loading a module).
- if [ "$function" = "module_put" ]; then
- # Mark the module as loaded when the first module_put event happens after module_load.
- tmp_eval=$(eval echo '${nr_alloc_pages_'${module_name}'}')
- echo "$tmp_eval pages consumed by \"$module_name\""
- eval module_loaded_$module_name=1
- # Module loading finished, so untrack the task.
- eval unset current_module_$pid
- eval unset nr_alloc_pages_$module_name
- continue
- fi
-
- if [ "$function" = "mm_page_alloc" ]; then
- # Get order first, then convert to actual pages.
- pages=$(echo $args | sed -e 's/.*order=\([0-9]*\) .*/\1/')
- pages=$(order_to_pages "$pages")
- tmp_eval=$(eval echo '${nr_alloc_pages_'${module_name}'}')
- eval nr_alloc_pages_$module_name="$(($tmp_eval+$pages))"
- fi
- done
-}
-
-cleanup_trace() {
- local trace_base
-
- if is_trace_ready; then
- trace_base=$(get_trace_base)
- echo 0 > $trace_base/tracing/tracing_on
- echo > $trace_base/tracing/trace
- echo > $trace_base/tracing/set_event
- echo 0 > $trace_base/tracing/events/kmem/filter
- echo 0 > $trace_base/tracing/events/module/filter
- fi
-}
-
-show_usage() {
- echo "Find out kernel modules with large memory consumption during loading based on trace."
- echo "Usage:"
- echo "1) run it first to setup trace."
- echo "2) run again to parse the trace data if any."
- echo "3) run with \"--cleanup\" option to cleanup trace after use."
-}
-
-if [ "$1" = "--help" ]; then
- show_usage
- exit 0
-fi
-
-if [ "$1" = "--cleanup" ]; then
- cleanup_trace
- exit 0
-fi
-
-if is_trace_ready ; then
- echo "tracekomem - Rough memory consumption by loading kernel modules (larger value with better accuracy)"
- parse_trace_data
-else
- prepare_trace
-fi
-
-exit $?
diff --git a/modules.d/99base/module-setup.sh b/modules.d/99base/module-setup.sh
index c9ead01d..3578643c 100755
--- a/modules.d/99base/module-setup.sh
+++ b/modules.d/99base/module-setup.sh
@@ -35,7 +35,6 @@ install() {
inst_script "$moddir/initqueue.sh" "/sbin/initqueue"
inst_script "$moddir/loginit.sh" "/sbin/loginit"
inst_script "$moddir/rdsosreport.sh" "/sbin/rdsosreport"
- inst_script "$moddir/memtrace-ko.sh" "/sbin/tracekomem"
[ -e "${initdir}/lib" ] || mkdir -m 0755 -p ${initdir}/lib
mkdir -m 0755 -p ${initdir}/lib/dracut

320
SOURCES/0076.patch Normal file
View File

@ -0,0 +1,320 @@
From adacd8101e7558930e4499c21006eaa14629c234 Mon Sep 17 00:00:00 2001
From: Kairui Song <kasong@redhat.com>
Date: Wed, 8 Apr 2020 20:09:38 +0800
Subject: [PATCH] Add 99memstrack module
memstrack is a new tool to track the overall memory usage and
allocation, which can help off load the improve the builtin module
memory tracing function in dracut.
With this change, the rd.memdebug=4 behavior is similiar with before,
but the report is defered to pre-pivot, so the memory usage info
during the whole initramfs run is traced. And the ourput format is
changed a bit:
dracut-pre-pivot[519]: ======== Report format module_summary: ========
dracut-pre-pivot[519]: Module squashfs using 10.4MB (2658 pages), peak allocation 10.4MB (2671 pages)
dracut-pre-pivot[519]: Module qxl using 3.4MB (865 pages), peak allocation 3.4MB (880 pages)
dracut-pre-pivot[519]: Module crc32c_intel using 2.0MB (519 pages), peak allocation 3.0MB (769 pages)
dracut-pre-pivot[519]: Module serio_raw using 2.0MB (505 pages), peak allocation 3.6MB (918 pages)
dracut-pre-pivot[519]: Module virtio_console using 1.6MB (416 pages), peak allocation 1.6MB (419 pages)
... snip ...
dracut-pre-pivot[519]: ======== Report format module_summary END ========
It now contains more detail and also includes the peak usage which could
be more helpful.
And now it have a rd.memdebug=5, which will print more detail about
the stack trace of the top memory user, also printed on pri-pivot:
dracut-pre-pivot[519]: ======== Report format module_top: ========
dracut-pre-pivot[519]: Top stack usage of module squashfs:
dracut-pre-pivot[519]: (null) Pages: 2658 (peak: 2671)
dracut-pre-pivot[519]: (null) Pages: 2658 (peak: 2671)
dracut-pre-pivot[519]: async_page_fault (0xffffffff81a01149) Pages: 1448 (peak: 1461)
dracut-pre-pivot[519]: do_async_page_fault (0xffffffff8105c509) Pages: 1448 (peak: 1461)
dracut-pre-pivot[519]: do_page_fault (0xffffffff8106296a) Pages: 1448 (peak: 1461)
dracut-pre-pivot[519]: do_user_addr_fault (0xffffffff810626bd) Pages: 1448 (peak: 1461)
dracut-pre-pivot[519]: handle_mm_fault (0xffffffff812940c4) Pages: 1448 (peak: 1461)
dracut-pre-pivot[519]: __handle_mm_fault (0xffffffff81293627) Pages: 1195 (peak: 1208)
dracut-pre-pivot[519]: __do_fault (0xffffffff8128b07e) Pages: 1195 (peak: 1208)
dracut-pre-pivot[519]: filemap_fault (0xffffffff8124c0b9) Pages: 1195 (peak: 1208)
dracut-pre-pivot[519]: __do_page_cache_readahead (0xffffffff812585da) Pages: 1063 (peak: 1076)
dracut-pre-pivot[519]: read_pages (0xffffffff812583c2) Pages: 1063 (peak: 1076)
dracut-pre-pivot[519]: squashfs_readpage squashfs (0xffffffffc0022073) Pages: 1039 (peak: 1052)
dracut-pre-pivot[519]: squashfs_readpage_block squashfs (0xffffffffc0024334) Pages: 744 (peak: 744)
dracut-pre-pivot[519]: squashfs_copy_cache squashfs (0xffffffffc0021a3f) Pages: 744 (peak: 744)
dracut-pre-pivot[519]: pagecache_get_page (0xffffffff8124abf7) Pages: 744 (peak: 744)
dracut-pre-pivot[519]: __page_cache_alloc (0xffffffff81247df6) Pages: 744 (peak: 744)
dracut-pre-pivot[519]: alloc_pages_current (0xffffffff812cdca7) Pages: 744 (peak: 744)
dracut-pre-pivot[519]: __alloc_pages_nodemask (0xffffffff812b3107) Pages: 744 (peak: 744)
dracut-pre-pivot[519]: __alloc_pages_nodemask (0xffffffff812b3107) Pages: 1488 (peak: 1488)
dracut-pre-pivot[519]: Top stack usage of module qxl:
dracut-pre-pivot[519]: (null) Pages: 865 (peak: 880)
dracut-pre-pivot[519]: entry_SYSCALL_64_after_hwframe (0xffffffff81a0008c) Pages: 855 (peak: 858)
dracut-pre-pivot[519]: do_syscall_64 (0xffffffff81002a5a) Pages: 855 (peak: 858)
dracut-pre-pivot[519]: __x64_sys_finit_module (0xffffffff8117ccea) Pages: 811 (peak: 811)
dracut-pre-pivot[519]: __do_sys_finit_module (0xffffffff8117cc6e) Pages: 811 (peak: 811)
dracut-pre-pivot[519]: load_module (0xffffffff8117c6be) Pages: 802 (peak: 802)
dracut-pre-pivot[519]: do_init_module (0xffffffff81179e72) Pages: 802 (peak: 802)
dracut-pre-pivot[519]: do_one_initcall (0xffffffff81000d5a) Pages: 802 (peak: 802)
dracut-pre-pivot[519]: serio_raw_poll serio_raw (0xffffffffc0200054) Pages: 802 (peak: 802)
dracut-pre-pivot[519]: __pci_register_driver (0xffffffff81557804) Pages: 802 (peak: 802)
dracut-pre-pivot[519]: driver_register (0xffffffff8167ed24) Pages: 802 (peak: 802)
dracut-pre-pivot[519]: bus_add_driver (0xffffffff8167cbb2) Pages: 801 (peak: 801)
dracut-pre-pivot[519]: driver_attach (0xffffffff8167d28e) Pages: 801 (peak: 801)
dracut-pre-pivot[519]: bus_for_each_dev (0xffffffff8167b62c) Pages: 801 (peak: 801)
dracut-pre-pivot[519]: __driver_attach (0xffffffff8167e18f) Pages: 801 (peak: 801)
dracut-pre-pivot[519]: device_driver_attach (0xffffffff8167e0ed) Pages: 801 (peak: 801)
dracut-pre-pivot[519]: driver_probe_device (0xffffffff8167de6c) Pages: 801 (peak: 801)
dracut-pre-pivot[519]: really_probe (0xffffffff8167d9c9) Pages: 801 (peak: 801)
dracut-pre-pivot[519]: pci_device_probe (0xffffffff81559627) Pages: 801 (peak: 801)
dracut-pre-pivot[519]: local_pci_probe (0xffffffff81557f98) Pages: 801 (peak: 801)
dracut-pre-pivot[519]: qxl_pci_probe qxl (0xffffffffc01f0387) Pages: 773 (peak: 773)
dracut-pre-pivot[519]: drm_fbdev_generic_setup drm_kms_helper (0xffffffffc01b30c5) Pages: 773 (peak: 773)
dracut-pre-pivot[519]: drm_fbdev_client_hotplug drm_kms_helper (0xffffffffc01b2656) Pages: 773 (peak: 773)
dracut-pre-pivot[519]: __drm_fb_helper_initial_config_and_unlock drm_kms_helper (0xffffffffc01b1a28) Pages: 770 (peak: 770)
dracut-pre-pivot[519]: drm_fb_helper_generic_probe drm_kms_helper (0xffffffffc01b2fa5) Pages: 770 (peak: 770)
dracut-pre-pivot[519]: vzalloc (0xffffffff812aa39c) Pages: 770 (peak: 770)
dracut-pre-pivot[519]: __vmalloc_node_range (0xffffffff812aa200) Pages: 768 (peak: 768)
... snip ...
======== Report format module_top END ========
This could be very helpful for debuging memory usage issues.
(cherry picked from commit 7dd8a2f4d351ce8975c0af122732a2a12697c8cc)
Resolves: #1829528
---
dracut.cmdline.7.asc | 16 +++++---
dracut.spec | 2 +
modules.d/99base/dracut-lib.sh | 2 +-
modules.d/99memstrack/memstrack-report.sh | 23 +++++++++++
modules.d/99memstrack/memstrack-start.sh | 68 +++++++++++++++++++++++++++++++
modules.d/99memstrack/memstrack.service | 13 ++++++
modules.d/99memstrack/module-setup.sh | 27 ++++++++++++
7 files changed, 144 insertions(+), 7 deletions(-)
diff --git a/dracut.cmdline.7.asc b/dracut.cmdline.7.asc
index 0dc58d1a..7f31fbae 100644
--- a/dracut.cmdline.7.asc
+++ b/dracut.cmdline.7.asc
@@ -187,8 +187,8 @@ It should be attached to any report about dracut problems.
_/run/initramfs/init.log_.
If "quiet" is set, it also logs to the console.
-**rd.memdebug=[0-3]**::
- Print memory usage info at various points, set the verbose level from 0 to 4.
+**rd.memdebug=[0-5]**::
+ Print memory usage info at various points, set the verbose level from 0 to 5.
+
Higher level means more debugging output:
+
@@ -197,10 +197,14 @@ It should be attached to any report about dracut problems.
1 - partial /proc/meminfo
2 - /proc/meminfo
3 - /proc/meminfo + /proc/slabinfo
- 4 - /proc/meminfo + /proc/slabinfo + tracekomem
- NOTE: tracekomem is a shell script utilizing kernel trace to track
- the rough total memory consumption of kernel modules during
- loading. It may override other trace configurations.
+ 4 - /proc/meminfo + /proc/slabinfo + memstrack summary
+ NOTE: memstrack is a memory tracing tool that tracks the total memory
+ consumption, and peak memory consumption of each kernel modules
+ and userspace progress during the whole initramfs runtime, report
+ is genereted and the end of initramsfs run.
+ 5 - /proc/meminfo + /proc/slabinfo + memstrack (with top memory stacktrace)
+ NOTE: memstrack (with top memory stacktrace) will print top memory
+ allocation stack traces during the whole initramfs runtime.
----
**rd.break**::
diff --git a/dracut.spec b/dracut.spec
index 0f7eb4bf..c82c24f6 100644
--- a/dracut.spec
+++ b/dracut.spec
@@ -84,6 +84,7 @@ Requires: xz
Requires: gzip
%if 0%{?fedora} || 0%{?rhel}
+Recommends: memstrack
Recommends: hardlink
Recommends: pigz
Recommends: kpartx
@@ -399,6 +400,7 @@ install -m 0755 51-dracut-rescue-postinst.sh $RPM_BUILD_ROOT%{_sysconfdir}/kerne
%{dracutlibdir}/modules.d/98syslog
%{dracutlibdir}/modules.d/98usrmount
%{dracutlibdir}/modules.d/99base
+%{dracutlibdir}/modules.d/99memstrack
%{dracutlibdir}/modules.d/99fs-lib
%{dracutlibdir}/modules.d/99shutdown
%attr(0644,root,root) %ghost %config(missingok,noreplace) %{_localstatedir}/log/dracut.log
diff --git a/modules.d/99base/dracut-lib.sh b/modules.d/99base/dracut-lib.sh
index 502c7568..56dd63ef 100755
--- a/modules.d/99base/dracut-lib.sh
+++ b/modules.d/99base/dracut-lib.sh
@@ -1220,7 +1220,7 @@ are_lists_eq() {
setmemdebug() {
if [ -z "$DEBUG_MEM_LEVEL" ]; then
- export DEBUG_MEM_LEVEL=$(getargnum 0 0 3 rd.memdebug)
+ export DEBUG_MEM_LEVEL=$(getargnum 0 0 5 rd.memdebug)
fi
}
diff --git a/modules.d/99memstrack/memstrack-report.sh b/modules.d/99memstrack/memstrack-report.sh
new file mode 100755
index 00000000..241e8621
--- /dev/null
+++ b/modules.d/99memstrack/memstrack-report.sh
@@ -0,0 +1,23 @@
+#!/usr/bin/env bash
+. /lib/dracut-lib.sh
+
+if ! [ "$DEBUG_MEM_LEVEL" -ge 4 ]; then
+ exit 0
+fi
+
+if type -P systemctl >/dev/null; then
+ systemctl stop memstrack.service
+else
+ get_pid_of_tracer () {
+ local _user _pid _rest
+ read _user _pid _rest <<< $(ps aux | grep [m]emstrack | head -1)
+ echo $_pid
+ }
+
+ kill -s INT $(get_pid_of_tracer)
+ while [[ -n $(get_pid_of_tracer) ]]; do
+ sleep 1
+ done
+fi
+
+cat /.memstrack
diff --git a/modules.d/99memstrack/memstrack-start.sh b/modules.d/99memstrack/memstrack-start.sh
new file mode 100755
index 00000000..5aa73efe
--- /dev/null
+++ b/modules.d/99memstrack/memstrack-start.sh
@@ -0,0 +1,68 @@
+#!/bin/sh
+# Mount kernel debug fs so debug tools can work.
+# memdebug=4 and memdebug=5 requires debug fs to be mounted.
+# And there is no need to umount it.
+
+type getargnum >/dev/null 2>&1 || . /lib/dracut-lib.sh
+
+# "sys/kernel/tracing" has the priority if exists.
+get_trace_base() {
+ # trace access through debugfs would be obsolete if "/sys/kernel/tracing" is available.
+ if [ -d "/sys/kernel/tracing" ]; then
+ echo "/sys/kernel"
+ else
+ echo "/sys/kernel/debug"
+ fi
+}
+
+is_debugfs_ready() {
+ [ -f "$(get_trace_base)/tracing/trace" ]
+}
+
+prepare_debugfs() {
+ local trace_base
+
+ trace_base=$(get_trace_base)
+ # old debugfs interface case.
+ if ! [ -d "$trace_base/tracing" ]; then
+ mount none -t debugfs $trace_base
+ # new tracefs interface case.
+ elif ! [ -f "$trace_base/tracing/trace" ]; then
+ mount none -t tracefs "$trace_base/tracing"
+ fi
+
+ if ! [ -f "$trace_base/tracing/trace" ]; then
+ echo "WARN: failed to mount debugfs"
+ return 1
+ fi
+}
+
+if ! is_debugfs_ready ; then
+ prepare_debugfs
+fi
+
+if [ -n "$DEBUG_MEM_LEVEL" ]; then
+ if [ "$DEBUG_MEM_LEVEL" -ge 5 ]; then
+ echo "memstrack - will report kernel module memory usage summary and top allocation stack"
+ memstrack --report module_summary,module_top --notui --throttle 80 -o /.memstrack &
+ elif [ "$DEBUG_MEM_LEVEL" -ge 4 ]; then
+ echo "memstrack - will report memory usage summary"
+ memstrack --report module_summary --notui --throttle 80 -o /.memstrack &
+ else
+ exit 0;
+ fi
+fi
+
+PID=$!
+RET=$?
+
+if [ $RET -ne 0 ]; then
+ echo "Failed to start memstrack, exit status: $RET"
+ exit $RET
+fi
+
+# Wait a second for memstrack to setup everything, avoid missing any event
+sleep 1
+
+echo $PID > /run/memstrack.pid
+disown
diff --git a/modules.d/99memstrack/memstrack.service b/modules.d/99memstrack/memstrack.service
new file mode 100644
index 00000000..6b47adef
--- /dev/null
+++ b/modules.d/99memstrack/memstrack.service
@@ -0,0 +1,13 @@
+[Unit]
+Description=Memstrack Anylazing Service
+DefaultDependencies=no
+Before=dracut-cmdline.service systemd-udevd.service local-fs-pre.target
+IgnoreOnIsolate=true
+
+[Service]
+Type=simple
+ExecStart=/bin/memstrack-start
+PIDFile=/run/memstrack.pid
+StandardInput=null
+StandardOutput=syslog+console
+StandardError=syslog+console
diff --git a/modules.d/99memstrack/module-setup.sh b/modules.d/99memstrack/module-setup.sh
new file mode 100755
index 00000000..d5bacb4d
--- /dev/null
+++ b/modules.d/99memstrack/module-setup.sh
@@ -0,0 +1,27 @@
+#!/usr/bin/bash
+
+check() {
+ if type -P memstrack >/dev/null; then
+ dinfo "memstrack is available"
+ return 0
+ fi
+
+ dinfo "memstrack is not available"
+ dinfo "If you need to use rd.memdebug>=4, please install memstrack"
+
+ return 1
+}
+
+depends() {
+ return 0
+}
+
+install() {
+ inst "/bin/memstrack" "/bin/memstrack"
+
+ inst "$moddir/memstrack-start.sh" "/bin/memstrack-start"
+ inst_hook cleanup 99 "$moddir/memstrack-report.sh"
+
+ inst "$moddir/memstrack.service" "$systemdsystemunitdir/memstrack.service"
+ systemctl -q --root "$initdir" add-wants initrd.target memstrack.service
+}

35
SOURCES/0077.patch Normal file
View File

@ -0,0 +1,35 @@
From 8b3033c92a073f9e63074ffcdb1af6e69d99105c Mon Sep 17 00:00:00 2001
From: Attila Bruncsak <bruncsak@users.noreply.github.com>
Date: Fri, 14 Dec 2018 15:57:33 +0100
Subject: [PATCH] the strip command should avoid changing the file modification
time
(cherry picked from commit 7e944c77c0e05f2cc28e11227b465525c5131772)
Resolves: #1776659
---
dracut.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/dracut.sh b/dracut.sh
index f270af76..223261d6 100755
--- a/dracut.sh
+++ b/dracut.sh
@@ -1663,14 +1663,14 @@ if [[ $do_strip = yes ]] && ! [[ $DRACUT_FIPS_MODE ]]; then
dinfo "*** Stripping files ***"
find "$initdir" -type f \
-executable -not -path '*/lib/modules/*.ko' -print0 \
- | xargs -r -0 $strip_cmd -g 2>/dev/null
+ | xargs -r -0 $strip_cmd -g -p 2>/dev/null
# strip kernel modules, but do not touch signed modules
find "$initdir" -type f -path '*/lib/modules/*.ko' -print0 \
| while read -r -d $'\0' f || [ -n "$f" ]; do
SIG=$(tail -c 28 "$f" | tr -d '\000')
[[ $SIG == '~Module signature appended~' ]] || { printf "%s\000" "$f"; }
- done | xargs -r -0 $strip_cmd -g
+ done | xargs -r -0 $strip_cmd -g -p
dinfo "*** Stripping files done ***"
fi

108
SOURCES/0078.patch Normal file
View File

@ -0,0 +1,108 @@
From cbebaacfd05c55fddd11b3090983a2be1d2b48d3 Mon Sep 17 00:00:00 2001
From: Kairui Song <kasong@redhat.com>
Date: Wed, 17 Jul 2019 17:10:36 +0800
Subject: [PATCH] dracut.sh: Adjust squash and strip order
Previously with squash module, some binaries will be reinstalled, but
stripping happens before that so new installed binaries is not stripped.
So adjust the squash and strip order, ensure new installed binaries are
stripped just the same way with the old binaries.
Also split squash into two stage to make the split easier, move the
squash temp dir into initdir so stripping will cover that too,
and print more usefule message.
Signed-off-by: Kairui Song <kasong@redhat.com>
(cherry picked from commit 6a74c03b4a8472fb090015b32e652edfeadb5a10)
Resolves: #1776659
---
dracut.sh | 43 +++++++++++++++++++++++++------------------
1 file changed, 25 insertions(+), 18 deletions(-)
diff --git a/dracut.sh b/dracut.sh
index 223261d6..310646e3 100755
--- a/dracut.sh
+++ b/dracut.sh
@@ -1659,21 +1659,6 @@ for d in $(ldconfig_paths); do
rmdir -p --ignore-fail-on-non-empty "$initdir/$d" >/dev/null 2>&1
done
-if [[ $do_strip = yes ]] && ! [[ $DRACUT_FIPS_MODE ]]; then
- dinfo "*** Stripping files ***"
- find "$initdir" -type f \
- -executable -not -path '*/lib/modules/*.ko' -print0 \
- | xargs -r -0 $strip_cmd -g -p 2>/dev/null
-
- # strip kernel modules, but do not touch signed modules
- find "$initdir" -type f -path '*/lib/modules/*.ko' -print0 \
- | while read -r -d $'\0' f || [ -n "$f" ]; do
- SIG=$(tail -c 28 "$f" | tr -d '\000')
- [[ $SIG == '~Module signature appended~' ]] || { printf "%s\000" "$f"; }
- done | xargs -r -0 $strip_cmd -g -p
-
- dinfo "*** Stripping files done ***"
-fi
if [[ $early_microcode = yes ]]; then
dinfo "*** Generating early-microcode cpio image ***"
ucode_dir=(amd-ucode intel-ucode)
@@ -1745,9 +1730,8 @@ if [[ $hostonly_cmdline == "yes" ]] ; then
fi
fi
-dinfo "*** Creating image file '$outfile' ***"
-
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
@@ -1761,7 +1745,7 @@ if dracut_module_included "squash"; then
exit 1
fi
- readonly squash_dir="${DRACUT_TMPDIR}/squashfs"
+ readonly squash_dir="$initdir/squash/root"
readonly squash_img=$initdir/squash/root.img
# Currently only move "usr" "etc" to squashdir
@@ -1854,15 +1838,38 @@ if dracut_module_included "squash"; then
fi
done
done
+fi
+if [[ $do_strip = yes ]] && ! [[ $DRACUT_FIPS_MODE ]]; then
+ dinfo "*** Stripping files ***"
+ find "$initdir" -type f \
+ -executable -not -path '*/lib/modules/*.ko' -print0 \
+ | xargs -r -0 $strip_cmd -g -p 2>/dev/null
+
+ # strip kernel modules, but do not touch signed modules
+ find "$initdir" -type f -path '*/lib/modules/*.ko' -print0 \
+ | while read -r -d $'\0' f || [ -n "$f" ]; do
+ SIG=$(tail -c 28 "$f" | tr -d '\000')
+ [[ $SIG == '~Module signature appended~' ]] || { printf "%s\000" "$f"; }
+ done | xargs -r -0 $strip_cmd -g -p
+ dinfo "*** Stripping files done ***"
+fi
+
+if dracut_module_included "squash"; then
+ dinfo "*** Squashing the files inside the initramfs ***"
mksquashfs $squash_dir $squash_img -comp xz -b 64K -Xdict-size 100% &> /dev/null
if [[ $? != 0 ]]; then
dfatal "dracut: Failed making squash image"
exit 1
fi
+
+ rm -rf $squash_dir
+ dinfo "*** Squashing the files inside the initramfs done ***"
fi
+dinfo "*** Creating image file '$outfile' ***"
+
if [[ $uefi = yes ]]; then
readonly uefi_outdir="$DRACUT_TMPDIR/uefi"
mkdir "$uefi_outdir"

30
SOURCES/0079.patch Normal file
View File

@ -0,0 +1,30 @@
From b36c1ff083499c2cf1d1dbb7fe1663a2dd0683cc Mon Sep 17 00:00:00 2001
From: Kairui Song <kasong@redhat.com>
Date: Wed, 25 Sep 2019 13:47:40 +0800
Subject: [PATCH] Fine tune mksquashfs options for squash module
Drop some unneeded metadata in the squash image, and print the error
message if something went wrong.
Signed-off-by: Kairui Song <kasong@redhat.com>
(cherry picked from commit 89bc1aa324bcdda3723247218a697171c5a3de6f)
Resolves: #1776659
---
dracut.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dracut.sh b/dracut.sh
index 310646e3..487add57 100755
--- a/dracut.sh
+++ b/dracut.sh
@@ -1857,7 +1857,7 @@ fi
if dracut_module_included "squash"; then
dinfo "*** Squashing the files inside the initramfs ***"
- mksquashfs $squash_dir $squash_img -comp xz -b 64K -Xdict-size 100% &> /dev/null
+ mksquashfs $squash_dir $squash_img -no-xattrs -no-exports -noappend -always-use-fragments -comp xz -Xdict-size 100% -no-progress 1> /dev/null
if [[ $? != 0 ]]; then
dfatal "dracut: Failed making squash image"

93
SOURCES/0080.patch Normal file
View File

@ -0,0 +1,93 @@
From 90d96c4f6a44d895f8999da8c4721a04612e6379 Mon Sep 17 00:00:00 2001
From: Kairui Song <kasong@redhat.com>
Date: Tue, 29 Oct 2019 16:29:14 +0800
Subject: [PATCH] 90kernel-modules: don't install any block driver if not
needed
If hostonly mode is in use, and there isn't any block device included
as hostonly device, then the initramfs won't need any block driver.
Eg. for kdump built image, there could be only one nfs mount point,
or the initramfs may only execute some network operation then reboot.
In such case, skip block driver installation to save space and time.
Signed-off-by: Kairui Song <kasong@redhat.com>
(cherry picked from commit f4ad2e5c8964b6c7b50420299a0096bade6a40bd)
Resolves: #1776659
---
modules.d/90kernel-modules/module-setup.sh | 32 +++++++++++++++++++++++-------
1 file changed, 25 insertions(+), 7 deletions(-)
diff --git a/modules.d/90kernel-modules/module-setup.sh b/modules.d/90kernel-modules/module-setup.sh
index 3dfceff0..c91ba10c 100755
--- a/modules.d/90kernel-modules/module-setup.sh
+++ b/modules.d/90kernel-modules/module-setup.sh
@@ -2,6 +2,8 @@
# called by dracut
installkernel() {
+ local _blockfuncs='ahci_platform_get_resources|ata_scsi_ioctl|scsi_add_host|blk_cleanup_queue|register_mtd_blktrans|scsi_esp_register|register_virtio_device|usb_stor_disconnect|mmc_add_host|sdhci_add_host|scsi_add_host_with_dma'
+
find_kernel_modules_external () {
local _OLDIFS
local external_pattern="^/"
@@ -16,11 +18,25 @@ installkernel() {
done < "$srcmods/modules.dep"
IFS=$_OLDIFS
}
- local _blockfuncs='ahci_platform_get_resources|ata_scsi_ioctl|scsi_add_host|blk_cleanup_queue|register_mtd_blktrans|scsi_esp_register|register_virtio_device|usb_stor_disconnect|mmc_add_host|sdhci_add_host|scsi_add_host_with_dma'
+
+ is_block_dev() {
+ [ -e /sys/dev/block/$1 ] && return 0
+ return 1
+ }
+
+ install_block_modules () {
+ hostonly='' instmods sr_mod sd_mod scsi_dh ata_piix
+ instmods \
+ scsi_dh_rdac scsi_dh_emc scsi_dh_alua \
+ =ide nvme vmd nfit \
+ virtio_blk
+
+ dracut_instmods -o -s "${_blockfuncs}" "=drivers"
+ }
if [[ -z $drivers ]]; then
hostonly='' instmods \
- sr_mod sd_mod scsi_dh ata_piix hid_generic unix \
+ hid_generic unix \
ehci-hcd ehci-pci ehci-platform \
ohci-hcd ohci-pci \
uhci-hcd \
@@ -38,10 +54,10 @@ installkernel() {
${NULL}
instmods \
- yenta_socket scsi_dh_rdac scsi_dh_emc scsi_dh_alua \
+ yenta_socket \
atkbd i8042 usbhid firewire-ohci pcmcia hv-vmbus \
- virtio virtio_blk virtio_ring virtio_pci virtio_scsi \
- "=drivers/pcmcia" =ide nvme vmd nfit
+ virtio virtio_ring virtio_pci virtio_scsi \
+ "=drivers/pcmcia"
if [[ "$(uname -m)" == arm* || "$(uname -m)" == aarch64 ]]; then
# arm/aarch64 specific modules
@@ -72,10 +88,12 @@ installkernel() {
${NULL}
fi
- dracut_instmods -o -s "${_blockfuncs}" "=drivers"
-
find_kernel_modules_external | instmods
+ if ! [[ $hostonly ]] || for_each_host_dev_and_slaves is_block_dev; then
+ install_block_modules
+ fi
+
# if not on hostonly mode, install all known filesystems,
# if the required list is not set via the filesystems variable
if ! [[ $hostonly ]]; then

63
SOURCES/0081.patch Normal file
View File

@ -0,0 +1,63 @@
From 9eb855e073c077966a011146484b9b9596857361 Mon Sep 17 00:00:00 2001
From: Kairui Song <kasong@redhat.com>
Date: Thu, 5 Mar 2020 18:44:45 +0800
Subject: [PATCH] 95znet: Add a rd.znet_ifname= option
qeth device may have a different IP for each boot, so the rd.ifname=
option will no longer work. So for znet device, introduce a
rd.znet_ifname= options, to subchannel id instead of MAC address as the
identifier and rename the interface.
Signed-off-by: Kairui Song <kasong@redhat.com>
(cherry picked from commit 872eb69936bd849eec6d1974dd6569f23a7ad3db)
Resolves: #1811977
---
dracut.cmdline.7.asc | 5 +++++
modules.d/95znet/parse-ccw.sh | 18 ++++++++++++++++++
2 files changed, 23 insertions(+)
diff --git a/dracut.cmdline.7.asc b/dracut.cmdline.7.asc
index 7f31fbae..4a7c2517 100644
--- a/dracut.cmdline.7.asc
+++ b/dracut.cmdline.7.asc
@@ -829,6 +829,11 @@ ZNET
RHEL/Fedora with ccw_init, which is called from udev for certain
devices on z-series.
rd.znet can be specified multiple times on the kernel command line.
+
+**rd.znet_ifname=**__<ifname>__:__<subchannels>__::
+ Assign network device name <interface> (i.e. "bootnet") to the NIC
+ corresponds to the subchannels. This is useful when dracut's default
+ "ifname=" doesn't work due to device having a changing MAC address.
+
[listing]
.Example
diff --git a/modules.d/95znet/parse-ccw.sh b/modules.d/95znet/parse-ccw.sh
index 7d40a1aa..59b588f3 100755
--- a/modules.d/95znet/parse-ccw.sh
+++ b/modules.d/95znet/parse-ccw.sh
@@ -4,4 +4,22 @@ for ccw_arg in $(getargs rd.ccw -d 'rd_CCW=') $(getargs rd.znet -d 'rd_ZNET=');
echo $ccw_arg >> /etc/ccw.conf
done
+for ifname in $(getargs rd.znet_ifname); do
+ IFS=: read ifname_if ifname_subchannels _rest <<< "$ifname"
+ if [ -z "$ifname_if" ] || [ -z "$ifname_subchannels" ] || [ -n "$_rest" ]; then
+ warn "Invalid arguments for rd.znet_ifname="
+ else
+ {
+ ifname_subchannels=${ifname_subchannels//,/|}
+
+ echo 'ACTION!="add|change", GOTO="ccw_ifname_end"'
+ echo 'ATTR{type}!="1", GOTO="ccw_ifname_end"'
+ echo 'SUBSYSTEM!="net", GOTO="ccw_ifname_end"'
+ echo "SUBSYSTEMS==\"ccwgroup\", KERNELS==\"$ifname_subchannels\", DRIVERS==\"?*\" NAME=\"$ifname_if\""
+ echo 'LABEL="ccw_ifname_end"'
+
+ } > /etc/udev/rules.d/81-ccw-ifname.rules
+ fi
+done
+
znet_cio_free

33
SOURCES/0082.patch Normal file
View File

@ -0,0 +1,33 @@
From 4f43dd89a1f9c21f66d6b460c0ad1b271ee40492 Mon Sep 17 00:00:00 2001
From: Lukas Nykryn <lnykryn@redhat.com>
Date: Mon, 25 May 2020 11:59:31 +0200
Subject: [PATCH] Revert "[RHEL] network: default to network-legacy even in
presence of nm-initrd-generator"
This reverts commit 7843bc52777683f6a4ef953d8dde7171ff3b911c.
This will cause that NM will be used in initrd on systems where it is installed.
Resolves: #1839706
---
modules.d/40network/module-setup.sh | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/modules.d/40network/module-setup.sh b/modules.d/40network/module-setup.sh
index bf252eb7..8e2a74a3 100755
--- a/modules.d/40network/module-setup.sh
+++ b/modules.d/40network/module-setup.sh
@@ -8,9 +8,9 @@ check() {
# called by dracut
depends() {
echo -n "kernel-network-modules "
- # RHEL 8.1: Default to network-legacy unless the user chose
- # network-manager manually
- if ! dracut_module_included "network-manager" ; then
+ if ! dracut_module_included "network-legacy" && [ -x "/usr/libexec/nm-initrd-generator" ] ; then
+ echo "network-manager"
+ else
echo "network-legacy"
fi
return 0

37
SOURCES/0083.patch Normal file
View File

@ -0,0 +1,37 @@
From 34ef33adfbb0b44ba6143f4ced206f948d814f86 Mon Sep 17 00:00:00 2001
From: Kairui Song <kasong@redhat.com>
Date: Wed, 27 May 2020 22:07:37 +0800
Subject: [PATCH] 99memstrack: hook script should not call exit
With memstrack module, rd.break may not work because the hook scripts
are sourced, not executed, so the exit call will make pre-pivot queue
exit early. See 98dracut-systemd/dracut-pre-pivot.sh, everything after
"source_hook cleanup" will be ignored.
Replace with return instead.
Credits go to Lukas Nykryn <lnykryn@redhat.com> who helped discover and
debug this issue.
Signed-off-by: Kairui Song <kasong@redhat.com>
(cherry picked from commit 424f01e2a0ac0b329e68eb63048cf0d6d9c74d37)
Resolves: #1829528
---
modules.d/99memstrack/memstrack-report.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/modules.d/99memstrack/memstrack-report.sh b/modules.d/99memstrack/memstrack-report.sh
index 241e8621..3de55bd1 100755
--- a/modules.d/99memstrack/memstrack-report.sh
+++ b/modules.d/99memstrack/memstrack-report.sh
@@ -2,7 +2,7 @@
. /lib/dracut-lib.sh
if ! [ "$DEBUG_MEM_LEVEL" -ge 4 ]; then
- exit 0
+ return 0
fi
if type -P systemctl >/dev/null; then

42
SOURCES/0084.patch Normal file
View File

@ -0,0 +1,42 @@
From f47136bada397328d0a6f36a81138699c793fe92 Mon Sep 17 00:00:00 2001
From: Kairui Song <kasong@redhat.com>
Date: Wed, 27 May 2020 21:59:55 +0800
Subject: [PATCH] Remove cleanup_trace_mem calls
In commit 49c4172 all shell based memory tracing functions are removed,
there are some left over. Remove them as well.
Signed-off-by: Kairui Song <kasong@redhat.com>
(cherry picked from commit 2a611328652388b809a379403ceec126cb55819f)
Resolves: #1829528
---
modules.d/98dracut-systemd/dracut-pre-pivot.sh | 1 -
modules.d/99base/init.sh | 1 -
2 files changed, 2 deletions(-)
diff --git a/modules.d/98dracut-systemd/dracut-pre-pivot.sh b/modules.d/98dracut-systemd/dracut-pre-pivot.sh
index 96e6f8ca..cc70e3c3 100755
--- a/modules.d/98dracut-systemd/dracut-pre-pivot.sh
+++ b/modules.d/98dracut-systemd/dracut-pre-pivot.sh
@@ -14,7 +14,6 @@ make_trace_mem "hook pre-pivot" '1:shortmem' '2+:mem' '3+:slab'
getarg 'rd.break=pre-pivot' 'rdbreak=pre-pivot' && emergency_shell -n pre-pivot "Break pre-pivot"
source_hook pre-pivot
-cleanup_trace_mem
# pre pivot cleanup scripts are sourced just before we switch over to the new root.
getarg 'rd.break=cleanup' 'rdbreak=cleanup' && emergency_shell -n cleanup "Break cleanup"
source_hook cleanup
diff --git a/modules.d/99base/init.sh b/modules.d/99base/init.sh
index 2c0ccd66..a5633936 100755
--- a/modules.d/99base/init.sh
+++ b/modules.d/99base/init.sh
@@ -271,7 +271,6 @@ getarg 'rd.break=pre-pivot' -d 'rdbreak=pre-pivot' && emergency_shell -n pre-piv
source_hook pre-pivot
make_trace_mem "hook cleanup" '1:shortmem' '2+:mem' '3+:slab'
-cleanup_trace_mem
# pre pivot cleanup scripts are sourced just before we switch over to the new root.
getarg 'rd.break=cleanup' -d 'rdbreak=cleanup' && emergency_shell -n cleanup "Break cleanup"
source_hook cleanup

72
SOURCES/0085.patch Normal file
View File

@ -0,0 +1,72 @@
From 689454c727c2730b6aa89ee4c4b7676900e07f78 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Fri, 12 Apr 2019 16:26:59 +0200
Subject: [PATCH] Do not require non-empty kernel cmdline
When booting with Fedora-Server-dvd-x86_64-30-20190411.n.0.iso,
/proc/cmdline is empty (libvirt, qemu host with bios, not sure if that
matters), after installation to disk, anaconda would "crash" in kernel-core
%posttrans, after calling kernel-install, because dracut would fail
with
> Could not determine the kernel command line parameters.
> Please specify the kernel command line in /etc/kernel/cmdline!
I guess it's legitimate, even if unusual, to have no cmdline parameters.
Two changes are done in this patch:
1. do not fail if the cmdline is empty.
2. if /usr/lib/kernel/cmdline or /etc/kernel/cmdline are present, but
empty, ignore /proc/cmdline. If there's explicit configuration to
have empty cmdline, don't ignore it.
(cherry picked from commit 38b4f4b21c3c6107d7a562fcb432237464440b91)
Resolves: #1746069
---
50-dracut.install | 4 +---
51-dracut-rescue.install | 10 +---------
2 files changed, 2 insertions(+), 12 deletions(-)
diff --git a/50-dracut.install b/50-dracut.install
index 139ff82e..b897db84 100755
--- a/50-dracut.install
+++ b/50-dracut.install
@@ -35,9 +35,7 @@ case "$COMMAND" in
read -r -d '' -a BOOT_OPTIONS < /etc/kernel/cmdline
elif [[ -f /usr/lib/kernel/cmdline ]]; then
read -r -d '' -a BOOT_OPTIONS < /usr/lib/kernel/cmdline
- fi
-
- if ! [[ ${BOOT_OPTIONS[*]} ]]; then
+ else
read -r -d '' -a BOOT_OPTIONS < /proc/cmdline
fi
diff --git a/51-dracut-rescue.install b/51-dracut-rescue.install
index 0580062f..5ac34ef3 100755
--- a/51-dracut-rescue.install
+++ b/51-dracut-rescue.install
@@ -47,9 +47,7 @@ if [[ -f /etc/kernel/cmdline ]]; then
read -r -d '' -a BOOT_OPTIONS < /etc/kernel/cmdline
elif [[ -f /usr/lib/kernel/cmdline ]]; then
read -r -d '' -a BOOT_OPTIONS < /usr/lib/kernel/cmdline
-fi
-
-if ! [[ "${BOOT_OPTIONS[@]}" ]]; then
+else
read -r -d '' -a line < /proc/cmdline
for i in "${line[@]}"; do
[[ "${i#initrd=*}" != "$i" ]] && continue
@@ -57,12 +55,6 @@ if ! [[ "${BOOT_OPTIONS[@]}" ]]; then
done
fi
-if ! [[ ${BOOT_OPTIONS[*]} ]]; then
- echo "Could not determine the kernel command line parameters." >&2
- echo "Please specify the kernel command line in /etc/kernel/cmdline!" >&2
- exit 1
-fi
-
if [[ -d "${BOOT_DIR_ABS%/*}" ]]; then
BOOT_DIR="/${MACHINE_ID}/0-rescue"
BOOT_ROOT=${BOOT_DIR_ABS%$BOOT_DIR}

79
SOURCES/0086.patch Normal file
View File

@ -0,0 +1,79 @@
From fc05c818dd862de2b6771dabe242bc9d26aa2160 Mon Sep 17 00:00:00 2001
From: Jan Synacek <jsynacek@redhat.com>
Date: Thu, 11 Jun 2020 11:29:41 +0200
Subject: [PATCH] Adapt to the new udevadm version output
See https://bugzilla.redhat.com/show_bug.cgi?id=1804252.
RHEL-only
Resolves: #1846034
---
dracut-init.sh | 2 +-
modules.d/01fips/fips.sh | 2 +-
modules.d/99base/dracut-lib.sh | 4 ++--
modules.d/99base/init.sh | 2 +-
4 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/dracut-init.sh b/dracut-init.sh
index ab07cabf..032c38c2 100644
--- a/dracut-init.sh
+++ b/dracut-init.sh
@@ -444,7 +444,7 @@ inst_rules_wildcard() {
}
prepare_udev_rules() {
- [ -z "$UDEVVERSION" ] && export UDEVVERSION=$(udevadm --version)
+ [ -z "$UDEVVERSION" ] && export UDEVVERSION=$(udevadm --version | { read v _ ; echo $v ; })
for f in "$@"; do
f="${initdir}/etc/udev/rules.d/$f"
diff --git a/modules.d/01fips/fips.sh b/modules.d/01fips/fips.sh
index 559952ca..03da6861 100755
--- a/modules.d/01fips/fips.sh
+++ b/modules.d/01fips/fips.sh
@@ -27,7 +27,7 @@ mount_boot()
if ! [ -e "$boot" ]; then
udevadm trigger --action=add >/dev/null 2>&1
- [ -z "$UDEVVERSION" ] && UDEVVERSION=$(udevadm --version)
+ [ -z "$UDEVVERSION" ] && UDEVVERSION=$(udevadm --version | { read v _ ; echo $v ; })
i=0
while ! [ -e $boot ]; do
if [ $UDEVVERSION -ge 143 ]; then
diff --git a/modules.d/99base/dracut-lib.sh b/modules.d/99base/dracut-lib.sh
index 56dd63ef..96dd55ad 100755
--- a/modules.d/99base/dracut-lib.sh
+++ b/modules.d/99base/dracut-lib.sh
@@ -531,7 +531,7 @@ incol2() {
}
udevsettle() {
- [ -z "$UDEVVERSION" ] && export UDEVVERSION=$(udevadm --version)
+ [ -z "$UDEVVERSION" ] && export UDEVVERSION=$(udevadm --version | { read v _ ; echo $v ; })
if [ $UDEVVERSION -ge 143 ]; then
udevadm settle --exit-if-exists=$hookdir/initqueue/work $settle_exit_if_exists
@@ -541,7 +541,7 @@ udevsettle() {
}
udevproperty() {
- [ -z "$UDEVVERSION" ] && export UDEVVERSION=$(udevadm --version)
+ [ -z "$UDEVVERSION" ] && export UDEVVERSION=$(udevadm --version | { read v _ ; echo $v ; })
if [ $UDEVVERSION -ge 143 ]; then
for i in "$@"; do udevadm control --property=$i; done
diff --git a/modules.d/99base/init.sh b/modules.d/99base/init.sh
index a5633936..732a7f46 100755
--- a/modules.d/99base/init.sh
+++ b/modules.d/99base/init.sh
@@ -92,7 +92,7 @@ fi
trap "emergency_shell Signal caught!" 0
-export UDEVVERSION=$(udevadm --version)
+export UDEVVERSION=$(udevadm --version | { read v _ ; echo $v ; })
if [ $UDEVVERSION -gt 166 ]; then
# newer versions of udev use /run/udev/rules.d
export UDEVRULESD=/run/udev/rules.d

82
SOURCES/0087.patch Normal file
View File

@ -0,0 +1,82 @@
From 3067edf07449e1dbc2dae0776da9426274b34cba Mon Sep 17 00:00:00 2001
From: Beniamino Galvani <bgalvani@redhat.com>
Date: Wed, 24 Jun 2020 13:06:05 +0200
Subject: [PATCH] network-manager: move connection generation to a lib file
Move the connection generation code to a library file so that it can
be reused from other places.
(cherry picked from commit 6e1e87cd2567801b10b2b4f716436c48688408bf)
Resolves: #1847518
---
modules.d/35network-manager/module-setup.sh | 1 +
modules.d/35network-manager/nm-config.sh | 15 +++------------
modules.d/35network-manager/nm-lib.sh | 20 ++++++++++++++++++++
3 files changed, 24 insertions(+), 12 deletions(-)
diff --git a/modules.d/35network-manager/module-setup.sh b/modules.d/35network-manager/module-setup.sh
index ad2a1534..ed2f399e 100755
--- a/modules.d/35network-manager/module-setup.sh
+++ b/modules.d/35network-manager/module-setup.sh
@@ -37,6 +37,7 @@ install() {
inst_hook initqueue/settled 99 "$moddir/nm-run.sh"
inst_rules 85-nm-unmanaged.rules
inst_libdir_file "NetworkManager/$_nm_version/libnm-device-plugin-team.so"
+ inst_simple "$moddir/nm-lib.sh" "/lib/nm-lib.sh"
if [[ -x "$initdir/usr/sbin/dhclient" ]]; then
inst /usr/libexec/nm-dhcp-helper
diff --git a/modules.d/35network-manager/nm-config.sh b/modules.d/35network-manager/nm-config.sh
index 39a1c8bd..2b9df020 100755
--- a/modules.d/35network-manager/nm-config.sh
+++ b/modules.d/35network-manager/nm-config.sh
@@ -1,18 +1,9 @@
#!/bin/sh
+type nm_generate_connections >/dev/null 2>&1 || . /lib/nm-lib.sh
+
if [ -n "$netroot" ] || [ -e /tmp/net.ifaces ]; then
echo rd.neednet >> /etc/cmdline.d/35-neednet.conf
fi
-/usr/libexec/nm-initrd-generator -- $(getcmdline)
-
-if getargbool 0 rd.neednet; then
- for i in /usr/lib/NetworkManager/system-connections/* \
- /run/NetworkManager/system-connections/* \
- /etc/NetworkManager/system-connections/* \
- /etc/sysconfig/network-scripts/ifcfg-*; do
- [ -f "$i" ] || continue
- echo '[ -f /tmp/nm.done ]' >$hookdir/initqueue/finished/nm.sh
- break
- done
-fi
+nm_generate_connections
diff --git a/modules.d/35network-manager/nm-lib.sh b/modules.d/35network-manager/nm-lib.sh
new file mode 100644
index 00000000..fe053cfa
--- /dev/null
+++ b/modules.d/35network-manager/nm-lib.sh
@@ -0,0 +1,20 @@
+#!/bin/bash
+
+type getcmdline >/dev/null 2>&1 || . /lib/dracut-lib.sh
+
+nm_generate_connections()
+{
+ rm -f /run/NetworkManager/system-connections/*
+ /usr/libexec/nm-initrd-generator -- $(getcmdline)
+
+ if getargbool 0 rd.neednet; then
+ for i in /usr/lib/NetworkManager/system-connections/* \
+ /run/NetworkManager/system-connections/* \
+ /etc/NetworkManager/system-connections/* \
+ /etc/sysconfig/network-scripts/ifcfg-*; do
+ [ -f "$i" ] || continue
+ echo '[ -f /tmp/nm.done ]' >$hookdir/initqueue/finished/nm.sh
+ break
+ done
+ fi
+}

34
SOURCES/0088.patch Normal file
View File

@ -0,0 +1,34 @@
From 7143750cf2e37f9c14ec47a8170b9186136874d7 Mon Sep 17 00:00:00 2001
From: Beniamino Galvani <bgalvani@redhat.com>
Date: Wed, 24 Jun 2020 13:09:04 +0200
Subject: [PATCH] cms: regenerate NetworkManager connections
After changing the kernel command line, the cmsifup script calls ifup
to activate the interface. However, ifup is only available in the
network-legacy module; when using the network-manager module, we
should regenerate connections according to the command line; then
later NM will be run and will activate the device.
(cherry picked from commit 5c3d0a96473ac339fa2d1b25213b8f301c1cfd0d)
Resolves: #1847518
---
modules.d/80cms/cmsifup.sh | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/modules.d/80cms/cmsifup.sh b/modules.d/80cms/cmsifup.sh
index 902df8d8..77c18452 100755
--- a/modules.d/80cms/cmsifup.sh
+++ b/modules.d/80cms/cmsifup.sh
@@ -35,4 +35,9 @@ fi
IFACES="$IFACES $DEVICE"
echo "$IFACES" >> /tmp/net.ifaces
-exec ifup "$DEVICE"
+if [ -x /usr/libexec/nm-initrd-generator ]; then
+ type nm_generate_connections >/dev/null 2>&1 || . /lib/nm-lib.sh
+ nm_generate_connections
+else
+ exec ifup "$DEVICE"
+fi

25
SOURCES/0089.patch Normal file
View File

@ -0,0 +1,25 @@
From 6c0071bc72dbbdd2a958277618a9b2c64c6ee460 Mon Sep 17 00:00:00 2001
From: Lukas Nykryn <lnykryn@redhat.com>
Date: Thu, 2 Jul 2020 14:33:20 +0200
Subject: [PATCH] spec: don't use NM on existing installations
Resolves: #1839706
---
dracut.spec | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/dracut.spec b/dracut.spec
index c82c24f6..a8076c18 100644
--- a/dracut.spec
+++ b/dracut.spec
@@ -481,4 +481,9 @@ install -m 0755 51-dracut-rescue-postinst.sh $RPM_BUILD_ROOT%{_sysconfdir}/kerne
%{_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
+# On existing installations we want to preserve the old scripts
+add_dracutmodules+=" network-legacy "' > /etc/dracut.conf.d/50-network-legacy.conf
+
%changelog

79
SOURCES/0090.patch Normal file
View File

@ -0,0 +1,79 @@
From 73242b75af92bc86c26cfbe2954b7ecb9aaaf765 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Tue, 4 Dec 2018 10:02:45 +0100
Subject: [PATCH] install/dracut-install.c: install module dependencies of
dependencies
(cherry picked from commit c38f9e980c1ee03151dd1c6602907c6228b78d30)
Resolves: #1846343
---
install/dracut-install.c | 28 +++++++++++++++++++++++++---
1 file changed, 25 insertions(+), 3 deletions(-)
diff --git a/install/dracut-install.c b/install/dracut-install.c
index 88bca1d4..253ae194 100644
--- a/install/dracut-install.c
+++ b/install/dracut-install.c
@@ -84,6 +84,11 @@ static bool arg_mod_filter_noname = false;
static int dracut_install(const char *src, const char *dst, bool isdir, bool resolvedeps, bool hashdst);
+static inline void kmod_module_unrefp(struct kmod_module **p) {
+ if (*p)
+ kmod_module_unref(*p);
+}
+#define _cleanup_kmod_module_unref_ _cleanup_(kmod_module_unrefp)
static inline void kmod_module_unref_listp(struct kmod_list **p) {
if (*p)
@@ -1234,28 +1239,45 @@ static bool check_module_path(const char *path)
static int install_dependent_modules(struct kmod_list *modlist)
{
struct kmod_list *itr;
- struct kmod_module *mod;
const char *path = NULL;
const char *name = NULL;
int ret = 0;
kmod_list_foreach(itr, modlist) {
+ _cleanup_kmod_module_unref_ struct kmod_module *mod = NULL;
mod = kmod_module_get_module(itr);
path = kmod_module_get_path(mod);
+ if (check_hashmap(items_failed, path))
+ return -1;
+
+ if (check_hashmap(items, path)) {
+ continue;
+ }
+
name = kmod_module_get_name(mod);
+
if ((path == NULL) || (arg_mod_filter_noname && (regexec(&mod_filter_noname, name, 0, NULL, 0) == 0))) {
- kmod_module_unref(mod);
continue;
}
+
ret = dracut_install(path, &path[kerneldirlen], false, false, true);
if (ret == 0) {
+ _cleanup_kmod_module_unref_list_ struct kmod_list *modlist = NULL;
+ _cleanup_kmod_module_unref_list_ struct kmod_list *modpre = NULL;
+ _cleanup_kmod_module_unref_list_ struct kmod_list *modpost = NULL;
log_debug("dracut_install '%s' '%s' OK", path, &path[kerneldirlen]);
install_firmware(mod);
+ modlist = kmod_module_get_dependencies(mod);
+ ret = install_dependent_modules(modlist);
+ if (ret == 0) {
+ ret = kmod_module_get_softdeps(mod, &modpre, &modpost);
+ if (ret == 0)
+ ret = install_dependent_modules(modpre);
+ }
} else {
log_error("dracut_install '%s' '%s' ERROR", path, &path[kerneldirlen]);
}
- kmod_module_unref(mod);
}
return ret;

50
SOURCES/0091.patch Normal file
View File

@ -0,0 +1,50 @@
From e4e1ab4e129fa17c5e90a2144e15096b0267c22a Mon Sep 17 00:00:00 2001
From: Lukas Nykryn <lnykryn@redhat.com>
Date: Thu, 2 Jul 2020 09:08:03 +0200
Subject: [PATCH] install: also install post weak dependencies of kernel
modules
(cherry picked from commit 6dafdda4a6bdb8721133e4267553c5d86564f9e8)
Resolves: #1846343
---
install/dracut-install.c | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/install/dracut-install.c b/install/dracut-install.c
index 253ae194..51f79422 100644
--- a/install/dracut-install.c
+++ b/install/dracut-install.c
@@ -1272,9 +1272,13 @@ static int install_dependent_modules(struct kmod_list *modlist)
ret = install_dependent_modules(modlist);
if (ret == 0) {
ret = kmod_module_get_softdeps(mod, &modpre, &modpost);
- if (ret == 0)
- ret = install_dependent_modules(modpre);
- }
+ if (ret == 0) {
+ int r;
+ ret = install_dependent_modules(modpre);
+ r = install_dependent_modules(modpost);
+ ret = ret ? : r;
+ }
+ }
} else {
log_error("dracut_install '%s' '%s' ERROR", path, &path[kerneldirlen]);
}
@@ -1335,8 +1339,12 @@ static int install_module(struct kmod_module *mod)
if (ret == 0) {
ret = kmod_module_get_softdeps(mod, &modpre, &modpost);
- if (ret == 0)
- ret = install_dependent_modules(modpre);
+ if (ret == 0) {
+ int r;
+ ret = install_dependent_modules(modpre);
+ r = install_dependent_modules(modpost);
+ ret = ret ? : r;
+ }
}
return ret;

55
SOURCES/0092.patch Normal file
View File

@ -0,0 +1,55 @@
From 818746166fec7c1e572ef12618edadc0535d4663 Mon Sep 17 00:00:00 2001
From: Kairui Song <kasong@redhat.com>
Date: Tue, 9 Jun 2020 03:03:18 +0800
Subject: [PATCH] dracut.sh: Move the library workaround after squash
Ensure the workaround is also valid when dracut-squash module is used
Signed-off-by: Kairui Song <kasong@redhat.com>
(cherry picked from commit de3cb0e3214c3fbab3a94e705445b4d1c2bf0dff)
Cherry-picked from: de3cb0e3214c3fbab3a94e705445b4d1c2bf0dff
Resolves: #1841077
---
dracut.sh | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)
diff --git a/dracut.sh b/dracut.sh
index 487add57..4c5176a1 100755
--- a/dracut.sh
+++ b/dracut.sh
@@ -1578,15 +1578,6 @@ if [[ $kernel_only != yes ]]; then
# Now we are done with lazy resolving, always install dependencies
unset DRACUT_RESOLVE_LAZY
export DRACUT_RESOLVE_DEPS=1
-
- # libpthread workaround: pthread_cancel wants to dlopen libgcc_s.so
- for _dir in $libdirs; do
- for _f in "$_dir/libpthread.so"*; do
- [[ -e "$_f" ]] || continue
- inst_libdir_file "libgcc_s.so*"
- break 2
- done
- done
fi
for ((i=0; i < ${#include_src[@]}; i++)); do
@@ -1840,6 +1831,17 @@ if dracut_module_included "squash"; then
done
fi
+if [[ $kernel_only != yes ]]; then
+ # libpthread workaround: pthread_cancel wants to dlopen libgcc_s.so
+ for _dir in $libdirs; do
+ for _f in "$dracutsysrootdir$_dir/libpthread.so"*; do
+ [[ -e "$_f" ]] || continue
+ inst_libdir_file "libgcc_s.so*"
+ break 2
+ done
+ done
+fi
+
if [[ $do_strip = yes ]] && ! [[ $DRACUT_FIPS_MODE ]]; then
dinfo "*** Stripping files ***"
find "$initdir" -type f \

43
SOURCES/0093.patch Normal file
View File

@ -0,0 +1,43 @@
From d8c0b10b15940d88a28acbcf93354e4da0babb8d Mon Sep 17 00:00:00 2001
From: Kairui Song <kasong@redhat.com>
Date: Wed, 10 Jun 2020 15:57:20 +0800
Subject: [PATCH] dracut.sh: FIPS workaround for openssl-libs on Fedora/RHEL
On Fedora/RHEL, libcryto will verify both itself and libssl on start, if
libssl is missing, FIPS self test will fail. However libssl is not a
dependency of libcryto so dracut will not install it, unless some other
binary or library pulls it in. Systemd requires libssl, so in most cases
it just worked, but could fail in some corner cases where systemd is not
used.
Signed-off-by: Kairui Song <kasong@redhat.com>
(cherry picked from commit 5a4c3469338410b6aea9452994b4b0af1ba59be7)
Resolves: #1841077
---
dracut.sh | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/dracut.sh b/dracut.sh
index 4c5176a1..86e95449 100755
--- a/dracut.sh
+++ b/dracut.sh
@@ -1840,6 +1840,17 @@ if [[ $kernel_only != yes ]]; then
break 2
done
done
+
+ # FIPS workaround for Fedora/RHEL: libcrypto needs libssl when FIPS is enabled
+ if [[ $DRACUT_FIPS_MODE ]]; then
+ for _dir in $libdirs; do
+ for _f in "$dracutsysrootdir$_dir/libcrypto.so"*; do
+ [[ -e "$_f" ]] || continue
+ inst_libdir_file -o "libssl.so*"
+ break 2
+ done
+ done
+ fi
fi
if [[ $do_strip = yes ]] && ! [[ $DRACUT_FIPS_MODE ]]; then

27
SOURCES/0094.patch Normal file
View File

@ -0,0 +1,27 @@
From 41739f232f3f353d45206ceee89ef0bc1c544f31 Mon Sep 17 00:00:00 2001
From: Kairui Song <kasong@redhat.com>
Date: Mon, 3 Aug 2020 16:51:54 +0800
Subject: [PATCH] 90kernel-modules: add pci_hyperv
Install pci_hyperv for SR-IOV devices on hyperv machines.
(cherry picked from commit f7ad1479f277ddffcc501bd08919a4a4a6facc26)
Resolves: #1854001
---
modules.d/90kernel-modules/module-setup.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/modules.d/90kernel-modules/module-setup.sh b/modules.d/90kernel-modules/module-setup.sh
index c91ba10c..86852038 100755
--- a/modules.d/90kernel-modules/module-setup.sh
+++ b/modules.d/90kernel-modules/module-setup.sh
@@ -56,7 +56,7 @@ installkernel() {
instmods \
yenta_socket \
atkbd i8042 usbhid firewire-ohci pcmcia hv-vmbus \
- virtio virtio_ring virtio_pci virtio_scsi \
+ virtio virtio_ring virtio_pci virtio_scsi pci_hyperv \
"=drivers/pcmcia"
if [[ "$(uname -m)" == arm* || "$(uname -m)" == aarch64 ]]; then

View File

@ -5,7 +5,7 @@
# strip the automatically generated dep here and instead co-own the # strip the automatically generated dep here and instead co-own the
# directory. # directory.
%global __requires_exclude pkg-config %global __requires_exclude pkg-config
%define dist_free_release 70.git20200228 %define dist_free_release 95.git20200804
Name: dracut Name: dracut
Version: 049 Version: 049
@ -97,6 +97,31 @@ Patch66: 0066.patch
Patch67: 0067.patch Patch67: 0067.patch
Patch68: 0068.patch Patch68: 0068.patch
Patch69: 0069.patch Patch69: 0069.patch
Patch70: 0070.patch
Patch71: 0071.patch
Patch72: 0072.patch
Patch73: 0073.patch
Patch74: 0074.patch
Patch75: 0075.patch
Patch76: 0076.patch
Patch77: 0077.patch
Patch78: 0078.patch
Patch79: 0079.patch
Patch80: 0080.patch
Patch81: 0081.patch
Patch82: 0082.patch
Patch83: 0083.patch
Patch84: 0084.patch
Patch85: 0085.patch
Patch86: 0086.patch
Patch87: 0087.patch
Patch88: 0088.patch
Patch89: 0089.patch
Patch90: 0090.patch
Patch91: 0091.patch
Patch92: 0092.patch
Patch93: 0093.patch
Patch94: 0094.patch
Source1: https://www.gnu.org/licenses/lgpl-2.1.txt Source1: https://www.gnu.org/licenses/lgpl-2.1.txt
@ -154,6 +179,7 @@ Requires: xz
Requires: gzip Requires: gzip
%if 0%{?fedora} || 0%{?rhel} %if 0%{?fedora} || 0%{?rhel}
Recommends: memstrack
Recommends: hardlink Recommends: hardlink
Recommends: pigz Recommends: pigz
Recommends: kpartx Recommends: kpartx
@ -469,6 +495,7 @@ install -m 0755 51-dracut-rescue-postinst.sh $RPM_BUILD_ROOT%{_sysconfdir}/kerne
%{dracutlibdir}/modules.d/98syslog %{dracutlibdir}/modules.d/98syslog
%{dracutlibdir}/modules.d/98usrmount %{dracutlibdir}/modules.d/98usrmount
%{dracutlibdir}/modules.d/99base %{dracutlibdir}/modules.d/99base
%{dracutlibdir}/modules.d/99memstrack
%{dracutlibdir}/modules.d/99fs-lib %{dracutlibdir}/modules.d/99fs-lib
%{dracutlibdir}/modules.d/99shutdown %{dracutlibdir}/modules.d/99shutdown
%attr(0644,root,root) %ghost %config(missingok,noreplace) %{_localstatedir}/log/dracut.log %attr(0644,root,root) %ghost %config(missingok,noreplace) %{_localstatedir}/log/dracut.log
@ -549,7 +576,55 @@ install -m 0755 51-dracut-rescue-postinst.sh $RPM_BUILD_ROOT%{_sysconfdir}/kerne
%{_sysconfdir}/kernel/postinst.d/51-dracut-rescue-postinst.sh %{_sysconfdir}/kernel/postinst.d/51-dracut-rescue-postinst.sh
%endif %endif
%triggerin network -- dracut-network < 049-83.git20200525
echo '# Since rhel-8.3 dracut moved to use NetworkManager
# On existing installations we want to preserve the old scripts
add_dracutmodules+=" network-legacy "' > /etc/dracut.conf.d/50-network-legacy.conf
%changelog %changelog
* Tue Aug 04 2020 Lukas Nykryn <lnykryn@redhat.com> - 049-95.git20200804
- 90kernel-modules: add pci_hyperv
* Thu Jul 09 2020 Lukas Nykryn <lnykryn@redhat.com> - 049-94.git20200709
- dracut.sh: Move the library workaround after squash
- dracut.sh: FIPS workaround for openssl-libs on Fedora/RHEL
* Thu Jul 02 2020 Lukas Nykryn <lnykryn@redhat.com> - 049-92.git20200702
- install/dracut-install.c: install module dependencies of
- install: also install post weak dependencies of kernel
* Thu Jul 02 2020 Lukas Nykryn <lnykryn@redhat.com> - 049-90.git20200702
- spec: don't use NM on existing installations
* Thu Jun 25 2020 Lukas Nykryn <lnykryn@redhat.com> - 049-89.git20200625
- Adapt to the new udevadm version output
- network-manager: move connection generation to a lib file
- cms: regenerate NetworkManager connections
* Tue Jun 02 2020 Lukas Nykryn <lnykryn@redhat.com> - 049-86.git20200602
- Do not require non-empty kernel cmdline
* Wed May 27 2020 Lukas Nykryn <lnykryn@redhat.com> - 049-85.git20200527
- 99memstrack: hook script should not call exit
- Remove cleanup_trace_mem calls
* Mon May 25 2020 Lukas Nykryn <lnykryn@redhat.com> - 049-83.git20200525
- Remove memtrace-ko and rd.memdebug=4 support in dracut
- Add 99memstrack module
- the strip command should avoid changing the file modification
- dracut.sh: Adjust squash and strip order
- Fine tune mksquashfs options for squash module
- 90kernel-modules: don't install any block driver if not
- 95znet: Add a rd.znet_ifname= option
- Revert "[RHEL] network: default to network-legacy even in
* Wed Apr 22 2020 Lukas Nykryn <lnykryn@redhat.com> - 049-75.git20200422
- network-manager: fix getting of ifname from the sysfs path
- network-manager: don't run NetworkManager when there are no
- network-manager: ensure that nm-run.sh is executed when
- network-manager: install libnss DNS and mDNS plugins
- Always pull in machinery to read ifcfg files
* Fri Feb 28 2020 Lukas Nykryn <lnykryn@redhat.com> - 049-70.git20200228 * Fri Feb 28 2020 Lukas Nykryn <lnykryn@redhat.com> - 049-70.git20200228
- network-legacy/ifup: fix ip=dhcp,dhcp6 setup_net logic - network-legacy/ifup: fix ip=dhcp,dhcp6 setup_net logic