#2970 Issue open
: Automate ReaR with GRUB w/o user intervention (ISO_DEFAULT not supported for GRUB)¶
Labels: enhancement
keredf opened issue at 2023-04-12 18:55:¶
-
ReaR version:
2.6 / 2020-06-17 -
OS version:
RHEL 8.6 -
ReaR configuration files (/etc/rear/local.conf):
OUTPUT=ISO
OUTPUT_URL=null
BACKUP=NETFS
BACKUP_URL=iso:///BACKUP/
ISO_MAX_SIZE=4400
BACKUP_PROG_EXCLUDE=("${BACKUP_PROG_EXCLUDE[@]}"'/media''/var/tmp''/var/crash''/mnt')
USER_INPUT_TIMEOUT=0
USER_INPUT_INTERRUPT_TIMEOUT=1
ISO_DEFAULT="automatic"
ISO_RECOVER_MODE="unattended"
USER_INPUT_DISK_LAYOUT_PROCEED_RECOVERY="yes"
USE_RESOLV_CONF=("search x" "name server 0.0.0.0")
-
Hardware vendor/product:
Laptop -
System architecture:
x86 -
Firmware and bootloader:
BIOS R2.0, EC Version 0.00.09, UEFI Firmware 2.7, GRUB2 bootloader (BIOS of this laptop is a custom UEFI BIOS) -
Storage:
ISO image saved locally onto laptop SSD, then image copied to a DVD -
Storage layout ("lsblk -ipo NAME,KNAME,PKNAME,TRAN,TYPE,FSTYPE,LABEL,SIZE,MOUNTPOINT"):
NAME KNAME PKNAME TRAN TYPE FSTYPE SIZE MOUNTPOINT
/dev/sr0 /dev/sr0 sata rom 2.6G
/dev/nvme0n1 /dev/nvme0n1 nvme disk 477G
/dev/nvme0n1p1 /dev/nvme0n1p1 /dev/nvme0n1 nvme part vfat 600M /boot/efi
/dev/nvme0n1p2 /dev/nvme0n1p2 /dev/nvme0n1 nvme part xfs 1G /boot/efi
/dev/nvme0n1p3 /dev/nvme0n1p3 /dev/nvme0n1 nvme part LVM2_member 475G
/dev/mapper/rhel-root /dev/dm-0 /dev/nvme0n1p3 lvm xfs 70G /
/dev/mapper/rhel-swap /dev/dm-1 /dev/nvme0n1p3 lvm swap 7.7G [SWAP]
/dev/mapper/rhel-home /dev/dm-2 /dev/nvme0n1p3 lvm xfs 397G /home
- Description of the issue:
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.
I then have to enter "root" as the login and then type "rear recover".
I want to fully automate this process.
See picture below.
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.
-
Workaround:
Boot off of DVD containing ISO, enter command prompt as root, type rear recover -
Attachments ("rear -D mkrescue/mkbackup/recover"):
None
pcahyna commented at 2023-04-12 19:38:¶
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 at 2023-04-12 19:45:¶
@pcahyna The screenshots are an example from the internet. Sorry for the confusion.
The versions that I am using are:
- ReaR version: 2.6 / 2020-06-17
- OS version: RHEL 8.6
pcahyna commented at 2023-04-12 20:49:¶
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 at 2023-04-13 11:14:¶
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 at 2023-04-13 11:22:¶
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 at 2023-04-13 12:11:¶
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 at 2023-04-13 16:46:¶
@pcahyna I have confirmed that the bootloader is GRUB2
pcahyna commented at 2023-04-13 16:58:¶
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 at 2023-04-18 15:23:¶
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 at 2023-04-21 17:24:¶
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?
[Export of Github issue for rear/rear.]