-
Notifications
You must be signed in to change notification settings - Fork 246
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
Wrong GRUB version recovered #895
Comments
rear-testupd.log-bootloader+grub.txt @jsmeix |
I assing it to me because it is about openSUSE 13.1 @GCChelp On my openSUSE 13.1 test system Therefore I like to understand the reasoning behind |
@jsmeix I am not an expert in bootloader issues, too. That's why I always postpone the possible project to update GRUB legacy to GRUB 2... |
@GCChelp By updating only the files of the system from older ones This means in general that rear should be prepared But there is the general problem to reliably detect the actually I will dig into it how rear detects what bootloader is used... |
@GCChelp +++ cat /var/lib/rear/recovery/bootloader ++ BOOTLOADER=GRUB i.e. it has correctly detected that GRUB (not GRUB2) is used ++ Print 'Installing GRUB2 boot loader' ++ echo -e 'Installing GRUB2 boot loader' ++ grub_name=grub2 FYI: On my openSUSE 13.1 test system GRUB2 |
I fully agree!
I am willing to provide further details or do some tests in our environment. |
With probability one (cf. https://en.wikipedia.org/wiki/Almost_surely ) Your "result of egrep -i 'bootloader|grub' rear-testupd.log" + source /usr/share/rear/finalize/Linux-i386/21_install_grub.sh ++ (( USING_UEFI_BOOTLOADER )) ++ [[ GRUB = \G\R\U\B ]] +++ type -p grub-probe +++ type -p grub2-probe ++ [[ -n /sbin/grub2-probe ]] ++ (( USING_UEFI_BOOTLOADER )) 2016-06-27 12:20:57.496977540 Including finalize/Linux-i386/22_install_grub2.sh + source /usr/share/rear/finalize/Linux-i386/22_install_grub2.sh ++ (( USING_UEFI_BOOTLOADER )) +++ type -p grub-probe +++ type -p grub2-probe ++ [[ -n /sbin/grub2-probe ]] ++ LogPrint 'Installing GRUB2 boot loader' I.e. it runs finalize/Linux-i386/21_install_grub.sh The wrong test in finalize/Linux-i386/21_install_grub.sh is # check the BOOTLOADER variable (read by 01_prepare_checks.sh script) if [[ "$BOOTLOADER" = "GRUB" ]]; then if [[ $(type -p grub-probe) || $(type -p grub2-probe) ]]; then # grub2 script should handle this instead return fi fi In finalize/Linux-i386/22_install_grub2.sh there is the same test: # Only for GRUB2 - GRUB Legacy will be handled by its own script [[ $(type -p grub-probe) || $(type -p grub2-probe) ]] || return Currently I do not understand how that tests are meant to work. @GCChelp In this case please change For example (untested) remove the test from 21_install_grub.sh Then try if afterwards "rear recover" installs GRUB |
"git blame" indicates the above mentioned test in 21_install_grub.sh @gdha [[ $(type -p grub-probe) || $(type -p grub2-probe) ]] tests in #895 (comment) are meant to work? From my current point of view the test looks like an I would have expected something straightforward # do not do anything for GRUB 2 here because # GRUB 2 is installed via 22_install_grub2.sh test "GRUB2" = "$BOOTLOADER" && return and accordingly in 22_install_grub2.sh # do not do anything for GRUB (i.e. GRUB Legacy) here # because GRUB Legacy is installed via 21_install_grub.sh test "GRUB" = "$BOOTLOADER" && return |
Ha! |
Grepping in "git log" for "3f8b22f" results: Merge: 78a6f9f 3f8b22f Author: Gratien D'haese Date: Thu May 21 18:24:28 2015 +0200 Merge pull request #589 from sanderu/Grub2_support_for_Linux which leads to #589 Problems found: The 21_install_grub.sh checked for GRUB2 which is not part of the first 2048 bytes of a disk - only GRUB was present - thus the check for grub-probe/grub2-probe. I am afraid - I still do not understand it - I mean how does if [[ "$BOOTLOADER" = "GRUB2" ]]; then check the first 2048 bytes of a disk? On my openSUSE 13.1 I have |
@jsmeix I believe |
The whole logic when what bootloader install script In I need to test it. For now @gdha In particular I have now in finalize/Linux-i386/21_install_grub.sh # If the BOOTLOADER variable (read by finalize/default/01_prepare_checks.sh) # is not "GRUB" (which means GRUB Legacy) skip this script (which is only for GRUB Legacy) # because finalize/Linux-i386/22_install_grub2.sh is for installing GRUB 2 # and finalize/Linux-i386/22_install_elilo.sh is for installing elilo: test "GRUB" = "$BOOTLOADER" || return But I wonder what is the intended way what "rear recover" Is then "NOBOOTLOADER=1" the right default? Or should perhaps "rear recover" install GRUB 2 |
I tested # rpm -qa | grep -i grub grub-0.97-162.172.1 There it still "just works" (at least for me): RESCUE f96:~ # cat /var/lib/rear/recovery/bootloader GRUB RESCUE f96:~ # rear -d -D recover Relax-and-Recover 1.18 / Git ... Recreated initramfs (mkinitrd). Installing GRUB Legacy boot loader: Installed GRUB Legacy boot loader with /boot on disk with MBR booted on 'device (hd0) /dev/sda' with 'root (hd0,1)'. Updating udev configuration (70-persistent-net.rules) ... Finished recovering your system. You can explore it under '/mnt/local'. @GCChelp I assume it will not yet work for you because I did not type -p grub-probe || type -p grub2-probe but I show now that message Skip installing GRUB Legacy boot loader because GRUB 2 is installed (grub-probe or grub2-probe exist). I assume you will get that message |
@GCChelp Basically "git clone" it into a directory and This is how I did in on my above mentioned SLES11-SP4 system: # git clone https://github.com/jsmeix/rear.git Cloning into 'rear'... # cd rear # git branch -a * master ... remotes/origin/perfer_to_run_GRUB_install_script_as_specified_issue895 # git checkout -b perfer_to_run_GRUB_install_script_as_specified_issue895 origin/perfer_to_run_GRUB_install_script_as_specified_issue895 Branch perfer_to_run_GRUB_install_script_as_specified_issue895 set up to track remote branch perfer_to_run_GRUB_install_script_as_specified_issue895 from origin. Switched to a new branch 'perfer_to_run_GRUB_install_script_as_specified_issue895' # vi etc/rear/local.conf ... # grep -v '^#' etc/rear/local.conf OUTPUT=ISO BACKUP=NETFS BACKUP_OPTIONS="nfsvers=3,nolock" BACKUP_URL=nfs://10.160.4.244/nfs NETFS_KEEP_OLD_BACKUP_COPY=yes SSH_ROOT_PASSWORD="rear" USE_DHCLIENT="yes" KEEP_BUILD_DIR="" # usr/sbin/rear -d -D mkbackup ... |
Interestingly on my openSUSE 13.1 system I have by default # cat /etc/os-release NAME=openSUSE VERSION="13.1 (Bottle)" VERSION_ID="13.1" PRETTY_NAME="openSUSE 13.1 (Bottle) (x86_64)" # rpm -qa | grep -i grub grub2-2.00-39.1.3.x86_64 grub-0.97-194.1.2.x86_64 grub2-i386-pc-2.00-39.1.3.x86_64 grub2-x86_64-efi-2.00-39.1.3.x86_64 grub2-branding-openSUSE-13.1-10.4.13.noarch # type -p grub-probe # type -p grub2-probe /usr/sbin/grub2-probe This means the test for type -p grub-probe || type -p grub2-probe succeeds which results that during "rear recover" Skip installing GRUB Legacy boot loader because GRUB 2 is installed (grub-probe or grub2-probe exist). |
I tested # rpm -qa | grep -i grub grub2-2.02~beta2-69.1.x86_64 grub2-branding-SLE-12-11.3.1.noarch grub2-i386-pc-2.02~beta2-69.1.x86_64 grub2-snapper-plugin-2.02~beta2-69.1.noarch There it also still "just works" (at least for me): RESCUE e229:~ # cat /var/lib/rear/recovery/bootloader GRUB2 RESCUE e229:~ # rear -d -D recover Relax-and-Recover 1.18 / Git ... Recreated initramfs (mkinitrd). Installing GRUB2 boot loader Finished recovering your system. You can explore it under '/mnt/local'. |
@jsmeix
You are right, I got
BTW:
|
@GCChelp # mv /usr/sbin/grub2-probe /usr/sbin/grub2-probe.away as a dirty hack to make "rear recover" work on |
@jsmeix Your script version of 21_install_grub.sh looks ok to me. We can give it a try (+1) |
…_as_specified_issue895 First steps towards more reliably installing the right bootloader. Regarding installing GRUB Legacy as bootloader overhauled finalize/Linux-i386/21_install_grub.sh and improved finalie/default/01_prepare_checks.sh (see issue #895) It is still not fully reliably installing the right bootloader: When GRUB 2 is installed in addition To GrubLegacy it still prefers to install GRUB 2 as bootloader even if the BOOTLOADER variable tells "GRUB" (which means GRUB Legacy). I.e. further work is needed...
With #900 I merged It is still not fully reliably installing the right bootloader: I.e. further work is needed... An idea how to further improve it: If GRUB 2 and GRUB Legacy are installed and In contrast if GRUB Legacy is not installed then |
@jsmeix Concerning the dirty hack, I found another workaround: Regarding the BOOTLOADER variable and the file /var/lib/rear/recovery/bootloader : Where does this value come from? How is it determined and defined? |
@GCChelp Regarding Regarding Because of this I like to keep this issue open because |
I had the same error in openSUSE 42.1: You need to change the bootloader settings part like this and it will work: ... #skip if another bootloader was installed #for UEFI systems with grub legacy with should use efibootmgr instead if [[ "$BOOTLOADER" = "GRUB" || "$BOOTLOADER" = "GRUB2" ]]; then #Only for GRUB Legacy - GRUB2 will be handled by its own script |
@stoxxys |
@stoxxys On my openSUSE Leap 42.1 system I have only grub2* # cat /etc/os-release NAME="openSUSE Leap" VERSION="42.1" VERSION_ID="42.1" PRETTY_NAME="openSUSE Leap 42.1 (x86_64)" ... # rpm -qa | grep -i grub grub2-i386-pc-2.02~beta2-76.1.x86_64 grub2-2.02~beta2-76.1.x86_64 grub2-x86_64-efi-2.02~beta2-76.1.x86_64 grub2-branding-openSUSE-42.1-6.2.noarch grub2-snapper-plugin-2.02~beta2-76.1.noarch and for me "rear recover" just works there. |
@stoxxys Please report issues with older rear versions as separated In general in case of issues preferably try to reproduce them In general regarding how to test with # git clone https://github.com/rear/rear.git # cd rear # vi etc/rear/local.conf # usr/sbin/rear -d -D mkbackup and finally test whether "rear -d -D recover" works |
@GCChelp Do you still need some assistance from us or are you good to close it? |
All what is shown as "merged" above will be in the next |
rear version (/usr/sbin/rear -V): Relax-and-Recover 1.18 / Git
OS version (cat /etc/rear/os.conf or lsb_release -a):
OS_VENDOR=SUSE_LINUX
OS_VERSION=13.1
ARCH='Linux-i386'
OS='GNU/Linux'
OS_VERSION='13.1'
OS_VENDOR='SUSE_LINUX'
OS_VENDOR_VERSION='SUSE_LINUX/13.1'
OS_VENDOR_ARCH='SUSE_LINUX/i386'
rear configuration files (cat /etc/rear/site.conf or cat /etc/rear/local.conf):
OUTPUT=USB
USB_DEVICE=/dev/disk/by-label/REAR-000
BACKUP=NETFS
BACKUP_URL=nfs://nfsserver/backups/rear
BACKUP_OPTIONS="nfsvers=3,nolock"
EXCLUDE_MOUNTPOINTS=( /home /scratch )
AUTOEXCLUDE_PATH=( /media /mnt )
AUTOEXCLUDE_AUTOFS=..
AUTOEXCLUDE_DISKS=y
SSH_ROOT_PASSWORD=XXX
Brief description of the issue
"rear recover" restores unconfigured GRUB2, while GRUB legacy was used on the system.
Result is a unbootable machine after restore.
Work-around, if any
nothing known
The text was updated successfully, but these errors were encountered: