#3357 Issue open
: finalize/.../660_install_grub2.sh automatism fails on RAID1¶
Labels: enhancement
, bug
jsmeix opened issue at 2024-12-05 15:03:¶
- ReaR version ("/usr/sbin/rear -V"):
current GitHub master code
- ReaR configuration files ("cat /etc/rear/site.conf" and/or "cat /etc/rear/local.conf"):
- Hardware vendor/product (PC or PowerNV BareMetal or ARM) or VM (KVM guest or PowerVM LPAR):
KVM/QEMU VM with BIOS and two 15G virtual harddisks /dev/vda and /dev/vdb
- 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):
BIOS
- Storage (local disk or SSD) and/or SAN (FC or iSCSI or FCoE) and/or multipath (DM or NVMe):
RAID 1 of two 15G virtual harddisks /dev/vda and /dev/vdb
- Storage layout ("lsblk -ipo NAME,KNAME,PKNAME,TRAN,TYPE,FSTYPE,LABEL,SIZE,MOUNTPOINT"):
- Description of the issue (ideally so that others can reproduce it):
In finalize/Linux-i386/660_install_grub2.sh the current automatism fails to determine where to install GRUB2 when there is more than one disk where GRUB2 can and should be installed
- Workaround, if any:
Explicity specifying the right disks where GRUB2 should be installed
GRUB2_INSTALL_DEVICES="/dev/vda /dev/vdb"
- Attachments, as applicable ("rear -D mkrescue/mkbackup/recover" debug log files):
Excerpt of "rear -D recover" console output:
Recreating initrd with /usr/bin/dracut...
Recreated initrd with /usr/bin/dracut
Installing GRUB2 boot loader...
Determining where to install GRUB2 (no GRUB2_INSTALL_DEVICES specified)
Failed to install GRUB2 - you may have to manually install it
WARNING:
For this system
SUSE_LINUX/15.6 on Linux-i386 (based on SUSE/15/i386)
there is no code to install a boot loader on the recovered system
or the code that we have failed to install the boot loader correctly.
Please contribute appropriate code to the Relax-and-Recover project,
see http://relax-and-recover.org/development/
Take a look at the scripts in /usr/share/rear/finalize - for example
for PC architectures like x86 and x86_64 see the script
/usr/share/rear/finalize/Linux-i386/660_install_grub2.sh
and for POWER architectures like ppc64le see the script
/usr/share/rear/finalize/Linux-ppc64le/660_install_grub2.sh
---------------------------------------------------
| IF YOU DO NOT INSTALL A BOOT LOADER MANUALLY, |
| THEN YOUR SYSTEM WILL NOT BE ABLE TO BOOT. |
---------------------------------------------------
You can use 'chroot /mnt/local bash --login'
to change into the recovered system and
manually install a boot loader therein.
Excerpt of "rear -D recover" log file
(excluding 'set -x' lines with more than two leading '++')
++ LogPrint 'Determining where to install GRUB2 (no GRUB2_INSTALL_DEVICES specified)'
2024-12-05 15:33:34.139126941 Determining where to install GRUB2 (no GRUB2_INSTALL_DEVICES specified)
++ test /mnt/local = /mnt/local
++ bootparts='/dev/md127p3
/dev/md127p4'
++ test '/dev/md127p3
/dev/md127p4'
++ disks='/dev/vda
/dev/vdb'
++ test '/dev/vda
/dev/vdb'
++ grub2_installed_disks=()
++ for disk in $disks
++ is_disk_a_pv /dev/vda
++ disk=/dev/vda
++ awk '$1 == "lvmdev" && $3 == "/dev/vda" { exit 1 }' /var/lib/rear/layout/disklayout.conf
++ return 1
++ part=/dev/md127p3
++ for bootpart in $bootparts
++ bootdisk='/dev/vda
/dev/vdb'
++ test /dev/vda = '/dev/vda
/dev/vdb'
++ for bootpart in $bootparts
++ bootdisk='/dev/vda
/dev/vdb'
++ test /dev/vda = '/dev/vda
/dev/vdb'
++ bootdisk='/dev/vda
/dev/vdb'
++ test '/dev/vda
/dev/vdb'
++ is_disk_grub_candidate '/dev/vda
/dev/vdb'
++ local 'disk=/dev/vda
/dev/vdb'
++ local disk_partitions part
++ local label flags
++ is_disk_a_pv '/dev/vda
/dev/vdb'
++ disk='/dev/vda
/dev/vdb'
++ awk '$1 == "lvmdev" && $3 == "/dev/vda
/dev/vdb" { exit 1 }' /var/lib/rear/layout/disklayout.conf
awk: cmd. line:1: $1 == "lvmdev" && $3 == "/dev/vda
awk: cmd. line:1: ^ unterminated string
awk: cmd. line:1: $1 == "lvmdev" && $3 == "/dev/vda
awk: cmd. line:1: ^ syntax error
++ return 0
++ return 1
++ continue
++ for disk in $disks
++ is_disk_a_pv /dev/vdb
++ disk=/dev/vdb
++ awk '$1 == "lvmdev" && $3 == "/dev/vdb" { exit 1 }' /var/lib/rear/layout/disklayout.conf
++ return 1
++ part=/dev/md127p3
++ for bootpart in $bootparts
++ bootdisk='/dev/vda
/dev/vdb'
++ test /dev/vdb = '/dev/vda
/dev/vdb'
++ for bootpart in $bootparts
++ bootdisk='/dev/vda
/dev/vdb'
++ test /dev/vdb = '/dev/vda
/dev/vdb'
++ bootdisk='/dev/vda
/dev/vdb'
++ test '/dev/vda
/dev/vdb'
++ is_disk_grub_candidate '/dev/vda
/dev/vdb'
++ local 'disk=/dev/vda
/dev/vdb'
++ local disk_partitions part
++ local label flags
++ is_disk_a_pv '/dev/vda
/dev/vdb'
++ disk='/dev/vda
/dev/vdb'
++ awk '$1 == "lvmdev" && $3 == "/dev/vda
/dev/vdb" { exit 1 }' /var/lib/rear/layout/disklayout.conf
awk: cmd. line:1: $1 == "lvmdev" && $3 == "/dev/vda
awk: cmd. line:1: ^ unterminated string
awk: cmd. line:1: $1 == "lvmdev" && $3 == "/dev/vda
awk: cmd. line:1: ^ syntax error
++ return 0
++ return 1
++ continue
++ is_true 1
++ case "$1" in
++ return 0
++ is_true
++ case "$1" in
++ return 1
++ LogPrintError 'Failed to install GRUB2 - you may have to manually install it'
2024-12-05 15:33:34.291918389 Failed to install GRUB2 - you may have to manually install it
What looks fishy therein at first glance is things like
++ bootdisk='/dev/vda
/dev/vdb'
...
++ is_disk_grub_candidate '/dev/vda
/dev/vdb'
++ local 'disk=/dev/vda
/dev/vdb'
++ local disk_partitions part
++ local label flags
++ is_disk_a_pv '/dev/vda
/dev/vdb'
++ disk='/dev/vda
/dev/vdb'
++ awk '$1 == "lvmdev" && $3 == "/dev/vda
/dev/vdb" { exit 1 }' /var/lib/rear/layout/disklayout.conf
awk: cmd. line:1: $1 == "lvmdev" && $3 == "/dev/vda
awk: cmd. line:1: ^ unterminated string
awk: cmd. line:1: $1 == "lvmdev" && $3 == "/dev/vda
awk: cmd. line:1: ^ syntax error
where variable and function names use singular
'bootdisdk' 'disk' 'is_disk_grub_candidate' 'is_disk_a_pv'
but they get an argument with more than one disk
/dev/vda
/dev/vdb
[Export of Github issue for rear/rear.]