rear / rear

Relax-and-Recover - Linux bare metal disaster recovery and system migration solution (cfr. mksysb, ignite)
http://relax-and-recover.org/
GNU General Public License v3.0
944 stars 255 forks source link

Automate ReaR with GRUB w/o user intervention (ISO_DEFAULT not supported for GRUB) #2970

Open keredf opened 1 year ago

keredf commented 1 year ago

I am attempting to fully automate ReaR with little to no user intervention. I have created a ReaR ISO, copied the ISO to a DVD using 'wodim'. I attempt to restore the image by booting off the DVD. The ReaR process begins but brings me to the ReaR cmd prompt. See picture below.

OIP

I then have to enter "root" as the login and then type "rear recover". I want to fully automate this process. See picture below.

OIP

I was able to fully automate this process on a completely different machine (a PC). I was using the same ReaR version, same local.conf, and same OS. One key difference is the BIOS was set to Legacy; Current machine is a custom UEFI BIOS.

For reference, I opened up Issue #2891 . This is a different configuration/situation.

pcahyna commented 1 year ago
  • ReaR version: 2.6 / 2020-06-17

    • OS version: RHEL 8.6

Something is wrong with your screenshots then, they show ReaR 2.00 and CentOS 7.

keredf commented 1 year ago

@pcahyna The screenshots are an example from the internet. Sorry for the confusion.

The versions that I am using are:

pcahyna commented 1 year ago

Current machine is a custom UEFI BIOS.

I suspect that's the issue then,

ISO_DEFAULT="automatic"
ISO_RECOVER_MODE="unattended"

work only with legacy BIOS and not UEFI (or with GRUB booting in general) as far as I know. (is the rescue DVD using GRUB for booting? The "example from the internet" shows SYSLINUX. That's why it is a bad example.)

keredf commented 1 year ago

Is there anything I could check in the BIOS that could be affecting this? (e.g. Secure Boot).

During my initial attempt to create the ReaR ISO (rear -d -v mkbackup), I was getting an error, "Error: Failed to make bootable EFI image of GRUB2 (error during grub2-mkstandalone of /temp/rear.wuVja96Ac9KGtCC/tmp/mnt/EFI/BOOT/BOOTX64.efi).

I had to install the 'grub2-efi-x64-modules' package to remove the error and create the ISO.

I believe the rescue DVD is using GRUB for booting. Is there a specific check I can do to confirm this? On the Rescue DVD, there are 4 folders: BACKUP, boot, EFI, and isolinux.

pcahyna commented 1 year ago

I believe there is a bootloader menu shown before boot where you can see whether it is GRUB, isn't it? For example, the screenshot hou have shown is from SYSLINUX.

keredf commented 1 year ago

image

Here is another example screenshot that looks similar to what I am seeing.

On my machine, I see the same 5 options and a similar comment at the bottom but the machine does not have a menu title at the top.

keredf commented 1 year ago

@pcahyna I have confirmed that the bootloader is GRUB2

pcahyna commented 1 year ago

Yes so unfortunately the problem is that ISO_DEFAULT is not supported for GRUB, so one option would be to boot in legacy BIOS mode, if that's feasible (uses SYSLINUX), another option is to modify the GRUB configuration in the ISO image a bit before burning the DVD (here's an example how to add the unattended kernel option this way: https://github.com/lzaoral/rear-testing/blob/main/Sanity/make-backup-and-restore-powervm/runtest.sh#L140).

keredf commented 1 year ago

I ran the following commands:

• xorriso -dev '/var/lib/rear/output/rear-localhost.iso' -osirrox on -cpx /boot/grub/grub.cfg $PWD/grub.cfg • sed -i '/^[[:blank:]]*linux/s/$/ unattended/' grub.cfg • xorriso -indev '/var/lib/rear/output/rear-localhost.iso' -update $PWD/grub.cfg /boot/grub/grub.cfg -outdev ‘/var/lib/rear/output/test.iso' • sync • wodim -v dev=/dev/sr0 speed=4 -eject test.iso

I created the ISO and confirmed that the grub.cfg was updated with "unattended". I wrote the ISO to a DVD but I cannot boot off of the DVD. It looks like this occurred after updating grub.cfg.

Do you know why this could be? Is there a way to update the bootable flag on the ISO? Any other suggestions or ideas?

Thank you for your help and guidance. @pcahyna

pcahyna commented 1 year ago

Sorry @keredf for my untested and nonfunctional suggestion. This code works for modifying the ISO image that is bootable on another platform (POWER with OpenFirmware), but apparently this is not correct for updating a UEFI bootable ISO. I think some variation of thereof could work, maybe one should add the same options to the second xorriso command as were used when creating rear-localhost.iso the first time? Also, can you please verify that the /boot/grub/grub.cfg path is indeed the correct path to the GRUB configuration file in your ISO and that the sed command has updated the file correctly? (diff of the file before and after the sed command would be useful.)

Also, what does "I cannot boot off of the DVD" mean? Does GRUB at least get loaded and then can not boot the kernel, or you don't even see the GRUB menu or prompt?

github-actions[bot] commented 1 year ago

Stale issue message

github-actions[bot] commented 1 year ago

Stale issue message

github-actions[bot] commented 1 year ago

Stale issue message

github-actions[bot] commented 11 months ago

Stale issue message

github-actions[bot] commented 8 months ago

Stale issue message

schlomo commented 7 months ago

I'd like to bring this issue up to our attention @rear/wiki-contributors because I think that it is getting more urgent for us to implement all the nice syslinux features for GRUB2 booting: image

github-actions[bot] commented 5 months ago

Stale issue message

gdha commented 2 months ago

@rear/contributors milestone is still 'ReaR v2.8' - please adjust as you think it best fits (v3.0 or v3.1). Thanks.

schlomo commented 2 months ago

Thanks, I'd suggest post 3.0 to get 3.0 through the door