New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
on SLES15 with btrfs after "rear recover" GRUB2 fails to boot (manual GRUB2 install helps) #1828
Comments
Some more details from within the ReaR recovery system: RESCUE e220:~ # rear -D recover Using log file: /var/log/rear/rear-e220.log ... Restoring finished. Recreating directories (with permissions) from /var/lib/rear/recovery/directories_permissions_owner_group Updating udev configuration (70-persistent-net.rules) Running mkinitrd... Recreated initrd (/sbin/mkinitrd). Installing GRUB2 boot loader Finished recovering your system. You can explore it under '/mnt/local'. RESCUE e220:~ # parted -s /dev/sda unit MiB print Model: ATA QEMU HARDDISK (scsi) Disk /dev/sda: 20480MiB Sector size (logical/physical): 512B/512B Partition Table: gpt Disk Flags: Number Start End Size File system Name Flags 1 1.00MiB 9.00MiB 8.00MiB sda1 bios_grub 2 9.00MiB 12906MiB 12897MiB btrfs sda2 4 12906MiB 18431MiB 5525MiB xfs sda4 legacy_boot 3 18431MiB 20480MiB 2049MiB linux-swap(v1) sda3 swap RESCUE e220:~ # findmnt -a | grep sda `-/mnt/local /dev/sda2[/@/.snapshots/1/snapshot] btrfs rw,relatime,space_cache,subvolid=267,subvol=/@/.snapshots/1/snapshot |-/mnt/local/.snapshots /dev/sda2[/@/.snapshots] btrfs rw,relatime,space_cache,subvolid=266,subvol=/@/.snapshots |-/mnt/local/opt /dev/sda2[/@/opt] btrfs rw,relatime,space_cache,subvolid=262,subvol=/@/opt |-/mnt/local/tmp /dev/sda2[/@/tmp] btrfs rw,relatime,space_cache,subvolid=260,subvol=/@/tmp |-/mnt/local/usr/local /dev/sda2[/@/usr/local] btrfs rw,relatime,space_cache,subvolid=259,subvol=/@/usr/local |-/mnt/local/boot/grub2/i386-pc /dev/sda2[/@/boot/grub2/i386-pc] btrfs rw,relatime,space_cache,subvolid=264,subvol=/@/boot/grub2/i386-pc |-/mnt/local/boot/grub2/x86_64-efi /dev/sda2[/@/boot/grub2/x86_64-efi] btrfs rw,relatime,space_cache,subvolid=263,subvol=/@/boot/grub2/x86_64-efi |-/mnt/local/srv /dev/sda2[/@/srv] btrfs rw,relatime,space_cache,subvolid=261,subvol=/@/srv |-/mnt/local/var /dev/sda2[/@/var] btrfs rw,relatime,space_cache,subvolid=258,subvol=/@/var |-/mnt/local/home /dev/sda4 xfs rw,relatime,attr2,inode64,noquota RESCUE e220:~ # less /var/log/rear/rear-e220.log ... ++ echo -e 'Installing GRUB2 boot loader' ... ++ grub2-install --root-directory=/mnt/local /dev/sda Installing for i386-pc platform. grub2-install: warning: cannot open directory `/usr/share/locale': No such file or directory. Installation finished. No error reported. ... RESCUE e220:~ # find /mnt/local -ls 2>/dev/null | grep 'normal\.mod' 47542 116 -rw-r--r-- 1 root root 116504 Mar 18 13:38 /mnt/local/usr/lib/grub2/i386-pc/normal.mod 47543 792 -rw-r--r-- 1 root root 810048 Mar 18 13:38 /mnt/local/usr/lib/grub2/i386-pc/normal.module 48096 172 -rw-r--r-- 1 root root 174104 Mar 18 13:38 /mnt/local/usr/lib/grub2/x86_64-efi/normal.mod 48097 1208 -rw-r--r-- 1 root root 1236288 Mar 18 13:38 /mnt/local/usr/lib/grub2/x86_64-efi/normal.module 966 116 -rw-r--r-- 1 root root 116504 Jun 13 09:17 /mnt/local/boot/grub2/i386-pc/normal.mod RESCUE e220:~ # mkdir /tmp/btrfsroot RESCUE e220:~ # mount -o subvolid=0 /dev/sda2 /tmp/btrfsroot RESCUE e220:~ # find /tmp/btrfsroot -ls 2>/dev/null | grep 'normal\.mod' 966 116 -rw-r--r-- 1 root root 116504 Jun 13 09:17 /tmp/btrfsroot/@/boot/grub2/i386-pc/normal.mod 47542 116 -rw-r--r-- 1 root root 116504 Mar 18 13:38 /tmp/btrfsroot/@/.snapshots/1/snapshot/usr/lib/grub2/i386-pc/normal.mod 47543 792 -rw-r--r-- 1 root root 810048 Mar 18 13:38 /tmp/btrfsroot/@/.snapshots/1/snapshot/usr/lib/grub2/i386-pc/normal.module 48096 172 -rw-r--r-- 1 root root 174104 Mar 18 13:38 /tmp/btrfsroot/@/.snapshots/1/snapshot/usr/lib/grub2/x86_64-efi/normal.mod 48097 1208 -rw-r--r-- 1 root root 1236288 Mar 18 13:38 /tmp/btrfsroot/@/.snapshots/1/snapshot/usr/lib/grub2/x86_64-efi/normal.module RESCUE e220:~ # umount /tmp/btrfsroot RESCUE e220:~ # target_system_filesystem_root=/mnt/local RESCUE e220:~ # mount -t proc none $target_system_filesystem_root/proc RESCUE e220:~ # mount -t sysfs sys $target_system_filesystem_root/sys RESCUE e220:~ # mount -o bind /dev $target_system_filesystem_root/dev RESCUE e220:~ # chroot $target_system_filesystem_root e220:/ # /sbin/mkinitrd Creating initrd: /boot/initrd-4.12.14-15-default dracut: Executing: /usr/bin/dracut --logfile /var/log/YaST2/mkinitrd.log --force /boot/initrd-4.12.14-15-default 4.12.14-15-default dracut: dracut module 'dmraid' will not be installed, because command 'dmraid' could not be found! dracut: dracut module 'dmraid' will not be installed, because command 'dmraid' could not be found! dracut: *** Including module: bash *** dracut: *** Including module: systemd *** dracut: *** Including module: warpclock *** dracut: *** Including module: systemd-initrd *** dracut: *** Including module: i18n *** dracut: Could not find FONT_MAP none! dracut: *** Including module: drm *** dracut: *** Including module: plymouth *** dracut: *** Including module: btrfs *** dracut: *** Including module: kernel-modules *** dracut: *** Including module: qemu *** dracut: *** Including module: rootfs-block *** dracut: *** Including module: suse-xfs *** dracut: *** Including module: terminfo *** dracut: *** Including module: udev-rules *** dracut: Skipping udev rule: 40-redhat.rules dracut: Skipping udev rule: 50-firmware.rules dracut: Skipping udev rule: 50-udev.rules dracut: Skipping udev rule: 91-permissions.rules dracut: Skipping udev rule: 80-drivers-modprobe.rules dracut: *** Including module: dracut-systemd *** dracut: *** Including module: haveged *** dracut: *** Including module: usrmount *** dracut: *** Including module: base *** dracut: *** Including module: fs-lib *** dracut: *** Including module: shutdown *** dracut: *** Including module: suse *** dracut: *** Including modules done *** dracut: *** Installing kernel module dependencies and firmware *** dracut: *** Installing kernel module dependencies and firmware done *** dracut: *** Resolving executable dependencies *** dracut: *** Resolving executable dependencies done*** dracut: *** Hardlinking files *** dracut: *** Hardlinking files done *** dracut: *** Stripping files *** dracut: *** Stripping files done *** dracut: *** Generating early-microcode cpio image *** dracut: *** Store current command line parameters *** dracut: Stored kernel commandline: dracut: root=UUID=f4361595-0a29-4b1c-9d71-1560cdfc5de3 rootfstype=btrfs rootflags=rw,relatime,space_cache,subvolid=267,subvol=/@/.snapshots/1/snapshot,subvol=@/.snapshots/1/snapshot dracut: *** Creating image file '/boot/initrd-4.12.14-15-default' *** dracut: *** Creating initramfs image file '/boot/initrd-4.12.14-15-default' done *** e220:/ # /usr/sbin/grub2-mkconfig -o /boot/grub2/grub.cfg Generating grub configuration file ... Found theme: /boot/grub2/themes/SLE/theme.txt Found linux image: /boot/vmlinuz-4.12.14-15-default Found initrd image: /boot/initrd-4.12.14-15-default done e220:/ # /usr/sbin/grub2-install --force /dev/sda Installing for i386-pc platform. Installation finished. No error reported. e220:/ # exit exit RESCUE e220:~ # reboot |
As expected things work when I have the contents of How I did that (on the original system): # mkdir -p /boot/grub2/i386-pc-sv # vi /etc/fstab [replace the mount point /boot/grub2/i386-pc by /boot/grub2/i386-pc-sv] # reboot [afterwards the btrfs subvolume /@/boot/grub2/i386-pc is mounted at /boot/grub2/i386-pc-sv] # cp -r /boot/grub2/i386-pc-sv/* /boot/grub2/i386-pc [now the contents are also in the normal directory boot/grub2/i386-pc] # df --output=source,target,file /boot/grub2/i386-pc/normal.mod Filesystem Mounted on File /dev/sda2 / /boot/grub2/i386-pc/normal.mod # findmnt -o SOURCE,TARGET,FSTYPE / SOURCE TARGET FSTYPE /dev/sda2[/@/.snapshots/1/snapshot] / btrfs # rear -D mkbackup Of course this is not a solution. It seems when GRUB2 was installed by "rear recover" on the replacement system In contrast when GRUB2 is installed by the SUSE installer on the original system |
It does not help to modify @@ -83,7 +83,7 @@ partnr=$((partnr - 1)) if [[ "$bootdisk" == "$disk" ]]; then - #chroot $TARGET_FS_ROOT $grub_name-mkconfig -o /boot/$grub_name/grub.cfg + chroot $TARGET_FS_ROOT $grub_name-mkconfig -o /boot/$grub_name/grub.cfg #chroot $TARGET_FS_ROOT $grub_name-install "$bootdisk" $grub_name-install --root-directory=$TARGET_FS_ROOT $bootdisk else to let With that modified 620_install_grub2.sh I get during +++ echo /dev/sda ++ bootdisk=/dev/sda ++ partnr=2 ++ partnr=2 ++ partnr=1 ++ [[ /dev/sda == \/\d\e\v\/\s\d\a ]] ++ chroot /mnt/local grub2-mkconfig -o /boot/grub2/grub.cfg Generating grub configuration file ... Found theme: /boot/grub2/themes/SLE/theme.txt Found linux image: /boot/vmlinuz-4.12.14-23-default Found initrd image: /boot/initrd-4.12.14-23-default done ++ grub2-install --root-directory=/mnt/local /dev/sda Installing for i386-pc platform. grub2-install: warning: cannot open directory `/usr/share/locale': No such file or directory. Installation finished. No error reported. But when rebooting grub still goes into its Booting from Hard Disk... GRUB loading.. Welcome to GRUB! error: file '/boot/grub2/i386-pc/normal.mod' not found. Entering rescue mode... grub rescue> ls (hd0,gpt2)/boot/grub2/i386-pc [no output] grub rescue> i.e. the contents of the btrfs subvolume /@/boot/grub2/i386-pc In contrast when SLES15 with its default btrfs structure grub rescue> ls (hd0,gpt2)/boot/grub2/i386-pc [tons of files, in particular the GRUB2 modules] grub rescue> |
I asked our GRUB2 maintainer what the right way is I would say using --root-directory is not a good idea, that's why it is hidden and the reason it did not get removed is for compatibility (I think it used to provide the option but obselelted). The bootloader installation has to be done in "bootstrape" (aka chroot) to ensure the result is on behalf of the target system. The --root-direcoty did not bootstrape a chroot environment to install bootloader. Here would be the difference between --root-directory and bootstrape that would lead to unwanted side effect. 1. The host's grub2-install vs the grub2-install in chroot may be different. 2. The host's /etc/default on host is used than the one in chroot 3. The host's /usr/share/grub2 is used .. 4. The host's /usr/lib/grub2 is used .. 5. The mount table /proc/self/mount would be different than bootstrape env. So that I would suggest to replace the process with mount --bind /dev /mnt/local/dev mount --bind /proc /mnt/local/proc mount --bind /sys /mnt/local/sys chroot /mnt/local grub2-mkconfig -o /boot/grub2/grub2.cfg chroot /mnt/local grub2-install /dev/sda Accordingly I modified # Find boot-disk: bootdisk=$( find_disk_and_multipath "$part" ) findmnt -a chroot $TARGET_FS_ROOT findmnt -a for mount_device in dev proc sys ; do umount $TARGET_FS_ROOT/$mount_device && sleep 1 mount --bind /$mount_device $TARGET_FS_ROOT/$mount_device || Error "Failed to bind mount /$mount_device at $TARGET_FS_ROOT/$mount_device" done chroot $TARGET_FS_ROOT findmnt -a chroot $TARGET_FS_ROOT $grub_name-mkconfig -o /boot/$grub_name/grub.cfg && chroot $TARGET_FS_ROOT $grub_name-install "$bootdisk" && NOBOOTLOADER='' Now the recreated system boots. What I get in the log during "rear recover" for that part of the code is ++ bootdisk=/dev/sda ++ findmnt -a TARGET SOURCE FSTYPE OPTIONS / rootfs rootfs rw |-/sys sysfs sysfs rw,nosuid,nodev,noexec,relatime | |-/sys/kernel/security securityfs securityfs rw,nosuid,nodev,noexec,relatime | |-/sys/fs/cgroup tmpfs tmpfs ro,nosuid,nodev,noexec,mode=755 | | |-/sys/fs/cgroup/unified cgroup cgroup2 rw,nosuid,nodev,noexec,relatime | | |-/sys/fs/cgroup/systemd cgroup cgroup rw,nosuid,nodev,noexec,relatime,xattr,name=systemd | | |-/sys/fs/cgroup/cpu,cpuacct cgroup cgroup rw,nosuid,nodev,noexec,relatime,cpu,cpuacct | | |-/sys/fs/cgroup/cpuset cgroup cgroup rw,nosuid,nodev,noexec,relatime,cpuset | | |-/sys/fs/cgroup/rdma cgroup cgroup rw,nosuid,nodev,noexec,relatime,rdma | | |-/sys/fs/cgroup/net_cls,net_prio cgroup cgroup rw,nosuid,nodev,noexec,relatime,net_cls,net_prio | | |-/sys/fs/cgroup/perf_event cgroup cgroup rw,nosuid,nodev,noexec,relatime,perf_event | | |-/sys/fs/cgroup/memory cgroup cgroup rw,nosuid,nodev,noexec,relatime,memory | | |-/sys/fs/cgroup/freezer cgroup cgroup rw,nosuid,nodev,noexec,relatime,freezer | | |-/sys/fs/cgroup/pids cgroup cgroup rw,nosuid,nodev,noexec,relatime,pids | | |-/sys/fs/cgroup/devices cgroup cgroup rw,nosuid,nodev,noexec,relatime,devices | | |-/sys/fs/cgroup/blkio cgroup cgroup rw,nosuid,nodev,noexec,relatime,blkio | | `-/sys/fs/cgroup/hugetlb cgroup cgroup rw,nosuid,nodev,noexec,relatime,hugetlb | `-/sys/fs/pstore pstore pstore rw,nosuid,nodev,noexec,relatime |-/proc proc proc rw,nosuid,nodev,noexec,relatime |-/dev devtmpfs devtmpfs rw,nosuid,size=456976k,nr_inodes=114244,mode=755 | |-/dev/shm tmpfs tmpfs rw,nosuid,nodev | `-/dev/pts devpts devpts rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000 | `-/dev/pts none devpts rw,relatime,gid=5,mode=620,ptmxmode=000 |-/run tmpfs tmpfs rw,nosuid,nodev,mode=755 `-/mnt/local /dev/sda2[/@/.snapshots/1/snapshot] btrfs rw,relatime,space_cache,subvolid=267,subvol=/@/.snapshots/1/snapshot |-/mnt/local/opt /dev/sda2[/@/opt] btrfs rw,relatime,space_cache,subvolid=263,subvol=/@/opt |-/mnt/local/tmp /dev/sda2[/@/tmp] btrfs rw,relatime,space_cache,subvolid=260,subvol=/@/tmp |-/mnt/local/srv /dev/sda2[/@/srv] btrfs rw,relatime,space_cache,subvolid=261,subvol=/@/srv |-/mnt/local/root /dev/sda2[/@/root] btrfs rw,relatime,space_cache,subvolid=262,subvol=/@/root |-/mnt/local/.snapshots /dev/sda2[/@/.snapshots] btrfs rw,relatime,space_cache,subvolid=266,subvol=/@/.snapshots |-/mnt/local/var /dev/sda2[/@/var] btrfs rw,relatime,space_cache,subvolid=258,subvol=/@/var |-/mnt/local/boot/grub2/i386-pc /dev/sda2[/@/boot/grub2/i386-pc] btrfs rw,relatime,space_cache,subvolid=265,subvol=/@/boot/grub2/i386-pc |-/mnt/local/boot/grub2/x86_64-efi /dev/sda2[/@/boot/grub2/x86_64-efi] btrfs rw,relatime,space_cache,subvolid=264,subvol=/@/boot/grub2/x86_64-efi |-/mnt/local/usr/local /dev/sda2[/@/usr/local] btrfs rw,relatime,space_cache,subvolid=259,subvol=/@/usr/local |-/mnt/local/home /dev/sda4 xfs rw,relatime,attr2,inode64,noquota `-/mnt/local/proc none proc rw,relatime ++ chroot /mnt/local findmnt -a TARGET SOURCE FSTYPE OPTIONS / /dev/sda2[/@/.snapshots/1/snapshot] btrfs rw,relatime,space_cache,subvolid=267,subvol=/@/.snapshots/1/snapshot |-/opt /dev/sda2[/@/opt] btrfs rw,relatime,space_cache,subvolid=263,subvol=/@/opt |-/tmp /dev/sda2[/@/tmp] btrfs rw,relatime,space_cache,subvolid=260,subvol=/@/tmp |-/srv /dev/sda2[/@/srv] btrfs rw,relatime,space_cache,subvolid=261,subvol=/@/srv |-/root /dev/sda2[/@/root] btrfs rw,relatime,space_cache,subvolid=262,subvol=/@/root |-/.snapshots /dev/sda2[/@/.snapshots] btrfs rw,relatime,space_cache,subvolid=266,subvol=/@/.snapshots |-/var /dev/sda2[/@/var] btrfs rw,relatime,space_cache,subvolid=258,subvol=/@/var |-/boot/grub2/i386-pc /dev/sda2[/@/boot/grub2/i386-pc] btrfs rw,relatime,space_cache,subvolid=265,subvol=/@/boot/grub2/i386-pc |-/boot/grub2/x86_64-efi /dev/sda2[/@/boot/grub2/x86_64-efi] btrfs rw,relatime,space_cache,subvolid=264,subvol=/@/boot/grub2/x86_64-efi |-/usr/local /dev/sda2[/@/usr/local] btrfs rw,relatime,space_cache,subvolid=259,subvol=/@/usr/local |-/home /dev/sda4 xfs rw,relatime,attr2,inode64,noquota `-/proc none proc rw,relatime ++ for mount_device in dev proc sys ++ umount /mnt/local/dev umount: /mnt/local/dev: not mounted. ++ mount --bind /dev /mnt/local/dev ++ for mount_device in dev proc sys ++ umount /mnt/local/proc ++ sleep 1 ++ mount --bind /proc /mnt/local/proc ++ for mount_device in dev proc sys ++ umount /mnt/local/sys umount: /mnt/local/sys: not mounted. ++ mount --bind /sys /mnt/local/sys ++ chroot /mnt/local findmnt -a TARGET SOURCE FSTYPE OPTIONS / /dev/sda2[/@/.snapshots/1/snapshot] btrfs rw,relatime,space_cache,subvolid=267,subvol=/@/.snapshots/1/snapshot |-/opt /dev/sda2[/@/opt] btrfs rw,relatime,space_cache,subvolid=263,subvol=/@/opt |-/tmp /dev/sda2[/@/tmp] btrfs rw,relatime,space_cache,subvolid=260,subvol=/@/tmp |-/srv /dev/sda2[/@/srv] btrfs rw,relatime,space_cache,subvolid=261,subvol=/@/srv |-/root /dev/sda2[/@/root] btrfs rw,relatime,space_cache,subvolid=262,subvol=/@/root |-/.snapshots /dev/sda2[/@/.snapshots] btrfs rw,relatime,space_cache,subvolid=266,subvol=/@/.snapshots |-/var /dev/sda2[/@/var] btrfs rw,relatime,space_cache,subvolid=258,subvol=/@/var |-/boot/grub2/i386-pc /dev/sda2[/@/boot/grub2/i386-pc] btrfs rw,relatime,space_cache,subvolid=265,subvol=/@/boot/grub2/i386-pc |-/boot/grub2/x86_64-efi /dev/sda2[/@/boot/grub2/x86_64-efi] btrfs rw,relatime,space_cache,subvolid=264,subvol=/@/boot/grub2/x86_64-efi |-/usr/local /dev/sda2[/@/usr/local] btrfs rw,relatime,space_cache,subvolid=259,subvol=/@/usr/local |-/home /dev/sda4 xfs rw,relatime,attr2,inode64,noquota |-/proc proc proc rw,nosuid,nodev,noexec,relatime |-/dev devtmpfs devtmpfs rw,nosuid,size=456976k,nr_inodes=114244,mode=755 `-/sys sysfs sysfs rw,nosuid,nodev,noexec,relatime ++ chroot /mnt/local grub2-mkconfig -o /boot/grub2/grub.cfg Generating grub configuration file ... Found theme: /boot/grub2/themes/SLE/theme.txt Found linux image: /boot/vmlinuz-4.12.14-23-default Found initrd image: /boot/initrd-4.12.14-23-default done ++ chroot /mnt/local grub2-install /dev/sda Installing for i386-pc platform. Installation finished. No error reported. ++ NOBOOTLOADER= Nevertheless something is still not fully correct Booting from Hard Disk... GRUB loading.. Welcome to GRUB! error: invalid environment block. but it boots somehow regardless of that error. |
Regarding the GRUB2 In the rebooted recreated system I re-installed GRUB2 again # findmnt -a -t btrfs -o TARGET,SOURCE,OPTIONS TARGET SOURCE OPTIONS / /dev/sda2[/@/.snapshots/1/snapshot] rw,relatime,space_cache,subvolid=267,subvol=/@/.snapshots/1/snapshot |-/srv /dev/sda2[/@/srv] rw,relatime,space_cache,subvolid=261,subvol=/@/srv |-/root /dev/sda2[/@/root] rw,relatime,space_cache,subvolid=262,subvol=/@/root |-/.snapshots /dev/sda2[/@/.snapshots] rw,relatime,space_cache,subvolid=266,subvol=/@/.snapshots |-/opt /dev/sda2[/@/opt] rw,relatime,space_cache,subvolid=263,subvol=/@/opt |-/var /dev/sda2[/@/var] rw,relatime,space_cache,subvolid=258,subvol=/@/var |-/usr/local /dev/sda2[/@/usr/local] rw,relatime,space_cache,subvolid=259,subvol=/@/usr/local |-/boot/grub2/i386-pc /dev/sda2[/@/boot/grub2/i386-pc] rw,relatime,space_cache,subvolid=265,subvol=/@/boot/grub2/i386-pc |-/boot/grub2/x86_64-efi /dev/sda2[/@/boot/grub2/x86_64-efi] rw,relatime,space_cache,subvolid=264,subvol=/@/boot/grub2/x86_64-efi `-/tmp /dev/sda2[/@/tmp] rw,relatime,space_cache,subvolid=260,subvol=/@/tmp # grub2-mkconfig -o /boot/grub2/grub2.cfg Generating grub configuration file ... Found theme: /boot/grub2/themes/SLE/theme.txt Found linux image: /boot/vmlinuz-4.12.14-23-default Found initrd image: /boot/initrd-4.12.14-23-default done # grub2-install /dev/sda Installing for i386-pc platform. Installation finished. No error reported. # reboot I had expected that this helps to make the But it did not help. During booting I still get the GRUB2 Then on the original system I also re-installed GRUB2 again # findmnt -a -t btrfs -o TARGET,SOURCE,OPTIONS TARGET SOURCE OPTIONS / /dev/sda2[/@/.snapshots/1/snapshot] rw,relatime,space_cache,subvolid=267,subvol=/@/.snapshots/1/snapshot |-/opt /dev/sda2[/@/opt] rw,relatime,space_cache,subvolid=263,subvol=/@/opt |-/root /dev/sda2[/@/root] rw,relatime,space_cache,subvolid=262,subvol=/@/root |-/var /dev/sda2[/@/var] rw,relatime,space_cache,subvolid=258,subvol=/@/var |-/srv /dev/sda2[/@/srv] rw,relatime,space_cache,subvolid=261,subvol=/@/srv |-/.snapshots /dev/sda2[/@/.snapshots] rw,relatime,space_cache,subvolid=266,subvol=/@/.snapshots |-/usr/local /dev/sda2[/@/usr/local] rw,relatime,space_cache,subvolid=259,subvol=/@/usr/local |-/boot/grub2/i386-pc /dev/sda2[/@/boot/grub2/i386-pc] rw,relatime,space_cache,subvolid=265,subvol=/@/boot/grub2/i386-pc |-/boot/grub2/x86_64-efi /dev/sda2[/@/boot/grub2/x86_64-efi] rw,relatime,space_cache,subvolid=264,subvol=/@/boot/grub2/x86_64-efi `-/tmp /dev/sda2[/@/tmp] rw,relatime,space_cache,subvolid=260,subvol=/@/tmp # grub2-mkconfig -o /boot/grub2/grub2.cfg Generating grub configuration file ... Found theme: /boot/grub2/themes/SLE/theme.txt Found linux image: /boot/vmlinuz-4.12.14-23-default Found initrd image: /boot/initrd-4.12.14-23-default done # grub2-install /dev/sda Installing for i386-pc platform. Installation finished. No error reported. # reboot The original system still boots without any GRUB2 error message. So I conclude that in the recreated system Investigating... |
The GRUB2 config file FYI: |
Also /boot/grub2/grubenv is identical on the recreated system Simply moving away that file helps on the recreated system: # mv /boot/grub2/grubenv /boot/grub2/grubenv.old # grub2-mkconfig -o /boot/grub2/grub2.cfg Generating grub configuration file ... Found theme: /boot/grub2/themes/SLE/theme.txt Found linux image: /boot/vmlinuz-4.12.14-23-default Found initrd image: /boot/initrd-4.12.14-23-default done # grub2-install /dev/sda Installing for i386-pc platform. Installation finished. No error reported. # reboot Now also the recreated system boots I got an automatically new created /boot/grub2/grubenv FYI: # GRUB Environment Block # WARNING: Do not edit this file other than by grub2-editenv env_block=512+1 saved_entry=SLES 15 ################################################################### ... and that is the content of the new /boot/grub2/grubenv on the recreated system # GRUB Environment Block # WARNING: Do not edit this file other than by grub2-editenv ################################################################## ... |
According to what It is often useful to be able to remember a small amount of information from one boot to the next. ... GRUB provides an “environment block” which can be used to save a small amount of state. ... The environment block is a preallocated 1024-byte file, which normally lives in /boot/grub/grubenv (although you should not assume this). At boot time, the load_env command (see load_env) loads environment variables from it, and the save_env (see save_env) command saves environment variables to it. From a running system, the grub-editenv utility can be used to edit the environment block. Because on a by "rear recover" recreated system Accordingly it is correct to delete all information from a previous boot rm /mnt/local/boot/grub2/grubenv according to There is no 'delete' command; if you want to delete the whole environment block, use 'rm /boot/grub2/grubenv'. |
To get boot/grub2/grubenv that was restored from the backup BACKUP_RESTORE_MOVE_AWAY_FILES=( /boot/grub2/grubenv ) The boot/grub2/grubenv that was restored from the backup has this content: # GRUB Environment Block # WARNING: Do not edit this file other than by grub2-editenv env_block=512+1 saved_entry=SLES 15 #####################################################... |
For the log: |
My current |
With #1843 merged Fixing it in the same way for the ppc64le architecture is planned for next week, |
My attempt to fix it in the same way for PPC64/PPC64LE is |
I asked our GRUB2 maintainer what the right way is > > > I would like to know what the "officially right" way is > > > how to install GRUB2 on a SLES15 system when one is > > > not "inside" a running SLES15 system but "outside" > > > e.g. in a rescue system. > > > > ... I would suggest ... > > > > mount --bind /dev /mnt/local/dev > > mount --bind /proc /mnt/local/proc > > mount --bind /sys /mnt/local/sys > > chroot /mnt/local grub2-mkconfig -o /boot/grub2/grub2.cfg > > chroot /mnt/local grub2-install /dev/sda > > is it exactly the same procedure also on POWER architecture > when GRUB2 is used e.g. on PPC64 and/or PPC64LE > or are there differences? Yes the procedure is the same, but the install device ... has to be PPC PReP partition. (The openfirmware is configured to read the elf image embedded in PReP partition, like how the MBR is used by pc-bios to embed boot code). |
…B2_installation_for_ppc64le Fixed, simplified and enhanced GRUB2 installation for PPC64/PPC64LE in the same way as it was already done for x86 architecture, cf. #1843 and #1828 so that the code in finalize/Linux-ppc64le/620_install_grub2.sh is aligned with the code in finalize/Linux-i386/620_install_grub2.sh as far as possible. Additionally the new is_completely_identical_layout_mapping function detects if a completely identical mapping and is used to not run the apply_layout_mappings function when there is a completely identical mapping cf. #1847
With #1848 merged |
ReaR version ("/usr/sbin/rear -V"):
Current ReaR GitHub master code (i.e. what will become ReaR 2.4)
OS version ("cat /etc/rear/os.conf" or "lsb_release -a" or "cat /etc/os-release"):
System architecture (x86 compatible or POWER and/or what kind of virtual machine):
Virtual KVM/QEMU x86_64 machine with a single 20GiB virtual harddisk
Are you using BIOS or UEFI or another way to boot?
BIOS
Brief description of the issue:
Reboot after "rear recover" fails in GRUB2 (got into grub rescue mode)
because grub2 could not load
normal.mod
(and other modules)because - as far as I found out by
ls
in grub rescue mode - thereare no grub2 modules accessible by grub2.
It seems the contents of the btrfs subvolume
/@/boot/grub2/i386-pc
that is mounted at
/boot/grub2/i386-pc
on the original systemare not accessible during boot time by grub2 as it was installed
by "rear recover" on the replacement system.
Work-around, if any:
After "rear recover" when still in the running ReaR recovery system
manually re-install GRUB2 on the replacement system as follows:
Then the replacement system boots
but I still notice that there is a possibly grub error message
which is too fast flashing away so that I cannot read it.
I need to investigate what the right way is how to correctly
install GRUB2 on SLES15 with btrfs.
On SLES15 with e.g. ext4 things still work, cf.
https://github.com/rear/rear/wiki/Test-Matrix-rear-2.4
This issue is no blocker to release ReaR 2.4
because SUSE customers can get a fix
via a SUSE specific maintenance update
and non SUSE customers who try out SLES 15
can use our GitHub master code when it is fixed there.
FYI:
As usual for each and every new SLES version
its default btrfs stuff changes in incompatible ways
which breaks ReaR and I need to fix things - just business as usual.
I could have sworn it had worked with some earlier SLES 15 beta
but I do no longer have SLES 15 beta ISOs to re-test that and
in the end it does not matter up to what version things had worked.
The text was updated successfully, but these errors were encountered: