import rear-2.4-12.el8

This commit is contained in:
CentOS Sources 2020-04-28 04:51:10 -04:00 committed by Andrew Lukoshko
parent 22c47ad414
commit b32b2fc593
9 changed files with 643 additions and 1 deletions

View File

@ -0,0 +1,33 @@
diff -up rear-2.4/usr/share/rear/conf/GNU/Linux.conf.empty rear-2.4/usr/share/rear/conf/GNU/Linux.conf
--- rear-2.4/usr/share/rear/conf/GNU/Linux.conf.empty 2019-09-10 09:45:50.381285069 +0200
+++ rear-2.4/usr/share/rear/conf/GNU/Linux.conf 2019-09-10 09:45:50.421284309 +0200
@@ -276,6 +276,6 @@ COPY_AS_IS_EXCLUDE=( "${COPY_AS_IS_EXCLU
# some stuff for the Linux command line
KERNEL_CMDLINE="$KERNEL_CMDLINE selinux=0"
# common users and groups
-CLONE_USERS=( "${CLONE_USERS[@]:-}" daemon rpc usbmuxd usbmux vcsa nobody dbus )
-CLONE_GROUPS=( "${CLONE_GROUPS[@]:-}" tty usbmuxd usbmux fuse kvm oinstall dbus )
+CLONE_USERS+=( daemon rpc usbmuxd usbmux vcsa nobody dbus )
+CLONE_GROUPS+=( tty usbmuxd usbmux fuse kvm oinstall dbus )
diff -up rear-2.4/usr/share/rear/rescue/default/900_clone_users_and_groups.sh.empty rear-2.4/usr/share/rear/rescue/default/900_clone_users_and_groups.sh
--- rear-2.4/usr/share/rear/rescue/default/900_clone_users_and_groups.sh.empty 2018-06-21 10:40:53.000000000 +0200
+++ rear-2.4/usr/share/rear/rescue/default/900_clone_users_and_groups.sh 2019-09-10 09:45:50.421284309 +0200
@@ -40,6 +40,8 @@ local group=""
# because it should succeed when there is any non-empty array member, not necessarily the first one:
test "${CLONE_USERS[*]}" && Log "Cloning users: ${CLONE_USERS[@]}"
for user in "${CLONE_USERS[@]}" ; do
+ # Skip empty user values, cf. https://github.com/rear/rear/issues/2220
+ test $user || continue
# Skip if the user exists already in the ReaR recovery system:
grep -q "^$user:" $ROOTFS_DIR/etc/passwd && continue
# Skip if the user does not exist in the current system:
@@ -78,6 +80,8 @@ done
# because it should succeed when there is any non-empty array member, not necessarily the first one:
test "${CLONE_GROUPS[*]}" && Log "Cloning groups: ${CLONE_GROUPS[@]}"
for group in "${CLONE_GROUPS[@]}" ; do
+ # Skip empty group values, cf. https://github.com/rear/rear/issues/2220
+ test $group || continue
# Skip if the group exists already in the ReaR recovery system:
grep -q "^$group:" $ROOTFS_DIR/etc/group && continue
# Skip if the group does not exist in the current system:

View File

@ -0,0 +1,113 @@
diff -up rear-2.4/usr/share/rear/build/default/980_verify_rootfs.sh.build rear-2.4/usr/share/rear/build/default/980_verify_rootfs.sh
--- rear-2.4/usr/share/rear/build/default/980_verify_rootfs.sh.build 2019-09-10 09:31:05.971102125 +0200
+++ rear-2.4/usr/share/rear/build/default/980_verify_rootfs.sh 2019-09-10 09:31:06.002101535 +0200
@@ -3,6 +3,33 @@
# i.e. test that the ReaR recovery system will be usable
# to avoid issues like https://github.com/rear/rear/issues/1494
+if test "$KEEP_BUILD_DIR" = "errors"; then
+ local keep_build_dir_on_errors=1
+else
+ # KEEP_BUILD_DIR does not say to keep it on errors
+ # - effective value depends on whether we are running interactively
+ if tty -s ; then
+ local keep_build_dir_on_errors=1
+ else
+ local keep_build_dir_on_errors=0
+ fi
+fi
+
+function keep_build_dir() {
+ if ! is_true "$KEEP_BUILD_DIR" && ! is_false "$KEEP_BUILD_DIR"; then
+ # is either empty or equal to "errors" ... or some garbage value
+ local orig_keep_build_dir="$KEEP_BUILD_DIR"
+ KEEP_BUILD_DIR="${keep_build_dir_on_errors}"
+ fi
+ if is_true "$KEEP_BUILD_DIR" ; then
+ LogPrintError "Build area kept for investigation in $BUILD_DIR, remove it when not needed"
+ elif ! is_false "$orig_keep_build_dir" ; then
+ # if users disabled preserving the build dir explicitly, let's not bother them with messages
+ LogPrintError "Build area $BUILD_DIR will be removed"
+ LogPrintError "To preserve it for investigation set KEEP_BUILD_DIR=errors or run ReaR with -d"
+ fi
+}
+
# In case the filesystem that contains the ROOTFS_DIR is mounted 'noexec' we cannot do the 'chroot' tests.
# The filesystem_name function in linux-functions.sh returns the mountpoint (not a filesystem name like 'ext4'):
local rootfs_dir_fs_mountpoint=$( filesystem_name $ROOTFS_DIR )
@@ -16,7 +43,7 @@ Log "Testing that $ROOTFS_DIR contains a
# The bash test ensures that we have a working bash in the ReaR recovery system:
if ! chroot $ROOTFS_DIR /bin/bash -c true ; then
- KEEP_BUILD_DIR=1
+ keep_build_dir
BugError "ReaR recovery system in '$ROOTFS_DIR' is broken: 'bash -c true' failed"
fi
@@ -25,7 +52,7 @@ fi
# First test is 'ldd /bin/bash' to ensure 'ldd' works:
Log "Testing 'ldd /bin/bash' to ensure 'ldd' works for the subsequent 'ldd' tests"
if ! chroot $ROOTFS_DIR /bin/ldd /bin/bash 1>&2 ; then
- KEEP_BUILD_DIR=1
+ keep_build_dir
BugError "ReaR recovery system in '$ROOTFS_DIR' is broken: 'ldd /bin/bash' failed"
fi
# Now test each binary (except links) with ldd and look for 'not found' libraries.
@@ -83,7 +110,7 @@ test $old_LD_LIBRARY_PATH && export LD_L
# Report binaries with 'not found' shared object dependencies:
if contains_visible_char "$broken_binaries" ; then
LogPrintError "There are binaries or libraries in the ReaR recovery system that need additional libraries"
- KEEP_BUILD_DIR=1
+ keep_build_dir
local fatal_missing_library=""
local ldd_output=""
for binary in $broken_binaries ; do
@@ -113,9 +140,10 @@ if contains_visible_char "$broken_binari
# 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" )"
done
+ LogPrintError "ReaR recovery system in '$ROOTFS_DIR' needs additional libraries, check $RUNTIME_LOGFILE for details"
+ is_true "$fatal_missing_library" && keep_build_dir
# Usually it should be no BugError when there are libraries missing for particular binaries because probably
# the reason is that the user added only the plain binaries with COPY_AS_IS (instead of using REQUIRED_PROGS):
is_true "$fatal_missing_library" && Error "ReaR recovery system in '$ROOTFS_DIR' not usable"
- LogPrintError "ReaR recovery system in '$ROOTFS_DIR' needs additional libraries, check $RUNTIME_LOGFILE for details"
fi
diff -up rear-2.4/usr/share/rear/conf/default.conf.build rear-2.4/usr/share/rear/conf/default.conf
--- rear-2.4/usr/share/rear/conf/default.conf.build 2019-09-10 09:31:05.996101649 +0200
+++ rear-2.4/usr/share/rear/conf/default.conf 2019-09-10 09:31:06.002101535 +0200
@@ -125,9 +125,19 @@ OS_VERSION=none
# supported values that could make it work even for your system.
# See the SetOSVendorAndVersion function in the config-functions.sh script.
-# Keep the build area after we are done (BOOL).
+# Keep the build area after we are done (ternary).
# Useful to inspect the ReaR recovery system content in $TMPDIR/rear.XXXXXXXXXXXXXXX/rootfs/
-# directly without the need to extract it from the initramfs/initrd in the ISO image:
+# directly without the need to extract it from the initramfs/initrd in the ISO image.
+# Set to "y", "Yes", etc. to always keep the build area, to "n", "No", etc. to never keep it.
+# KEEP_BUILD_DIR is automatically set to true in debug mode (-d) and in debugscript mode (-D).
+# In addition to true (any value that is recognized as 'yes' by the is_true function)
+# and false (any value that is recognized as 'no' by the is_false function) it can be set
+# to several special values:
+# - "errors" to obtain the old behaviour where KEEP_BUILD_DIR was always set
+# to true to keep the build area when errors in the ReaR recovery system were detected.
+# - empty (KEEP_BUILD_DIR="") which means that the build area will be kept on errors
+# if running interactively (in a terminal) and not otherwise (to avoid cluttering
+# /tmp by cron or other automated jobs in case of errors).
KEEP_BUILD_DIR=""
# No default workflows. This variable is filled in where the workflows are defined
diff -up rear-2.4/usr/share/rear/lib/framework-functions.sh.build rear-2.4/usr/share/rear/lib/framework-functions.sh
--- rear-2.4/usr/share/rear/lib/framework-functions.sh.build 2018-06-21 10:40:53.000000000 +0200
+++ rear-2.4/usr/share/rear/lib/framework-functions.sh 2019-09-10 09:31:06.002101535 +0200
@@ -106,7 +106,7 @@ function SourceStage () {
function cleanup_build_area_and_end_program () {
# Cleanup build area
Log "Finished in $((SECONDS-STARTTIME)) seconds"
- if test "$KEEP_BUILD_DIR" ; then
+ if is_true "$KEEP_BUILD_DIR" ; then
LogPrint "You should also rm -Rf $BUILD_DIR"
else
Log "Removing build area $BUILD_DIR"

View File

@ -0,0 +1,12 @@
diff -up rear-2.4/usr/share/rear/conf/default.conf.nbu rear-2.4/usr/share/rear/conf/default.conf
--- rear-2.4/usr/share/rear/conf/default.conf.nbu 2019-09-10 09:37:56.619290929 +0200
+++ rear-2.4/usr/share/rear/conf/default.conf 2019-09-10 09:37:56.621290891 +0200
@@ -1480,7 +1480,7 @@ OBDR_BLOCKSIZE=2048
#
COPY_AS_IS_NBU=( /usr/openv/bin/vnetd /usr/openv/bin/vopied /usr/openv/lib /usr/openv/netbackup /usr/openv/var/auth/[mn]*.txt )
COPY_AS_IS_EXCLUDE_NBU=( "/usr/openv/netbackup/logs/*" "/usr/openv/netbackup/bin/bpjava*" /usr/openv/netbackup/bin/xbp /usr/openv/netbackup/bin/private /usr/openv/lib/java /usr/openv/lib/shared/vddk /usr/openv/netbackup/baremetal )
-NBU_LD_LIBRARY_PATH="/usr/openv/lib"
+NBU_LD_LIBRARY_PATH="/usr/openv/lib:/usr/openv/netbackup/sec/at/lib/"
PROGS_NBU=( )
##

View File

@ -0,0 +1,87 @@
diff --git a/usr/share/rear/layout/save/GNU/Linux/230_filesystem_layout.sh b/usr/share/rear/layout/save/GNU/Linux/230_filesystem_layout.sh
index 2fc8ccd3..60306718 100644
--- a/usr/share/rear/layout/save/GNU/Linux/230_filesystem_layout.sh
+++ b/usr/share/rear/layout/save/GNU/Linux/230_filesystem_layout.sh
@@ -50,13 +50,28 @@ fi
# so that in particular what is mounted at '/' is output before other stuff.
read_filesystems_command="$read_filesystems_command | sort -t ' ' -k 1,1 -u"
-# docker daemon mounts file systems for its docker containers
-# see also https://docs.docker.com/storage/storagedriver/device-mapper-driver/#configure-direct-lvm-mode-for-production
-# As it is for container usage only we do not to backup these up or recreate as this disk device is completely under
-# control by docker itself (even the recreation of it incl, the creation of the volume group). Usually this is
-# done via a kind of cookbook (Chef, puppet or ansible)
+# The Docker daemon mounts file systems for its Docker containers, see also
+# https://docs.docker.com/storage/storagedriver/device-mapper-driver/#configure-direct-lvm-mode-for-production
+# As it is for container usage only we do not to backup these up or recreate as this disk device is completely
+# under control by Docker itself (even the recreation of it incl, the creation of the volume group).
+# Usually this is done via a kind of cookbook (Chef, puppet or ansible).
docker_is_running=""
-service docker status >/dev/null 2>&1 && docker_is_running="yes"
+docker_root_dir=""
+if service docker status &>/dev/null ; then
+ docker_is_running="yes"
+ # When the Docker daemon/service is running, try to get its 'Docker Root Dir':
+ # Kill 'docker info' with SIGTERM after 5 seconds and with SIGKILL after additional 2 seconds
+ # because there are too many crippled Docker installations, cf. https://github.com/rear/rear/pull/2021
+ docker_root_dir=$( timeout -k 2s 5s docker info | grep 'Docker Root Dir' | awk '{print $4}' )
+ # Things may go wrong in the 'Docker specific exclude part' below
+ # when Docker is used but its 'Docker Root Dir' cannot be determined
+ # cf. https://github.com/rear/rear/issues/1989
+ if test "$docker_root_dir" ; then
+ LogPrint "Docker is running, skipping filesystems mounted below Docker Root Dir $docker_root_dir"
+ else
+ LogPrintError "Cannot determine Docker Root Dir - things may go wrong - check $DISKLAYOUT_FILE"
+ fi
+fi
# Begin writing output to DISKLAYOUT_FILE:
(
@@ -64,9 +79,10 @@ service docker status >/dev/null 2>&1 && docker_is_running="yes"
echo "# Format: fs <device> <mountpoint> <fstype> [uuid=<uuid>] [label=<label>] [<attributes>]"
# Read the output of the read_filesystems_command:
while read device mountpoint fstype options junk ; do
+ Log "Processing filesystem '$fstype' on '$device' mounted at '$mountpoint'"
# Empty device or mountpoint or fstype may may indicate an error. In this case be verbose and inform the user:
if test -z "$device" -o -z "$mountpoint" -o -z "$fstype" ; then
- LogPrint "Empty device='$device' or mountpoint='$mountpoint' or fstype='$fstype', skipping saving filesystem layout for it."
+ LogPrintError "Empty device='$device' or mountpoint='$mountpoint' or fstype='$fstype', skipping saving filesystem layout for it."
continue
fi
# FIXME: I (jsmeix@suse.de) have no idea what the reason for the following is.
@@ -88,15 +104,18 @@ service docker status >/dev/null 2>&1 && docker_is_running="yes"
Log "$device is CD/DVD type device [fstype=$fstype], skipping."
continue
fi
- # docker specific exclude part
+ # Docker specific exclude part:
if is_true $docker_is_running ; then
- # docker daemon/service is running
- docker_root_dir=$( docker info 2>/dev/null | grep 'Docker Root Dir' | awk '{print $4}' )
- # If $docker_root_dir is in the beginning of the $mountpoint string then FS is under docker control
- # and we better exclude from saving the layout,
- # see https://github.com/rear/rear/issues/1749
- Log "$device is mounted below $docker_root_dir (mount point $mountpoint is under docker control), skipping."
- echo "$mountpoint" | grep -q "^$docker_root_dir" && continue
+ # If docker_root_dir is the beginning of the mountpoint string then the filesystem is under Docker control
+ # and we better exclude it from saving the layout, see https://github.com/rear/rear/issues/1749
+ # but ensure docker_root_dir is not empty (otherwise any mountpoint string matches "^" which
+ # would skip all mountpoints), see https://github.com/rear/rear/issues/1989#issuecomment-456054278
+ if test "$docker_root_dir" ; then
+ if echo "$mountpoint" | grep -q "^$docker_root_dir" ; then
+ Log "Filesystem $fstype on $device mounted at $mountpoint is below Docker Root Dir $docker_root_dir, skipping."
+ continue
+ fi
+ fi
fi
# Replace a symbolic link /dev/disk/by-uuid/a1b2c3 -> ../../sdXn
# by the fully canonicalized target of the link e.g. /dev/sdXn
@@ -232,7 +251,7 @@ service docker status >/dev/null 2>&1 && docker_is_running="yes"
test -z "$btrfs_default_subvolume_path" && btrfs_default_subvolume_path="/"
# Empty btrfs_default_subvolume_ID may may indicate an error. In this case be verbose and inform the user:
if test -z "$btrfs_default_subvolume_ID" ; then
- LogPrint "Empty btrfs_default_subvolume_ID, no btrfs default subvolume stored for $btrfs_device at $btrfs_mountpoint"
+ LogPrintError "Empty btrfs_default_subvolume_ID, no btrfs default subvolume stored for $btrfs_device at $btrfs_mountpoint"
else
echo "btrfsdefaultsubvol $btrfs_device $btrfs_mountpoint $btrfs_default_subvolume_ID $btrfs_default_subvolume_path"
fi

View File

@ -0,0 +1,17 @@
diff --git a/usr/share/rear/restore/BACULA/default/400_restore_backup.sh b/usr/share/rear/restore/BACULA/default/400_restore_backup.sh
index eac4d275..d21af71c 100644
--- a/usr/share/rear/restore/BACULA/default/400_restore_backup.sh
+++ b/usr/share/rear/restore/BACULA/default/400_restore_backup.sh
@@ -110,7 +110,11 @@ WARNING: The new root is mounted under '$TARGET_FS_ROOT'.
Press ENTER to start bconsole"
read
- bconsole
+ if bconsole 0<&6 1>&7 2>&8 ; then
+ Log "bconsole finished with zero exit code"
+ else
+ Log "bconsole finished with non-zero exit code $?"
+ fi
LogPrint "
Please verify that the backup has been restored correctly to '$TARGET_FS_ROOT'

View File

@ -0,0 +1,119 @@
diff --git a/usr/share/rear/layout/save/GNU/Linux/220_lvm_layout.sh b/usr/share/rear/layout/save/GNU/Linux/220_lvm_layout.sh
index e43ff896..a9730435 100644
--- a/usr/share/rear/layout/save/GNU/Linux/220_lvm_layout.sh
+++ b/usr/share/rear/layout/save/GNU/Linux/220_lvm_layout.sh
@@ -53,6 +53,7 @@ Log "Saving LVM layout."
done
header_printed=0
+ already_processed_lvs=""
## Get all logical volumes
# format: lvmvol <volume_group> <name> <size(bytes)> <layout> [key:value ...]
@@ -61,7 +62,7 @@ Log "Saving LVM layout."
if lvm lvs -o lv_layout >/dev/null 2>&1; then
- lvm 8>&- 7>&- lvs --separator=":" --noheadings --units b --nosuffix -o origin,lv_name,vg_name,lv_size,lv_layout,pool_lv,chunk_size,stripes,stripe_size | while read line ; do
+ lvm 8>&- 7>&- lvs --separator=":" --noheadings --units b --nosuffix -o origin,lv_name,vg_name,lv_size,lv_layout,pool_lv,chunk_size,stripes,stripe_size,seg_size | while read line ; do
if [ $header_printed -eq 0 ] ; then
echo "# Format for LVM LVs"
@@ -72,7 +73,7 @@ Log "Saving LVM layout."
origin="$(echo "$line" | awk -F ':' '{ print $1 }')"
# Skip snapshots (useless) or caches (dont know how to handle that)
if [ -n "$origin" ] ; then
- echo "# Skipped snapshot of cache information '$line'"
+ echo "# Skipped snapshot or cache information '$line'"
continue
fi
@@ -84,25 +85,45 @@ Log "Saving LVM layout."
chunksize="$(echo "$line" | awk -F ':' '{ print $7 }')"
stripes="$(echo "$line" | awk -F ':' '{ print $8 }')"
stripesize="$(echo "$line" | awk -F ':' '{ print $9 }')"
+ segmentsize="$(echo "$line" | awk -F ':' '{ print $10 }')"
kval=""
+ infokval=""
[ -z "$thinpool" ] || kval="${kval:+$kval }thinpool:$thinpool"
[ $chunksize -eq 0 ] || kval="${kval:+$kval }chunksize:${chunksize}b"
[ $stripesize -eq 0 ] || kval="${kval:+$kval }stripesize:${stripesize}b"
+ [ $segmentsize -eq $size ] || infokval="${infokval:+$infokval }segmentsize:${segmentsize}b"
if [[ ,$layout, == *,mirror,* ]] ; then
kval="${kval:+$kval }mirrors:$(($stripes - 1))"
elif [[ ,$layout, == *,striped,* ]] ; then
kval="${kval:+$kval }stripes:$stripes"
fi
- echo "lvmvol /dev/$vg $lv ${size}b $layout $kval"
+ if [[ " $already_processed_lvs " == *\ $vg/$lv\ * ]] ; then
+ # The LV has multiple segments; the create_lvmvol() function in
+ # 110_include_lvm_code.sh is not able to recreate this, but
+ # keep the information for the administrator anyway.
+ echo "#lvmvol /dev/$vg $lv ${size}b $layout $kval"
+ if [ -n "$infokval" ] ; then
+ echo "# extra parameters for the line above not taken into account when restoring using 'lvcreate': $infokval"
+ fi
+ else
+ if [ $segmentsize -ne $size ] ; then
+ echo "# WARNING: Volume $vg/$lv has multiple segments. Restoring it in Migration Mode using 'lvcreate' won't preserve segments and properties of the other segments as well!"
+ fi
+ echo "lvmvol /dev/$vg $lv ${size}b $layout $kval"
+ if [ -n "$infokval" ] ; then
+ echo "# extra parameters for the line above not taken into account when restoring using 'lvcreate': $infokval"
+ fi
+ already_processed_lvs="${already_processed_lvs:+$already_processed_lvs }$vg/$lv"
+ fi
done
else
# Compatibility with older LVM versions (e.g. <= 2.02.98)
# No support for 'lv_layout', too bad, do our best!
- lvm 8>&- 7>&- lvs --separator=":" --noheadings --units b --nosuffix -o origin,lv_name,vg_name,lv_size,modules,pool_lv,chunk_size,stripes,stripe_size | while read line ; do
+ lvm 8>&- 7>&- lvs --separator=":" --noheadings --units b --nosuffix -o origin,lv_name,vg_name,lv_size,modules,pool_lv,chunk_size,stripes,stripe_size,seg_size | while read line ; do
if [ $header_printed -eq 0 ] ; then
echo "# Format for LVM LVs"
@@ -125,11 +146,14 @@ Log "Saving LVM layout."
chunksize="$(echo "$line" | awk -F ':' '{ print $7 }')"
stripes="$(echo "$line" | awk -F ':' '{ print $8 }')"
stripesize="$(echo "$line" | awk -F ':' '{ print $9 }')"
+ segmentsize="$(echo "$line" | awk -F ':' '{ print $10 }')"
kval=""
+ infokval=""
[ -z "$thinpool" ] || kval="${kval:+$kval }thinpool:$thinpool"
[ $chunksize -eq 0 ] || kval="${kval:+$kval }chunksize:${chunksize}b"
[ $stripesize -eq 0 ] || kval="${kval:+$kval }stripesize:${stripesize}b"
+ [ $segmentsize -eq $size ] || infokval="${infokval:+$infokval }segmentsize:${segmentsize}b"
if [[ "$modules" == "" ]] ; then
layout="linear"
[ $stripes -eq 0 ] || kval="${kval:+$kval }stripes:$stripes"
@@ -148,7 +172,24 @@ Log "Saving LVM layout."
kval="${kval:+$kval }stripes:$stripes"
fi
- echo "lvmvol /dev/$vg $lv ${size}b $layout $kval"
+ if [[ " $already_processed_lvs " == *\ $vg/$lv\ * ]]; then
+ # The LV has multiple segments; the create_lvmvol() function in
+ # 110_include_lvm_code.sh is not able to recreate this, but
+ # keep the information for the administrator anyway.
+ echo "#lvmvol /dev/$vg $lv ${size}b $layout $kval"
+ if [ -n "$infokval" ] ; then
+ echo "# extra parameters for the line above not taken into account when restoring using 'lvcreate': $infokval"
+ fi
+ else
+ if [ $segmentsize -ne $size ] ; then
+ echo "# WARNING: Volume $vg/$lv has multiple segments. Restoring it in Migration Mode using 'lvcreate' won't preserve segments and properties of the other segments as well!"
+ fi
+ echo "lvmvol /dev/$vg $lv ${size}b $layout $kval"
+ if [ -n "$infokval" ] ; then
+ echo "# extra parameters for the line above not taken into account when restoring using 'lvcreate': $infokval"
+ fi
+ already_processed_lvs="${already_processed_lvs:+$already_processed_lvs }$vg/$lv"
+ fi
done
fi

View File

@ -0,0 +1,194 @@
diff --git a/usr/share/rear/lib/uefi-functions.sh b/usr/share/rear/lib/uefi-functions.sh
index 95e6292d..c583e044 100644
--- a/usr/share/rear/lib/uefi-functions.sh
+++ b/usr/share/rear/lib/uefi-functions.sh
@@ -37,20 +37,76 @@ function trim {
}
function build_bootx86_efi {
- local gmkimage
- if has_binary grub-mkimage; then
- gmkimage=grub-mkimage
- elif has_binary grub2-mkimage; then
- gmkimage=grub2-mkimage
+ local outfile="$1"
+ local embedded_config=""
+ local gmkstandalone=""
+ local gprobe=""
+ local dirs=()
+ # modules is the list of modules to load
+ local modules=()
+
+ # Configuration file is optional for image creation.
+ shift
+ if [[ -n "$1" ]] ; then
+ # graft point syntax. $1 will appear as /boot/grub/grub.cfg in the image
+ embedded_config="/boot/grub/grub.cfg=$1"
+ shift
+ # directories that should be accessible by GRUB2 (e.g. because they contain the kernel)
+ dirs=( ${@:+"$@"} )
+ fi
+
+ if has_binary grub-mkstandalone ; then
+ gmkstandalone=grub-mkstandalone
+ elif has_binary grub2-mkstandalone ; then
+ # At least SUSE systems use 'grub2' prefixed names for GRUB2 programs:
+ gmkstandalone=grub2-mkstandalone
else
- Log "Did not find grub-mkimage (cannot build bootx86.efi)"
- return
+ # This build_bootx86_efi function is only called in output/ISO/Linux-i386/250_populate_efibootimg.sh
+ # which runs only if UEFI is used so that we simply error out here if we cannot make a bootable EFI image of GRUB2
+ # (normally a function should not exit out but return to its caller with a non-zero return code):
+ Error "Cannot make bootable EFI image of GRUB2 (neither grub-mkstandalone nor grub2-mkstandalone found)"
+ fi
+
+ # Determine what modules need to be loaded in order to access given directories
+ # (if the list of modules is not overriden by GRUB2_MODULES_LOAD)
+ if (( ${#dirs[@]} )) && ! (( ${#modules[@]} )) ; then
+ if has_binary grub-probe ; then
+ gprobe=grub-probe
+ elif has_binary grub2-probe ; then
+ # At least SUSE systems use 'grub2' prefixed names for GRUB2 programs:
+ gprobe=grub2-probe
+ else
+ LogWarn "Neither grub-probe nor grub2-probe found"
+ if test /usr/lib/grub*/x86_64-efi/partmap.lst ; then
+ LogWarn "including all partition modules"
+ modules=( $(cat /usr/lib/grub*/x86_64-efi/partmap.lst) )
+ else
+ Error "Can not determine partition modules, ${dirs[*]} would be likely inaccessible in GRUB2"
+ fi
+ fi
+
+ if [ -n "$gprobe" ]; then
+ # this is unfortunately only a crude approximation of the Grub internal probe_mods() function
+ modules=( $( for p in "${dirs[@]}" ; do
+ $gprobe --target=fs "$p"
+ $gprobe --target=partmap "$p" | sed -e 's/^/part_/'
+ $gprobe --target=abstraction "$p"
+ done | sort -u ) )
+ fi
+ fi
+
+ # grub-mkimage needs /usr/lib/grub/x86_64-efi/moddep.lst (cf. https://github.com/rear/rear/issues/1193)
+ # and at least on SUSE systems grub2-mkimage needs /usr/lib/grub2/x86_64-efi/moddep.lst (in 'grub2' directory)
+ # so that we error out if grub-mkimage or grub2-mkimage would fail when its moddep.lst is missing.
+ # Careful: usr/sbin/rear sets nullglob so that /usr/lib/grub*/x86_64-efi/moddep.lst gets empty if nothing matches
+ # and 'test -f' succeeds with empty argument so that we cannot use 'test -f /usr/lib/grub*/x86_64-efi/moddep.lst'
+ # also 'test -n' succeeds with empty argument but (fortunately/intentionally?) plain 'test' fails with empty argument:
+ test /usr/lib/grub*/x86_64-efi/moddep.lst || Error "$gmkstandalone would not make bootable EFI image of GRUB2 (no /usr/lib/grub*/x86_64-efi/moddep.lst file)"
+
+ (( ${#modules[@]} )) && LogPrint "GRUB2 modules to load: ${modules[*]}"
+
+ if ! $gmkstandalone $v ${modules:+"--modules=${modules[*]}"} -O x86_64-efi -o $outfile $embedded_config ; then
+ Error "Failed to make bootable EFI image of GRUB2 (error during $gmkstandalone of $outfile)"
fi
- # as not all Linux distro's have the same grub modules present we verify what we have (see also https://github.com/rear/rear/pull/2001)
- grub_modules=""
- for grub_module in part_gpt part_msdos fat ext2 normal chain boot configfile linux linuxefi multiboot jfs iso9660 usb usbms usb_keyboard video udf ntfs all_video gzio efi_gop reboot search test echo btrfs ; do
- test "$( find /boot -type f -name "$grub_module.mod" 2>/dev/null )" && grub_modules="$grub_modules $grub_module"
- done
- $gmkimage $v -O x86_64-efi -c $TMP_DIR/mnt/EFI/BOOT/embedded_grub.cfg -o $TMP_DIR/mnt/EFI/BOOT/BOOTX64.efi -p "/EFI/BOOT" $grub_modules
- StopIfError "Error occurred during $gmkimage of BOOTX64.efi"
}
+
diff --git a/usr/share/rear/output/ISO/Linux-i386/250_populate_efibootimg.sh b/usr/share/rear/output/ISO/Linux-i386/250_populate_efibootimg.sh
index fdf66039..e9325012 100644
--- a/usr/share/rear/output/ISO/Linux-i386/250_populate_efibootimg.sh
+++ b/usr/share/rear/output/ISO/Linux-i386/250_populate_efibootimg.sh
@@ -2,6 +2,9 @@
is_true $USING_UEFI_BOOTLOADER || return 0 # empty or 0 means NO UEFI
+local boot_dir="/boot"
+local efi_boot_tmp_dir="$TMP_DIR/mnt/EFI/BOOT"
+
mkdir $v -p $TMP_DIR/mnt/EFI/BOOT >&2
StopIfError "Could not create $TMP_DIR/mnt/EFI/BOOT"
@@ -56,14 +59,8 @@ title Relax-and-Recover (no Secure Boot)
EOF
else
-# create small embedded grub.cfg file for grub-mkimage
-cat > $TMP_DIR/mnt/EFI/BOOT/embedded_grub.cfg <<EOF
-set prefix=(cd0)/EFI/BOOT
-configfile /EFI/BOOT/grub.cfg
-EOF
-
-# create a grub.cfg
- create_grub2_cfg > $TMP_DIR/mnt/EFI/BOOT/grub.cfg
+ # create a grub.cfg
+ create_grub2_cfg > $efi_boot_tmp_dir/grub.cfg
fi
# Create BOOTX86.efi but only if we are NOT secure booting.
@@ -72,15 +69,15 @@ fi
# See issue #1374
# build_bootx86_efi () can be safely used for other scenarios.
if ! test -f "$SECURE_BOOT_BOOTLOADER" ; then
- build_bootx86_efi
+ build_bootx86_efi $TMP_DIR/mnt/EFI/BOOT/BOOTX64.efi $efi_boot_tmp_dir/grub.cfg "$boot_dir" "$UEFI_BOOTLOADER"
fi
# We will be using grub-efi or grub2 (with efi capabilities) to boot from ISO.
# Because usr/sbin/rear sets 'shopt -s nullglob' the 'echo -n' command
# outputs nothing if nothing matches the bash globbing pattern '/boot/grub*'
-local grubdir="$( echo -n /boot/grub* )"
+local grubdir="$( echo -n ${boot_dir}/grub* )"
# Use '/boot/grub' as fallback if nothing matches '/boot/grub*'
-test -d "$grubdir" || grubdir='/boot/grub'
+test -d "$grubdir" || grubdir="${boot_dir}/grub"
if [ -d $(dirname ${UEFI_BOOTLOADER})/fonts ]; then
cp $v $(dirname ${UEFI_BOOTLOADER})/fonts/* $TMP_DIR/mnt/EFI/BOOT/fonts/ >&2
diff --git a/usr/share/rear/output/default/940_grub2_rescue.sh b/usr/share/rear/output/default/940_grub2_rescue.sh
index a94957de..fbbd7074 100644
--- a/usr/share/rear/output/default/940_grub2_rescue.sh
+++ b/usr/share/rear/output/default/940_grub2_rescue.sh
@@ -144,13 +144,18 @@ if is_true $USING_UEFI_BOOTLOADER ; then
# probably a bug, as I was able to boot with value set to root=anything
root_uuid=$(mount | grep -w 'on /' | awk '{print $1}' | xargs blkid -s UUID -o value)
- # Grub2 modules that will be used for booting "Relax-and-Recover"
- # It might be useful to make this variable global in the future
- grub2_modules="linux echo all_video part_gpt ext2 btrfs search configfile"
-
# Create configuration file for "Relax-and-Recover" UEFI boot entry.
# This file will not interact with existing Grub2 configuration in any way.
- ( echo "menuentry '$grub_rear_menu_entry_name' --class os {"
+ ( echo "set btrfs_relative_path=y"
+ echo "insmod efi_gop"
+ echo "insmod efi_uga"
+ echo "insmod video_bochs"
+ echo "insmod video_cirrus"
+ echo "insmod all_video"
+ echo ""
+ echo "set gfxpayload=keep"
+ echo ""
+ echo "menuentry '$grub_rear_menu_entry_name' --class os {"
echo " search --no-floppy --fs-uuid --set=root $grub_boot_uuid"
echo " echo 'Loading kernel $boot_kernel_file ...'"
echo " linux $grub_boot_dir/$boot_kernel_name root=UUID=$root_uuid $KERNEL_CMDLINE"
@@ -159,19 +164,8 @@ if is_true $USING_UEFI_BOOTLOADER ; then
echo "}"
) > $grub_config_dir/rear.cfg
- # Tell rear.efi which configuration file to load
- ( echo "search --no-floppy --fs-uuid --set=root $grub_boot_uuid"
- echo ""
- echo "set btrfs_relative_path=y"
- echo "set prefix=(\$root)${grub_boot_dir}/grub${grub_num}"
- echo ""
- echo "configfile (\$root)${grub_boot_dir}/grub${grub_num}/rear.cfg"
- ) > $grub_config_dir/rear_embed.cfg
-
# Create rear.efi at UEFI default boot directory location.
- if ! grub${grub_num}-mkimage -o $boot_dir/efi/EFI/BOOT/rear.efi -O x86_64-efi -c $grub_config_dir/rear_embed.cfg -p /EFI/BOOT $grub2_modules ; then
- Error "Could not create UEFI boot image"
- fi
+ build_bootx86_efi $boot_dir/efi/EFI/BOOT/rear.efi $grub_config_dir/rear.cfg "$boot_dir" "$UEFI_BOOTLOADER"
# If UEFI boot entry for "Relax-and-Recover" does not exist, create it.
# This will also add "Relax-and-Recover" to boot order because if UEFI entry is not listed in BootOrder,

View File

@ -0,0 +1,17 @@
diff -up rear-2.4/usr/share/rear/finalize/Fedora/i386/550_rebuild_initramfs.sh.sfdc02343208 rear-2.4/usr/share/rear/finalize/Fedora/i386/550_rebuild_initramfs.sh
--- rear-2.4/usr/share/rear/finalize/Fedora/i386/550_rebuild_initramfs.sh.sfdc02343208 2019-04-09 09:14:05.000000000 +0200
+++ rear-2.4/usr/share/rear/finalize/Fedora/i386/550_rebuild_initramfs.sh 2019-04-09 09:14:53.000000000 +0200
@@ -65,6 +65,7 @@ WITH_INITRD_MODULES=$( printf '%s\n' ${I
mount -t proc none $TARGET_FS_ROOT/proc
mount -t sysfs none $TARGET_FS_ROOT/sys
+mount -o bind /run $TARGET_FS_ROOT/run
# Recreate any initrd or initramfs image under $TARGET_FS_ROOT/boot/ with new drivers
# Images ignored:
@@ -109,4 +110,4 @@ and decide yourself, whether the system
fi
done
-umount $TARGET_FS_ROOT/proc $TARGET_FS_ROOT/sys
+umount $TARGET_FS_ROOT/proc $TARGET_FS_ROOT/sys $TARGET_FS_ROOT/run

View File

@ -3,7 +3,7 @@
Summary: Relax-and-Recover is a Linux disaster recovery and system migration tool
Name: rear
Version: 2.4
Release: 10%{?dist}
Release: 12%{?dist}
License: GPLv3
Group: Applications/File
URL: http://relax-and-recover.org/
@ -21,6 +21,14 @@ patch13: rear-bz1663515.patch
Patch14: rear-bz1672938.patch
Patch15: rear-bz1685166.patch
Patch16: rear-bz1655956.patch
Patch17: rear-bz1732328.patch
Patch18: rear-bz1726982.patch
Patch19: rear-bz1693608.patch
Patch20: rear-bz1700807.patch
Patch21: rear-bz1711123.patch
Patch22: rear-bz1692575.patch
Patch23: rear-sfdc02343208.patch
Patch24: rear-bz1737042.patch
ExcludeArch: s390x
ExcludeArch: s390
@ -118,6 +126,14 @@ fi
%patch14 -p1
%patch15 -p1
%patch16 -p1
%patch17 -p1
%patch18 -p1
%patch19 -p1
%patch20 -p1
%patch21 -p1
%patch22 -p1
%patch23 -p1
%patch24 -p1
echo "30 1 * * * root /usr/sbin/rear checklayout || /usr/sbin/rear mkrescue" >rear.cron
@ -151,6 +167,40 @@ TZ=UTC %{__make} -C doc
%{_sbindir}/rear
%changelog
* Mon Dec 16 2019 Pavel Cahyna <pcahyna@redhat.com> - 2.4-12
- Backport upstream PR #2293 to use grub-mkstandalone instead of
grub-mkimage for UEFI (ISO image and GRUB_RESCUE image generation).
Avoids hardcoded module lists or paths and so is more robust.
Fixes an issue where the generated ISO image had no GRUB2 modules and
was therefore unbootable. The backport does not add new config settings.
Resolves: rhbz1737042
* Mon Nov 18 2019 Pavel Cahyna <pcahyna@redhat.com> - 2.4-11
- Apply upstream PR2122: add additional NBU library path to fix support for
NetBackup 8.
Resolves: rhbz1747393
- Apply upstream PR2021: Be safe against empty docker_root_dir (issue 1989)
Resolves: rhbz1729493, where ReaR can not create a backup in rescue mode,
because it thinks that the Docker daemon is running and hits the problem
with empty docker_root_dir.
- Apply upstream PR2223 and commit 36cf20e to avoid an empty string in the
list of users to clone, which can lead to bash overflow with lots of users
and groups per user and to wrong passwd/group files in the rescue system.
Resolves: rhbz1729495
- Backport of Upstream fix for issue 2035: /run is not mounted in the rescue
chroot, which causes LVM to hang, especially if rebuilding initramfs.
Resolves: rhbz1757488
- Backport upstream PR 2218: avoid keeping build dir on errors
by default when used noninteractively
Resolves: rhbz1729501
- Apply upstream PR2173 - Cannot restore using Bacula method
due to "bconsole" not showing its prompt
Resolves: rhbz1726992
- Backport fix for upstream issue 2187 (disklayout.conf file contains
duplicate lines, breaking recovery in migration mode or when
thin pools are used). PR2194, 2196.
Resolves: rhbz1732308
* Tue Jun 4 2019 Pavel Cahyna <pcahyna@redhat.com> - 2.4-10
- Apply upstream patch PR1993
Automatically exclude $BUILD_DIR from the backup