Bug#699038: grub-efi-amd64-bin: Transition grub-pc -> grub-efi fails due to missing FS driver module

Colin Watson cjwatson at debian.org
Mon Jan 28 11:58:00 UTC 2013


On Sat, Jan 26, 2013 at 05:56:02PM +0100, Jens G wrote:
> I recently moved from grub-pc/GPT to grub-efi/GPT (dual boot with Win 8).
> After successfully installing Grub to the ESP and getting the UEFI to run
> grubx64.efi Grub (after welcomming me) complained:
> 
> | error: invalid arch independent ELF magic.
> | grub rescue>

This probably means that it's trying to load modules from /boot/grub/
and they're actually for grub-pc rather than grub-efi-amd64.  What is
$prefix set to?  (You can inspect it in the rescue shell using 'set'.)

> This happend when running grubx64.efi from an EFI-shell (v1) and with the
> normal UEFI boot sequence. However, when I used the previously installed
> rEFInd boot manager to launch grubx64.efi, Grub worked just fine.

That's a little mysterious.

> AFAIK rEFInd contains some file system drivers. So I installed Grub under a
> second label and added
> 
> | --modules="part_gpt ext2"
> 
> to the grub-install invocation. This produced a different grubx64.efi but
> with the same size as the first one.

I doubt this was necessary.  grub-install autodetects the necessary
modules already, and this is confirmed by the fact that your core image
was the same size both times round.  GRUB does not know about or use
rEFInd's file system drivers.

> Accidently running the FIRST grubx64.efi, it now worked using either UEFI
> boot or EFI-shell!

grub-install copies modules into /boot/grub/, which probably explains
the change in behaviour.  Perhaps you constructed the first grubx64.efi
using some mechanism other than grub-install, or perhaps grub-pc is
still installed and some bit of packaging called grub-install for the
BIOS platform without you noticing?

> Does grub-efi use the GPT boot partition similar to grub-pc? If so, did
> grub-install add the ext2.mod there so that both Grub instances can now
> access the remaining modules on the (separate) ext3 /boot partition?

grub-pc and grub-efi-amd64 both use /boot/grub/.  (In GRUB 2.00 this is
clarified by moving the modules to /boot/grub/i386-pc/ and
/boot/grub/x86_64-efi/ respectively; but in 1.99 they shared a single
/boot/grub/ directory.)

The GRUB core image (which typically resides in the BIOS Boot Partition
with grub-pc on GPT, or in the EFI System Partition with grub-efi-amd64)
is required to contain all the modules that are necessary to access
/boot/grub/, much as a Linux kernel + initramfs are together required to
contain all modules necessary to access /.  Once the core image has
started up to roughly the point where it could execute a rescue shell,
it does not normally access the BIOS Boot Partition / EFI System
Partition any further.

Just for reference, what is your partition layout (e.g. 'parted -l')?

> If more information is needed I'll try to help but I tried an awful lot of
> things to get the UEFI/Win8/GPT/Linux/Grub thingy working, may not remember
> /all/ of it and am loth to do anything disruptive at this point.

The evidence suggests that, on your first attempt, the GRUB core image
and the modules it found were built for different platforms, but that
your second attempt installed the correct set of modules.
Unfortunately, if you didn't take detailed notes, we may not be able to
progress this bug any further because it's pretty hard to guess at what
point things went wrong.

Cheers,

-- 
Colin Watson                                       [cjwatson at debian.org]



More information about the Pkg-grub-devel mailing list