#2326 PR merged: Allow to boot original system from Grub menu (UEFI)

Labels: enhancement, cleanup, fixed / solved / done

gozora opened issue at 2020-02-03 20:24:

  • Type: New Feature / Enhancement

  • Impact: Normal

  • Reference to related issue (URL): #2276

  • How was this pull request tested?
    ReaR rescue system boot with:
    OUTPUT=USB and OUTPUT=ISO
    on

    • SLES12-SP2
    • Fedora29
    • Centos 7
  • Brief description of the changes in this pull request:
    This patch adds following:

    • Possibility to boot original system for UEFI boot with OUTPUT=NETFS
      and OUTPUT=USB (similarly to non UEFI ReaR rescue system).

    - Introduces couple of new variables that could be later beneficial for other UEFI code:

    • esp_mpt - mount-point of ESP (e.g. /boot/efi)
    • esp_disk - disk device holding ESP (e.g. /dev/sda1)
    • esp_relative_bootloader - relative path to UEFI_BOOTLOADER (e.g. /EFI/BOOT/BOOTX64.EFI)
    • esp_disk_uuid - UUID of disk holding ESP

    - Replaces grub-mkimage for building of Grub2 boot image for OUTPUT=USB
    with build_bootx86_efi() (grub-mkstandalone).
    - Replaces separate Grub configuration for OUTPUT=USB with
    create_grub2_cfg()

    Using build_bootx86_efi() and create_grub2_cfg() in OUTPUT=USB will
    unify process of Grub boot image creation with OUTPUT=NETFS.

gozora commented at 2020-02-03 20:30:

@gdha @jsmeix I'd really appreciate if you could "just" test this code by trying to boot to ReaR recovery system Grub menu and test whether your original system gets booted, when Boot original system menu option is chosen (it doesn't really mater whether you use NETFS or USB).

Thanks

V.

jsmeix commented at 2020-02-04 09:15:

Testing will take some time because I first need to set up
a UEFI booting system but that is on my todo list anyway:
I like to test UEFI USB recovery with my laptop that I use
currently in BIOS mode (the one I used at FOSDEM).

gozora commented at 2020-02-04 09:17:

Testing will take some time because I first need to set up
a UEFI booting system but that is on my todo list anyway:
I like to test UEFI USB recovery with my laptop that I use
currently in BIOS mode (the one I used at FOSDEM).

No rush, take your time!

V.

jsmeix commented at 2020-03-02 13:22:

@gozora
I think I will not find time to test it in the foreseeable future
so feel free to merge it as you like.

jsmeix commented at 2020-03-18 12:28:

@gozora
thank you for all your work here!

Currently I can not at all test things like that
because for now I have to work from home
on a rather limited computer.

jsmeix commented at 2020-10-16 09:26:

@gozora
I have a question because you had written OUTPUT=NETFS:

In
https://github.com/rear/rear/pull/2326#issue-370505870
you wrote OUTPUT=USB and OUTPUT=NETFS
and also in usr/share/rear/conf/default.conf you wrote
# 1. UEFI boot with OUTPUT=NETFS without secure boot (SECURE_BOOT_BOOTLOADER="")
https://github.com/rear/rear/blob/master/usr/share/rear/conf/default.conf#L2983
cf. https://github.com/rear/rear/pull/2326/files

Do you really use OUTPUT=NETFS or is that a typo which should be BACKUP=NETFS?

But when BACKUP=NETFS is meant I would not understand what in default.conf
# 1. UEFI boot with BACKUP=NETFS without secure boot (SECURE_BOOT_BOOTLOADER="")
would mean because what backup method is used should be irrelevant for the boot method.

The related issue https://github.com/rear/rear/issues/2276 indicates that
this pull request was actually about OUTPUT=USB with BACKUP=NETFS
but I like to be on the safe side regarding possibly exceptional OUTPUT vaules.

The reason behind is that I like to add a prep/default/036_valid_output_methods.sh
script that tests for valid OUTPUT vaules, cf.
https://github.com/rear/rear/issues/2501#issuecomment-709911656

So I need to know what exceptional OUTPUT vaules are in use "out there"
in addition to the well known ones that are documented in "man rear"

OUTPUT=RAMDISK
OUTPUT=ISO
OUTPUT=PXE
OUTPUT=OBDR
OUTPUT=USB
OUTPUT=RAWDISK

https://github.com/rear/rear/blob/master/doc/rear.8.adoc

gozora commented at 2020-10-16 09:45:

Hello @jsmeix,

Unfortunately I don't remember details, but checking config files on my Fedora 29 test servers I've made a typo

[root@fedora29 backup]# cat local.conf_NFS
OUTPUT=ISO
BACKUP=NETFS
BACKUP_OPTIONS="nfsvers=3,nolock"

BACKUP_URL=nfs://backup.virtual.sk/mnt/rear
OUTPUT_URL=nfs://backup.virtual.sk/mnt/rear/iso

BACKUP_PROG_EXCLUDE=( ${BACKUP_PROG_EXCLUDE[@]} '/mnt' '/media' '/var/tmp/*' )

USE_RESOLV_CONF="no"

GRUB_RESCUE=y

[root@fedora29 backup]# cat local.conf_USB
BACKUP=NETFS
OUTPUT=USB

BACKUP_URL=usb:///dev/disk/by-label/REAR-000
USB_SUFFIX="$HOSTNAME"
BACKUP_PROG_EXCLUDE=( ${BACKUP_PROG_EXCLUDE[@]} '/mnt' '/media' '/var/tmp/*' )

GRUB_RESCUE=y
GRUB2_DEFAULT_BOOT="1"
USE_RESOLV_CONF="no"

So the correct statement should look line this:

  • How was this pull request tested?
    ReaR rescue system boot with:
    OUTPUT=USB and OUTPUT=ISO
    on
    • SLES12-SP2
    • Fedora29
    • Centos 7

and

# 1. UEFI boot with OUTPUT=ISO without secure boot (SECURE_BOOT_BOOTLOADER="")

V.

jsmeix commented at 2020-10-16 09:58:

@gozora
thank you so much for your prompt and explanatory reply.
I will fix the wording.

jsmeix commented at 2020-10-16 10:05:

In default.conf fixed typo OUTPUT=NETFS to OUTPUT=ISO via
https://github.com/rear/rear/commit/fd89139db8e6e6950fab1fa03609771aba13d990


[Export of Github issue for rear/rear.]