Thursday, December 3, 2015

Dual boot Linux and Windows 10 with UEFI

Problem:
I have had issues in the past trying to get Windows 8+ to coexist with Linux Mint on a machine with UEFI.

Solution:
The following steps worked for me on an Asus q400a laptop.

  1. BIOS has CSM on and fastboot off
  2. Within Linux I used gparted to format a USB stick with a GPT partition table as fat32. Then I opened the ISO file for the windows installer and copied all the files onto the USB stick.
  3. I caught the bios with f2 and move up the boot device for UEFI: My_USB_stick (it was ADATA in my case)
  4. I installed Windows and then subsequently upgraded to Windows 10 which is still currently free for 7 and higher users.
  5. Shrink the drive for Windows 10 to free up some spare space. The Linux installer I used was not aware of the Windows 10 installation so it couldn't shrink it for me.
  6. Using the same GPT partition table USB stick, delete all the files from it and then extract the files from your Linux ISO onto it. 
  7. Windows 10 made it so I couldn't get to the bios, so I used the instructions here to go into troubleshooting mode
  8. Once in the BIOS, I again selected the UEFI: My_USB_stick and ran the Linux live installer.
  9. In the installer I selected the "do something else" partitioning option and created a primary ext4 root mount "/" using all but 8GB of free space (the amount of my RAM). I then created a logical swap partition containing the rest. I also set the device to "use as bootloader" to the EFI partition Windows had created.
  10. I rebooted and grub popped up letting me pick my OS as I see fit.
  11. Just to be as "secure" as possible, I disabled CSM in the bios so only UEFI is allowed. The only thing this seemed to change is that I get the windows loading circle below the ASUS logo as it launches Windows 10.

Missing windows key sticker

Problem:
I wiped my OEM installed copy of windows from my ASUS laptop (to install Linux) and deleted the recovery partition. Also, the key is missing because it rubbed of the sticker. I wanted to put Windows on in addition to Linux.

Solution:

  1. Use Linux to extract the key from your laptop firmware. It's still in there, and that is how the OEM disk gets it when you re-install. It just takes a single command run as root to get at it. With that key you can then install a generic copy of Windows which you can get from Microsoft. So either boot up linux on the computer or run it from a live disk (no install required).  Then run sudo hd /sys/firmware/acpi/tables/MSDM
  2. Next go and download the installer for your version of Windows. In my case I needed windows 8. This could get into a bunch of other issues since the installer I could get from MS is really an 8.1 installer which may not take my 8 OEM key. The solution in that case may be to install with a generic key first and then swap in my OEM key. The subject is well explained in this reddit post. I lucked out though, and it picked up my OEM key no problem (this may have been because I upgraded to 8.1 at some point in the past).
  3. Now install and enjoy.
  4. And if you are still in the Win 7 or 8 upgrade window, maybe consider upgrading to Windows 10.