#2659 PR merged
: Simplifications for USB_BOOTLOADER="grub"¶
Labels: enhancement
, cleanup
, fixed / solved / done
jsmeix opened issue at 2021-07-20 09:01:¶
-
Type: Enhancement
-
Impact: Normal
-
Reference to related issue (URL):
https://github.com/rear/rear/pull/2655 -
How was this pull request tested?
Not at all tested by me -
Brief description of the changes in this pull request:
Simplifications for USB_BOOTLOADER="grub"
jsmeix commented at 2021-07-23 14:26:¶
This pull request is a part of https://github.com/rear/rear/issues/2648
jsmeix commented at 2021-07-26 13:14:¶
With the recent adaptions
USB_BOOTLOADER="grub" works in a basic way for me
on my older x86_64 laptop with traditional BIOS
with a separated boot partition
with GPT partitioning
on openSUSE Leap 15.2 that has /boot/grub2 (but no /boot/grub).
With etc/rear/local.conf
OUTPUT=USB
USB_DEVICE_FILESYSTEM_PERCENTAGE=10
USB_DEVICE_FILESYSTEM_LABEL='MY-DATA'
USB_BOOT_PART_SIZE=1024
USB_BOOTLOADER="grub"
USB_DEVICE_BOOT_LABEL=MY-BOOT
OUTPUT_URL=usb:///dev/disk/by-label/MY-BOOT
USB_DEVICE_PARTED_LABEL=gpt
BACKUP=NETFS
BACKUP_URL=usb:///dev/disk/by-label/MY-DATA
I get
# usr/sbin/rear -D format /dev/sdb
...
Repartitioning /dev/sdb
Creating partition table of type gpt on /dev/sdb
Creating BIOS boot partition /dev/sdb1
Setting 'bios_grub' flag on BIOS boot partition /dev/sdb1
Creating boot partition /dev/sdb2 with size 1024 MiB aligned at 8 MiB
Setting 'legacy_boot' flag on boot partition /dev/sdb2
Creating ReaR data partition /dev/sdb3 up to 10% of /dev/sdb
Creating ext2 filesystem with label 'MY-BOOT' on boot partition /dev/sdb2
Creating ext3 filesystem with label 'MY-DATA' on ReaR data partition /dev/sdb3
Adjusting filesystem parameters on ReaR data partition /dev/sdb3
Exiting rear format (PID 21208) and its descendant processes ...
# usr/sbin/rear -D mkbackup
...
Created initrd.cgz with gzip default compression (68582767 bytes) in 15 seconds
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
Saved /root/rear.github.master/var/log/rear/rear-linux-h9wr.log as rear/linux-h9wr/20210726.1506/rear-linux-h9wr.log
Making backup (using backup method NETFS)
Creating tar archive '/tmp/rear.l5lqCsqFVPTjR6o/outputfs/rear/linux-h9wr/20210726.1506/backup.tar.gz'
Preparing archive operation
OK
Exiting rear mkbackup (PID 21898) and its descendant processes ...
# usr/sbin/rear -D mkbackup
...
Created initrd.cgz with gzip default compression (68580499 bytes) in 14 seconds
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
Saved /root/rear.github.master/var/log/rear/rear-linux-h9wr.log as rear/linux-h9wr/20210726.1508/rear-linux-h9wr.log
Making backup (using backup method NETFS)
Creating tar archive '/tmp/rear.9fHYUxaJSUPH3EX/outputfs/rear/linux-h9wr/20210726.1508/backup.tar.gz'
Preparing archive operation
OK
Exiting rear mkbackup (PID 14065) and its descendant processes ...
# parted -s /dev/sdb unit MiB print
Model: TOSHIBA External USB 3.0 (scsi)
Disk /dev/sdb: 476940MiB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
1 0.02MiB 8.00MiB 7.98MiB primary bios_grub
2 8.00MiB 1032MiB 1024MiB ext2 primary legacy_boot
3 1032MiB 47694MiB 46662MiB ext3 primary
# lsblk -ipo NAME,TRAN,TYPE,FSTYPE,SIZE,LABEL /dev/sdb
NAME TRAN TYPE FSTYPE SIZE LABEL
/dev/sdb usb disk 465.8G
|-/dev/sdb1 part 8M
|-/dev/sdb2 part ext2 1G MY-BOOT
`-/dev/sdb3 part ext3 45.6G MY-DATA
# find /dev/disk/by-*/ -ls | grep 'MY-'
... /dev/disk/by-label/MY-DATA -> ../../sdb3
... /dev/disk/by-label/MY-BOOT -> ../../sdb2
# mount /dev/sdb2 /mnt ; find /mnt ; umount /mnt
/mnt
/mnt/lost+found
/mnt/boot
/mnt/boot/grub2
/mnt/boot/grub2/grub.cfg
/mnt/boot/grub2/i386-pc
/mnt/boot/grub2/i386-pc/xnu.mod
...
/mnt/boot/grub2/i386-pc/ufs2.mod
/mnt/boot/grub2/fonts
/mnt/boot/grub2/fonts/unicode.pf2
/mnt/boot/grub2/grubenv
/mnt/linux-h9wr
/mnt/rear
/mnt/rear/linux-h9wr
/mnt/rear/linux-h9wr/20210726.1506
/mnt/rear/linux-h9wr/20210726.1506/kernel
/mnt/rear/linux-h9wr/20210726.1506/initrd.cgz
/mnt/rear/linux-h9wr/20210726.1506/rear-linux-h9wr.log
/mnt/rear/linux-h9wr/20210726.1508
/mnt/rear/linux-h9wr/20210726.1508/kernel
/mnt/rear/linux-h9wr/20210726.1508/initrd.cgz
/mnt/rear/linux-h9wr/20210726.1508/rear-linux-h9wr.log
# mount /dev/sdb3 /mnt ; find /mnt ; umount /mnt
/mnt
/mnt/lost+found
/mnt/rear
/mnt/rear/linux-h9wr
/mnt/rear/linux-h9wr/20210726.1506
/mnt/rear/linux-h9wr/20210726.1506/backup.log
/mnt/rear/linux-h9wr/20210726.1506/backup.tar.gz
/mnt/rear/linux-h9wr/20210726.1508
/mnt/rear/linux-h9wr/20210726.1508/backup.log
/mnt/rear/linux-h9wr/20210726.1508/backup.tar.gz
That USB disk boots with GRUB2
on my older x86_64 laptop with traditional BIOS.
The ReaR recovery system starts up and is usable.
What does not yet work is:
Selection in the GRUB2 boot menue what to boot i.e.
the recovery system and backup dated 20210726.1506
or the recovery system and backup dated 20210726.1508
Currently only the last one can be booted because
e.g. im my case the created boot/grub2/grub.cfg contains
menuentry "Relax-and-Recover (no Secure Boot)" --class gnu-linux --class gnu --class os {
echo 'Loading kernel ...'
linux /rear/linux-h9wr/20210726.1508/kernel root=UUID=f05af948-6075-40a3-9191-354b0a0a9afc selinux=0
echo 'Loading initial ramdisk ...'
initrd /rear/linux-h9wr/20210726.1508/initrd.cgz
}
menuentry "Relax-and-Recover (Secure Boot)" --class gnu-linux --class gnu --class os {
echo 'Loading kernel ...'
linuxefi /rear/linux-h9wr/20210726.1508/kernel root=UUID=f05af948-6075-40a3-9191-354b0a0a9afc selinux=0
echo 'Loading initial ramdisk ...'
initrdefi /rear/linux-h9wr/20210726.1508/initrd.cgz
}
Booting the existing system from the built-in local harddisk does not
work
because e.g. im my case the created boot/grub2/grub.cfg contains
menuentry "Boot original system" {
search --fs-uuid --no-floppy --set=esp
chainloader ($esp)
}
The GRUB2 default is to boot the recovery system via
Relax-and-Recover (no Secure Boot)
jsmeix commented at 2021-07-26 13:19:¶
I think some things will get already fixed by
https://github.com/rear/rear/pull/2661
So my plan is to merge this pull request here soon
so that I can then merge
https://github.com/rear/rear/pull/2661
and then I will re-test how things behave in particular with
SUSE and openSUSE systems that have things like
grub2-install (but no grub-install) and /boot/grub2 (but no /boot/grub).
jsmeix commented at 2021-07-26 13:21:¶
@rear/contributors
if there are no objections
I would like to merge this pull request tomorrow morning.
DEvil0000 commented at 2021-07-26 14:32:¶
you are correct, #2661 fixes some of the issues you face with grub
config.
Just for additional explanation:
"Relax-and-Recover (no Secure Boot)" is correct in case you don't use
EFI and should work for EFI with secure boot disabled.
"Relax-and-Recover (Secure Boot)" only works with EFI (and you may need
secure boot enabled).
The mentioned PR makes this a bit more clear and fixes some other things
around EFI/no EFI and serial config.
[Export of Github issue for rear/rear.]