fix unusable recovery with newer systemd

Resolves: rbhz#2254871
This commit is contained in:
Lukáš Zaoral 2024-02-06 12:56:23 +01:00
parent 35f81198d9
commit 816978a083
No known key found for this signature in database
GPG Key ID: 39157506DD67752D
2 changed files with 62 additions and 1 deletions

View File

@ -0,0 +1,54 @@
From 060fef89b6968f0c8f254e6f612eff839b83c057 Mon Sep 17 00:00:00 2001
From: Pavel Cahyna <pcahyna@redhat.com>
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

View File

@ -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 <lzaoral@redhat.com> - 2.7-3
- fix unusable recovery with newer systemd (rbhz#2254871)
* Mon Feb 05 2024 Lukáš Zaoral <lzaoral@redhat.com> - 2.7-2
- migrate to SPDX license format
- properly use %%license and %%doc macros