Ubuntu – Failed to mount /boot/efi


I just downloaded the lastest Version of Ubuntu13.04 from the official website(of course it is amd64)and my Computer is the ASUS-A45V Laptop.I used the universal usb installer to creater a boot usb disk for installing ubuntu.And first i tried to use the first default option to install it(that means i let ubuntu to do all the things itself,and i have Win7 installed on my HDD),and all the things seems runs very good.but, then when i reboot and try to start ubuntu.It told me that "Faild to mount /boot/efi, type S to skip it, or type M to fix it manually"and then i check the /boot/efi folder ,and find that there is nothing in it!
And then i tried to install it manually,but got the same result. Whats the problem? How can i fix it?and whats more, Boot-Repair can only bring my Win7 loader back in the Grub list but the formal efi loader of Win7 has been overwrited into Grub by Ubuntu. How can i restore it?

Best Answer

First, it was Boot Repair, not Ubuntu's installer, that replaced the Windows boot loader with another copy of GRUB. Boot Repair does this because it's the only available workaround for some buggy BIOSes that will launch the Windows boot loader but not a Linux boot loader; but IMHO, Boot Repair is far too quick to resort to this solution, which is an inelegant (albeit occasionally necessary) hack. IIRC, there's an option in Boot Repair to undo this change. If you can't find it, you can do the same thing manually by renaming files. The Microsoft boot loader should be EFI/Microsoft/Boot/bootmgfw.efi on the ESP (which is mounted at /boot/efi in Linux; see below). In your case, that file will hold a copy of GRUB, and the real Microsoft boot loader will be renamed with another extension or with a few new leading characters -- the Boot Repair developers seem to have changed the names they use at least once. Note that if you rename your boot programs correctly, it's conceivable that your computer will begin booting Windows directly when you power it on, giving you no option to boot Linux. If this happens, you may be able to find Linux in your firmware's own boot manager (usually launched by hitting a function key at boot time); and you can probably restore GRUB to be the default by using the efibootmgr program in Linux. See my Web page on EFI boot loader installation for details.

The /boot/efi directory is empty because it's a mount point for the ESP, and as you've reported, the system has been unable to mount it. This is most likely because of filesystem damage, although it could be that your /etc/fstab entry for /boot/efi has an error. Try this:

  1. Type sudo parted /dev/sda print. This should produce a list of partitions on your disk. The ESP is normally a FAT partition with the "boot flag" set, in parted's nomenclature. Identify this partition and note its number. If you can't find a FAT partition, that could be because of very serious damage to the ESP -- but this seems unlikely, given that you can boot.
  2. Type sudo mount /dev/sda1 /boot/efi, changing 1 to whatever number you identified in the first step. If there's an error message, take note of it; it may be a clue about what's wrong.
  3. If you were unable to mount the ESP, type sudo dosfsck /dev/sda1, again changing 1 to the correct partition number. This will run Linux's FAT filesystem check utility on the partition, which with any luck will fix the problem. You can then try manually mounting the partition again.
  4. If you were able to mount the ESP without running dosfsck, look for its entry in /etc/fstab and fix any problems with it. I know this description is vague, but it's hard to know what might be wrong without seeing the entry. Post it here if you need further advice.

You mentioned Windows 7, but be aware that Windows 8 doesn't use a normal shutdown by default. Instead, it uses a "fast startup" feature that's more like a suspend-to-disk operation. One consequence of this is that filesystems are left in an inconsistent state. I've heard of this feature causing problems with the ESP on some computers, which is why I mention it. When dual-booting with Windows 8, you should disable the "fast startup" feature, as described here. Even in Windows 7, you might see something similar if you used a suspend-to-disk feature or otherwise did not shut down cleanly.

Related Question