#3395 Issue closed: Failed to source /usr/share/rear/conf/default.conf

Labels: support / question, fixed / solved / done

Bouncy-Handrail opened issue at 2025-02-04 14:03:

ReaR version

Relax-and-Recover 2.9 / 2025-01-31

Describe the ReaR bug in detail

Hello,

we try to use the "Use from source (portable install)" as advertised in this YouTube Video
https://www.youtube.com/watch?v=QN6vk5DfzAk&t=6s
of ReaR, means we download a release file, extract it, link the /usr/sbin/rear file and run Rear systemwide.

If I try to run rear checklayout I get this error:
Failed to source /usr/share/rear/conf/default.conf

[root@vm ~]# rear checklayout
/sbin/rear: line 382: /usr/share/rear/conf/default.conf: No such file or directory
ERROR: BUG in Relax-and-Recover
Failed to source /usr/share/rear/conf/default.conf
Please report it at https://github.com/rear/rear/issues

Platform

Linux x64

OS version

NAME="Oracle Linux Server" VERSION="9.5" ID="ol" ID_LIKE="fedora" VARIANT="Server" VARIANT_ID="server" VERSION_ID="9.5" PLATFORM_ID="platform:el9" PRETTY_NAME="Oracle Linux Server 9.5" ANSI_COLOR="0;31" CPE_NAME="cpe:/o:oracle:linux:9:5:server" HOME_URL="https://linux.oracle.com/" BUG_REPORT_URL="https://github.com/oracle/oracle-linux"  ORACLE_BUGZILLA_PRODUCT="Oracle Linux 9" ORACLE_BUGZILLA_PRODUCT_VERSION=9.5 ORACLE_SUPPORT_PRODUCT="Oracle Linux" ORACLE_SUPPORT_PRODUCT_VERSION=9.5

Backup

No response

Storage layout

[root@gisu1017 ~]# lsblk -ipo NAME,KNAME,PKNAME,TRAN,TYPE,FSTYPE,LABEL,SIZE,MOUNTPOINT
NAME                        KNAME     PKNAME    TRAN   TYPE FSTYPE      LABEL  SIZE MOUNTPOINT
/dev/sda                    /dev/sda                   disk                     20G 
|-/dev/sda1                 /dev/sda1 /dev/sda         part vfat               600M /boot/efi
|-/dev/sda2                 /dev/sda2 /dev/sda         part xfs                  1G /boot
`-/dev/sda3                 /dev/sda3 /dev/sda         part LVM2_member       18.4G 
  |-/dev/mapper/system-root /dev/dm-0 /dev/sda3        lvm  ext4              17.4G /
  `-/dev/mapper/system-swap /dev/dm-1 /dev/sda3        lvm  swap                 4G [SWAP]
/dev/sdb                    /dev/sdb                   disk LVM2_member          4G 
|-/dev/mapper/system-swap   /dev/dm-1 /dev/sdb         lvm  swap                 4G [SWAP]
`-/dev/mapper/system-data   /dev/dm-2 /dev/sdb         lvm  ext4              1020M /data
/dev/sr0                    /dev/sr0            sata   rom                    1024M

What steps will reproduce the bug?

Workaround, if any

No response

Additional information

No response

jsmeix commented at 2025-02-04 14:51:

As far as I see in
https://www.youtube.com/watch?v=QN6vk5DfzAk&t=6s
the ReaR installation part is at about 18:32 (minute:second)
and there I don't see some symlinking thing
which is the main thing that I do not understand
and where I assume it cannot work.

And yes, it cannot work because
in sbin/rear there is

# Find out if we're running from checkout
REAR_DIR_PREFIX=""
readonly SCRIPT_FILE="$( readlink -f $( type -p "$0" || echo "$0" ) )"
if test "$SCRIPT_FILE" != "$( readlink -f /usr/sbin/$PROGRAM )" ; then
    REAR_DIR_PREFIX=${SCRIPT_FILE%/usr/sbin/$PROGRAM}
fi
readonly REAR_DIR_PREFIX

# Program directories - they must be set here. Everything else is then dynamic.
# Not yet readonly here because they are set via the /etc/rear/rescue.conf file
# in the recovery system that is sourced by the rear command in recover mode
# and CONFIG_DIR can also be changed via '-c' command line option:
SHARE_DIR="$REAR_DIR_PREFIX/usr/share/rear"
CONFIG_DIR="$REAR_DIR_PREFIX/etc/rear"
# Use REAR_VAR=/tmp/rear rear <workflow> to redirect ReaR VAR_DIR for one invocation,
# primarily used by tools/run-in-docker and development
VAR_DIR="${REAR_VAR:-$REAR_DIR_PREFIX/var}/lib/rear"
LOG_DIR="${REAR_VAR:-$REAR_DIR_PREFIX/var}/log/rear"

so when sbin/rear is actually '/opt/rear-2.9/usr/sbin/rear'
then for a symlink '/usr/sbin/rear'
with symlink target '/opt/rear-2.9/usr/sbin/rear'
the above code in sbin/rear does (with 'set -x')

+ REAR_DIR_PREFIX=
+++ type -p /usr/sbin/rear
++ readlink -f /usr/sbin/rear
+ readonly SCRIPT_FILE=/opt/rear-2.9/usr/sbin/rear
+ SCRIPT_FILE=/opt/rear-2.9/usr/sbin/rear
++ readlink -f /usr/sbin/rear
+ test /opt/rear-2.9/usr/sbin/rear '!=' /opt/rear-2.9/usr/sbin/rear
+ readonly REAR_DIR_PREFIX
+ SHARE_DIR=/usr/share/rear
+ CONFIG_DIR=/etc/rear
+ VAR_DIR=/var/lib/rear
+ LOG_DIR=/var/log/rear

which results

# /usr/sbin/rear -D help
/usr/sbin/rear: line ...: /usr/share/rear/conf/default.conf: No such file or directory
ERROR: BUG in Relax-and-Recover
Failed to source /usr/share/rear/conf/default.conf
Please report it at https://github.com/rear/rear/issues

because there is no /usr/share/rear/conf/default.conf file
because it is /opt/rear-2.9/usr/share/rear/conf/default.conf

So you need to use ReaR from within your prefix directory
in the same way as you use it when you did a Git checkout
which we described in our "QUICK START GUIDE" at
https://github.com/rear/rear
and also in
https://relax-and-recover.org/documentation/getting-started
and also in the section
"Testing current ReaR upstream GitHub master code" in my
https://en.opensuse.org/SDB:Disaster_Recovery
basically via

cd /opt/rear-2.9/

and then use relative paths from therein.


[Export of Github issue for rear/rear.]