Created attachment 5844 [details] Patch for /lib/libDrakX/bootloader.pm As there now seems to be a number of Mageia users who are using the rEFInd boot manager, I think it would be useful to support this in drakboot. Attached is the first of two patches to do this (second patch to follow). With these patches applied to the stage 2 installer in the M5 beta 1 classic installer ISO (copied to a USB stick), I was able to install and boot M5 on a UEFI system with legacy boot disabled (I can't test with M5 beta 2, because the installer is broken). After applying the patches to the installed system, I was able to edit the boot options via the MCC. Currently this relies on rEFInd being installed manually. I can look at adapting the rEFInd RPM for Mageia, but will wait to see if these patches are accepted before doing any more work on this.
Created attachment 5845 [details] Patch for /lib/libDrakX/any.pm
Assignee: bugsquad => thierry.vignaud
Created attachment 5932 [details] Patch for /lib/libDrakX/any.pm Updated patches to accommodate changes since beta 1.
Attachment 5845 is obsolete: 0 => 1
Created attachment 5933 [details] Patch for /lib/libDrakX/bootloader.pm
Attachment 5844 is obsolete: 0 => 1
Created attachment 5936 [details] add refind support Does this patch works as well (especially the reorder in any.pm for smaller changes) Else it fixes a couple perl_checker warnings
Keywords: (none) => NEEDINFO
No, the reorder in any.pm means that the 'if ($e->{type} eq "image")' branch gets taken instead of the 'elsif ($b->{method} eq 'refind')' branch. All this means is that the user gets presented with some options that aren't used in the rEFInd configuration, so if you really don't like it, you could take out that branch. Apart from that, it seems to work as before.
I've just noticed I've used -e "/boot/EFI/EFI/refind" in two places in bootloader.pm, which should probably be -e "$::prefix/boot/EFI/EFI/refind" Any chance of this making it into Mageia-5?
Keywords: NEEDINFO => (none)
Created attachment 5975 [details] Updated patch As well as fixing the errors mentioned in the previous comment, this also ensures that a newly installed kernel update will be the default on the next boot.
Attachment 5932 is obsolete: 0 => 1 Attachment 5933 is obsolete: 0 => 1 Attachment 5936 is obsolete: 0 => 1
We don't want that. That's the user choice which choose the default entry
(In reply to Thierry Vignaud from comment #8) > We don't want that. > That's the user choice which choose the default entry No, that's not true. When you install a kernel update, the symlinks in /boot are modified to make the new kernel the default. rEFInd ignores the symlinks, so I had to find a different way to get this behaviour. Also, rEFInd defaults to selecting the previously booted menu entry. If the user overrides this in the rEFInd configuration file, that will take precedence over the suggestion made by drakboot.
Created attachment 6187 [details] Updated patch Updated patch to prevent an empty configuration file being written if the /boot/vmlinuz symbolic link has gone missing (an empty configuration file exposes a nasty bug in the current version of rEFInd).
Attachment 5975 is obsolete: 0 => 1
Created attachment 6188 [details] Patch to prevent installer forcing the use of grub2 when the rEFInd boot manager is being used This additional patch is needed to stop the installer automatically installing grub2 and making it the default boot manager when the user has already chosen to install and use rEFInd. It does not prevent the user subsequently choosing grub2 when configuring the bootloader at the end of stage 2.
I feel uneasy about adding support for another bootloader now (I fear breaking existing stuff). Could more people test those patches?
It wouldn't be hard for others to test if they are already using UEFI boot. rEFInd is available as a RPM package, which is easy to install from an existing Mageia system. I know one of the QA team (Lewys Smith) is already using rEFInd, because he's written about it on the Wiki, so he might be a good person to ask. Generally though, my patches should be fairly safe - unless rEFInd is already installed, then it won't appear as an option. I'm ready to do the extra work to make it fully available, but I thought that might be best left for Mageia-6.
@Thomas: what do you think?
BTW You need to update your patch. See http://gitweb.mageia.org/software/drakx/commit/perl-install/bootloader.pm?id=6a38c077285c88dcf4d042ec43b6803ba5c56cb1 ("fix detecting grub2 on ESP")
(In reply to Thierry Vignaud from comment #15) > BTW You need to update your patch. > See > http://gitweb.mageia.org/software/drakx/commit/perl-install/bootloader. > pm?id=6a38c077285c88dcf4d042ec43b6803ba5c56cb1 > ("fix detecting grub2 on ESP") Not sure what you mean - my patch still applies cleanly, and still works as I expect it to. The Mageia-specific configuration for rEFInd is only ever stored in /boot, never on the ESP.
The goal is to detect it :-) That is, detectloader must return "refind". Drakboot should default to refind once rerunning on a system booted with refind. It should not advertize grub2.
I think I've already implemented what you want: - at install time, if refind is installed in the ESP, it becomes the default choice of bootloader. The user can change to grub2 at the end of stage 2 if they wish - in a running system, drakboot will show refind as the default choice if either - both refind is installed in the ESP and the file /boot/refind_linux.conf exists - refind is installed in the ESP and grub2 is not installed In the latter case, drakboot will report that no bootloader is found and generate the default boot config - I need this to generate a new refind_linux.conf file. What have I missed? N.B. It is possible that a user may wish to use both refind and grub2, using refind as the primary boot manager and grub2 as a second level. I've tried to allow for this by making sure grub2 is the first choice once it is installed.
That's b/c detectloader (which reuses bootloader.pm) cannot find what bootloader is installed. For ESP case, the only choice we have is a file test. See above commit for grub2.
Created attachment 6308 [details] Patch to add support for rEFInd boot manager in drakboot (updated) This update adds support for switching between grub2 and rEFInd. drakboot correctly identifies which is the currently selected boot manager. I noticed whilst testing this that when grub2 is selected, changes made by the user to the list of entries are ignored - and when you first select grub2, the list bears no relation to what is actually generated. Maybe this step needs to be skipped when grub2 is selected.
Attachment 6187 is obsolete: 0 => 1
Another issue is that it prevents switching back to grub2 once installed (in method_choices_raw())
(In reply to Thierry Vignaud from comment #21) > Another issue is that it prevents switching back to grub2 once installed (in > method_choices_raw()) No it doesn't. I tested it multiple times.
Comment on attachment 6308 [details] Patch to add support for rEFInd boot manager in drakboot (updated) If refind needs efibootmgr, it should requires it instead of patching bootloader.pm in order to install it (last bit of your patch)
(In reply to Thierry Vignaud from comment #23) > If refind needs efibootmgr, it should requires it instead of patching > bootloader.pm in order to install it (last bit of your patch) No, because: 1) rEFInd doesn't need efibootmgr - drakboot does (if you select rEFInd). 2) rEFInd may have been installed from another distribution, or even from Windows or MacOS. It does not need to be installed again from inside Mageia. It requires nothing to be created inside the Mageia distribution except the configuration file that my patched drakboot creates (and even that is optional). It's a boot manager, not a boot loader. 3) We don't currently have a Mageia package for installing rEFInd (I installed it using the vanilla upstream package, which works well enough). I'll take the time to create one if these patches ever get accepted. At that point we can change the package that drakboot installs and add the requires.
Created attachment 8124 [details] add support for rEFInd boot manager (mga#15153) rebased over current git + pass perl_checker
Attachment 6308 is obsolete: 0 => 1
Created attachment 8125 [details] do not preselect grub2 if refind is configured rebased over current git
Attachment 6188 is obsolete: 0 => 1
Created attachment 8126 [details] add support for rEFInd boot manager (mga#15153) ( v3: log error I fixed it not to use $::prefix for accessing /sys The new log error shows that this was never tested as writing to the /sys/firmware/efi/efivars/... fails with "no such file" We obviously should use refind-install. But we would need to actually package refind... Also there's bug with upstream refind-install regarding Mageia (see the patches I'll attach) Last but not least, detectloader hasn't been updated to detect we configured refind....
Attachment 8124 is obsolete: 0 => 1
Created attachment 8127 [details] refind-install: don't choke on /dev/vda
Created attachment 8128 [details] refidn-install: adapt to Mageia's /boot/EFI
Priority: Normal => Low
As a previous user of the GAG boot manager I was - on my HP 450 UEFI Probook - very happy to install and use the excellent rEFInd as boot manager, doubly so when I was made aware recently of the additional benefit it can provide of avoiding altogether the use of Grub - which can be uninstalled... This is now working smoothly, and the Installer proposal in this 'bug' report will greatly facilitate this big improvement.
CC: (none) => maurice
(In reply to Thierry Vignaud from comment #27) > We obviously should use refind-install. > But we would need to actually package refind... I'm not entirely convinced this is the right thing to do. The only part of rEFInd that "belongs" to the Mageia installation is the /boot/refind_linux.conf file that drakboot creates. The files in the ESP provide a boot manager which is common to all OS installations on the machine. If you allow the installer to reinstall rEFInd, there's a danger you will break something. The refind-install script takes some care to preserve any changes the user has made to a previous installation, but I don't know how robust it is if the version of rEFInd being installed is older than the one already installed (which could happen in the future if, e.g., someone had the latest version of Mageia installed and decided to (re)install an older version). If you really do want to go down this route, I think we should at least prompt the user to ask if they want to reinstall rEFInd. The alternative is to stick with my original scheme of simply detecting that a user has manually installed rEFInd, and not meddling with it. > Also there's bug with upstream refind-install regarding Mageia (see the > patches I'll attach) I've submitted your first patch upstream. The second patch wasn't suitable for submission because other distros mount the ESP at /boot/efi, so I created and submitted an alternative patch that checked both mount points. > Last but not least, detectloader hasn't been updated to detect we configured > refind.... You removed the parts of my patch that handled this :-(
I think that just because rEFInd boot manager is installed on a machine it's detection should not affect the installation of grub2-efi as default bootloader. I see nothing wrong with creating a configuration file for it though.
CC: (none) => zen25000
IMHO no, not at all - rEFInd will find the grub.efi file and include an icon for it on its boot menu, with the option to boot via that. But the grub.efi isn't *needed*, as rEFInd can boot straight into an install's /boot directory; it just needs the ad hoc /boot/refind_linux.conf there to allow rEFInd to make a neater job of it.
(In reply to Maurice Batey from comment #33) > IMHO no, not at all - rEFInd will find the grub.efi file and include an icon > for it on its boot menu, with the option to boot via that. But it can't do that if the presence of rEFInd on a system inhibits the installation of grub2. > > But the grub.efi isn't *needed*, as rEFInd can boot straight into an > install's /boot directory; it just needs the ad hoc /boot/refind_linux.conf > there to allow rEFInd to make a neater job of it. OK I understand grub2 is not needed if you want to use rEFInd exclusively, however I don't yet see how you can select which kernel to boot, or enter rescue mode using rEFInd alone.
(In reply to Barry Jackson from comment #34) > (In reply to Maurice Batey from comment #33) > > IMHO no, not at all - rEFInd will find the grub.efi file and include an icon > > for it on its boot menu, with the option to boot via that. > > But it can't do that if the presence of rEFInd on a system inhibits the > installation of grub2. The patches don't (or at least didn't) inhibit the installation of grub2 - they just prevent it being installed regardless of whether it's wanted. And they make the not unreasonable assumption that if rEFInd is installed, the user wants to use it. If grub2 is installed, it becomes the default for future changes. > OK I understand grub2 is not needed if you want to use rEFInd exclusively, > however I don't yet see how you can select which kernel to boot, or enter > rescue mode using rEFInd alone. F2 lets you select different boot options. The patches need updating. I'll do this once mga6 is out.
(In reply to Martin Whitaker from comment #35) > (In reply to Barry Jackson from comment #34) > > (In reply to Maurice Batey from comment #33) > > > IMHO no, not at all - rEFInd will find the grub.efi file and include an icon > > > for it on its boot menu, with the option to boot via that. > > > > But it can't do that if the presence of rEFInd on a system inhibits the > > installation of grub2. > > The patches don't (or at least didn't) inhibit the installation of grub2 - > they just prevent it being installed regardless of whether it's wanted. So if there is rEFInd on a machine and I install Mageia (assuming patches are present) then I can install with grub2 and also get the rEFInd config? That would be the only option I would consider using. > And > they make the not unreasonable assumption that if rEFInd is installed, the > user wants to use it. Not necessarily, a user may install rEFInd just to have it there as an alternative when set as the first in the boot order. > If grub2 is installed, it becomes the default for > future changes. > > > OK I understand grub2 is not needed if you want to use rEFInd exclusively, > > however I don't yet see how you can select which kernel to boot, or enter > > rescue mode using rEFInd alone. > > F2 lets you select different boot options. Thanks I will check that out in VM > > The patches need updating. I'll do this once mga6 is out.
Created attachment 10371 [details] patch to add support for rEFInd boot manager - rebased to current git master - restored the code that supported switching between rEFInd and GRUB2 - fixed the real issues that prevented the PreviousBoot EFI variable being written - modified to use the newly-created Mageia refind package - added support for installing in /EFI/BOOT (a workaround for buggy BIOSs that ignore the settings in NVRAM) - dropped the patch that prevented automatic installation of the grub2-efi package - users can manually remove it later
Attachment 8125 is obsolete: 0 => 1 Attachment 8126 is obsolete: 0 => 1
What's the Unicode change? What was your issue? It's probably unrelated to refind & should probably a split commit.
(In reply to Thierry Vignaud from comment #38) > What's the Unicode change? > What was your issue? > It's probably unrelated to refind & should probably a split commit. In the patch: + print $efivar Encode::encode('UTF16-LE', $default_kernel); That doesn't work if the Unicode module isn't available.
Released in cauldron.
Status: NEW => RESOLVEDResolution: (none) => FIXED