Make UEFI, GPT, Bootloader, SSD, USB, Linux and Windows work together

22

24

I like to use the latest hardware and the latest software; thus I have a Laptop (Lenovo X220) with

  • UEFI instead of BIOS
  • an SSD instead of an HDD
  • GPT partitioning scheme instead of MBR
  • USB to boot from instead of optical disks.

I need to use both Windows and Linux. I tried to make them work alongside, but I didn't succeed.

Most Linux distribution isos don't even really work on UEFI systems booted from USB. (Not even the self-claimed cutting-edge Fedora. I also tried Linux Mint Debian Edition and Sabayon Linux (according to this guide) which did not work. Only Ubuntu worked for me.

I first installed Windows 8 which created sda1: Recovery, sda2: EFI system, sda3: msftres, sda4: NTFS Windows. Windows worked without a problem. I then created sda5: linux-swap and installed Ubuntu into sda6: btrfs. After rebooting, I was not presented GRUB2 as expected, but instead my system just booted into Ubuntu. I could no longer access Windows.

After fixing dpkg in btrfs Ubuntu, I followed the Ubuntu documentation on UEFI booting. The result left me with a broken GRUB2, but interestingly, when I wanted to select the device to boot from, I was not only presented the internal SSD, an attached USB device, or LAN, but also Grub2 (broken), Ubuntu and Windows.

The result is not very satisfying to me.

What would I have to do to fix everything? Or differently asked, what operating system should I install at what point given my possibilities and requirements, so that I have a working bootloader in my UEFI GPT system which presents me a working Linux and Windows.

gbag

Posted 2012-04-21T23:34:12.670

Reputation: 591

Found this with Google: http://www.rodsbooks.com/efi-bootloaders/

– Harry Johnston – 2012-04-23T06:00:42.550

Also useful in this context: http://unix.stackexchange.com/a/40775/12779

– Marco – 2012-07-17T21:56:11.440

Answers

23

OK, it was a very involving process, but I solved my problem and everything works together just as it should.

I'm documenting the solution for everyone:

  1. One must begin with GParted Live and create a fresh GPT partition table. This will wipe everything on the HDD resp. SSD. Then one must create a small 8 MB 'unpartitioned' partition and flag it with 'bios_grub'. Afterwards, one creates a 100 MB fat32 partition labeled 'EFI' and flagged 'boot'. (This is the modern and more transparent equivalent of what the MBR used to do, see here for reference.)

  2. Optional: Install a Linux distribution that works correctly on GPT UEFI systems from USB. I don't know which ones do. I installed Chakra Linux to try it out. While installing make sure to mount the 100 MB fat32 as /boot/efi. Do the rest as usual. I left some unformatted room for Windows 8 (300 GB), created a linux-swap of 1 GB afterwards, created an adjoining ext4 (25 GB) and mounted it as /. After installation it will not boot, but we will fix that with ease. Do the entire step again for installing more distributions.

  3. Install Windows 8 in the unformatted space we left in the previous step. It will automatically identify the EFI system partition, create a MSFTRES, and a NTFS where it installs itself. After installation we can only boot into Windows, but we will fix that later.

  4. Ubuntu will fix it all. While installing select the 100 MB fat32 and change it into 'use as efi'. Create an ext4, install Ubuntu. Upon rebooting we are presented a nice working GRUB2 which detects Ubuntu and Chakra Linux.

  5. Now we will configure GRUB2 to detect Windows. It is a known bug, however, Rasmus Pedersen's workaround is functional. Be aware of a typing error he made: It is /etc/default/grub without an s instead of /etc/defaults/grub. When writing "chainloader (${root})/efi/Microsoft/Boot/bootmgfw.efi" I wrote /EFI/ in capitals just to be sure. When done this will present us a working GRUB2 with a working Windows 8 entry.

  6. GRUB2 does not look very nice with so many boot options and it is not in my preferred order. Thus I install and use grub-customizer in Ubuntu as shown here. I configure it so to hide the memtest, the recovery and the old kernels, and I reorder it to put my custom script with Windows on top. Done.

gbag

Posted 2012-04-21T23:34:12.670

Reputation: 591

Nice share @gbag. For those going with Ubuntu and GRUB2 in place of rEFInd, according to bugs.launchpad the "Not detecting Windows Boot Entry" bug is fixed in ubuntu starting with 12.04.3 ("Saucy" rel 3). – tuk0z – 2015-07-27T13:59:10.257

very nice , thanks for this post , just one additional thing: I would like to use software RAID 0 as for windows 7 as for linux from 4 paritions I have been went through many times to configure RAID 0 within described "technology usage" except the dual boot windows 7 on RAID 0. Does anybody has experience with it ? thanks for any info. regards, Martin – None – 2012-05-01T20:17:26.280

Thank you very much for your answer, I followed your steps, but. After I did step 5, I can't boot into windows 8 with the entry. I am sure the entry is correct, because windows 8 logo has appeared shortly but after that nothing will show up and the system will reboot automatically. Because I installed both windows 8 and Ubuntu with uefi mode, I have both uefi Ubuntu and uefi windows boot manager in my uefi. Before I install Ubuntu, the windows boot manager can boot me into windows 8. But after all what I did, it doesn't work anymore. It gives me the same error as I got from selecting the windo – None – 2012-06-29T15:45:02.790

This answer was very helpful to me as a basis for my install. – davidtbernal – 2012-08-05T03:48:25.043

3

Kubuntu and LinuxMint KDE distro's worked fine for me with GPT and EFI.

Steps:

  1. Start Windows 7/8 install and configure HDD partition, it will create automatically the EFI boot, MS System Reserved, for Windows 8 also the recovery partition. Install Windows.
  2. Install your desired Linux distro with EFI support. Select manual partitioning and to install bootloader on "/" root partition, Grub 2 EFI files will be automatically installed on EFI boot partition, alongside with those of Windows.
  3. Install rEFInd and your good to go. rEFInd will do the job and offer you option to chose desired operating system at PC start. Install rEFInd info - http://www.rodsbooks.com/refind/installing.html. Before rEFInd install, you must select boot device at start with your BIOS dedicated key, or by entering in BIOS and put desired device first in list, boot Windows and configure rEFInd from Windows. Make sure that proper EFI partition is set as default boot device in BIOS.

I personally prefer Kubuntu 12.10, probably Mageia 3 will be nice to but it's a long way till 2013 spring.

Good luck.

Andrei

Posted 2012-04-21T23:34:12.670

Reputation: 31