From 816978a083c29e8d63b2177b2aedd42e8afa486e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Zaoral?= Date: Tue, 6 Feb 2024 12:56:23 +0100 Subject: [PATCH] fix unusable recovery with newer systemd Resolves: rbhz#2254871 --- ...ibility-with-newer-systemd-bz2254871.patch | 54 +++++++++++++++++++ rear.spec | 9 +++- 2 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 rear-fix-compatibility-with-newer-systemd-bz2254871.patch diff --git a/rear-fix-compatibility-with-newer-systemd-bz2254871.patch b/rear-fix-compatibility-with-newer-systemd-bz2254871.patch new file mode 100644 index 0000000..ffec7b6 --- /dev/null +++ b/rear-fix-compatibility-with-newer-systemd-bz2254871.patch @@ -0,0 +1,54 @@ +From 060fef89b6968f0c8f254e6f612eff839b83c057 Mon Sep 17 00:00:00 2001 +From: Pavel Cahyna +Date: Mon, 13 Nov 2023 18:54:41 +0100 +Subject: [PATCH] Do not mount /sys if already mounted + +Newer versions of systemd (starting with Fedora 39) seem to mount /sys +themselves. Mounting it again leads to errors on the recovery system +startup (startup scripts failing with status=219/CGROUP ), see +https://github.com/rear/rear/issues/3017. + +Check if /sys is already mounted using the `mountpoint` tool and mount it +only if it is not. + +Do the same for the other system mountpoints like /proc, /dev, /dev/pts. +Not sure if they suffer from the same problem, but they probably could. + +N.B. the `mountpoint` command is already among REQUIRED_PROGS. +--- + usr/share/rear/skel/default/etc/scripts/boot | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/usr/share/rear/skel/default/etc/scripts/boot b/usr/share/rear/skel/default/etc/scripts/boot +index 0f221af3e4..f06e759620 100755 +--- a/usr/share/rear/skel/default/etc/scripts/boot ++++ b/usr/share/rear/skel/default/etc/scripts/boot +@@ -4,8 +4,8 @@ + dmesg -n1 + + # basic mounts +-mount -t proc -n none /proc +-mount -t sysfs none /sys ++mountpoint /proc || mount -t proc -n none /proc ++mountpoint /sys || mount -t sysfs none /sys + + if type udevd &>/dev/null && ! type udevinfo &>/dev/null; then + ### we use udevinfo to filter out old udev versions (<106) that don't +@@ -13,7 +13,7 @@ if type udevd &>/dev/null && ! type udevinfo &>/dev/null; then + udev_version=$(udevd --version) + if [[ "$udev_version" -gt 175 ]]; then + ### udev > 175 needs devtmpfs +- mount -t devtmpfs none /dev ++ mountpoint /dev || mount -t devtmpfs none /dev + fi + fi + +@@ -26,7 +26,7 @@ if [[ ! -L /dev/fd ]] ; then + ln -s /proc/self/fd /dev/fd + fi + +-mount -t devpts -o gid=5,mode=620 none /dev/pts ++mountpoint /dev/pts || mount -t devpts -o gid=5,mode=620 none /dev/pts + + cat /proc/mounts >/etc/mtab 2>/dev/null + diff --git a/rear.spec b/rear.spec index 626a8d9..eca8c50 100644 --- a/rear.spec +++ b/rear.spec @@ -3,7 +3,7 @@ Name: rear Version: 2.7 -Release: 2%{?dist} +Release: 3%{?dist} Summary: Relax-and-Recover is a Linux disaster recovery and system migration tool URL: https://relax-and-recover.org License: GPL-3.0-only @@ -53,6 +53,10 @@ Patch108: rear-save-lvm-poolmetadatasize-RHEL-6984.patch # https://github.com/rear/rear/commit/ed4c78d5fe493ea368989d0086a733653692f5cb Patch109: rear-skip-useless-xfs-mount-options-RHEL-10478.patch +# fix unusable recovery with newer systemd +# https://github.com/rear/rear/commit/060fef89b6968f0c8f254e6f612eff839b83c057 +Patch110: rear-fix-compatibility-with-newer-systemd-bz2254871.patch + ###################### # downstream patches # ###################### @@ -191,6 +195,9 @@ install -m 0644 %{SOURCE3} %{buildroot}%{_docdir}/%{name}/ #-- CHANGELOG -----------------------------------------------------------------# %changelog +* Tue Feb 06 2024 Lukáš Zaoral - 2.7-3 +- fix unusable recovery with newer systemd (rbhz#2254871) + * Mon Feb 05 2024 Lukáš Zaoral - 2.7-2 - migrate to SPDX license format - properly use %%license and %%doc macros