#3054 PR merged: Fail safe USB_DEVICE_BOOT_LABEL setting and fallback

Labels: enhancement, fixed / solved / done, minor bug

jsmeix opened issue at 2023-10-10 12:59:

OUTPUT=USB
USB_BOOTLOADER="grub"
USB_DEVICE_PARTED_LABEL=gpt
BACKUP=NETFS
BACKUP_URL=usb:///dev/disk/by-label/REAR-000
  • How was this pull request tested?
    See below how "rear mkrescue" looks now.
    I tested that GRUB in the recovery system boots now without error message.
    Before it had also booted but via some GRUB fallback with an error message.

  • Description of the changes in this pull request:

In output/USB/Linux-i386/300_create_grub.sh
check with "lsblk -no LABEL" if something with USB_DEVICE_BOOT_LABEL exists
and if not try to use USB_DEVICE_FILESYSTEM_LABEL if something with it exists
and error out otherwise.

jsmeix commented at 2023-10-10 13:04:

On my test VM I use for OUTPUT=USB

# lsblk -ipo NAME,KNAME,TRAN,TYPE,FSTYPE,LABEL,SIZE /dev/sdb
NAME        KNAME     TRAN TYPE FSTYPE LABEL    SIZE
/dev/sdb    /dev/sdb  ata  disk                  10G
|-/dev/sdb1 /dev/sdb1      part                   8M
|-/dev/sdb2 /dev/sdb2      part vfat   REAR-EFI   1G
`-/dev/sdb3 /dev/sdb3      part ext3   REAR-000   9G

# parted -s /dev/sdb unit GiB print
Model: ATA QEMU HARDDISK (scsi)
Disk /dev/sdb: 10.0GiB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 
Number  Start    End      Size     File system  Name     Flags
 1      0.00GiB  0.01GiB  0.01GiB               primary  bios_grub
 2      0.01GiB  1.01GiB  1.00GiB  fat32        primary  boot, esp
 3      1.01GiB  10.0GiB  8.99GiB  ext3         primary  legacy_boot

Before it was:

# usr/sbin/rear -D mkrescue
...
Using GRUB2 as USB bootloader for legacy BIOS boot on /dev/sdb (USB_BOOTLOADER='grub')
Installing GRUB2 as USB bootloader on /dev/sdb
Creating GRUB2 config for legacy BIOS boot as USB bootloader
Configuring GRUB2 kernel /rear/localhost/20231010.1234/kernel
Configuring GRUB2 initrd /rear/localhost/20231010.1234/initrd.cgz
Configuring GRUB2 root device as 'search --no-floppy --set=root --label REARBOOT'
...

With the changes in this pull request:

# usr/sbin/rear -D mkrescue
...
Using GRUB2 as USB bootloader for legacy BIOS boot on /dev/sdb (USB_BOOTLOADER='grub')
Installing GRUB2 as USB bootloader on /dev/sdb
Creating GRUB2 config for legacy BIOS boot as USB bootloader
Could not find USB_DEVICE_BOOT_LABEL 'REARBOOT' on /dev/sdb
Using USB_DEVICE_FILESYSTEM_LABEL 'REAR-000' as USB_DEVICE_BOOT_LABEL
Configuring GRUB2 kernel /rear/localhost/20231010.1444/kernel
Configuring GRUB2 initrd /rear/localhost/20231010.1444/initrd.cgz
Configuring GRUB2 root device as 'search --no-floppy --set=root --label REAR-000'
...

jsmeix commented at 2023-10-12 05:46:

@rear/contributors
unless there are objections I would like
to merge it tomorrow afternoon.


[Export of Github issue for rear/rear.]