#2644 Issue closed: Grub boot option for OUTPUT=USB (syslinux may not work with coreboot)

Labels: enhancement, no-issue-activity

DEvil0000 opened issue at 2021-07-02 12:53:

  • ReaR version ("/usr/sbin/rear -V"):
    Relax-and-Recover 2.6 / 2020-06-17

  • OS version ("cat /etc/os-release" or "lsb_release -a" or "cat /etc/rear/os.conf"):
    Ubuntu 20.04.2

  • ReaR configuration files ("cat /etc/rear/site.conf" and/or "cat /etc/rear/local.conf"):
    OUTPUT=USB
    BACKUP=BORG
    USB_DEVICE=/dev/disk/by-label/REAR-000
    USB_DEVICE_FILESYSTEM_LABEL=REAR-000
    USB_DEVICE_PARTED_LABEL=gpt
    USB_DEVICE_FILESYSTEM=ext4
    CLONE_USERS=(root)
    CLONE_GROUPS=(root)
    CLONE_ALL_USERS_GROUPS="false"
    BORGBACKUP_REPO="/borg"
    BORGBACKUP_UMASK="0002"
    BORGBACKUP_ENC_TYPE="repokey"
    export BORG_RELOCATED_REPO_ACCESS_IS_OK="yes"
    export BORG_UNKNOWN_UNENCRYPTED_REPO_ACCESS_IS_OK="yes"
    export TMPDIR="/wsp_var/tmp/"
    #USING_UEFI_BOOTLOADER=1
    USE_RESOLV_CONF="no"
    USE_DHCLIENT=no
    USB_UEFI_PART_SIZE="512"
    USE_SERIAL_CONSOLE=console=ttyS0,115200
    REAR_INITRD_COMPRESSION="best"
    GRUB2_DEFAULT_BOOT="2"
    USE_STATIC_NETWORKING=1

  • Hardware (PC or PowerNV BareMetal or ARM) or virtual machine (KVM guest or PoverVM LPAR):
    PC Engines APU -

  • System architecture (x86 compatible or PPC64/PPC64LE or what exact ARM device):
    x86_64

  • Firmware (BIOS or UEFI or Open Firmware) and bootloader (GRUB or ELILO or Petitboot):
    Coreboot/bios grub on system

  • Storage (local disk or SSD) and/or SAN (FC or iSCSI or FCoE) and/or multipath (DM or NVMe):
    local

  • Storage layout ("lsblk -ipo NAME,KNAME,PKNAME,TRAN,TYPE,FSTYPE,SIZE,MOUNTPOINT" or "lsblk" as makeshift):

sda                8:0    1 57.3G  0 disk 
└─sda1             8:1    1 57.3G  0 part 
sdb                8:16   1   15G  0 disk 
├─sdb1             8:17   1 1007K  0 part 
├─sdb2             8:18   1    1G  0 part /boot
└─sdb3             8:19   1   14G  0 part (lvm)
  ├─var      253:0    0    1G  0 lvm  /var
  ├─database 253:1    0    1G  0 lvm  /db
  └─system   253:2    0   12G  0 lvm  /
  • Description of the issue (ideally so that others can reproduce it):
    when building a USB stick I have to use efi or syslinux for boot.
    efi is not supported by this machine.
    syslinux/extlinux does start but not boot anything.
    it would be nice to choose grub for this. Everything would use the same boot system and would work fine.

jsmeix commented at 2021-07-05 10:13:

I am not at all a booting expert and
I know basically nothing at all about coreboot.

Perhaps @pcahyna could tell a bit more about
using GRUB as bootloader also for OUTPUT=USB?

An alternative to OUTPUT=USB is OUTPUT=RAWDISK, see
https://github.com/rear/rear/issues/2500
for an example and see the RAWDISK_* config variables
in our current usr/share/rear/conf/default.conf
https://github.com/rear/rear/blob/master/usr/share/rear/conf/default.conf

According to default.conf and man rear (excerpt):

OUTPUT=RAWDISK
    ...
    supports Legacy BIOS boot if syslinux is installed

So OUTPUT=RAWDISK also uses syslinux for BIOS boot
so that OUTPUT=RAWDISK may fail same as OUTPUT=USB
in case of coreboot (if syslinux does not work with coreboot).

FYI:
With ReaR version 2.6 RAWDISK output fails to boot on Ubuntu >=18.04.4
when using Grub 2 + UEFI but without Secure Boot, see
https://github.com/rear/rear/issues/2419
which is fixed in current ReaR GitHub master code.
Regarding using current ReaR GitHub master code see the section
"Testing current ReaR upstream GitHub master code" in
https://en.opensuse.org/SDB:Disaster_Recovery

DEvil0000 commented at 2021-07-05 15:37:

the output=rawdisk method is actually working fine with this machine. So we have found a workaround and we know the issue is in the way the usb disk is prepared.
This workaround however need some additional scripting to write the file to the disk and create a second partition for later backup storage (borg in my case). This is not at all a solution for my usecase.

Edit:

  1. As a sidenote output=iso and then writing the iso to USB should work the same way. I however did not test it.
  2. With grub one can boot from a iso file stored on disk. I may use that method in the future.
  3. output=usb is broken in most modes - the only combination working fine for me is uefi + gpt (uefi however is not supported on this device)

DEvil0000 commented at 2021-07-06 16:37:

Since serial display was not fully/correctly working for me (different issue - PR follows soon) I did try most boot entries but not all of them.

The chainloading from other disk and the topmost entry may have worked while all the ones I expected to work (around +/-2 from the default one) did not. Since I started to fix all sorts of issues in the scripts and will PR them soon I am not sure if that one entry at top was actually working all the time or just due to other fixes.

jsmeix commented at 2021-07-07 08:33:

@DEvil0000
thank you in advance for your pull requests!

I recommend to have a look at
https://github.com/rear/rear/wiki/Coding-Style
to avoid that you do major coding work on your own
but then we at ReaR upstream may have many questions about
what the code is meant to do and why it does this or that specific thing
and why things are implemented in this or that specific way.

In particular the USB bootloader setup code is rather old code
e.g. 50% of the code in output/USB/Linux-i386/300_create_extlinux.sh
is 10 years old (from 2011 according to what 'git blame' shows)
so large parts of the USB bootloader setup code is not in compliance with
https://github.com/rear/rear/wiki/Coding-Style

In the past I tried several times to generally clean up the USB bootloader setup code
but I failed because I am not a sufficient bootloader setup expert to understand
how the current code works in all cases.
I could fix a specific booting issue with my own USB disk at my own computer
by trial and error attempts until it works for me in my specific environment
but I cannot do a general cleanup of the USB bootloader setup code.

github-actions commented at 2021-09-06 02:12:

Stale issue message


[Export of Github issue for rear/rear.]