sync with patches in CentOS Stream 9

- Backport PR 3250 to fix useless warning that libsystemd-core requires
  additional libraries and ReaR recovery system needs additional libraries
- Backport PR 3242 to fix IPv6 address in nfs:// and sshfs:// BACKUP/OUTPUT_URL
- Use git to apply patches in %prep

Resolves: RHEL-46612
Resolves: RHEL-46613
This commit is contained in:
Lukáš Zaoral 2024-07-24 11:23:19 +02:00 committed by Pavel Cahyna
parent 79beaa01ec
commit a7f1dc5c64
4 changed files with 1728 additions and 38 deletions

1542
rear-fix-ipv6.patch Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,110 @@
commit eb574592a21c7ca986393c4563fe5484b9f01454
Author: Johannes Meixner <jsmeix@suse.com>
Date: Tue Jun 18 13:47:27 2024 +0200
In 990_verify_rootfs.sh fix issue #3021 (#3250)
In build/default/990_verify_rootfs.sh
for each 'not found' shared object
(i.e. a shared object that was 'not found' by 'ldd')
check whether or not the shared object
may exist nevertheless in the recovery system
and if yes, we may sufficiently safely assume
things are OK in the ReaR recovery system
so we do not report it as missing to the user
(for debugging we have all in the log), see
https://github.com/rear/rear/issues/3021#issuecomment-2165453757
Additionally in 990_verify_rootfs.sh
more consistent level when messages are shown,
i.e. now only LogPrint and LogPrintError
to show nothing (except errors) when not in verbose mode
and all messages when in verbose mode
to make the messages as a whole
better understandable by the user.
Cherry-picked-by: Lukáš Zaoral <lzaoral@redhat.com>
diff --git a/usr/share/rear/build/default/990_verify_rootfs.sh b/usr/share/rear/build/default/990_verify_rootfs.sh
index 3d203cca..dce42701 100644
--- a/usr/share/rear/build/default/990_verify_rootfs.sh
+++ b/usr/share/rear/build/default/990_verify_rootfs.sh
@@ -70,9 +70,13 @@ DebugPrint "Testing each binary with 'ldd' and look for 'not found' libraries wi
local backup_tool_LD_LIBRARY_PATH=""
local binary=""
local broken_binary_LD_LIBRARY_PATH=""
-local broken_binaries="no"
local fatal_missing_library="no"
local ldd_output=""
+local not_found_output=""
+local not_found_library=""
+local junk=""
+local actually_found_library=""
+local actually_missing_libraries="no"
# Third-party backup tools may use LD_LIBRARY_PATH to find their libraries
# so that for testing such third-party backup tools we must also use their special LD_LIBRARY_PATH here:
if test "$BACKUP" = "TSM" ; then
@@ -159,9 +163,8 @@ for binary in $( find $ROOTFS_DIR -type f \( -executable -o -name '*.so' -o -nam
broken_binary_LD_LIBRARY_PATH=$backup_tool_LD_LIBRARY_PATH
Log "$binary requires additional libraries with backup tool specific LD_LIBRARY_PATH=$backup_tool_LD_LIBRARY_PATH"
fi
- # All tests had a 'not found' shared object dependency so the binary requires additional libraries
- # without LD_LIBRARY_PATH and with LD_LIBRARY_PATH and with backup tool specific LD_LIBRARY_PATH:
- broken_binaries="yes"
+ # At this point all tests had a 'not found' shared object dependency so the binary requires additional libraries
+ # without LD_LIBRARY_PATH and with LD_LIBRARY_PATH and with backup tool specific LD_LIBRARY_PATH.
# Only for programs (i.e. files in a .../bin/... or .../sbin/... directory) treat a missing library as fatal
# unless specified when a 'not found' reported library is not fatal (when the 'ldd' test was false alarm):
if grep -q '/[s]*bin/' <<<"$binary" ; then
@@ -169,17 +172,17 @@ for binary in $( find $ROOTFS_DIR -type f \( -executable -o -name '*.so' -o -nam
if test "$NON_FATAL_BINARIES_WITH_MISSING_LIBRARY" ; then
# A program with missing library is treated as fatal when it does not match the pattern:
if grep -E -q "$NON_FATAL_BINARIES_WITH_MISSING_LIBRARY" <<<"$binary" ; then
- LogPrintError "$binary requires additional libraries (specified as non-fatal)"
+ LogPrint "$binary requires libraries were 'ldd' shows 'not found' (specified as non-fatal)"
else
- LogPrintError "$binary requires additional libraries (fatal error)"
+ LogPrint "$binary requires libraries were 'ldd' shows 'not found' (fatal error)"
fatal_missing_library="yes"
fi
else
- LogPrintError "$binary requires additional libraries (fatal error)"
+ LogPrint "$binary requires libraries were 'ldd' shows 'not found' (fatal by default)"
fatal_missing_library="yes"
fi
else
- LogPrintError "$binary requires additional libraries"
+ LogPrint "$binary requires libraries were 'ldd' shows 'not found'"
fi
# Run the same ldd call as above but now keep its whole stdout output.
# The ldd call that results the final 'not found' shared object is the last of the above ldd calls that was run.
@@ -191,10 +194,27 @@ for binary in $( find $ROOTFS_DIR -type f \( -executable -o -name '*.so' -o -nam
fi
# Have the whole ldd output only in the log:
Log "$ldd_output"
- # Show only the missing libraries to the user to not flood his screen with tons of other ldd output lines:
- PrintError "$( grep 'not found' <<<"$ldd_output" )"
+ # For each 'not found' shared object (i.e. a shared object that was 'not found' by 'ldd')
+ # check whether or not the shared object may exist nevertheless in the ReaR recovery system
+ # and if yes, we may sufficiently safely assume things are OK in the ReaR recovery system
+ # so we do not report it as missing to the user (for debugging we have all in the log)
+ # cf. https://github.com/rear/rear/issues/3021#issuecomment-2165453757
+ not_found_output="$( grep 'not found' <<<"$ldd_output" )"
+ # not_found_output is a string of multiple lines (separated by \n) that look e.g. like
+ # libsystemd-shared-255.4-1.fc40.so => not found
+ # /path/to/library => not found
+ while read not_found_library junk ; do
+ # We prefer a simple 'grep -q' pipe over dealing with find -name versus -path options:
+ if actually_found_library="$( find $ROOTFS_DIR -xdev | grep "$not_found_library" )" ; then
+ LogPrint "$binary requires $not_found_library which was not found by 'ldd' but exists as $actually_found_library"
+ else
+ actually_missing_libraries="yes"
+ # Show only the missing libraries to the user to not flood his screen with tons of other ldd output lines:
+ LogPrintError "$binary requires $not_found_library which could not be found in the ReaR recovery system"
+ fi
+ done <<<"$not_found_output"
done
-is_true $broken_binaries && LogPrintError "ReaR recovery system in '$ROOTFS_DIR' needs additional libraries, check $RUNTIME_LOGFILE for details"
+is_true $actually_missing_libraries && LogPrintError "ReaR recovery system in '$ROOTFS_DIR' needs additional libraries, check $RUNTIME_LOGFILE for details"
is_true $fatal_missing_library && keep_build_dir
# Testing that each program in the PROGS array can be found as executable command within the recovery system

View File

@ -42,8 +42,6 @@ index fcf0a5ff..7d494281 100644
# Missing programs in the PROGS array are ignored:
PROGS+=( grub-bios-setup grub2-bios-setup
grub-install grub2-install
# https://github.com/rear/rear/pull/3145
diff --git a/usr/share/rear/prep/Linux-s390/305_include_s390_tools.sh b/usr/share/rear/prep/Linux-s390/305_include_s390_tools.sh
index b4ab3786..4451f53d 100644
--- a/usr/share/rear/prep/Linux-s390/305_include_s390_tools.sh
@ -78,6 +76,18 @@ index ea86af4c..93e59eae 100644
-# Remember the ESP device node in VAR_DIR/recovery/bootdisk:
-echo "${esp_proc_mounts_line[0]}" >$VAR_DIR/recovery/bootdisk
-
commit ca99d855579cfcab37f985e2547a3187e0f0aeeb
Merge: 8c59415c 40b883c0
Author: pcahyna <pcahyna@users.noreply.github.com>
Date: Fri Feb 16 11:40:04 2024 +0100
Merge pull request #3145 from rear/restore-hybrid-bootloader
Support saving and restoring hybrid BIOS/UEFI bootloader setup and clean up bootloader detection
Cherry-picked-by: Lukáš Zaoral <lzaoral@redhat.com>
diff --git a/usr/share/rear/finalize/Linux-i386/630_install_grub.sh b/usr/share/rear/finalize/Linux-i386/630_install_grub.sh
index f3d9a820..a0e87e1d 100644
--- a/usr/share/rear/finalize/Linux-i386/630_install_grub.sh
@ -173,10 +183,21 @@ index f3d9a820..a0e87e1d 100644
part=$( echo $bootparts | cut -d' ' -f1 )
diff --git a/usr/share/rear/finalize/Linux-i386/660_install_grub2.sh b/usr/share/rear/finalize/Linux-i386/660_install_grub2.sh
index d1c36bd3..af3d8a92 100644
index d1c36bd3..5bf9144c 100644
--- a/usr/share/rear/finalize/Linux-i386/660_install_grub2.sh
+++ b/usr/share/rear/finalize/Linux-i386/660_install_grub2.sh
@@ -45,6 +45,37 @@
@@ -36,7 +36,9 @@
# This script does not check BOOTLOADER because it is also used as fallback
# to install the nowadays most often used bootloader GRUB2
# unless the BOOTLOADER variable tells to install another bootloader
-# (other bootloader install scripts check the BOOTLOADER variable).
+# (other bootloader install scripts check the BOOTLOADER variable)
+# and unless we are using UEFI (BOOTLOADER then indicates the BIOS bootloader
+# in a a hybrid boot setup).
#
# This script does not error out because at this late state of "rear recover"
# (i.e. after the backup was restored) I <jsmeix@suse.de> consider it too hard
@@ -45,6 +47,37 @@
# so that after "rear recover" finished he can manually install the bootloader
# as appropriate for his particular system.
@ -214,7 +235,7 @@ index d1c36bd3..af3d8a92 100644
# Skip if another bootloader was already installed:
# In this case NOBOOTLOADER is not true,
# cf. finalize/default/050_prepare_checks.sh
@@ -52,12 +83,16 @@ is_true $NOBOOTLOADER || return 0
@@ -52,12 +85,16 @@ is_true $NOBOOTLOADER || return 0
# For UEFI systems with grub2 we should use efibootmgr instead,
# cf. finalize/Linux-i386/670_run_efibootmgr.sh
@ -233,7 +254,7 @@ index d1c36bd3..af3d8a92 100644
LogPrint "Installing GRUB2 boot loader..."
@@ -101,7 +136,7 @@ if test "$GRUB2_INSTALL_DEVICES" ; then
@@ -101,7 +138,7 @@ if test "$GRUB2_INSTALL_DEVICES" ; then
else
LogPrint "Installing GRUB2 on $grub2_install_device (specified in GRUB2_INSTALL_DEVICES)"
fi
@ -242,7 +263,7 @@ index d1c36bd3..af3d8a92 100644
LogPrintError "Failed to install GRUB2 on $grub2_install_device"
grub2_install_failed="yes"
fi
@@ -145,8 +180,8 @@ fi
@@ -145,8 +182,8 @@ fi
grub2_installed_disks=()
for disk in $disks ; do
# Installing GRUB2 on an LVM PV will wipe the metadata so we skip those:
@ -253,7 +274,7 @@ index d1c36bd3..af3d8a92 100644
# Use first boot partition by default:
part=$( echo $bootparts | cut -d' ' -f1 )
@@ -165,6 +200,8 @@ for disk in $disks ; do
@@ -165,6 +202,8 @@ for disk in $disks ; do
# Install GRUB2 on the boot disk if one was found:
if test "$bootdisk" ; then
@ -262,7 +283,7 @@ index d1c36bd3..af3d8a92 100644
# Continue with the next possible boot disk when GRUB2 was already installed on the current one.
# When there are more disks like /dev/sda and /dev/sdb it can happen that
# for /dev/sda bootdisk=/dev/sda and GRUB2 gets installed on /dev/sda and
@@ -172,7 +209,7 @@ for disk in $disks ; do
@@ -172,7 +211,7 @@ for disk in $disks ; do
# so we avoid that GRUB2 gets needlessly installed two times on the same device:
IsInArray "$bootdisk" "${grub2_installed_disks[@]}" && continue
LogPrint "Found possible boot disk $bootdisk - installing GRUB2 there"
@ -271,7 +292,7 @@ index d1c36bd3..af3d8a92 100644
grub2_installed_disks+=( "$bootdisk" )
# In contrast to the above behaviour when GRUB2_INSTALL_DEVICES is specified
# consider it here as a successful bootloader installation when GRUB2
@@ -181,11 +218,14 @@ for disk in $disks ; do
@@ -181,11 +220,14 @@ for disk in $disks ; do
# Continue with the next possible boot disk:
continue
fi
@ -313,10 +334,10 @@ index 1679c9a4..57b44bca 100644
# The output is stored in an artificial bash array so that $BOOTLOADER is the first word:
test -s $bootloader_file && BOOTLOADER=( $( grep -v '^[[:space:]]*#' $bootloader_file ) )
diff --git a/usr/share/rear/layout/save/default/445_guess_bootloader.sh b/usr/share/rear/layout/save/default/445_guess_bootloader.sh
index 06de7648..0233b0eb 100644
index 06de7648..374a706f 100644
--- a/usr/share/rear/layout/save/default/445_guess_bootloader.sh
+++ b/usr/share/rear/layout/save/default/445_guess_bootloader.sh
@@ -1,7 +1,15 @@
@@ -1,10 +1,26 @@
# Determine or guess the used bootloader if not specified by the user
# and save this information into /var/lib/rear/recovery/bootloader
@ -333,7 +354,18 @@ index 06de7648..0233b0eb 100644
# When BOOTLOADER is specified use that:
if test "$BOOTLOADER" ; then
@@ -57,39 +65,31 @@ for block_device in /sys/block/* ; do
+ # case-insensitive match, as later we conver all to uppercase
+ if [[ "$BOOTLOADER" == [Gg][Rr][Uu][Bb] ]] ; then
+ if is_grub2_installed ; then
+ LogPrintError "BOOTLOADER=GRUB used to mean GRUB 2 if GRUB 2 is installed and GRUB Legacy if not"
+ Error "BOOTLOADER set to '$BOOTLOADER', set it to 'GRUB2' explicitly to avoid the ambiguity"
+ fi
+ # we should add an ErrorIfDeprecated call here or later for GRUB Legacy deprecation
+ fi
LogPrint "Using specified bootloader '$BOOTLOADER' for 'rear recover'"
echo "$BOOTLOADER" | tr '[a-z]' '[A-Z]' >$bootloader_file
return
@@ -57,39 +73,31 @@ for block_device in /sys/block/* ; do
# Continue guessing the used bootloader by inspecting the first bytes on the next disk:
continue
fi
@ -394,7 +426,7 @@ index 06de7648..0233b0eb 100644
echo "$known_bootloader" >$bootloader_file
return
fi
@@ -103,6 +103,26 @@ for block_device in /sys/block/* ; do
@@ -103,6 +111,26 @@ for block_device in /sys/block/* ; do
Log "End of strings in the first bytes on $disk_device"
done
@ -422,7 +454,7 @@ index 06de7648..0233b0eb 100644
# Error out when no bootloader was specified or could be autodetected:
Error "Cannot autodetect what is used as bootloader, see default.conf about 'BOOTLOADER'"
diff --git a/usr/share/rear/lib/bootloader-functions.sh b/usr/share/rear/lib/bootloader-functions.sh
index a8ee92a9..2d6955cc 100644
index a7363c4c..3dade874 100644
--- a/usr/share/rear/lib/bootloader-functions.sh
+++ b/usr/share/rear/lib/bootloader-functions.sh
@@ -529,6 +529,53 @@ function get_root_disk_UUID {
@ -479,26 +511,11 @@ index a8ee92a9..2d6955cc 100644
# Output GRUB2 configuration on stdout:
# $1 is the kernel file with appropriate path for GRUB2 to load the kernel from within GRUB2's root filesystem
# $2 is the initrd file with appropriate path for GRUB2 to load the initrd from within GRUB2's root filesystem
diff --git a/usr/share/rear/lib/checklayout-workflow.sh b/usr/share/rear/lib/checklayout-workflow.sh
index 94b70fc0..744ca0be 100644
--- a/usr/share/rear/lib/checklayout-workflow.sh
+++ b/usr/share/rear/lib/checklayout-workflow.sh
@@ -15,6 +15,10 @@ function WORKFLOW_checklayout () {
SourceStage "layout/precompare"
+ # layout code needs to know whether we are using UEFI (USING_UEFI_BOOTLOADER)
+ # as it also detects the bootloader in use ( layout/save/default/445_guess_bootloader.sh )
+ Source $SHARE_DIR/prep/default/320_include_uefi_env.sh
+
# In case of e.g. BACKUP_URL=file:///mybackup/ automatically exclude the matching component 'fs:/mybackup'
# otherwise 'rear checklayout' would always detect a changed layout with BACKUP_URL=file:///...
# because during 'rear mkrescue/mkbackup' such a component was automatically excluded this way
diff --git a/usr/share/rear/lib/layout-functions.sh b/usr/share/rear/lib/layout-functions.sh
index cb33ac28..2f53d4fa 100644
index 69f38b47..ee651b2a 100644
--- a/usr/share/rear/lib/layout-functions.sh
+++ b/usr/share/rear/lib/layout-functions.sh
@@ -526,6 +526,33 @@ get_component_type() {
@@ -532,6 +532,33 @@ get_component_type() {
grep -E "^[^ ]+ $1 " $LAYOUT_TODO | cut -d " " -f 3
}
@ -532,14 +549,14 @@ index cb33ac28..2f53d4fa 100644
# Function returns 0 when v1 is greater or equal than v2
version_newer() {
local v1list=( ${1//[-.]/ } )
@@ -760,17 +787,17 @@ blkid_label_of_device() {
@@ -806,17 +833,17 @@ blkid_label_of_device() {
echo "$label"
}
-# Returns 1 if the device is an LVM physical volume
-# Returns 0 otherwise or if the device doesn't exists
+# Returns true if the device is an LVM physical volume
+# Returns false otherwise or if the device doesn't exists
+# Returns false otherwise or if the device doesn't exist
is_disk_a_pv() {
disk=$1

View File

@ -73,7 +73,7 @@ Patch112: rear-copy-console-kernel-cmdline-from-host.patch
# support saving and restoring hybrid BIOS/UEFI bootloader setup and clean
# up bootloader detection
# https://github.com/rear/rear/commit/096bfde5e234f5a803bae74f24e3821798022c7c
# https://github.com/rear/rear/pull/3145
# https://github.com/rear/rear/commit/ca99d855579cfcab37f985e2547a3187e0f0aeeb
Patch113: rear-restore-hybrid-bootloader-RHEL-16864.patch
# resolve libs for executable links in COPY_AS_IS
@ -84,13 +84,27 @@ Patch114: rear-resolve-libraries-for-symlinks-in-COPY_AS_IS-RHEL-15108.patch
# https://github.com/rear/rear/commit/c08658d5a0260c3242bb817e77b9c6dadecd14f6
Patch115: rear-skip-invalid-drives-RHEL-22863.patch
# fix useless warning that libsystemd-core requires additional libraries
# and ReaR recovery system needs additional libraries
# https://github.com/rear/rear/commit/eb574592a21c7ca986393c4563fe5484b9f01454
Patch116: rear-fix-libsystemd-ldd-warning.patch
# fix IPv6 addresses in nfs:// and sshfs:// BACKUP/OUTPUT_URL
# https://github.com/rear/rear/commit/8a10135bf958c03b4b5077fc7ae7761ad2a71eec
Patch117: rear-fix-ipv6.patch
# ALREADY INCLUDED IN REAR 2.7!
# remove obsolete FAT16 options to avoid kernel warning
# https://github.com/rear/rear/commit/9a6b9a109aa77afc6c96cf05bbd7988cf0310d61
# Patch118: rear-no-fat-16.patch
# fix booting on UEFI with multiple CDROM devices
# https://github.com/rear/rear/commit/283efdaea10ff62dc94e968f74e1136b8384a954
Patch116: rear-uefi-booting-with-multiple-cdrom-devices.patch
Patch119: rear-uefi-booting-with-multiple-cdrom-devices.patch
# skip btrfs subvolumes when detecting ESP partitions
# https://github.com/rear/rear/commit/c8409e1f2972e9cd87d9390ca0b52b908d1a872a
Patch117: rear-skip-btrfs-subvolumes-when-detecting-ESP-partitions.patch
Patch120: rear-skip-btrfs-subvolumes-when-detecting-ESP-partitions.patch
######################
# downstream patches #
@ -139,6 +153,7 @@ Requires: s390utils-core
# Required for HTML user guide
BuildRequires: asciidoctor
BuildRequires: git
BuildRequires: make
### Mandatory dependencies:
@ -187,7 +202,7 @@ Professional services and support are available.
#-- PREP, BUILD & INSTALL -----------------------------------------------------#
%prep
%autosetup -p1
%autosetup -p1 -S git
# Change /lib to /usr/lib for COPY_AS_IS
sed -E -e "s:([\"' ])/lib:\1/usr/lib:g" \
@ -243,6 +258,12 @@ EOF
- skip btrfs subvolumes when detecting ESP partitions
- fix booting on UEFI systems with multiple CDROM devices
- fix copying of console kernel cmdline parameters
- Use git to apply patches in %%prep
- Sync with patches in CentOS Stream 9 (kudos to @pcahyna!):
- Backport PR 3250 to fix useless warning that libsystemd-core requires
additional libraries and ReaR recovery system needs additional libraries
- Backport PR 3242 to fix IPv6 address in nfs:// and sshfs://
BACKUP/OUTPUT_URL
* Mon Jun 24 2024 Troy Dawson <tdawson@redhat.com> - 2.7-9
- Bump release for June 2024 mass rebuild