#2806 Issue closed: Recover RHEL 7.9 backup on different machine with new MAC addresses for Network Interfaces. Doesn't keep old Network Interface names.

Labels: support / question, no-issue-activity

DrayInsane opened issue at 2022-05-12 14:45:

Relax-and-Recover (ReaR) Issue Template

Relax-and-Recover: Version 2.6

RHEL 7.9

local.conf:

OUTPUT=ISO
BACKUP=NETFS
OUTPUT_URL=null
BACKUP_URL="iso:///backup/"
  • Hardware vendor/product (PC or PowerNV BareMetal or ARM) or VM (KVM guest or PowerVM LPAR):
    Oracle Virtual Box 6.1

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

  • Description of the issue (ideally so that others can reproduce it):

I am creating a backup of a machine where the interface names are configured using the ifcfg-X files which have the old interfaces renamed using the DEVICE= parameter. (I.E. DEVICE=Internet which renames the interface name to Internet). I have software running on the build that look for the interface name so I want the name to remain consistent even on different hardware.

When I try to recover the image on the new machine that has different MAC addresses for the network interfaces I get the standard prompt telling me that the old interface cannot be found and gives me the option to replace it with one of the newer ones. Instead of completely replacing the interface which changes the name of the file adds the new mac and adds the new device(interface) name I need it to only replace the MAC address in the file and not the file name or device name. I tried altering the local.conf, altering the kernel cmdline, and changing some of the parameters in the 55-migrate-network-devices.sh but I am unable to figure out how to keep the device name from changing after rear recover is run.

I essentially want to take (Old machine - Old MAC Address / Old Interface Name) and end up with
(New machine - New MAC Address / Old Interface Name).

Is there any way to do this?

jsmeix commented at 2022-05-13 09:17:

@rmetrich
if time permits could you perhaps have a look here?
My networking knowledge is basically limited
to let DHCP automatically do "the right thing" ;-)

@DrayInsane
as a generic method you could after "rear recover" finished
in the still running ReaR recovery system manually change
the (config) files of the recreated system as you like.
The recreated filesystems with the restored files
are mounted below /mnt/local in the ReaR recovery system.

jsmeix commented at 2022-05-13 09:25:

@DrayInsane
now I see you mentioned 55-migrate-network-devices.sh which is
skel/default/etc/scripts/system-setup.d/55-migrate-network-devices.sh
so it seems you do not want to adapt some restored config files
to make the recreated system boot with proper networking setup
but you want to adapt the networking setup of the ReaR recovery system?

If yes, see "RESCUE IMAGE KERNEL COMMAND LINE OPTIONS"
in "man rear" e.g. for current master code it is online at
https://github.com/rear/rear/blob/master/doc/rear.8.adoc
and "NETWORKING_PREPARATION_COMMANDS" in
usr/share/rear/conf/default.conf which is currently online at
https://github.com/rear/rear/blob/master/usr/share/rear/conf/default.conf#L3108

DrayInsane commented at 2022-05-13 18:29:

Thanks I'll take a look into it and see if I can figure something out. Is there any way I can get rear to kick off a custom script before the reboot of the system? I could then create the script to rename the interface files back to how we need them to be and everything could be done before booting into the system after recovery.

jsmeix commented at 2022-05-16 08:08:

See POST_RECOVERY_SCRIPT in
usr/share/rear/conf/default.conf

See
usr/share/rear/wrapup/default/500_post_recovery_script.sh
how POST_RECOVERY_SCRIPT is called.

For an example of a POST_RECOVERY_SCRIPT see
usr/share/rear/conf/examples/SLE12-SP2-btrfs-example.conf

Instead of doing all as a single command in
POST_RECOVERY_SCRIPT it should be usually easier
to make a separated script and include it
into the ReaR recovery system via

COPY_AS_IS+=( /path/to/script.sh )

and call that script via POST_RECOVERY_SCRIPT,
see the COPY_AS_IS description in default.conf.

Because the default

COPY_AS_IS=( $SHARE_DIR $VAR_DIR )

and because SHARE_DIR is usr/share/rear
you could place your script in usr/share/rear
so it gets automatically included in the
ReaR recovery system.

github-actions commented at 2022-07-16 03:15:

Stale issue message


[Export of Github issue for rear/rear.]