Ubuntu – Grub2 EFI: Where is the EFI partition

bootgrub2partitioninguefi

I have installed ubuntu 12.04 on my Thinkpad Edge (UEFI) using an USB-Stick. I guess it has been botted using EFI since a GRUB menu appeared with the options to boot a live system, install, or check the disk.

When I boot my laptop, grub only shows its command line prompt "grub>".

After manually running grub-install /dev/sda + update-grub within a chrooted environment it boots grub in recovery mode saying "File not found."

The disk is partitioned as follows:

/dev/sda1:    ntfs,  1.5GB, SYSTEM DRV
/dev/sda2:    ntfs,  150GB, Windows7 OS
/dev/sda3:    extended
  /dev/sda6:  ext4,  140GB, Ubuntu 12.04
  /dev/sda5:  ntfs, 10.7GB, Lenovo Recovery
/dev/sda4:    ntfs, 16.8GB, a custom additional partition

I guessed that the partition labelled "SYSTEM DRV" may be the EFI partition, but then I read that the EFI partition is of type FAT32. I don't have any FAT32 partition here!

So I can't follow any How-Tos explaining how to install Grub2 with EFI support. They all want me to mount my EFI partition at /boot/efi. I also can't just create an EFI partition since in most How-Tos they say that it should be the first partition (at least it has to be a primary partition), but as you see I already have a partition 1.

Isn't it possible to just use the normal Grub2 tool on EFI hardware?

If not, will creating an EFI partition solve the problem? Can I use partition 4 for that?

My BootInfo as created by using this article can be found here: http://paste.ubuntu.com/1011739/. Note that is being made from a Ubuntu Live USB drive which was at /dev/sdb, so you should ignore this drive.

UPDATE:

As EFI doesn't seem to be the problem here, I reinstalled (non-EFI-)grub using boot-repair.

New BootInfo can be found here: http://paste.ubuntu.com/1012223/.

Problem is now, that BIOS doesn't boot but gives the error:

Operating system not found.

UPDATE 2 (SOLUTION):

When you read this question when having the same issue (Operating system not found.), you might miss the forest for the trees when reading the answers, so I repeat the solution here:

The problem in my case was, that I accidently changed the boot flag of the drive to /dev/sda6, which is a logical partition. BIOS searches for boot flags on a hard drive it wants to boot from, but only looks in primary partitions. If it can't find a boot flag, it skips the hard drive. If it doesn't find any drive or media to boot from, you see the error "Operating system not found."

Best Answer

The hard disk is definitely set up for BIOS-style booting. Specific evidence of this includes:

  • The partition table is MBR. Although it's theoretically possible to boot in EFI mode from an MBR partition table, to the best of my knowledge Windows does not support this configuration. Certainly its installer doesn't; the Windows installer supports MBR-on-BIOS or GPT-on-EFI, but not MBR-on-EFI or GPT-on-BIOS.
  • There's no ESP on /dev/sda. (There are EFI boot files on /dev/sdb1, but that looks like a USB flash drive, not your regular boot disk.)
  • The Boot Info Script output identifies GRUB as being installed in the MBR of /dev/sda. This is consistent with a BIOS-mode GRUB installation.
  • The Boot Info Script output has identified /Windows/System32/winload.exe as a boot file on /dev/sda2. If this were an EFI installation of Windows, you'd see a reference to winload.efi somewhere.

Thus, whatever the source of the problem, it doesn't seem to have anything to do with EFI; it's a straight-up GRUB-on-BIOS problem.

The biggest clue I see is this, from the Boot Info Script output:

=> Grub2 (v1.99) is installed in the MBR of /dev/sda and looks at sector 1 of 
   the same hard drive for core.img. core.img is at this location and looks 
   for (,msdos6)/root/grub on this drive.

Note in particular the reference to (,msdos6)/root/grub. Later in the Boot Info Script output, there's a list of boot files on /dev/sda6 ((,msdos6) in GRUB-speak). This list includes /boot/grub/grub.cfg, but there's no mention of anything in the root directory. In fact, the root directory (not to be confused with the / directory, whose name is pronounced "root") is the superuser's home directory, and it doesn't ordinarily hold boot files. Thus, I suspect that GRUB was mis-installed. Perhaps you used options to grub-install that you didn't mention and that were inappropriate, or perhaps there's a bug in the installation script. In any event, I recommend re-installing GRUB using the usual procedures for doing this on a BIOS-based computer. Note, however, that if your emergency system boots in EFI mode, that could create complications, so you should be sure to boot your emergency system in BIOS mode.

You can check your boot mode in Linux by looking for the /sys/firmware/efi directory. If it's present, you've booted in EFI mode. If it's absent, you've probably booted in BIOS mode (although there are conditions when that file will be absent even though you've booted in EFI mode).

Related Question