Monday, February 3, 2014

Install Ubuntu on UEFI enabled Computers

Recently I have came across many people asking how to install Ubuntu in a UEFI machine. Unified Extensible Firmware Interface (or UEFI for short) is a new type of firmware that was initially designed by Intel (known as EFI then) mainly for its Itanium based systems. It introduces new ways of booting an OS that is distinct from the commonly used "MBR boot code" method followed for BIOS systems. A detailed description of UEFI can be found at the ArchWiki or Wikipedia

The installation remains similar to normal installation procedure but needs a little bit of tweaking. Having a PC with EFI firmware does not mean that you need to install Ubuntu in EFI mode. If you have a machine in which there is any operating system already installed in Legacy mode then you must install Ubuntu also in Legacy mode, unless you wish to format the system and start from scratch. If Ubuntu is the only operating system on your computer, then it does not matter, you can install Ubuntu in EFI mode or Legacy. But if you have a pre-installed Windows in UEFI mode then it is mandatory to install Ubuntu in EFI mode.
Update: The following method was tested with different versions of  Ubuntu starting from 13.04 to 19.10, KDE Neon and Linux Mint (by various readers of the blog).
 
Partitioning instructions for users without any pre-installed or Existing OS. (Formatting Entire hard-disk).
  1. The first and foremost thing is that the partition table followed in EFI systems is GPT and not the Legacy MS-DOS. If you are starting the installation on a system with no operating system then the first step is to create a GPT partition table.  This can be done from Gparted (after booting into Ubuntu live media) by using Create Partition table under device menu. A dialog box similar to one shown here appears and you can use Advanced option to set partition table to GPT. Then press Apply. The GPT partition table doesn't have the limitation of allowing only four  primary partitions as in an MS-DOS table.
          
  2. Now partition the hard disk to install Windows. You will require one NTFS drive at beginning to install Windows. If you need to install Ubuntu as only operating system then there is no need for this NTFS partition.
  3. The create an EFI partition using GParted. The type of partition is FAT32 with a size of minimum 100Mib (200MiB recommended). Set the boot flag for this partition using manage flags option.
  4. Leave a 100-200 MB free space before making next partiton. This space will be used as Reserved Area for Boot/GRUB during installation.
  5. Create an EXT4 partition for the root filesystem. The size of the partition can be limited to 15-20 GB (minimum 4GB) depending on how many softwares you are going to install.
  6. Create another EXT4 partition for the home folder. This is recommended because this will help you to reinstall Ubuntu again without losing any files or settings as you will not need to format the home partition everytime.
  7. Create a SWAP area. Rule of thumb is size is of SWAP is twice the amount of RAM you have. Swap area is needed but the it can be a smaller partition also. If you are running RAM intensive applications (or codes) or plan to do hibernation SWAP size twice RAM is recommended.
  8. Create the rest of partitions as per your need of partitions.
  9. Reboot and install Windows in the NTFS partition created in step 2. It will create the System/Recovery partition by dividing the existing partition. This will be taken care by the Windows Installer. After completing installation reboot and boot back into Ubuntu installer.
  10. Now proceed to the common installation instructions.
Partitioning instructions for users with Windows installed in EFI mode (Resizing hard-disk). 
  1. Boot into Ubuntu Live Disk/USB and select Gparted from dash.
     
  2. Resizing the disk: The partition table in machines with pre-installed Windows in EFI mode is GPT. Usually OEM manufactures install the OS with only single large C drive. However there will be small additional 2 or 3 partitions one for Recovery/System, EFI boot and manufacture specific drivers. These small partitions should not be disturbed while resizing (It may cause boot failure for windows). The C drive (largest NTFS partition)  can be resized to create free space.
  3. Your disk already contains an EFI partition (eg if your computer had Windows8 preinstalled), it can be used for Ubuntu too. Do not format it. It is strongly recommended to have only 1 EFI partition per disk.
  4. Leave a 100-200 MB free space before making next partiton. This space will be used as Reserved Area for Boot/GRUB during installation.
  5. Create an EXT4 partition for the root filesystem. The size of the partition can be limited to 15-20 GB (minimum 4GB) depending on how many softwares you are going to install.
  6. Create another EXT4 partition for the home folder. This is recommended because this will help you to reinstall Ubuntu again without losing any files or settings as you will not need to format the home partition every time.
  7. Create a SWAP area. Rule of thumb is size of SWAP is twice the amount of RAM you have. Swap area is needed but the it can be a smaller partition also. If you are running RAM intensive applications (or codes) or plan to do hibernation SWAP size twice RAM is recommended.
  8. Create the rest of partitions as per your need of partitions.
  9. Now proceed to the common installation instructions.

Common Installation Instructions after Partitioning.
  1. Start Ubuntu installation as normal and choose something else as installation type. 

                      
  2. Now in the next step choose the EFI partition created in Step3 as EFI boot partiton. Do not tick format this partition option.
  3. The Space left free in step 4 must be marked as Reserved BIOS boot area.

                         
  4. Set the EXT4 partition created in step 5 as root by setting mount point to /
  5. Set the EXT4 partition created in step 6 as home by setting mount point to /home
  6. Now proceed to further steps of installation and complete the installation.
  7. After reboot GRUB will appear as boot loader. If it loads directly into Windows instead of GRUB you can change the EFI boot order in EFI settings to put Ubuntu above Windows. This will set grub as the default loader.
  8. If there is still no GRUB or any boot error is shown while loading Ubuntu go back to UEFI settings and disable secure boot. 
Converting a Legacy Installation on GPT Hard Disk to EFI

Update: This section no longer works properly for users with Ubuntu 16.04 and above.


If you have mistakenly installed Ubuntu without following above steps into a GPT hard disk in legacy mode, it can be converted to EFI mode.  The first step is to boot into Ubuntu in Legacy mode. Now install boot-repair 

                   
  Launch boot repair from dash and do recommended repair. Follow the instructions on screen and run the commands shown on screen. This will convert the Legacy installation to EFI. Now reboot select EFI mode.

 
 

No comments:

Post a Comment