PDA

View Full Version : 14.04 Upgrade GRUB Error with UEFI



trevorrr.rice
July 25th, 2014, 02:36 AM
I have had the same problem as many others while upgrading to 14.04. Upon restart, I get the error: symbol 'grub_term_highlight_color, not found. I have looked through the forums and the bug report (https://bugs.launchpad.net/ubuntu/+source/grub2/+bug/1289977/+index?comments=all) but have had a hard time finding a solution for those using UEFI. According to post #194,
...

2) You are booting in EFI mode with grub-efi, and have used boot-repair at some point which made a copy of grub.efi in the windows efi directory, and configured windows to chain load that. After upgrade, this copy is now old and broken because we don't know anything about it and it shouldn't be there. Grub-repair shouldn't be doing this. Fortunately this one is quite easy to work around: tell your efi bios to boot grub instead of windows first. this should be an easy fix for me. I, however, am unsure how to tell my "efi bios to boot grub instead of windows first."

My boot priority in my BIOS is as follows:
-External Device (so I can boot from LiveUSB)
-Internal Hard Disk Drive
-Internal Optical Disk Drive
-Network

From grub rescue:

grub resuce> ls (hd0,gpt6)/boot/grub
./ ../ x86_64-efi/ grubenv locale/ fonts/ unicode.pf2 grub.cfg

If I do: ls (hd0,gpt6)/boot/grub/x86_64-efi, there are a bunch of .mod files.

Some other possible helpful information:

ubuntu@ubuntu:~$ sudo debconf-show grub-pc
grub2/kfreebsd_cmdline:
grub2/linux_cmdline:
grub-pc/install_devices_failed: false
grub-pc/chainload_from_menu.lst: true
grub-pc/postrm_purge_boot_grub: false
grub2/kfreebsd_cmdline_default: quiet splash
grub2/linux_cmdline_default: quiet splash
grub-pc/hidden_timeout: true
grub-pc/install_devices:
grub-pc/partition_description:
grub2/device_map_regenerated:
grub-pc/kopt_extracted: false
grub-pc/disk_description:
grub-pc/install_devices_empty: false
grub-pc/timeout: 10
grub-pc/install_devices_failed_upgrade: true
grub-pc/install_devices_disks_changed:
grub-pc/mixed_legacy_and_grub2: true

ubuntu@ubuntu:~$ sudo debconf-show grub-efi

ubuntu@ubuntu:~$ sudo parted -l
Model: ATA Hitachi HTS72756 (scsi)
Disk /dev/sda: 640GB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt

Number Start End Size File system Name Flags
1 1049kB 274MB 273MB fat32 EFI system partition hidden
2 274MB 20.8GB 20.5GB ntfs Basic data partition hidden, diag
3 20.8GB 21.1GB 273MB fat32 EFI system partition boot
4 21.1GB 21.2GB 134MB Microsoft reserved partition msftres
5 21.2GB 368GB 346GB ntfs Basic data partition msftdata
6 368GB 630GB 262GB ext4 boot
7 630GB 640GB 10.6GB linux-swap(v1)


Model: SanDisk Cruzer (scsi)
Disk /dev/sdb: 4022MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number Start End Size Type File system Flags
1 19.5kB 4014MB 4014MB primary fat32 boot


I'm not sure where to go from here. I'll be sure to provide any additional information if needed.

Any help would be appreciated. Thank you.

oldfred
July 25th, 2014, 05:17 AM
I would use Boot-Repair's advanced options and do the full uninstall and reinstall of grub2. Be sure to boot Ubuntu installer in UEFI mode and then add Boot-Repair to that.

Boot Repair -Also handles LVM, GPT, separate /boot and UEFI dual boot.:
https://help.ubuntu.com/community/Boot-Repair

The bug report is a dpkg command that you have to run from a chroot. Boot-Repair walks you thru the chroot and the full reinstall of grub should be the same as the dpkg reconfigure of grub. Otherwise you can try that recommendation that is in bug report.

trevorrr.rice
July 25th, 2014, 08:45 PM
Before I proceed, I just want to make sure I'm doing this correct.

I have booted into Ubuntu through my LiveUSB and installed Boot Repair.

In the advanced options, should I check any of the boxes for these options in addition to the 'Reinstall GRUB' box that is already checked?
'Use the standard EFI file'
'Backup and rename Windows EFI files (solves the [hard-coded-EFI] error)'
'Restore EFI backups'

And then in Other options, I should 'Repair Windows boot files' right?

oldfred
July 25th, 2014, 09:56 PM
I would not use the rename function. That renames the Windows efi file to be grub for those systems that only boot Windows. Some other file rename generally works better now.
And if not renamed before you should not have to run the restore. Did you run that before?
Not sure what Boot-Repair does not Repair Windows boot files. It only is able to do minor repairs to Windows. Generally much better to use your Windows repairCD or flash drive to make Windows repairs.

trevorrr.rice
July 25th, 2014, 10:10 PM
Here are the options for Boot Repair. Is the only change I need to make 'Use the standard EFI file'?

Sorry, I just want to make sure I don't mess anything up.

oldfred
July 25th, 2014, 11:00 PM
The only change I might do is uncheck secure boot.

I think grub still has a bug and will not dual boot Windows 8.1 with secure boot on. You can use it, but then cannot turn it on in UEFI unless only booting Ubuntu.
Or if you do turn it on in UEFI and are dual booting, you can only boot from UEFI menu not from grub menu.

trevorrr.rice
July 25th, 2014, 11:03 PM
I'm not sure if it makes a difference, but I'm dual booting Windows 7 and not 8.

I unchecked Secure boot and ran boot repair. Here is the result: http://paste.ubuntu.com/7859738/

I also ran it with Secure boot checked. http://paste.ubuntu.com/7859842/

I restarted and still ended up at grub rescue. It looks like this has to do with the MBR, but I don't know what that means.

oldfred
July 26th, 2014, 04:52 AM
Undo this that Boot-Repair did.
/EFI/boot/bkpbootx64.efi

Boot_Repair renames Windows bootmgfw.efi. But cannot boot Windows from UEFI only from grub menu with bkpbootmgr.efi entry
Always say no until proven that you only can boot Windows entry from UEFI menu.
buggy-kernel detected. Do you want to activate [Backup and rename Windows EFI files]? yes (if any choice fails, please retry with the other)
To undo & to rename files to their original names, you just need to tick the "Restore EFI backups" option of Boot-Repair.

Any rename either manually or with Boot-Repair of bootmfgw.efi will need to be redone after a Windows update as it will restore Windows files.

Windows 7 will not work with secure boot, so do not turn that on in UEFI.

You now have two efi partitions and with that system will not boot. Use gparted and remove boot flag from sda6.

It then should boot.

trevorrr.rice
July 26th, 2014, 07:06 PM
So I ran Boot-Repair with "Restore EFI backups" ticked and then used gparted to remove the boot flag from sda6. Upon restart, I booted straight to Windows 7.

Here was my report: http://paste.ubuntu.com/7867228/

I then went back into Ubuntu via LiveUSB and tried running Boot-Repair again this time with "Backup and rename Windows EFI files" ticked. I still booted straight to Windows 7.

Here was my report from the latest repair: http://paste.ubuntu.com/7867478/

oldfred
July 27th, 2014, 04:10 AM
Can you go into UEFI menu and boot ubuntu entry. Or using one time boot key.
And then can you set it as the default boot entry in UEFI boot order?

Generally best not to use Boot-Repairs rename as it renames the Windows efi boot file to boot grub. You should be able to rename bootx64.efi instead and still set hard drive as boot option.

Rename /efi/boot/bootx64.efi, copy shim or grub into /efi/boot and name it bootx64.efi Then boot harddrive entry in UEFI menu.

trevorrr.rice
July 27th, 2014, 05:13 AM
If I'm looking at the correct thing, my UEFI menu only contains this for my boot priority:
-External Device
-Internal Hard Disk Drive
-Internal Optical Disk Drive
-Network

I see no reference to Ubuntu.

How do I rename /efi/boot/bootx64.efi and copy shim?

trevorrr.rice
July 27th, 2014, 05:42 PM
Sorry for the dumb questions, but I'm not sure which file I should be renaming.

Starting here http://imgur.com/WyXPTlM I can see the EFI folder which includes: http://imgur.com/4gG1n4x.

The "boot" folder contains an "en-US" folder as well as "bootx64.efi"
The "microsoft" folder contains a "boot" folder which then contains "bootmgfw.efi"
The "ubuntu" folder contains "grubx64.efi"

Are any of these the ones that I should be renaming?

I think I'm confused because there are a lot of different paths to boot and efi folders. For instance, I can go Computer->cdrom->EFI->BOOT which then contains BOOTx64.EFI and grubx64.efi

ubfan1
July 27th, 2014, 06:27 PM
Your UEFI Settings (aka BIOS) looks like it lists only the devices, not the oses. When actually using the EFI menu to boot, selecting the HDD (assuming no OSes are listed) should produce another window/menu listing the OS bootloaders, "Windows" and "Ubuntu" for instance.
From Ubuntu, you can run sudo efibootmgr -v to see the boot loaders and their default order -- don't know how to do this from Windows, but there should be a way.
Each bootable device (hard disk, cdrom, usb, etc.) can have its own set of bootloaders in an EFI partition, so that's what you are seeing on the cdrom. Removable devices (like USB, and CDROM) use the bootloader in their EFI partition: /EFI/Boot/bootx64.efi . The hard disk's EFI partition is just a filesystem containing any number of bootloaders, which are run in the order selected in the firmware's nvram. You can change this order with
efibootmgr too, but I find that is a losing battle, since Windows keeps changing things back on you (even some firmware seems to keep changing the order, no Windows involved!). Using the efi menu to boot allows you to select the OS you want, regardless of what position it has in the boot order. Some machines with broken UEFI will only boot bootloaders named bootmgfw.efi (like Windows). The boot-repair "renname" function is to workaround this problem, but this rename is not needed in most machines.

trevorrr.rice
July 27th, 2014, 07:31 PM
Is this EFI menu suppose to pop up when I turn on my machine? Because I do not see any menu. It goes straight to Windows. When I use F2 to see my UEFI settings, no OSes are listed at all.

oldfred
July 27th, 2014, 07:40 PM
UEFI will not normally show up.
You should have two different keys. One gets you into the full UEFI where you can see a boot submenu, change boot order and do other maintenance. The other is a UEFI boot menu.
Only if booting into ubuntu entry in UEFI menu would you get grub menu. And some systems do not easily boot ubuntu by default.

Did you mention which brand & model system?
UEFI/BIOS Boot keys - about halfway down on this Microsoft page
http://social.technet.microsoft.com/wiki/contents/articles/12911.tips-for-configuring-your-bios-settings-to-work-with-windows-to-go.aspx

trevorrr.rice
July 27th, 2014, 07:43 PM
I have a Sony Vaio. According to that link, I do not have an option for Boot Menu.

I had a similar problem when I was originally installing Ubuntu that you helped me with here: http://ubuntuforums.org/showthread.php?t=2185615

I tried going through this thread again, but none of the those suggestions have worked either.

oldfred
July 27th, 2014, 08:30 PM
Sony only boots Windows.
It looks like you used the Boot-Repair fix before that copied grub or shim into Windows efi folder and renamed the Windows efi file to be a backup and named the shim file to be the Windows file. Then UEFI thinks it is booting Windows, but really boots grub. But then you can only boot Windows from grub menu using backed up Windows efi file name.

Now many have reported similar issues and several other workarounds. And other renames allow booting of Windows and avoid some issues where a Windows update overwrites the renamed "Windows file" that really is grub and then you are back to only booting Windows.

HOWTO: Sony Vaio Pro 13 DualBoot (Win 8 + Ubuntu Trusty 14.04) SecureBoot Wifi LVM
http://ubuntuforums.org/showthread.php?t=2227580
Sony Vaio Pro 13 - To get into UEFI press this "Assist" button BEFORE starting
http://askubuntu.com/questions/458413/how-to-fix-dual-booting-windows-8-and-ubuntu-14-04-on-a-sony-vaio
Issues on rename
https://bugs.launchpad.net/boot-repair/+bug/1315490
UEFI With encryption but you do not have to and with efi file boot rename
http://steffankarger.nl/2013/12/10/ubuntu-13-10-on-the-sony-vaio-pro-13/
One Sony user

The trick was to manually copy the ubuntu Boot directory in place of the \EFI\Boot Directory, and rename shimx64.efi to \EFI\Boot\bootx64.efi (not \EFI\Microsoft\Boot\bootmgfw.efi )


I have accumulated this list of althernatives. Some seem to work on some systems and others on other systems.
http://askubuntu.com/questions/486752/dual-boot-win-8-ubuntu-loads-only-win/486789#486789
http://ubuntuforums.org/showthread.php?t=2234019
Systems that only boot Windows from UEFI. Work arounds -Often Sony & HP, maybe others
Backup entire efi partition before making changes.
A: Manually rename files either efi\Microsoft\Boot\bootmgfw.efi and/or /EFI/BOOT/BOOTX64.EFI to be grub or shim
a1: Rename /efi/boot/bootx64.efi, copy shim or grub into /efi/boot and name it bootx64.efi Then boot harddrive entry in UEFI menu.
a2:(this is the same as what Boot-Repair does in B:.
Rename /efi/Microsoft/Boot/bootmgfw.efi and copy grub or shim into /efi/Microsoft/Boot and name it bootmfgw.efi Then boot Windows entry to boot to grub menu. You have to manually add a grub menu entry to boot renamed Windows efi file. Grub2's os-prober entry boots bootmfgw.efi entry which is now just grub, so it will not work.

Users who manually moved efi files around see post #6
http://ubuntuforums.org/showthread.php?t=2101840
http://ubuntuforums.org/showthread.php?t=2219452
http://ubuntuforums.org/showthread.php?t=2221498&p=13012109#post13012109

B:Boot_Repair renames Windows bootmgfw.efi. But cannot boot Windows from UEFI only from grub menu with bkpbootmgr.efi entry
Always say no until proven that you only can boot Windows entry from UEFI menu.
buggy-kernel detected. Do you want to activate ? yes (if any choice fails, please retry with the other)
To undo & to rename files to their original names, you just need to tick the "Restore EFI backups" option of Boot-Repair.

Any rename either manually or with Boot-Repair of bootmfgw.efi will need to be redone after a Windows update as it will restore Windows files.

[B]C: Edit Windows BCD, one Alternative to Boot-Repairs rename to make shim have Windows name.
Some systems work better to register grub/shim from inside Windows - for those that keep resetting Windows as default
http://askubuntu.com/questions/371559/grub-not-showing-on-startup-for-windows-8-1-ubuntu-13-10-dual-boot
bcdedit /set {bootmgr} path \EFI\ubuntu\grubx64.efi
https://coderwall.com/p/vfyqkg

D: If Description has to be Windows then change UEFI description.
sudo efibootmgr -c -L "Windows Boot Manager" -l " \EFI\ubuntu\shimx64.efi"

E: Some install rEFInd which seems to be another workaround and has nice boot icons.
http://www.rodsbooks.com/refind/index.html
http://www.rodsbooks.com/refind/secureboot.html
Now has a ppa to make it easy to install:
http://www.rodsbooks.com/refind/getting.html

trevorrr.rice
July 27th, 2014, 09:46 PM
I'm making progress, haha. Thank you.
I followed the steps from the first link in part A up to step 4. I finally end up at the GRUB menu! I am then able to boot to Ubuntu.

I am given three options:
-Ubuntu
-Advanced options for Ubuntu
-Windows Boot Manager (on /dev/sda3)

I'm assuming this has to do with not completing steps beyond step 4, but I wasn't able to find the file that contains my menu entries. Where would I be able to find these?

oldfred
July 27th, 2014, 10:12 PM
UEFI has menu.
Grub has menu which it seems you now get to. From grub menu can you boot both Ubuntu and Windows?

So did you use the option C: where you add an entry to BCD?
With that you boot Windows and from BCD choose ubuntu entry & it should reboot into grub.

trevorrr.rice
July 27th, 2014, 11:14 PM
I used option A. I followed the steps from post #6 from this link: http://ubuntuforums.org/showthread.php?t=2101840. I did steps 1-4, but was unable to find the file that contains my menu entries to complete step 5.

And no, I cannot boot to Windows from the grub menu. I can only boot to Ubuntu.

oldfred
July 27th, 2014, 11:56 PM
That is then just like what Boot-Repair does. It renames the Windows efi boot file. But then you have to add a boot stanza to grub to have it boot the renamed file as grub2's os-prober just finds the standard file name and then the grub2 standard entry just loops back to grub. Same as B: above but you may have renamed it to a different backup name?

#Add menu entry to 40_custom, change example from sda3 to your efi partition, if not sda3. Also change bootmgfw.efi to whatever you have renamed it to.
gksudo gedit /etc/grub.d/40_custom

sudo update-grub


menuentry "Windows bootmgfw.efi UEFI" {
search --file --no-floppy --set=root /efi/Microsoft/Boot/bootmgfw.efi
chainloader (${root})/efi/Microsoft/Boot/bootmgfw.efi
}




Note that Windows updates will write a new bootgfw.efi. Then you have to redo the rename as grub version with original file name is gone and the renamed file may be an obsolete bootmgfw.efi. Or you have to go thru process again. That is why now I prefer renaming bootx64.efi if that rename will work.

trevorrr.rice
July 28th, 2014, 02:12 AM
So I tried following these steps from your link:

5) Go to /etc/grub.d/ and find the file which contains your menu entry. Grep might be helpful for this. For me, the file is 25_custom it looks like:
Code:

menuentry "windows UEFI bootmgfw.efi.bkp" {
search --fs-uuid --no-floopy --set=root DE90-E7F8
chainloader (${root})/EFI/Microsoft/Boot/bootmgfw.efi.bkp
6) Back up this entry if you wish, or simply change it.
7) Replace the line that begins with "search" to say
Code:

set root='(hd0,gpt3)'
(note that I have gpt formatted disk, and hd0, gpt3 corresponds to /dev/sda3, the disk which contains my .efi files.
8) Run update-grub to update the menu
Code:

update-grub



My 40_custom looks like this: http://imgur.com/aRWa9Dn
I tried with both .../Boot/bootmgfw.efi and .../Boot/bootmgfw.efi.bkp
Both of these produced another entry in my grub menu but neither booted to Windows. Both just go back to the grub menu.

oldfred
July 28th, 2014, 04:30 AM
Cannot easily read image. You can just copy & paste code. If longer use code tags with # in edit panel of Advanced Editor. And you can attach screenshots with paperclip icon.

Post a link to BootInfo report.

Boot Repair -Also handles LVM, GPT, separate /boot and UEFI dual boot.:
https://help.ubuntu.com/community/Boot-Repair

(https://help.ubuntu.com/community/Boot-Repair)The report may not show much of renamed files as it is hard coded to only look for standard file names. It will printout entire grub.cfg. Your filename has to match exactly with the name in the Windows efi boot folder.

trevorrr.rice
July 28th, 2014, 06:01 PM
Here is my 40_custom file:

#!/bin/shexec tail -n +3 $0
# This file provides an easy way to add custom menu entries. Simply type the
# menu entries you want to add after this comment. Be careful not to change
# the 'exec tail' line above.
menuentry "Windows bootmgfw.efi.bkp UEFI" {
set root='(hd0,gpt3)'
chainloader (${root})/EFI/Microsoft/Boot/bootmgfw.efi.bkp
}

And here is my BootInfo report: http://paste.ubuntu.com/7886392/

oldfred
July 28th, 2014, 06:14 PM
Do you have secure boot off? Grub will not boot Windows 8.1 if secure boot is on currently.

Your entries looks correct if the .bkp file is the original Windows bootgfw.efi file.
Or was Windows left in hibernation or fast boot? Then grub will not boot it either.

If Windows will not boot you need to restore the correct/original bootgfw.efi file and directly boot Windows from UEFI menu. Then you should be able to fix Windows. Or you may need to use f8 to get into Windows repairs.
Grub really only boots working Windows.

trevorrr.rice
July 28th, 2014, 06:22 PM
I'm trying to boot into Windows 7, and I don't have an option for secure boot in my UEFI.

Should I run Boot-Repair with "Restore EFI backups" ticked and untick "SecureBoot" even though I don't have it as an option in my UEFI?

oldfred
July 28th, 2014, 06:36 PM
If system was originally Windows 8 you may have secure boot in UEFI, but even Windows 7 will not work with it on.

Since you manually renamed Windows files do not use Restore form Boot-Repair. It will restore the files it renamed, not any you have renamed. Hope you kept track of which was which. :)