Well, work's been a bit on the hellish side, and so I've not had the chance to fully work on this until today really. But, after a few days of trial and error, I finally have a working dual boot, UEFI system! I'm hoping that a kernel upgrade does not break anything. This seems pretty stable, though.
For future people's sake, here's how I finally got it working. Note, I'm working with two hard drives here, and the instructions will likely vary for those working from just one drive. It's also worth noting that if you're working from two drives, it might be handy to unplug the Windows drive from the system to help diagnose problems. I couldn't figure out what was going wrong until I realized that I couldn't even boot Kubuntu when it was the only drive in the system. Final note is that this was with Kubuntu 12.04. Any other versions may stray from this (especially older versions). However, I was happy to learn that I was over thinking things, and that out of the box it seems that Kubuntu 12.04 (and likely Ubuntu as well) set things up well right from the start.
Anyway, here are the steps I took:
1. Make an Ubuntu (or in my case Kubuntu) .iso boot disk as usual.
2. In BIOS (if yours supports it) load the disk using UEFI mode. If you don't specifically choose to boot the .iso as UEFI, you may be installing in BIOS mode instead of UEFI, which will cause problems later. We *need* to make sure that both OSes are UEFI here or else going with the traditional BIOS approach is the best tack to take.
3. I tried as others have suggested to preformat the drive. However, I was either doing something wrong or there is a bug / glitch here and I was unable to get a stable working Kubuntu system to boot. Every time I would try to boot from a fresh install, I would get something like "Reboot and Select the Proper Boot Device" errors. The goal here is to format the drive in GPT mode (instead of the old standby MBR mode), creating a new type of /boot partition as follows (let's assume the drive is /dev/sda for this):
Code:
Partition Type Mount Point Size Flags
/dev/sda1 fat32 /boot/efi 200MiB boot
/dev/sda2 linuxswap (if you want one that is!)
/dev/sda3 ext4 /
/dev/sda4 ext4 /home
This is all assuming you want those options. Minimally, you need to have a FAT32 EFI partition at the start that is around 200MiB bit that is marked as /boot. This option was selectable for me when I chose manual partition during the Kubuntu setup. You may or may not find that pre-formatting the hard drive with a Gparted Live CD works better (which I've seen posted in several places around the net). However, with 12.04, it seems like it handled the above scheme with no problems. The rest of the partitions can be as you like following standard guidelines (if there is such a thing!).
4. During the partition phase of the installation, be sure to choose to have the boot loader installed on sda1. Just leaving it as sda didn't seem to work well for me.
5. Once the isntallation finishes, reboot the system and verify that when you choose to boot Kubuntu as UEFI it boots without problem. You may or (more likely) may not see a Grub menu before it loads the system. This is normal (even from the old days) if there were no other OSes present for Grub to present.
If you're with me to this point, then we're in the home stretch. If not, you may need to verify that you're indeed installing Kubuntu as UEFI, and that in the /boot/efi parition that you made, you see a similar file structure:
Code:
dave@CygnusX1:/boot$ ls
abi-3.2.0-23-generic efi initrd.img-3.2.0-23-generic memtest86+_multiboot.bin vmlinuz-3.2.0-23-generic
config-3.2.0-23-generic grub memtest86+.bin System.map-3.2.0-23-generic
Code:
dave@CygnusX1:/boot/efi/EFI/ubuntu$ ls
grubx64.efi
dave@CygnusX1:/boot/efi/EFI/ubuntu$
Code:
dave@CygnusX1:/boot/grub$ ls
acpi.mod datetime.mod gcry_twofish.mod lsmmap.mod parttool.lst test_blockarg.mod
adler32.mod dm_nv.mod gcry_whirlpool.mod ls.mod parttool.mod testload.mod
affs.mod echo.mod gettext.mod lspci.mod password.mod test.mod
afs_be.mod efi_gop.mod gfxmenu.mod lssal.mod password_pbkdf2.mod tga.mod
afs.mod efi_uga.mod gfxterm.mod lvm.mod pbkdf2.mod trig.mod
aout.mod elf.mod gptsync.mod lzopio.mod pci.mod true.mod
appleldr.mod example_functional_test.mod grub.cfg mdraid09.mod play.mod udf.mod
ata.mod ext2.mod grub.efi mdraid1x.mod png.mod ufs1.mod
ata_pthru.mod extcmd.mod grubenv memdisk.mod probe.mod ufs2.mod
at_keyboard.mod fat.mod gzio.mod memrw.mod raid5rec.mod uhci.mod
befs_be.mod fixvideo.mod halt.mod minicmd.mod raid6rec.mod usb_keyboard.mod
befs.mod font.mod hashsum.mod minix2.mod raid.mod usb.mod
bitmap.mod fshelp.mod hdparm.mod minix.mod read.mod usbms.mod
bitmap_scale.mod fs.lst hello.mod mmap.mod reboot.mod usbserial_common.mod
blocklist.mod functional_test.mod help.mod moddep.lst regexp.mod usbserial_ftdi.mod
boot.mod gcry_arcfour.mod hexdump.mod msdospart.mod reiserfs.mod usbserial_pl2303.mod
bsd.mod gcry_blowfish.mod hfs.mod multiboot2.mod relocator.mod usbtest.mod
btrfs.mod gcry_camellia.mod hfsplus.mod multiboot.mod scsi.mod video_bochs.mod
bufio.mod gcry_cast5.mod iorw.mod nilfs2.mod search_fs_file.mod video_cirrus.mod
cat.mod gcry_crc.mod iso9660.mod normal.mod search_fs_uuid.mod video_fb.mod
chain.mod gcry_des.mod jfs.mod ntfscomp.mod search_label.mod videoinfo.mod
cmp.mod gcry_md4.mod jpeg.mod ntfs.mod search.mod video.lst
command.lst gcry_md5.mod keylayouts.mod ohci.mod serial.mod video.mod
configfile.mod gcry_rfc2268.mod keystatus.mod part_acorn.mod setjmp.mod videotest.mod
core.efi gcry_rijndael.mod linux.mod part_amiga.mod setpci.mod xfs.mod
cpio.mod gcry_rmd160.mod loadbios.mod part_apple.mod sfs.mod xnu.mod
cpuid.mod gcry_seed.mod loadenv.mod part_bsd.mod sleep.mod xnu_uuid.mod
crypto.lst gcry_serpent.mod locale part_gpt.mod squash4.mod xzio.mod
crypto.mod gcry_sha1.mod loopback.mod partmap.lst tar.mod zfsinfo.mod
cs5536.mod gcry_sha256.mod lsacpi.mod part_msdos.mod terminal.lst zfs.mod
datehook.mod gcry_sha512.mod lsefimmap.mod part_sun.mod terminal.mod
date.mod gcry_tiger.mod lsefisystab.mod part_sunpc.mod terminfo.mod
dave@CygnusX1:/boot/grub$
Again, with just one drive in the system so that you can diagnose things, be sure that you have a working UEFI install of Kubuntu that boots without problems before going on. Until you have that, dual booting is impossible.
6. Now if you have Kubuntu booting normally as UEFI, we need to add Windows to Grub. First we need to know the UUID of its /boot/efi parition. To find out, run (after plugging the Windows drive back in that is!):
Then look for the UUID for that partition which will be vfat and have a short, 8 character UUID instead of the long one. In my case, it was:
Code:
dave@CygnusX1:/boot/grub$ sudo blkid
/dev/sda1: UUID="DEEB-3A1A" TYPE="vfat"
/dev/sda2: UUID="b170157f-8d99-4f06-8ce2-92e8e3f44f43" TYPE="swap"
/dev/sda3: UUID="58702a5d-45aa-4c17-9de9-650e2d21d30e" TYPE="ext4"
/dev/sda4: UUID="1b1c5499-2500-4432-a049-41c93399382d" TYPE="ext4"
/dev/sdb1: UUID="1261-7FB0" TYPE="vfat"
/dev/sdb3: UUID="4ECC6BF6CC6BD6AD" TYPE="ntfs
Since I know that the Windows drive is /dev/sdb, I know that the UUID of the Windows efi_boot partition is 1261-7FB0.
7. Add an entry to Grub to load the Windows EFI Bootloader by running:
Code:
sudo nano /etc/grub.d/40_custom
and add the following:
Code:
menuentry "Windows 7" {
insmod part_gpt
insmod fat
insmod search_fs_uuid
insmod chain
search --fs-uuid --no-floppy --set=root 1261-7FB0
chainloader (${root})/efi/Microsoft/Boot/bootmgfw.efi
}
Note that where I have '1261-7FB0' in my entry, you'll want to replace that with the UUID you found in the last step.
8. Run:
in order to add the entry to the grub.cfg line. On my system, I didn't specifically see it add an entry for Windows when it was discovering things. I was worried this didn't work but decided to try it out anyway and rebooted. I was pleasantly surprised to see a new Windows 7 entry in Grub, which loaded without any problems.
I believe that once you add the Windows entry to grub.cfg you should see the Grub menu when you reboot. If not, then you'll want to edit /etc/default/grub and comment out the two GRUB_HIDDEN lines as such:
Code:
#GRUB_HIDDEN_TIMEOUT=0
#GRUB_HIDDEN_TIMEOUT_QUIET=true
That will ensure that you see the Grub menu every time, without having to press 'shift' to see it.
By the way, you'll also need to make sure that your Kubuntu hard drive is the default one in the Boot order so that the system knows to load it first. Of course, if you try to have the Windows disk be the default, you'll never get to Grub and the whole thing falls apart.
Well, that's about it. After messing around with a bunch of solutions, this seems to be working quite well, and barring any unforeseen breakage from Kernel updates (which I don't think will happen), I think this is the best way to go as it offers the most flexibility without really altering the finicky and fragile Windows boot loader (which I managed to break more than once - good thing it's easy to fix with the installation DVD!).
I hope that helps someone in the future, and they don't spend nearly as much time as I did trying to figure this all out.
Bookmarks