20

I have been reading/researching for hours now on how to partition for a UEFI enabled, secure boot windows 8 system. The language used is a bit above my head though and some steps seem to be skipped for the non ubuntu endowed minds.

So very simply, I am starting right at the partition option in the installer, where I click "something else" instead of erasing the whole disk (because I want to keep windows 8 as well). Now I have read that you can only have one UEFI partition. Great. Sounds good. Now do I also need a partition for installing linux with the ext3/4, or do I do as one guide said and format it in fat32?

I am lost at this point. Then it goes on talking about boot flagging and how only the UEFI partition needs to be boot flagged. So here is where my dummy-ness kicks in and I am lost. I am looking for very specific instructions on how not to totally screw up the booting and install a dual-boot ubuntu/windows 8 system.

  • Possible duplicated askubuntu.com/questions/221835/… – Braiam Oct 4 '13 at 16:39
  • @Braiam That might be the highest rated and detailed answer on that topic, but as the questioner already said, some guides are overly detailed and therefore hard to understand. Since the question is about partitioning, quick instructions and explanations on how to verify the setup might be welcome. – LiveWireBT Oct 4 '13 at 20:11
  • @LiveWireBT if that's the case, attach your answer into the main question so everyone that look for answer that are to their level would find them in 1 place instead of scattered in several questions. – Braiam Oct 4 '13 at 20:35
  • It's subject to loads of firmware glitches. There cannot be a canonical answer for this unless there's a wiki with each BIOS firmware that each answer is targeting. Mine for example didn't honor legacy mode defaults if GPT partitions were present, if non-GPT uefi security partitions were present even on a non-primary drive (the SSD for cacheing), etc. It tried HARD to default to UEFI. Since I have some other OSes that don't support UEFI yet dual booting, I had to just burn it to the ground and use DOS style partitions. – RobotHumans Oct 4 '13 at 20:55
  • @Braiam No my answer would be out of place on that topic, but it fits this topic. – LiveWireBT Oct 4 '13 at 20:57
17

Partitioning is the very easy part. For all the partitioning tasks you should use a partitioning software like GParted which ships with the Ubuntu Live ISO image. A tool like the Ubuntu installer, which oversimplifies things, is probably the main reason why you're confused.

For proper EFI partitioning and installing you need to:

  1. Have a GPT partition table on the hard drive you want to install to.

    • You can verify this in GParted via menu entries View -> Device Information. If the partition table attribute reads msdos instead of gpt, then it's wrong and might get messy if you continue. Unfortunately creating a new partition table destroys the existing one and all data on the disk.

    • Related: How can I check and change the partition table type?

  2. Have a EFI system partition (ESP).

    • A EFI system partition has the partition type ef00 and usually contains a FAT32 file system.
    • Given that you have a GPT partition table, if the checkbox for boot is ticked in GParted's manage flags dialog on the partition that is meant to be your ESP and the partition contains a FAT32 file system everything is good. If not tick the checkbox for boot and ensure that none of the other partitions has this flag set, because as you already found out, there can only be one ESP. (Yes, the boot flag in GParteds GUI equals partition type ef00, however this is not the real GUID used in GPT for the ESP, see Wikipedia for a list of partition type GUIDs and the comment below by user Rod Smith, and also the footnote in the article about manufacturer specific boot partitions.)
  3. Create the remaining partitions needed for the OS and boot the installation media in UEFI mode.

    • Your proper partition setup is almost complete. Just add the partitions you want for your new OS installation as you see fit. You can do this via the Ubuntu installer or GParted, it's up to you and you can't do much wrong here. (The de facto default file system for Linux is EXT4. You can't install to FAT32, because due to this file systems limited feature set.)
    • If you haven't booted the installation media in UEFI mode, you need to reboot and explicitly boot in UEFI mode. UEFI needs to be enabled in you computers firmware setup screen (formerly/usually called BIOS). Instructions on how to boot and verify that the installation media booted in UEFI mode can be found in the community documentation. From there on the Ubuntu installer should know that it should do a UEFI installation.
    • Secure boot should work with Ubuntu 12.10 64-bit and 12.04.2 64-bit and newer installation media (see: How do I install Ubuntu alongside a pre-installed Windows with UEFI?).

You can do UEFI installations on MBR partitioned disks and do certain hacks/kludges, but a setup verified to be like this will give you the least amount of trouble and everything should work fine. I found the Arch Linux UEFI wiki page very detailed and helpful for learing more on the whole topic and doing some hacks.


Known UEFI bugs and implementation shortcomings:

  • Wikipedia about Lenovo, Toshiba, Samsung without going into much detail.
  • Computers from 2011 or earlier may feature a UEFI firmware, but the implementation may not always provide a UEFI boot interface. Source: Talk at LCA 2013 from Dong Wei - UEFI, the Converged Firmware Infrastructure (http://mirror.linux.org.au/linux.conf.au/2013/mp4/ file UEFI_the_Converged_Firmware_Infrastructure.mp4 - at around 12:14)
  • 3
    This is fairly accurate, but I want to point out that the hex codes (such as EF00) are used by GPT fdisk (gdisk, cgdisk, and sgdisk). These aren't official GPT type codes. The real type codes are 128-bit (32-digit hexadecimal) numbers, which are awkward to type, display, and remember, so GPT fdisk uses shortened 4-digit hexadecimal codes instead. GParted and parted use certain "flags," such as the "boot flag," to denote certain partition type codes. Other tools have other ways of representing GPT type codes. – Rod Smith Oct 5 '13 at 16:15
  • @RodSmith I remember seeing full GUIDs when reading up on that topic over a year ago in the Arch Wiki, but couldn't find them there again. I have now added a link to Wikipedia. – LiveWireBT Oct 7 '13 at 7:37
5

Actually partitioning for an EFI-based Ubuntu installation is no harder than partitioning for a BIOS-based installation. If you've read a guide to Ubuntu installation or partitioning, the changes for an EFI-based installation are:

  • You generally use the GUID Partition Table (GPT) for EFI rather than the older Master Boot Record (MBR). On a system with Windows already installed, this should already be done, and the Ubuntu installer will detect and use the GPT partitions just fine. Using GPT does have some further implications, though, as detailed below....
  • GPT doesn't use extended or logical partition types. Instead, GPT supports up to 128 (by default; that limit can be raised) partitions. Some tools refer to these as "primary partitions," although in the absence of extended and logical partition types, the designation "primary" is meaningless. The point of all this is that you can ignore any instructions to create an extended partition or to create a certain mix of primary and logical partitions.
  • The current version of Ubuntu has a bug that causes it to use the Windows filesystem type code for Linux partitions. This causes your Ubuntu filesystem partition(s) to show up in Windows as unpartitioned disks. The solution is to use gdisk to change the type code of your Ubuntu filesystem partition(s) from 0700 to 8300. This problem is covered in more detail on this page. You can make this change after installing Ubuntu.
  • GPT doesn't use cylinder/head/sector (CHS) values. Older documentation may refer to this, or to "cylinder alignment." Ignore such references. (You might also look for newer documentation, since CHS issues are obsolete even for new installations on BIOS-based computers.)
  • An EFI-based installation stores its boot loader in the EFI System Partition (ESP) rather than in the MBR. Thus, you must have an ESP, which the Ubuntu installer refers to an an "EFI boot partition." If the computer already boots another OS in EFI mode, it will already have an ESP. I recommend backing up any existing ESP before you proceed, just in case of an accident. (A file-level backup should work fine.) On a system with Windows 8 pre-installed, the ESP is usually one of the first three partitions on the disk. It always uses a FAT (usually FAT32) filesystem, so you can identify it in this way on the partitioning screen. In GParted or parted it will have its "boot flag" set, and in gdisk it will have a type code of EF00.

Other partitioning issues are common across firmware and partition table types. In particular, Ubuntu defaults to using two partitions: One for the root (/) filesystem and another for swap space. Many users like to split off /home or other directories into their own partitions, and some like to use Logical Volume Manager (LVM) setups. The issues related to such things are the same for EFI and GPT as they are for MBR and BIOS, so refer to any of the hundreds of sites that cover such issues.

2

How I installed my system, but I have secure boot off in bios, so I am not sure that it will work:

  1. Create new partition table on your hard disk in GPT mode. (Warning: this will erase all data on the disk!) Then you must create a 100 MB fat32 partition labeled 'EFI' and flagged 'boot'. and the system partitions, so:

    • sda1: 100mb, fat32, EFI, boot flag set
    • sda2: 30gb, ext4, kali-linux
    • sda3: 4gb, swap, swap for kali&ubuntu
    • sda4: 60gb, ext4, ubuntu
    • sda5: 250gb, ntfs, windows 8.1
    • sda6: 382gb, ntfs, datas
  2. (optional) Install Kali-linux, While installing make sure to mount the 100 MB fat32 as /boot/efi. Do the rest as usual.

  3. Install Windows 8. 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, while installing select the 100 MB fat32 and change it into 'use as efi'. Create an ext4, install Ubuntu. Upon rebooting we are presented with win8 loader. in bootmenu choose ubuntu end get into it.

  5. Now we will configure GRUB2 to detect Windows. open a root nautilus, navigate to /boot/efi/EFI delete the boot folder and copy the boot folder from the microsoft folder to the windows partition and after delete the microsoft folder. Aft r go to /etc/default/grub and comment out the 2 line start with "GRUB_HIDDEN". Next, the entry for windows can be manually added by appending the following lines to /etc/grub.d/40_custom:

    menuentry "Windows" {
            search --fs-uuid --no-floppy --set=root YOUR-EFI-PARTITIONS-UUID-HERE
            chainloader (${root})/Boot/bootmgfw.efi
    }
    

And finally type sudo update-grub. Welcome in the working system.

  • Welcome to ask Ubuntu! Please take your time to read up on how to format answers. For example you could have used a numbered list instead of manually writing "step(number).". – LiveWireBT Oct 4 '13 at 20:32
  • The user didn't want to destroy his Windows installation, but you are doing it in the first step without warning. :( There is a tool called bcdboot that installs the bootloader and proper configuration data to the given directory. – LiveWireBT Oct 4 '13 at 20:54
  • hard to follow: delete the boot folder and copy the boot folder from the microsoft folder to the windows partition and after delete the microsoft folder, can you explain? is there a boot folder inside /boot/efi/EFI? i can't see it there and i don't believe i want to delete /boot/efi/EFI root – tomasb Oct 2 '16 at 19:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.