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

rear drops to network interface migration prompt when specifying a custom TMPDIR environment variable

    • Icon: Bug Bug
    • Resolution: Done-Errata
    • Icon: Undefined Undefined
    • rhel-9.4
    • rhel-9.3.0
    • rear
    • None
    • rear-2.6-24.el9
    • Normal
    • ZStream, Regression
    • sst_cs_system_management
    • ssg_core_services
    • 26
    • 26
    • 3
    • False
    • Hide

      None

      Show
      None
    • Yes
    • Red Hat Enterprise Linux
    • Approved Blocker
    • Bug Fix
    • Hide
      .ReaR no longer fails during recovery if the `TMPDIR` variable is set in the configuration file

      Previously, the ReaR default configuration file `/usr/share/rear/conf/default.conf` contained the following instructions:
      ----
      # To have a specific working area directory prefix for Relax-and-Recover
      # specify in /etc/rear/local.conf something like
      #
      # export TMPDIR="/prefix/for/rear/working/directory"
      #
      # where /prefix/for/rear/working/directory must already exist.
      # This is useful for example when there is not sufficient free space
      # in /tmp or $TMPDIR for the ISO image or even the backup archive.
      ----

      The instructions mentioned above did not work correctly because the `TMPDIR` variable had the same value in the rescue environment, which was not correct if the directory specified in the `TMPDIR` variable did not exist in the rescue image.

      As a consequence, when the rescue image was booted, setting and exporting `TMPDIR` in the `/etc/rear/local.conf` file led to the following error :

      ----
      mktemp: failed to create file via template '/prefix/for/rear/working/directory/tmp.XXXXXXXXXX': No such file or directory
      cp: missing destination file operand after '/etc/rear/mappings/mac'
      Try 'cp --help' for more information.
      No network interface mapping is specified in /etc/rear/mappings/mac
      ----

      or the following error and abort later, when running `rear recover`:
      ----
      ERROR: Could not create build area
      ----

      With this update, ReaR unsets the `TMPDIR` variable in the rescue environment. ReaR also detects when the variable has been set in `/etc/rear/local.conf`, and prints a warning if the variable is set. The comment in `/usr/share/rear/conf/default.conf` has been changed to instruct to set and export `TMPDIR` in the environment before executing `rear` instead of setting it in `/etc/rear/local.conf`.

      If the command `export TMPDIR=...` is used in `/etc/rear/local.conf`, ReaR now prints the following warning:

      ----
      Warning: Setting TMPDIR in a configuration file is deprecated. To specify a working area directory prefix, export TMPDIR before executing 'rear'
      ----

      As a result, the recovery is successful in the described configuration.

      Setting `TMPDIR` in a configuration file like `/etc/rear/local.conf` is now deprecated and the functionality will be removed in a future release. It is recommended to remove such settings from `/etc/rear/local.conf`, and to set and export `TMPDIR` in the environment before calling ReaR instead.
      Show
      .ReaR no longer fails during recovery if the `TMPDIR` variable is set in the configuration file Previously, the ReaR default configuration file `/usr/share/rear/conf/default.conf` contained the following instructions: ---- # To have a specific working area directory prefix for Relax-and-Recover # specify in /etc/rear/local.conf something like # # export TMPDIR="/prefix/for/rear/working/directory" # # where /prefix/for/rear/working/directory must already exist. # This is useful for example when there is not sufficient free space # in /tmp or $TMPDIR for the ISO image or even the backup archive. ---- The instructions mentioned above did not work correctly because the `TMPDIR` variable had the same value in the rescue environment, which was not correct if the directory specified in the `TMPDIR` variable did not exist in the rescue image. As a consequence, when the rescue image was booted, setting and exporting `TMPDIR` in the `/etc/rear/local.conf` file led to the following error : ---- mktemp: failed to create file via template '/prefix/for/rear/working/directory/tmp.XXXXXXXXXX': No such file or directory cp: missing destination file operand after '/etc/rear/mappings/mac' Try 'cp --help' for more information. No network interface mapping is specified in /etc/rear/mappings/mac ---- or the following error and abort later, when running `rear recover`: ---- ERROR: Could not create build area ---- With this update, ReaR unsets the `TMPDIR` variable in the rescue environment. ReaR also detects when the variable has been set in `/etc/rear/local.conf`, and prints a warning if the variable is set. The comment in `/usr/share/rear/conf/default.conf` has been changed to instruct to set and export `TMPDIR` in the environment before executing `rear` instead of setting it in `/etc/rear/local.conf`. If the command `export TMPDIR=...` is used in `/etc/rear/local.conf`, ReaR now prints the following warning: ---- Warning: Setting TMPDIR in a configuration file is deprecated. To specify a working area directory prefix, export TMPDIR before executing 'rear' ---- As a result, the recovery is successful in the described configuration. Setting `TMPDIR` in a configuration file like `/etc/rear/local.conf` is now deprecated and the functionality will be removed in a future release. It is recommended to remove such settings from `/etc/rear/local.conf`, and to set and export `TMPDIR` in the environment before calling ReaR instead.
    • Done

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

      Some customers use a dedicated TMPDIR to create the backup, through adding the following in /etc/rear/local.conf:

      export TMPDIR=/foo/bar
      

      This was working fine with RHEL7 and RHEL8, but now fails during Rescue boot, at step 55-migrate-network-devices.sh:

      mktemp: failed to create file via template '/foo/bar/tmp.XXXXXXXXXX': No such file or directory
      cp: missing destination file operand after '/etc/rear/mappings/mac'
      Try 'cp --help' for more information.
      No network interface mapping is specified in /etc/rear/mappings/mac
      
      The original network interface enp1s0 52:54:00:4e:e2:ef is not available
      1) enp1s0 52:54:00:4e:e2:ef virtio_net
      2) enp8s0 52:54:00:81:42:fe virtio_net
      3) Skip replacing enp1s0 52:54:00:4e:e2:ef
      Choose replacement for enp1s0 52:54:00:4e:e2:ef
      

      This is because $TMPDIR doesn't exist in the initramfs, preventing mktemp from creating a temporary file.

      On RHEL8 (rear-2.6-10.el8), mktemp was creating the file in /tmp, which hence tells us something changed with RHEL9 rear since $TMPDIR seems to be used during Rescue, while it was not previously.
      I didn't dig further into this.

      Please provide the package NVR for which bug is seen:

      rear-2.6-20.el9_3.x86_64

      How reproducible:

      Always

      Steps to reproduce

      1.  Set a TMPDIR in /etc/rear/local.conf
        export TMPDIR=/foo/bar
      2.  Create the TMPDIR on system and generate the rescue
        # mkdir -p /foo/bar
        # rear mkrescue
      3. Make sure you have 2 network interfaces on the system to trigger the issue
      4. Boot the Rescue

      Expected results

      Getting the prompt

      Actual results

      Asks for interface mapping

            rhn-support-pcahyna Pavel Cahyna
            rhn-support-rmetrich Renaud Metrich
            Renaud Metrich
            Pavel Cahyna Pavel Cahyna
            Jakub Haruda Jakub Haruda
            Mugdha Soni Mugdha Soni
            Votes:
            0 Vote for this issue
            Watchers:
            10 Start watching this issue

              Created:
              Updated:
              Resolved: