How to install Ubuntu in dual boot with Windows 8

11 min. read

Recently I tried to install Ubuntu 16.04 in a new Lenovo Yoga 3 which came with Windows 8 pre-installed. The problem was that nobody knew the password to enter Windows, and the partition was in an unstable state, so it was unreadable from Linux.

When Windows 8 shuts down, it really does not shut down but hibernates, so that it can start faster. This is a setting that can be disabled in the BIOS.

The solution was to reset the laptop to factory settings, and make a recovery disk for Windows. Then rearrange the partitions to install Ubuntu alongside Windows. Nobody had used this Windows partition, since the laptop was there just to test sites in Internet Explorer, so it was ok to do this.

I would have loved to wipe out Windows completely, but I prefer to be conservative, since these days the manufacturers entangle the devices to Windows so deeply (see for example the combination Acer + Windows10), and I am not an expert but just a normal user. Thankfully, this experience was much more straight-forward than for Acer-Windows 10, it worked without too much fiddling. Also, this Lenovo BIOS was simpler than my Acer's.

Reset to factory settings

  • Press Shift + Restart, then press F1 when the Lenovo logo appears
  • Reset laptop to factory settings. This took about half an hour
  • Setup. Jumped the Microsoft account creation by providing a gmail email and clicking on "Continue without a Microsoft account".

Lenovo partitions

If you type diskpart on the prompt, then select disk 0 and list part to see all partitions, the Lenovo Yoga 3 will display:


1 Recovery   1000MB WINRE_DRV   UEFI/GPT
2 EFI System  260MB SYSTEM_DRV  UEFI/GPT
3 OEM        1000MB LRS_ESP     One Key Recovery button
4 Reserved    128MB MSR         UEFI/GPT
5 Primary     196GB Windows8_OS C: (used: 31.58GB)
6 Primary      25GB LENOVO      D: (used: 60.00MB)
7 Recovery     14GB PBR_DRV     Used by One Key, but can be burned to a USB

Partitions 1, 2 and 4 should be kept, and they are compatible with dual booting (UEFI/GPT). In particular, the second is the one that both Windows and Linux use to boot the laptop. Partition 7 can be moved to an external bootable USB to free some space on disk. You can learn more in this post about Lenovo Yoga partitions.

Make the BIOS able to boot from USB

Before we continue is good to check if we can boot from USB because we will need it from now on.

  • In Windows, press windows + I > Update and recovery > Recovery > Advanced Sartup > Restart now. Then click Troubleshoot > Advanced options > UEFI Firmware Settings. The system will restart and enter the BIOS automatically.

  • Change boot order like this:

    
    USB FDD
    USB CD
    USB HDD
    ATA HDD
    Windows Boot Manager

  • While we are here, we can also disable Secure Boot. This will allow us to boot from the USB as well as install Ubuntu and all the third party software it needs.

  • Just in case, I would also disable Fast Boot. If we don't do this, after we install Ubuntu we may be able to boot from the grub once, but the next time we choose to start in Windows, we won't be able to load the grub anymore, i.e., it will skip the grub and go directly to Windows. This is due to the fast-start shenanigan I mentioned at the top.

Create recovery from Windows

Since we are going to delete partition 7, we must save a recovery USB so that we can go back to factory if anything weird happens.

  • Connect an empty USB drive with at least 32GB capacity. Open the search and type "create recovery drive". Follow the instructions to create a bootable device. This will format the USB and create a 32GB FAT partition. If the disk is bigger than that, the rest of the space will be unallocated for you to format as you wish.

  • When the recovery is finished, it asks you to delete the recovery partition, the 14GB one. Say yes.

  • Check that the recovery works by connecting the recovery USB you just created and restarting. Since we changed the boot order, it should boot into the recovery USB. Select shut-down to leave.

Prepare a partition for Linux

This laptop came with a 200GB partition for Windows and a 25GB partition for data. I think 200 is too much for Windows and 25 is too little for data, and there still needs to be some space for Ubuntu!

I reserved about 30GB for the Ubuntu partition. This will be split in two by the Ubuntu installer, which will partition 8GB for swap and the rest for the OS. Once installed, Ubuntu takes about 5GB of space.

The data partition is so that you have a partition that is accessible both from Windows and from Ubuntu.

  • Open the prompt as admin (press windows + X and choose it from the pop-up menu), then type diskmgmt.msc.

  • Arrange your partitions so that you shrink the windows partition, make a bigger partition for data, and reserve 30GB for Ubuntu. Don't touch partitions 1, 2, 3, and 4 listed above.

  • Restart in Windows once, this is needed for Windows to finish the partitioning properly so that it is not in an unstable state when you try to read it from Ubuntu Live.

Install Ubuntu 16.04

  • You need to make a bootable USB with Ubuntu 16.04. Once you have it, connect it and then restart the laptop.

  • Choose "Install Ubuntu" and then "Install Ubuntu alongside Windows". Follow the instructions and you will be done.

  • It will ask you to restart, and it will load the grub. Select "system setup". This will enter the BIOS. Check that the first item in the boot order is now "1. ubuntu" and exit the BIOS.

  • Restart and log into Ubuntu again. Check that you have the directory /sys/firmware/efi and open the disks utility to confirm that partition 2 is mounted at /boot/efi.

  • Click on all the disks and check that they mount correctly. You should see:

    
    LRS_ESP     - 3 OEM (Lenovo Recovery System)
    Windows8_OS - 5 Windows partition
    LENOVO      - 6 Data partition

  • Check that you can log into Windows and then back to Linux. If not, you may have forgotten to disable fast boot in the BIOS.

Done!

This was much easier than before! I guess different manufacturers have different degrees of assholery towards their end users.

The recovery disk I used was needed also for Ubuntu backup copies, so I created a partition from the unused space and formatted it as encrypted (LUKS) using the disks utility in Ubuntu.

Comments