-
-
Notifications
You must be signed in to change notification settings - Fork 268
first steps to make GRUB_RESCUE work for GRUB2 on SLES12 #942
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
first steps to make GRUB_RESCUE work for GRUB2 on SLES12 #942
Conversation
| # (grub-probe or grub2-probe only exist in GRUB 2) | ||
| # in particular do not run this script when GRUB Legacy is used | ||
| # (for GRUB Legacy output/default/94_grub_rescue.sh is run): | ||
| type -p grub-probe >&2 || type -p grub2-probe >&2 || { LogPrint "Skipping GRUB_RESCUE setup for GRUB 2 (no GRUB 2 found)." return ; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jsmeix Did you not forget a ; between the LogPrint and return?
|
@gdha Yes, the ';' was missing. I also removed the '2>&8'. Regarding GRUB 2 config using '--set=root' I don't know. Now I changed it so that setting GRUB2 password I only liked to check hwo it behaves for me without GRUB_RESCUE=y GRUB_RESCUE_PASSWORD="" GRUB_SUPERUSER="" For me it behaves better now because now I can still boot I.e. who actively enables GRUB_RESCUE gets what he |
|
@jsmeix after a bit of comparing why Centos protects only ReaR entry with password and SLES12 does all, I've probably found the reason. In order to allow boot entry without password you need to specify in grub.cfg option --unrestricted to entry you don't wish to protect with password. e.g. I guess RedHat guys are using this option as default, that why they don't had trouble with such setup ... |
|
Yes, while working on it I also learned But I will never ever implement that via GRUB_RESCUE I find it scaring enough that via GRUB_RESCUE Therefore my current code makes GRUB_RESCUE_PASSWORD Meanwhile I think I like to change the default to empty GRUB_RESCUE_PASSWORD="REAR" GRUB_SUPERUSER="rearadmin" the GRUB_RESCUE feature (at least on SLE12) |
…GRUB_RESCUE and better explanation in default.conf plus option to use an existing GRUB2 user via GRUB_RESCUE_USER without the need to let rear create a GRUB2 superuser (issue938)
|
Now I implemented support to set GRUB2 password only optionally Additionally one can (also optionally) use an existing Two examples how in now works for me on SLES12-SP1: With GRUB_RESCUE=y GRUB_RESCUE_PASSWORD="rear" GRUB_SUPERUSER="root" GRUB_RESCUE_USER="" it does: # usr/sbin/rear -d -D mkbackup Relax-and-Recover 1.18 / Git Using log file: /root/rear/var/log/rear/rear-f121.log Creating disk layout Creating root filesystem layout Copying files and directories Copying binaries and libraries Copying kernel modules Creating initramfs Making ISO image Wrote ISO image: /root/rear/var/lib/rear/output/rear-f121.iso (20M) Setting up GRUB_RESCUE: Adding Relax-and-Recover rescue system to the local GRUB 2 configuration. Setting up GRUB 2 password protection with GRUB 2 user 'root'. Setting up GRUB 2 superuser 'root'. Modifying local GRUB 2 configuration. Finished GRUB_RESCUE setup: Added 'Relax-and-Recover' GRUB 2 menu entry. Copying resulting files to nfs location Encrypting disabled Creating tar archive '/tmp/rear.W6BQduTst1CjlPk/outputfs/f121/backup.tar.gz' Archived 1316 MiB [avg 7325 KiB/sec]OK Archived 1316 MiB in 185 seconds [avg 7285 KiB/sec] After manually # rm /etc/grub.d/01_users to get rid of the GRUB 2 superuser that was set before GRUB_RESCUE=y it does: # usr/sbin/rear -d -D mkbackup Relax-and-Recover 1.18 / Git Using log file: /root/rear/var/log/rear/rear-f121.log Creating disk layout Creating root filesystem layout Copying files and directories Copying binaries and libraries Copying kernel modules Creating initramfs Making ISO image Wrote ISO image: /root/rear/var/lib/rear/output/rear-f121.iso (73M) Setting up GRUB_RESCUE: Adding Relax-and-Recover rescue system to the local GRUB 2 configuration. Modifying local GRUB 2 configuration. Finished GRUB_RESCUE setup: Added 'Relax-and-Recover' GRUB 2 menu entry. Copying resulting files to nfs location Encrypting disabled Creating tar archive '/tmp/rear.cf0xFwJYsF0DF6F/outputfs/f121/backup.tar.gz' Archived 1315 MiB [avg 7403 KiB/sec]OK Archived 1315 MiB in 183 seconds [avg 7362 KiB/sec] |
…local variables and fixed a misplaced LogPrint message (issue938)
…2 menue entry (issue938)
|
Now it works sufficiently well for me on SLES12-SP1. From my current point of view it could be merged Note that this pull request is only about GRUB 2 If GRUB_RESCUE works sufficiently well for nowadays GRUB 2 FYI: The only left drawback from my current point of view is For example if one does "rear mkbackup" with GRUB_RESCUE=y GRUB_RESCUE_PASSWORD="bar" GRUB_SUPERUSER="foo" one gets a GRUB 2 superuser 'foo' set up If later one changes local.conf to be only GRUB_RESCUE=y the previously set up GRUB 2 superuser 'foo' is To get rid of previously set up GRUB 2 superuser rm /etc/grub.d/01_users |
|
@jsmeix maybe I've overlooked, but did you manage to solve problem on SLES12 when all grub entries were protected by password? |
|
I did not (and I will not) deal with when all grub entries I only documented that unexpected possible result in default.conf When GRUB_RESCUE_PASSWORD is set it may result password protection for all GRUB2 menue entries of the currently running system unless the '--unrestricted' option is set for those GRUB2 menue entries that should not have password protection. Currently the only way to avoid that unexpected result |
|
Fair enough ... |
|
Damn! Seems to be again a nice mess how GRUB 2 works Currently I don't know how to fix such Linux distribution mess Furthermore regarding the GRUB 2 password protection see Bottom line: I think I will remove GRUB 2 password protection setup from rear |
…ompatible way - now one must use GRUB_RESCUE_USER plus GRUB_RESCUE_PASSWORD if the otional GRUB 2 password protection is wanted (issue938)
|
With my latest commit I removed GRUB_SUPERUSER support |
|
Wow! With removed GRUB_SUPERUSER support With old-style GRUB_RESCUE=y GRUB_RESCUE_PASSWORD="bar" GRUB_SUPERUSER="foo" I get Setting up GRUB_RESCUE: Adding Relax-and-Recover rescue system to the local GRUB 2 configuration. Setting up GRUB 2 password protection with GRUB 2 user 'foo'. Skipping GRUB 2 superuser setup: GRUB_SUPERUSER is no longer supported (see default.conf). Modifying local GRUB 2 configuration. Finished GRUB_RESCUE setup: Added 'Relax-and-Recover' GRUB 2 menu entry. and a "password_pbkdf2 foo grub.pbkdf2.sha512..." But I have no /etc/grub.d/01_users file But it "just boots" nevertheless (without password prompt). I.e. it seems GRUB 2 behaves fail-safe when there is |
|
Still can result a mess if one is not very careful. With that manually created /etc/grub.d/01_users #!/bin/sh cat << EOF set superusers="baz" password baz rear password foo bar EOF and non-matching /etc/rear/local.conf entries GRUB_RESCUE=y GRUB_RESCUE_PASSWORD="blah" GRUB_RESCUE_USER="foo" I cannot boot 'Relax-and-Recover' as user foo Therefore I am now thinking about also dropping support This would mean when GRUB_RESCUE_USER is non-empty Perhaps I might implement a check that looks if a |
…ward compatible way - now only GRUB_RESCUE_USER can be used (which needs already setup GRUB 2 users) if the otional GRUB 2 password protection is wanted (issue938)
|
With my latest commit I also removed Now only GRUB_RESCUE_USER can be used Now the whole GRUB 2 password protection stuff What I tested: I have a manually created /etc/grub.d/01_users #!/bin/sh cat << EOF set superusers="root" password root rootpw password rear rearpw EOF With GRUB_RESCUE=y GRUB_RESCUE_USER="unrestricted" I get this /etc/grub.d/45_rear #!/bin/bash
cat << EOF
menuentry 'Relax-and-Recover' --class os --unrestricted {
search --no-floppy --fs-uuid --set=root 45fd0fdf-b85e-4d10-9e0b-a4395ac6db11
echo 'Loading kernel /boot/rear-kernel ...'
linux /boot/rear-kernel selinux=0 console=ttyS0,9600 console=tty0
echo 'Loading initrd /boot/rear-initrd.cgz (may take a while) ...'
initrd /boot/rear-initrd.cgz
}
EOF
which results that I can boot that without password dialog With GRUB_RESCUE=y GRUB_RESCUE_USER="rear" I get this /etc/grub.d/45_rear #!/bin/bash
cat << EOF
menuentry 'Relax-and-Recover' --class os --users rear {
search --no-floppy --fs-uuid --set=root 45fd0fdf-b85e-4d10-9e0b-a4395ac6db11
echo 'Loading kernel /boot/rear-kernel ...'
linux /boot/rear-kernel selinux=0 console=ttyS0,9600 console=tty0
echo 'Loading initrd /boot/rear-initrd.cgz (may take a while) ...'
initrd /boot/rear-initrd.cgz
}
EOF
which results that I can boot this as GRUB2 user 'rear' With only GRUB_RESCUE=y I get this /etc/grub.d/45_rear #!/bin/bash
cat << EOF
menuentry 'Relax-and-Recover' --class os {
search --no-floppy --fs-uuid --set=root 45fd0fdf-b85e-4d10-9e0b-a4395ac6db11
echo 'Loading kernel /boot/rear-kernel ...'
linux /boot/rear-kernel selinux=0 console=ttyS0,9600 console=tty0
echo 'Loading initrd /boot/rear-initrd.cgz (may take a while) ...'
initrd /boot/rear-initrd.cgz
}
EOF
which results that I can boot it only as GRUB 2 superuser. |
…ing on the Linux distribution currently the absolute path for SLE and openSUSE and for all others we assume Red Hat behaviour as default/fallback which is the basename plus a leading slash (issue938)
|
With my latest commit I use different Currently the absolute path for SLE and openSUSE This means for SLE and openSUSE linux /boot/rear-kernel ... initrd /boot/rear-initrd.cgz for all others one gets linux /rear-kernel ... initrd /rear-initrd.cgz which should (hopefully) fix |
|
From my current point of view the GRUB_RESCUE functionality When there are no objections |
|
Ha! |
|
See the follow-up issue #946 |
see #938
starting at #938 (comment)
In its current state it somewhat works for me with
as follows
Now I have an additional GRUB 2 menue entry "Relax-and-Recover"
and when I select it I get asked for username (I enter root) and
password (I enter rear) and then the rear recovery system starts
where I can log in as root (without password) and therein I could
run "rear recover" but I did not yet test that.
In its current state what does not look o.k. for me is
that now I get the GRUB 2 password dialog also for
the default SLES12 boot entry.
This is an unexpected change compared to before
where I could boot the default SLES12 without
a GRUB 2 password dialog.
I.e. I need to find out how to set up GRUB 2 so that
its password dialog happens only for the "Relax-and-Recover"
boot menue entry...