Uploaded image for project: 'RHEL'
  1. RHEL
  2. RHEL-104290

ReaR continues execution despite syntax error in /etc/rear/local.conf on RHEL 8, but correctly fails on RHEL 10

Linking RHIVOS CVEs to...Migration: Automation ...SWIFT: POC ConversionSync from "Extern...XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Undefined Undefined
    • None
    • rhel-8.10
    • rear
    • No
    • None
    • rhel-jotnar
    • None
    • False
    • False
    • Hide

      None

      Show
      None
    • None
    • None
    • None
    • None
    • Unspecified
    • Unspecified
    • Unspecified
    • None

      What were you trying to do that didn't work?
      ================================================

      I was to testing ReaR with an intentional syntax error in /etc/rear/local.conf to verify behavior.
      On RHEL 8, even though a syntax error was logged, ReaR proceeded with the mkbackup workflow, which is not expected behavior. The same test on RHEL 10 correctly failed, indicating  missing validation logic in ReaR on RHEL 9.

      What is the impact of this issue to you?
      ================================================
      1] Risk of running backup with an incomplete or misconfigured environment
      2] Inconsistent behavior across OS versions

      Please provide the package NVR for which the bug is seen:
      ================================================

      rear-2.6-12.el8.x86_64

      How reproducible is this bug?:
      ================================================
      100% reproducible

      Steps to reproduce
      ================================================
      1] On a RHEL 8 system with ReaR installed, create a syntax error in /etc/rear/local.conf

      # cat /etc/rear/local.conf 
      OUTPUT=ISO
      OUTPUT_URL=file:///rear
      BACKUP=NETFS
      BACKUP_URL=file:///rear/
      BACKUP_PROG_EXCLUDE=("${BACKUP_PROG_EXCLUDE[@]}" '/media' '/var/tmp '/var/crash' )

      The syntax error is the closing quote is missing around /var/tmp 

      2] Run: rear -d -v mkbackup

      3] Check the logs at /var/log/rear/rear-<hostname>.log.

      Observe that a syntax error is logged:

      /etc/rear/local.conf: line 23: unexpected EOF while looking for matching `''
      /etc/rear/local.conf: line 24: syntax error: unexpected end of file
      2025-07-17 12:06:38.502330577 Source function: 'source /etc/rear/local.conf' returns 1

      But the workflow proceeds and backup starts.

      [root@RHEL8 ~]# rear -d -v mkbackup
      Relax-and-Recover 2.6 / 2020-06-17
      Running rear mkbackup (PID 209239)
      Using log file: /var/log/rear/rear-RHEL8.log
      Running workflow mkbackup on the normal/original system
      Using backup archive '/rear//RHEL8/backup.tar.gz'
      Found EFI system partition /dev/vda1 on /boot/efi type vfat
      Using UEFI Boot Loader for Linux (USING_UEFI_BOOTLOADER=1)
      ERROR: URL 'file:///rear/' has the backup directory '/rear/' in the '/' filesystem which is forbidden.
      Some latest log messages since the last called script 400_automatic_exclude_recreate.sh:
        2025-07-17 12:06:38.908344790 Including prep/NETFS/default/400_automatic_exclude_recreate.sh
        mkdir: created directory '/rear/'
      Aborting due to an error, check /var/log/rear/rear-RHEL8.log for details
      Exiting rear mkbackup (PID 209239) and its descendant processes ...
      Running exit tasks
      You should also rm -Rf --one-file-system /tmp/rear.X4zrQ6rWDIuLk5j
      Terminated
      [root@RHEL8 ~]# cat /var/log/rear/rear-RHEL8.log
      2025-07-17 12:06:38.476597550 Relax-and-Recover 2.6 / 2020-06-17
      2025-07-17 12:06:38.477519154 Running rear mkbackup (PID 209239)
      2025-07-17 12:06:38.478409401 Command line options: /usr/sbin/rear -d -v mkbackup
      2025-07-17 12:06:38.479266672 Using log file: /var/log/rear/rear-RHEL8.log
      2025-07-17 12:06:38.480244054 Current set of flags is 'hB'
      2025-07-17 12:06:38.481117085 The debugscripts flags are 'x'
      2025-07-17 12:06:38.481966740 Combining configuration files
      2025-07-17 12:06:38.483019793 Including /etc/rear/os.conf
      2025-07-17 12:06:38.486130227 Including conf/Linux-i386.conf
      2025-07-17 12:06:38.488423316 Including conf/GNU/Linux.conf
      2025-07-17 12:06:38.501368139 Including /etc/rear/local.conf
      /etc/rear/local.conf: line 23: unexpected EOF while looking for matching `''
      /etc/rear/local.conf: line 24: syntax error: unexpected end of file
      2025-07-17 12:06:38.502330577 Source function: 'source /etc/rear/local.conf' returns 1
      2025-07-17 12:06:38.504552234 ======================
      2025-07-17 12:06:38.505371237 Running 'init' stage
      2025-07-17 12:06:38.506190873 ======================
      2025-07-17 12:06:38.516353322 Including init/default/005_verify_os_conf.sh
      2025-07-17 12:06:38.521204479 Including init/default/010_EFISTUB_check.sh
      2025-07-17 12:06:38.524843293 Including init/default/010_set_drlm_env.sh
      2025-07-17 12:06:38.527994901 Including init/default/030_update_recovery_system.sh
      2025-07-17 12:06:38.531176373 Including init/default/050_check_rear_recover_mode.sh
      2025-07-17 12:06:38.532473015 Running workflow mkbackup on the normal/original system
      2025-07-17 12:06:38.535374830 Including init/default/950_check_missing_programs.sh
      2025-07-17 12:06:38.542918088 Finished running 'init' stage in 0 seconds
      2025-07-17 12:06:38.547200860 Using build area '/tmp/rear.X4zrQ6rWDIuLk5j'
      mkdir: created directory '/tmp/rear.X4zrQ6rWDIuLk5j/rootfs'
      mkdir: created directory '/tmp/rear.X4zrQ6rWDIuLk5j/tmp'
      2025-07-17 12:06:38.549932059 Running mkbackup workflow
      2025-07-17 12:06:38.552522732 ======================
      2025-07-17 12:06:38.553353820 Running 'prep' stage
      2025-07-17 12:06:38.554170607 ======================
      2025-07-17 12:06:38.565031053 Including prep/default/005_remove_workflow_conf.sh
      mkdir: created directory '/tmp/rear.X4zrQ6rWDIuLk5j/rootfs/etc'
      mkdir: created directory '/tmp/rear.X4zrQ6rWDIuLk5j/rootfs/etc/rear'
      2025-07-17 12:06:38.569671181 Including prep/default/020_translate_url.sh
      2025-07-17 12:06:38.573028167 Including prep/default/030_translate_tape.sh
      2025-07-17 12:06:38.577524124 Including prep/default/035_valid_backup_methods.sh
      2025-07-17 12:06:38.582299963 Including prep/default/040_check_backup_and_output_scheme.sh
      2025-07-17 12:06:38.589253807 Including prep/NETFS/default/040_inspect_configuration_files.sh
      2025-07-17 12:06:38.590645614 Source function: 'source /usr/share/rear/prep/NETFS/default/040_inspect_configuration_files.sh' returns 1
      2025-07-17 12:06:38.593255666 Including prep/NETFS/default/050_check_NETFS_requirements.sh
      2025-07-17 12:06:38.597403318 Skipping 'ping' test for host '' in BACKUP_URL 'file:///rear/'
      2025-07-17 12:06:38.602196670 Including prep/default/050_check_keep_old_output_copy_var.sh
      2025-07-17 12:06:38.603431394 Source function: 'source /usr/share/rear/prep/default/050_check_keep_old_output_copy_var.sh' returns 1
      2025-07-17 12:06:38.606653796 Including prep/NETFS/default/060_mount_NETFS_path.sh
      2025-07-17 12:06:38.611306717 Including prep/NETFS/default/070_set_backup_archive.sh
      2025-07-17 12:06:38.615757786 Using backup archive '/rear//RHEL8/backup.tar.gz'
      2025-07-17 12:06:38.620132726 Including prep/NETFS/default/090_check_encrypted_backup.sh
      2025-07-17 12:06:38.624532773 Including prep/NETFS/default/100_check_nfs_version.sh
      find: '/var/lib/nfs': No such file or directory
      2025-07-17 12:06:38.639002516 Including prep/default/100_init_workflow_conf.sh
      2025-07-17 12:06:38.643055071 Including prep/NETFS/default/150_save_rsync_version.sh
      2025-07-17 12:06:38.647061061 Including prep/GNU/Linux/200_include_getty.sh
      2025-07-17 12:06:38.661663694 Source function: 'source /usr/share/rear/prep/GNU/Linux/200_include_getty.sh' returns 1
      2025-07-17 12:06:38.664406136 Including prep/GNU/Linux/200_include_serial_console.sh
      /usr/share/rear/lib/_input-output-functions.sh: line 476: type: getty: not found
      2025-07-17 12:06:38.674191226 Including prep/NETFS/GNU/Linux/200_selinux_in_use.sh
      2025-07-17 12:06:38.678199843 Including prep/NETFS/GNU/Linux/205_inspect_tar_capabilities.sh
      2025-07-17 12:06:38.690032119 Including prep/GNU/Linux/210_include_dhclient.sh
      2025-07-17 12:06:38.731928547 Detected an active Network Manager connection 'enp1s0' set up via DHCPv4
      2025-07-17 12:06:38.733094242 Auto-enabling DHCP on the rescue system
      /usr/share/rear/lib/_input-output-functions.sh: line 476: type: dhcpcd: not found
      2025-07-17 12:06:38.738015393 Including prep/GNU/Linux/220_include_lvm_tools.sh
      2025-07-17 12:06:38.740252423 Device mapper found enabled. Including LVM tools.
      2025-07-17 12:06:38.778995125 Including prep/GNU/Linux/230_include_md_tools.sh
      2025-07-17 12:06:38.782901999 Including prep/GNU/Linux/240_include_multipath_tools.sh
      2025-07-17 12:06:38.786018680 Including prep/GNU/Linux/280_include_systemd.sh
      2025-07-17 12:06:38.794942347 Including systemd (init replacement) tool-set to bootstrap Relax-and-Recover
      2025-07-17 12:06:38.797783598 Including prep/GNU/Linux/280_include_virtualbox.sh
      2025-07-17 12:06:38.804295395 Including prep/GNU/Linux/280_include_vmware_tools.sh
      2025-07-17 12:06:38.810882084 Including prep/GNU/Linux/290_include_drbd.sh
      2025-07-17 12:06:38.817317026 Including prep/GNU/Linux/300_check_backup_and_output_url.sh
      2025-07-17 12:06:38.825495887 Including prep/ISO/default/300_check_iso_dir.sh
      2025-07-17 12:06:38.829802510 Including prep/GNU/Linux/300_include_grub_tools.sh
      2025-07-17 12:06:38.833595138 Including prep/GNU/Linux/310_include_cap_utils.sh
      2025-07-17 12:06:38.836520247 Including prep/ISO/default/320_check_cdrom_size.sh
      2025-07-17 12:06:38.839840115 ISO Directory '/var/lib/rear/output' [/dev/mapper/rhel_rhel8-root] has 7106 MB free space
      2025-07-17 12:06:38.842750713 Including prep/default/320_include_uefi_env.sh
      2025-07-17 12:06:38.851125177 Found EFI system partition /dev/vda1 on /boot/efi type vfat
      2025-07-17 12:06:38.852325525 Using UEFI Boot Loader for Linux (USING_UEFI_BOOTLOADER=1)
      2025-07-17 12:06:38.855220152 Including prep/ISO/GNU/Linux/320_verify_mkisofs.sh
      2025-07-17 12:06:38.867190268 Using '/bin/xorrisofs' to create ISO images
      2025-07-17 12:06:38.870118026 Including prep/default/321_EFISTUB_check_uefi_env.sh
      2025-07-17 12:06:38.873082810 Including prep/ISO/Linux-i386/330_find_isolinux.sh
      2025-07-17 12:06:38.895025847 Including prep/default/330_include_uefi_tools.sh
      2025-07-17 12:06:38.897921762 Including prep/ISO/GNU/Linux/340_add_isofs_module.sh
      2025-07-17 12:06:38.902529207 Including prep/ISO/GNU/Linux/360_EFISTUB_prechecks.sh
      2025-07-17 12:06:38.905363915 Including prep/default/380_include_opal_tools.sh
      /usr/share/rear/lib/_input-output-functions.sh: line 476: type: sedutil-cli: not found
      2025-07-17 12:06:38.908344790 Including prep/NETFS/default/400_automatic_exclude_recreate.sh
      mkdir: created directory '/rear/'
      2025-07-17 12:06:38.925651686 ERROR: URL 'file:///rear/' has the backup directory '/rear/' in the '/' filesystem which is forbidden.
      ===== Stack trace =====
      Trace 0: /usr/sbin/rear:541 main
      Trace 1: /usr/share/rear/lib/mkbackup-workflow.sh:9 WORKFLOW_mkbackup
      Trace 2: /usr/share/rear/lib/framework-functions.sh:116 SourceStage
      Trace 3: /usr/share/rear/lib/framework-functions.sh:56 Source
      Trace 4: /usr/share/rear/prep/NETFS/default/400_automatic_exclude_recreate.sh:32 source
      === End stack trace ===
      2025-07-17 12:06:38.931891771 Exiting rear mkbackup (PID 209239) and its descendant processes ...
      2025-07-17 12:06:41.982493071 rear,209239 /usr/sbin/rear -d -v mkbackup
        `-rear,209704 /usr/sbin/rear -d -v mkbackup
            `-pstree,209705 -Aplau 209239
      /usr/share/rear/lib/_input-output-functions.sh: line 151: kill: (209708) - No such process
      2025-07-17 12:06:41.996852861 Running exit tasks
      2025-07-17 12:06:41.998066576 Exit task 'cleanup_build_area_and_end_program'
      2025-07-17 12:06:41.999185918 Finished in 3 seconds
      2025-07-17 12:06:42.000325380 You should also rm -Rf --one-file-system /tmp/rear.X4zrQ6rWDIuLk5j
      2025-07-17 12:06:42.001430696 End of program reached
      2025-07-17 12:06:42.002633072 Exit task '(( EXIT_FAIL_MESSAGE )) && echo 'rear mkbackup failed, check /var/log/rear/rear-RHEL8.log for details' 1>&8'
      2025-07-17 12:06:42.003818282 Exit task 'exec 8>&-'
      2025-07-17 12:06:42.005093617 Exit task 'exec 7>&-'
      2025-07-17 12:06:42.006179260 Exit task 'exec 6<&-'
      2025-07-17 12:06:42.007261793 Exit task ''

       

      4] Run the same test on a RHEL 10 system with ReaR 2.9 and observe that it fails early, which is the correct behavior.

       

      [root@rhel10 ~]# rear -d -v mkbackup
      Relax-and-Recover 2.9 / 2025-01-31
      Running rear mkbackup (PID 5068 date 2025-07-17 21:34:26)
      Command line options: /usr/sbin/rear -d -v mkbackup
      Using log file: /var/log/rear/rear-rhel10.log
      Using build area: /var/tmp/rear.8YdP1dzbJjynTOe
      Setting TMPDIR to ReaR's '/var/tmp/rear.8YdP1dzbJjynTOe/tmp' (was unset when ReaR was launched)
      ERROR: Failed to Source /etc/rear/local.conf
      You may use debugscript mode '-D' for full debug messages with 'set -x' output
      Aborting due to an error, check /var/log/rear/rear-rhel10.log for details
      Exiting rear mkbackup (PID 5068) and its descendant processes ...
      Running exit tasks
      To remove the build area you may use (with caution): rm -Rf --one-file-system /var/tmp/rear.8YdP1dzbJjynTOe
      Terminated
      # cat /var/log/rear/rear-rhel10.log
      2025-07-17 21:39:25.955590934 Relax-and-Recover 2.9 / 2025-01-31
      2025-07-17 21:39:25.958402702 Running rear mkbackup (PID 5317 date 2025-07-17 21:39:25)
      2025-07-17 21:39:25.961159985 Command line options: /usr/sbin/rear -d -v mkbackup
      2025-07-17 21:39:25.963900731 Using log file: /var/log/rear/rear-rhel10.log
      2025-07-17 21:39:25.966603804 Using build area: /var/tmp/rear.CM5M5KI3uIoB2V5
      2025-07-17 21:39:25.969751791 Setting TMPDIR to ReaR's '/var/tmp/rear.CM5M5KI3uIoB2V5/tmp' (was unset when ReaR was launched)
      2025-07-17 21:39:25.973087749 Current set of flags is 'hB'
      2025-07-17 21:39:25.976165260 The debugscripts flags are 'x'
      2025-07-17 21:39:25.978830277 Combining configuration files
      2025-07-17 21:39:25.993124055 Including conf/Linux-i386.conf
      2025-07-17 21:39:25.995945567 Including conf/GNU/Linux.conf
      2025-07-17 21:39:26.017158905 Including /etc/rear/local.conf
      /etc/rear/local.conf: line 31: unexpected EOF while looking for matching `''
      2025-07-17 21:39:26.019978306 Source function: 'source /etc/rear/local.conf' returns 1
      2025-07-17 21:39:26.029636190 ERROR: Failed to Source /etc/rear/local.conf
      ===== Stack trace =====
      Trace 0: /usr/sbin/rear:757 main
      === End stack trace ===
      2025-07-17 21:39:26.036692941 Exiting rear mkbackup (PID 5317) and its descendant processes ...
      2025-07-17 21:39:26.049157250 rear,5317 /usr/sbin/rear -d -v mkbackup
                                      `-rear,5508 /usr/sbin/rear -d -v mkbackup
                                          `-pstree,5509 -Aplau 5317
      /usr/share/rear/lib/_input-output-functions.sh: line 151: kill: (5514) - No such process
      2025-07-17 21:39:26.066442173 Running exit tasks
      2025-07-17 21:39:26.069453587 Exit task 'cleanup_build_area_and_end_program'
      2025-07-17 21:39:26.073669162 Finished rear mkbackup in 1 seconds
      2025-07-17 21:39:26.079900547 To remove the build area you may use (with caution): rm -Rf --one-file-system /var/tmp/rear.CM5M5KI3uIoB2V5
      2025-07-17 21:39:26.082845343 End of program 'rear' reached
      2025-07-17 21:39:26.085784583 Exit task '(( EXIT_FAIL_MESSAGE )) && echo 'rear mkbackup failed, check /var/log/rear/rear-rhel10.log for details' 1>&8'
      2025-07-17 21:39:26.088607663 Exit task 'exec 8>&-'
      2025-07-17 21:39:26.092359231 Exit task 'exec 7>&-'
      2025-07-17 21:39:26.096495773 Exit task 'exec 6<&-'
      2025-07-17 21:39:26.099342049 Exit task ''

      Expected results
      ================================================
      ReaR should abort execution immediately on syntax errors in local.conf to prevent unsafe or misconfigured backups.

      Actual results
      ================================================

      ReaR logs the syntax error but continues execution.

              jotnar-project Jötnar Project
              rhn-support-vbhope Vaibhav Bhope
              Pavel Cahyna Pavel Cahyna
              Jötnar Project Jötnar Project
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated: