Switch to Reading Mode

Dual-Booting Kali and Windows 10 with EFI/UEFI (Acer Aspire)

Posted: December 1, 2017 13:56:50 • 1988 words

For the majority of my career, I've been doing infosec work, either primarily or on the side, and that means that I've been using Kali Linux (formerly known as BackTrack Linux) for many years. In recent years, I've had it set up as a secondary OS on my laptop, configured to dual-boot with Windows. On previous versions of Windows, this was no big deal, and until March 2017, my primary laptop was a Windows 7 system that I bought in 2008, so it still pre-dated the Windows 8/10 push to convert everything to UEFI booting. Unfortunately, my trusty old laptop died in a way that wasn't realistically feasible to fix, so I had to get a new one. With limited budget, I had to settle for a cheap, off-the-shelf Acer Aspire (the first time I've ever bought an off-the-shelf computer with no customization since 1997), running Windows 10 (which I can't stand, but that's a separate essay). And, eight months later, I finally got around to doing something I've been procrastinating since day 1: Setting it up for dual-boot with Kali.

Initially, this seemed like it would be as straightforward as my previous dual-boot installations, but that turned out to not be the case. At all. What would normally have been a 1-2 hour project kept me up all night, with frustrated, frantic Google searches, plus several hours of seriously considering wiping the whole system and making it Linux-only. The key to getting this running turned out to be something that didn't show up in any Kali-specific information in my searches, at all. So, to hopefully spare someone else from the frustrations I encountered, I wanted to consolidate the various information that helped me finally get this working.

Acer-Specific BIOS Configuration Information

Simply getting to the BIOS on a new Acer laptop is shockingly difficult. Remember the old days of hammering the setup key from the moment you turned on the computer if you wanted to have any hope of getting into the BIOS? Those days are back with Acer, except they don't actually tell you which key is the setup key. Yay? There are ways to get to it from within Windows, using the recovery options and "Advanced Startup", but if you prefer to avoid doing simple tasks in obnoxious, convoluted ways, the setup key on an Acer Aspire is F2. Just start rapidly, repeatedly hitting it as soon as you power the system on, because by the time the Acer logo appears, you have just a fraction of a second for that keystroke to register.

Once you've entered setup, there are a few settings to change before you can actually install Kali. Or, really, any flavor of Linux.

  1. On the Security tab, set a Supervisor Password. For whatever reason, this is required to change anything related to Secure Boot Mode. Make sure it's something you'll remember for eternity.
  2. On the Boot tab:
    1. Disable Secure Boot. This is vital for getting a non-Windows OS running, because while the BIOS will hypothetically give you the option to select a different EFI file on the Security tab with Secure Boot enabled, Linux systems (and Kali especially) don't fall under the Microsoft definition of "Secure" and therefore cannot boot this way.
    2. If you're going to keep Windows installed on the system, do not change the Boot Mode, keep it set to UEFI! I ran into quite a few Kali installation tutorials that said to change this to Legacy, but if you do, your existing Windows installation will cease to function. You can easily switch it back, of course, but if you install Kali (or any other OS) with this set to Legacy, that OS won't work in UEFI mode.
    3. If you're installing from a DVD, set your optical drive (or USB CDROM) as the first boot priority entry. A lot of people prefer to install from thumbdrives nowadays, but as someone who owns exactly two thumbdrives and 1000+ blank DVDs, I still use optical media for this sort of thing. If you do too, make sure you change this setting, because newer systems no longer default to booting from removable media.
    4. If you're installing from a USB drive, set USB HDD as the first boot priority entry.
    5. Don't bother with changing the boot priority for anything else, it doesn't make a difference. Windows Boot Manager will still be the default boot device even if it's the last item on the list; we'll fix it elsewhere later.
  3. As an alternative to steps 2.3/2.4, or if you just prefer to have a boot-device menu available, set F12 Boot Menu to "Enabled" on the Main tab. According to the poorly-translated Item-Specific Help, it claims that this will show a "Press <F12> to display Boot Menu" message during POST; this is either a lie, or it's hidden behind the full-screen Acer logo that cannot be disabled. Thus, to use this boot menu, start rapidly hitting F12 as soon as you power the system on, just like hitting the F2 key to enter setup.
  4. Save and exit by hitting F10.

Now you're ready to install Kali.

Hard Drive Partitioning, and Installing Kali Linux

One of the standard tutorials will work just fine for this part, with a few notes. I'll be using this Kali dual-boot tutorial as a reference point, because it's the one I used, and aside from being a little outdated, it's pretty good. Here are my notes for its various steps:

  • Steps 2-6 (prepping thumb drive with Rufus): If you're using a DVD instead of a thumbdrive, you can skip this entire section and just burn the DVD like you normally would.
  • Step 7 (repartitioning Windows): I recommend a minimum of 30-40gb for your new Linux partition, because if you're going through the trouble of actually installing Kali, you're probably going to actually use it, rather than treating it like an ephemeral Live CD. Also, you don't need to create a new partition in Windows after shrinking your Windows partition. Simply leaving the space for Kali unallocated will work just fine, and it will save you time later, since you'll just have to delete that partition during Kali's setup process.
  • Step 8 (reboot and start install): Disabling Secure Boot is vital, and for Acer systems, I covered it in the previous section (if you're using a better system, it will probably be similar, but I've seen some weird BIOS interfaces, so just search for the specifics for your PC brand/model). Disabling "Fast Boot", however, is not in the BIOS on Windows 10 systems, as far as I can tell. It also doesn't seem to make much of a difference; it definitely didn't resolve any of the post-installation issues I was having. But, if you want to do it just to be safe, instructions for disabling Fast Boot are here.
  • Steps 15-19 (partitioning Kali): This tutorial is starting to show its age, because the partitioning section of the Kali installer now has an option for "Guided - use the largest continuous free space"; if you took my advice on Step 7 and skipped creating a new partition in Windows, this will work just fine without further partition adjustments.
  • Step 20 (partitioning Kali): If you're using Kali and logging in as root, don't even bother with a separate /home partition. You'll never use it, and it will just consume space, leaving less for things you'll actually use. "All files in one partition" works just fine.
  • Step 23 (network mirror): The above-linked tutorial recommends you answer "No" when asked to "Use a network mirror?", which is not great advice. Unless you have a really good reason not to, answering "Yes" to this will save a lot of hassle later, because if you say "No", apt will only install from local files, not from the online Kali repositories.
  • Steps 24-25 (grub bootloader): Kali no longer asks whether you want to install grub, nor does it ask where you would like to install it. This difference could just be on EFI systems, but if it doesn't ask you questions about installing grub, don't panic, grub is still there.

Ok, we've finished the tutorial, and therefore we've finished installing Kali...right?

Why Is The Grub Gone?

At this point, if your Kali installation experience is going the way mine did, you rebooted the system after installing Kali, and it booted straight into Windows 10, just like before. Nothing else we've done up to this point (including disabling Fast Boot, which has zero effect on this problem) has any bearing on this behavior. Searching mostly yields outdated information about adding EFI boot capability to Kali by using Rufus, but the latest versions of Kali already have EFI capabilities right out of the box. Reinstalling Kali changes nothing. Attempting to just re-do the "Install grub" part of the installer will, at best, break the installer so badly that you have to reinstall Kali anyway. So, what's the deal?

I found the solution by typing an entire paragraph into a Google search, which yielded advice completely unrelated to Kali, but it ended up working. The article that pointed me in the right direction can be found here: Fix Grub Not Showing For Windows 10 Linux Dual Boot. So, to convert these instructions to Kali:

  1. Boot up into Windows.
  2. Run the Windows Command Prompt as Administrator. The next step won't work without doing this.
  3. Run the following command: bcdedit /set {bootmgr} path \EFI\kali\grubx64.efi

That final step is so simple, and so vital, yet no one covers it in any tutorial, anywhere, as far as I can tell (and I read over 100 of them the night that I was working on this). After doing that, grub should show up on your next boot, exactly as expected.

If the EFI file is located at a different path, you can find it by following these steps:

  1. Boot from the Linux Live CD/USB drive of your choice.
  2. Find the EFI System partition using fdisk -l. After running this command, look for "EFI System" as the Type; it will probably be the first partition, so for the purposes of these instructions, let's assume it's /dev/sda1. If it's a different partition on your system, substitute that partition's path in the next steps.
  3. Create a directory to use as a mount point. For these instructions, we'll use /mnt/boot, so the command would be: mkdir /mnt/boot
  4. Mount the EFI System partition. Using the assumptions in these instructions (/dev/sda1 is our EFI partition, and /mnt/boot is where we want to mount it), the command would be: mount /dev/sda1 /mnt/boot
  5. Enter the EFI directory on the EFI System partition. Using the example paths established above, this command would be: cd /mnt/boot/EFI
  6. Check the subdirectories contained in the EFI directory (ls command), and look for the one that matches your new Linux installation. It should be fairly obvious; if the subdirectories you see listed are Boot kali Microsoft OEM, you probably want the EFI file in the kali directory. So, enter that one (cd kali).
  7. There should only be one file, but if not, look for a .efi file that matches your system architecture. So, if you have an x64 system, you want grubx64.efi.

Kali is an advanced operating system, designed for the ultimate power users, but despite what condescending forum posts might say, running into weird issues can happen to all of us, and "just search for it" doesn't always yield the right answer. Plus, "just search for it" doesn't work unless someone has encountered the same problem, AND found a solution, AND wrote about both the problem and the solution in a way that search engines can understand. So, while I can't magically fix Linux installation problems, I do hope that, in writing this, one less person will have this same frustration in setting up their new Kali installation.

Happy hacking!