[olug] anyone know how to fix the bootloader on EFI systems?

Lou Duchez lou at paprikash.com
Sun Mar 12 06:24:06 CDT 2017


Three cheers and a tiger for me, I have won!  Computer is fixed.

Let me cut to the chase for the next poor shlub dealing with this.  If I 
had to fix it again from scratch, it would go like this:

1) Use the Fedora installation media to boot to a grub command prompt.

2) The "ls" command to figure out which partition is my EFI partition 
(/dev/sda1) and which is my boot partition (/dev/sda3 in my case, 
ymmv).  A lot of "ls (hd0,0)/" -ish commands until you can see what's what.

3) Use the Fedora installation media to boot to a 
nearly-fully-functional version of Fedora that mounts my ailing hard drive.

4) Get a copy of the /boot/efi/EFI/fedora directory from a healthy 
computer, put it on a flash drive.

5) Copy the fedora directory from the flash drive into /boot/effi/EFI on 
the ailing hard drive.  Practice sensible renaming.

6) Edit grub.cfg so that it references the UUID of my boot partition, 
make sure it points to a valid kernel, and so on.

7) Reboot and pray.  Sacrificing a goat couldn't possibly hurt to cover 
all bases.

8) If for whatever reason it wasn't finding my Fedora EFI, I'd install 
rEFInd and then use that to find fedora.

By all means, visit 
http://www.rodsbooks.com/refind/installing.html#linux and just read what 
it says to do, because it inadvertently provides a tutorial on what EFI 
is about.  EFI is pretty cool, once you no longer fear it like a caveman 
encountering fire for the first time.  In broad strokes, EFI lets you 
manage your boot options from within your operating system, rather than 
having to run an external utility to make the changes.  It's kind of ike 
how LVM lets you manage your partitions from within your operating 
system.  Neither one seems like that helpful of a thing until you 
encounter a case where you need it, and then suddenly it's the most 
helpful thing on earth.

In my fumbling efforts here, I discovered I was able to add rEFInd as a 
boot option all within Linux -- add the right files to a directory, run 
efibootmgr to register the directory and change the boot order, and it 
worked.  Is that cool?  Why yes, yes it is. And that's what gave me the 
idea of just trying to clone a successful EFI directory from another 
computer and then register it.



>
> Having fought the good fight last year and finally succeeding in 
> getting my old Mac Pro 1,1 to boot Linux (32bit EFI / 64 bit system) 
> here is the best site I found that also has a VERY useful bootable 
> miniEFI cd:
>
> http://www.rodsbooks.com/refind/
>
> I used the reFIND CD image many times to edit and fix the EFI 
> partition. Bear in mind the EFI partition is ~200-300M FAT32 at the 
> front of the disk.
>
> Also the Linux kernels after 3.3 or so have an EFI stub that can load 
> directly from reFIND or a similar EFI boot partition loader. A little 
> harder to change out kernels and none of the distros use it as they 
> only want you to use grub2 or similar but it works very well.
>
> I ripped grub2 off of the partition early on as it had very peculiar 
> setups with respect to kernel placement etc. But then I still use LILO 
> so go figure...
>
> Seriously check our Rod's pages and note that if you do decide to use 
> his CD to fix the partition then you will want to obtain the SHELL64 
> (SHELL32 in my case as EFI was 32bit) code and merge it into the CD 
> image (USB works fine also). The SHELL64 is the actual shell into the 
> boot partition that lets you see and (limited) edit files on the EFI 
> partition.
>
> HTH!
>
> mgm
>
>
> On Thu, 9 Mar 2017, Lou Duchez wrote:
>
>> No luck yet, and for the sake of my blood pressure I'm setting the 
>> matter aside for now.
>>
>> Some things I have tried and the roadblocks I have encountered:
>>
>> 1)    Various instructions say to run grub2-install ... I think this 
>> is the root of the problem, you SHOULDN'T run grub2-install on an EFI 
>> system. Apparently, on EFI the MBR doesn't change from kernel version 
>> to kernel version (or distro version to distro version), it's 
>> allegedly smart enough to find the appropriate bootloader.  That's 
>> where I screwed things up I think, I changed the MBR.
>>
>> 2)    The fix is supposed to be reinstalling the package grub2-efi, 
>> which will fix the MBR.  But that would require booting to normal 
>> Linux; I did once or twice but I can't now. If I can somehow get the 
>> thing to boot normally just once more I can sort this out.
>>
>> 3)    grub rescue options, like setting "prefix" and "root" ... 
>> haven't found options that work.
>>
>> 4)    I've tried making Super Grub2 bootable drives but I can't 
>> manage to make one that actually boots.  I'm using a Windows 7 
>> machine to try to build them, shut up I have my reasons.  :-)
>>
>> Using the Fedora installation media I can at least get at the file 
>> system, mount drives, and so forth.  All the user data has been 
>> copied off and that makes the thought of a full reinstallation more 
>> palatable, but I still feel like there should be some way to fix this 
>> mess.
>>
>> I also feel like EFI shouldn't make this such a fearsome process. It 
>> ought to be something that can be fixed simply, and I feel like I'm 
>> almost there, it's just that one step.
>>
>>
>>> Did you find a solution to this? I fear EFI thanks to these things.  
>>> It seems like the fix would be to boot a live distro and (re)install 
>>> a boot loader that works with EFI? grub should work with the right 
>>> options, I believe.
>>>
>>> Possibly relevant: 
>>> https://wiki.archlinux.org/index.php/GRUB#UEFI_systems
>>>
>>> -- Kava
>>>
>>>
>>>
>>> -----Original Message-----
>>> From: olug-bounces at olug.org [mailto:olug-bounces at olug.org] On Behalf 
>>> Of Lou Duchez
>>> Sent: Thursday, 9 March, 2017 00:35
>>> To: Omaha Linux User Group <olug at olug.org>
>>> Subject: [olug] anyone know how to fix the bootloader on EFI systems?
>>>
>>> Well I screwed up.  I ran grub2-install on an EFI system, and 
>>> apparently one shouldn't do that.  Now my system won't boot without 
>>> the help of the Fedora installation media, and even then I can only 
>>> get it to the grub command line, or (with the right set of gyrations 
>>> and some good fortune) single-user mode and access to the entire LVM 
>>> file system.
>>>
>>> Any suggestions on how to fix the MBR (which is, I believe, where 
>>> the problem lies)?
>>> _______________________________________________
>>> OLUG mailing list
>>> OLUG at olug.org
>>> https://lists.olug.org/mailman/listinfo/olug
>>> _______________________________________________
>>> OLUG mailing list
>>> OLUG at olug.org
>>> https://lists.olug.org/mailman/listinfo/olug
>> _______________________________________________
>> OLUG mailing list
>> OLUG at olug.org
>> https://lists.olug.org/mailman/listinfo/olug
>>
>
> --------------------------------------------------
> Matthew G. Marsh
> Special Email Addr for OLUG ;-}
> Phone: (402) 932-7250
> Email: olug4mgm at paktronix.com
> WWW:  http://www.paksecured.org
> --------------------------------------------------
> _______________________________________________
> OLUG mailing list
> OLUG at olug.org
> https://lists.olug.org/mailman/listinfo/olug


More information about the OLUG mailing list