I wanted to be able to use Grub2 personally. I run Linux mint but it's similar enough in this respect that it should work regardless, I've even applied the same principles to install red hat as well so I could study for the RHCSA and RHCE exams (wish me luck).
- Disable secure boot and enable both legacy and efi booting
- burn a normal x64 Ubuntu/Linux iso to a flash drive or DVD
- boot into the DVD and perform a normal legacy installation, including installing grub2 to the root of /dev/sda, and make sure the live system is connected to the internet
- once installation is complete and you're on your live DVD, take a deep breath and open a terminal
- Live CD's don't let you use the root account and insist on using sudo but I have not seen any benefit to using sudo on the live disk vs simply becoming the root user and doing what you need to do. You of course want to be extremely careful but on the other hand we won't be rm'ing anything or overwriting anything, just installing and uninstalling packages.
type the commands:
$ sudo -s
# passwd
Enter new UNIX password:
Reenter new UNIX password:
Password successfully changed...
# exit
$ su
Password:
#
You will now be the root user, our next task is to mount our newly installed system, You need to know the partition layout and the drive layout but I'm going to assume this:
- /dev/sda (only internal hard drive)
- /dev/sda1 (EFI system Partition)
- /dev/sda2 (Windows System)
- /dev/sda3 (Recovery Image)
- /dev/sda4 (Recovery Program)
- /dev/sda5 (diagnostic)
- /dev/sda6 (your new /boot/ system)
- /dev/sda7 (your new linux swap)
- /dev/sda8 (your new / system)
- /dev/sda9 (your new /home/ system)
If you need to figure this out, you can use the command sudo parted /dev/sda list
Now let's mount our system
# mount /dev/sda8 /mnt/
# mount /dev/sda6 /mnt/boot/
# mount /dev/sda9 /mnt/home/
# mount /dev/sda1 /mnt/boot/efi/
# # this is optional here, you can mount the windows partition if you want
# mount /dev/sda2 /mnt/mnt/
# # this below is also necessary, it mounts the virtual file systems
# mount -o bind /dev/ /mnt/dev/
# mount -o bind /dev/pts/ /mnt/dev/pts/
# mount -o bind /sys/ /mnt/sys/
# mount -o bind /proc/ /mnt/proc/
Ok, at this point, your /mnt/ basically looks exactly and I mean exactly like that system would if you had booted into it, in fact the only thing that's different at this point besides differences in network configuration is that the root directory isn't the system's root and we're about to fix that. Before we do however, If something doesn't work after you issue the next command you'll need to use the exit
command to get back and fix it before going back to the new root.
- Change the root for the system to the newly installed system:
# chroot /mnt/
- Alright, you're in the new system and it's time to make some changes...
#> apt-get update
#> apt-get purge grub-pc
- YUP, You're going to destroy grub and get rid of it for all eternity.... ok, you're just swapping it for grub-efi
- now do this:
#> apt-get install grub-efi
- now we have the correct package for grub, now let's put things where they belong
#> grub-install
#> update-grub
- This command might give you a warning but as long as the next set of commands gives you the listed results, you're good. Specifically it will complain about not having efi variables because "efivars" isn't loaded into the kernel (that's because you booted in legacy mode, but that doesn't matter for this part, it just means your live disc cannot bless the firmware which we're gonna take care of in a few steps.
- and now let's make sure that things are where they should be...
#> ls -R /boot/efi/EFI/* | grep grubx64.efi
/boot/efi/EFI/ubuntu/grubx64.efi
- If you see the output above then we're in good shape. remember that path...
- and now that we're in good shape...
#> exit
# shutdown -r now
Ok... GRUB won't load.... I knew that was coming. Everything is set up, you just need to bless the firmware.... Well, mac calls it "bless", but we're going to do this in windows so we need to use bcdedit. We need to first bring up an admin command prompt. If you're in windows 7, it's in the start menu, if you're in windows 8, right click on the bottom left corner of the desktop and it will be right there in the menu. So issue this command...
C:\WINDOWS\system32> bcdedit /set {bootmgr} path \EFI\ubuntu\grubx64.efi`
Where \EFI\ubuntu\grubx64.efi is the path you recorded earlier without /boot/efi and switching the forward slashes for backslashes... type the /set {bootmgr} path
exactly as written, type in the curly braces and the words you see. the only thing you're changing is the path at the end of the command.
and reboot.
You should now be looking at the grub menu and be able to select linux or windows. Enjoy!