#3377 Issue open: 'USE_RESOLV_CONF=n' error with ReaR 2.8 (because USE_RESOLV_CONF is an array)

Labels: documentation, support / question, minor bug

hpannenb opened issue at 2025-01-03 16:19:

  • ReaR version ("/usr/sbin/rear -V"):
    Relax-and-Recover 2.8 / 2024-12-19

  • If your ReaR version is not the current version, explain why you can't upgrade:

  • OS version ("cat /etc/os-release" or "lsb_release -a" or "cat /etc/rear/os.conf"):

NAME="Red Hat Enterprise Linux Server"
VERSION="7.9 (Maipo)"
ID="rhel"
ID_LIKE="fedora"
VARIANT="Server"
VARIANT_ID="server"
VERSION_ID="7.9"
PRETTY_NAME="Red Hat Enterprise Linux"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:redhat:enterprise_linux:7.9:GA:server"
HOME_URL="https://www.redhat.com/"
BUG_REPORT_URL="https://bugzilla.redhat.com/"

REDHAT_BUGZILLA_PRODUCT="Red Hat Enterprise Linux 7"
REDHAT_BUGZILLA_PRODUCT_VERSION=7.9
REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux"
REDHAT_SUPPORT_PRODUCT_VERSION="7.9"
  • ReaR configuration files ("cat /etc/rear/site.conf" and/or "cat /etc/rear/local.conf"):
    Extract:
USE_DHCLIENT=
USE_STATIC_NETWORKING="y"
USE_RESOLV_CONF=n
  • Hardware vendor/product (PC or PowerNV BareMetal or ARM) or VM (KVM guest or PowerVM LPAR):
    BareMetal

  • System architecture (x86 compatible or PPC64/PPC64LE or what exact ARM device):
    x86

  • Firmware (BIOS or UEFI or Open Firmware) and bootloader (GRUB or ELILO or Petitboot):

  • Storage (local disk or SSD) and/or SAN (FC or iSCSI or FCoE) and/or multipath (DM or NVMe):

  • Storage layout ("lsblk -ipo NAME,KNAME,PKNAME,TRAN,TYPE,FSTYPE,LABEL,SIZE,MOUNTPOINT"):

  • Description of the issue (ideally so that others can reproduce it):
    If using USE_RESOLV_CONF=n in sites.conf a rear -v mkrescue fails with ReaR 2.8 as from the log extracted below.
    ReaR 2.7 does not show this failure. The issue is reproducible and can be mitigated with a proper initialisation of this variable in /usr/share/rear/conf/default.conf (see workaround). IMHO the issue is a combination of 38f67fe3ffc4774bc83e649f9729e4f7b35c1632 in conjunction with a later code change in 59ccd12f75e4b8b91e961c702e1a5a2482f74c45 .

  • Workaround, if any:
    Change USE_RESOLV_CONF=() to USE_RESOLV_CONF= in /usr/share/rear/conf/default.conf.

  • Attachments, as applicable ("rear -D mkrescue/mkbackup/recover" debug log files):

...
++ for var in '"${array_variables[@]}"'
++ mapfile -t var_assignments
+++ grep -v '^[[:space:]]*#' /etc/rear/site.conf
+++ sed -n -E -e '/(^|\W+)USE_RESOLV_CONF\+?=/p'
++ for line in '"${var_assignments[@]}"'
++ [[ USE_RESOLV_CONF=n == *USE_RESOLV_CONF?(+)=\(* ]]
++ Error 'Syntax error: Variable USE_RESOLV_CONF not assigned as Bash array in /etc/rear/site.conf:
USE_RESOLV_CONF=n
'
++ test -s /var/log/rear/rear-ts5xxxxxxxxxsv002.log
++ PrintError 'ERROR: Syntax error: Variable USE_RESOLV_CONF not assigned as Bash array in /etc/rear/site.conf:
USE_RESOLV_CONF=n
'
++ test -s /var/log/rear/rear-ts5xxxxxxxxxsv002.log
++ test '  2025-01-03 16:47:31.507734091 Entering debugscript mode via '\''set -x'\''.'
++ PrintError 'Some latest log messages since the last called script 001_verify_config_arrays.sh:'
++ PrintError '  2025-01-03 16:47:31.507734091 Entering debugscript mode via '\''set -x'\''.'
++ test -f /dev/null
++ test 1
++ test 1
++ Log 'ERROR: Syntax error: Variable USE_RESOLV_CONF not assigned as Bash array in /etc/rear/site.conf:
USE_RESOLV_CONF=n
...

jsmeix commented at 2025-01-07 10:05:

USE_RESOLV_CONF is an array - see default.conf
so you must specify it as an array
in your local.conf (or site.conf).

See the comments in
init/default/001_verify_config_arrays.sh
why this test is there:

# Ensure that all array variables are assigned as arrays in user provided configuration.
# This avoids user config mistakes which can lead to obscure and severe errors,
# see https://github.com/rear/rear/issues/2930 and for an example
# see https://github.com/rear/rear/issues/2911

jsmeix commented at 2025-01-07 10:19:

There is a bug in the USE_RESOLV_CONF documentation
in default.conf

# With USE_RESOLV_CONF="no" ...
...
# With USE_RESOLV_CONF="/path/to/file" ...

which must be

# With USE_RESOLV_CONF=( "no" ) ...
...
# With USE_RESOLV_CONF=( "/path/to/file" ) ...

And there is also
usr/share/rear/prep/OPALPBA/Linux-i386/001_configure_workflow.sh

USE_RESOLV_CONF='no'

which must be

USE_RESOLV_CONF=( 'no' )

but this does not cause an error because
init/default/001_verify_config_arrays.sh
runs before.

jsmeix commented at 2025-01-07 10:23:

I will have to check for all array variables in default.conf
that examples in default.conf have correct syntax.


[Export of Github issue for rear/rear.]