How to Dual-Boot Kali-Linux and Windows 8.1?

11,600

This is a common problem with Windows 8.0 and 8.1 machines.

With Windows 8.0, Microsoft no longer relies on an efi file to boot windows, they use a more advanced format for speed up the boot process and keep more persistence between reboot cycles. Sadly, GRUB cannot yet detect this boot format.

The proper way to dual boot Windows 8.1 is to first disable quickboot and secureboot in BIOS, then boot into Windows. This will force the the windows bootloader to generate an efi file for other bootloaders like GRUB.

You of course, have a bigger problem because you now have a GRUB bootloader and thus cannot force Windows 8 to generate the efi file. To do this, ensure quickboot and secureboot are disabled. When you are at GRUB, press c to drop to the GRUB command line. Boot to Windows using the following command:

chainload (hd0,0)+1

You may need to use the tab-autocomplete option to find the correct partitions.

IF THIS FAILS, SEE BELOW.

Now that Windows has an efi file, reboot into Kali Linux. From a root terminal run:

sudo update-grub 

You should see a GRUB debug output line roughly equivalent to:

/dev/sdb1@/EFI/Microsoft/Boot/bootmgfw.efi

The file "bootmgfw.efi" is what you need to force the Windows bootloader to generate. You should now have a dual boot between Kali and Windows 8.

IF CHAINLOAD FAILS:

Before beginning, you need to have a Kali (or any type of Debian live cd) and the Windows recovery disk/USB. You do not need to re-install the entire system. When the Windows recovery environment starts, choose the option to open a command prompt. Run the following commands:

diskpart
select disk 0

This mounts the harddrive with Windows and GRUB.

Next run:

list volume

This should list the partitions on the disk, including the peripheral mount (your recovery cd or USB). Make a note of the drive letter. The run the following to quit diskpart:

exit

Now that you have the drive letter of the recovery partition that includes the bootloader files, enter the boot directory (you need the quotes):

cd "<your drive letter>\boot"

Now run:

dir

This lists the files in the boot directory. You should see a file named

bootsect.exe

If you don't, you're in the wrong place. Consider looking up a more in depth recovery tutorial.

Next:

bootsect /nt60 SYS /mbr

Now reboot, GRUB will not appear but Windows should start. What you've done is set the Windows bootloader as the system entry point, you have not actually deleted any partitions for either operating system including the one containing GRUB. Again, at this point, ensure quickboot and secureboot are disabled. Reboot into Windows generating the boot efi file. Now that Windows it bootable from GRUB, we need to restore it. Using your Kali/Debian live disk, boot into the Linux operating system and open a root shell. Ensure boot-repair (only available from a live disk) is installed:

sudo add-apt-repository ppa:yannubuntu/boot-repair
sudo apt-get update
sudo apt-get install -y boot-repair && boot-repair
sudo boot-repair
sudo update-grub

This will replace the Windows bootloader as the system entry point with GRUB, again in the process nothing is actually deleted.

If this isn't available as on option (it is on my Ubuntu and Kali live disks), look at your distro version's GRUB restore options.

On the update-grub command, you should see debug output resembling this:

/dev/sdb1@/EFI/Microsoft/Boot/bootmgfw.efi

Now reboot, you should see Kali and Windows options in GRUB now.

SIDENOTE:

I would not recommend a strictly Windows/Kali dualboot for a few reasons.

First, Kali uses legacy GRUB, not GRUB 2 (now 2.02). This can make dualbooting very painful and laggy on high resolution, modern displays. If you have a discrete graphics card, this can cause other problems getting booting to work properly.

Second, Kali uses a custom Kernel version (noted Kali1) for which many modern Ethernet cards do not have drivers (available as bcmwl-kernel-source for standard kernels). You either have to modify drivers, or add Debian repos for standard kernels and swap this.

Third, why Kali? It's a pen-testing distro that, comparatively (and respectfully), sucks at most everything else. If you truly are doing pen-testing, you should have separate boot, root, and home partitions, where root and home are encrypted and require passwords prior to booting that you provide to initramfs. I don't do a lot of pen-testing, but when I do I sure as hell don't write my plugins and scripts in Kali. For this reason, I always keep another Linux distro installed.

What I'm getting at here, is Kali is for experienced Debian users, who ought to know the current problems with dual-booting Windows 8. Consider installing a friendlier distro alongside Windows first, I like Ubuntu (or one of it's flavors if you're a Unity hater). Ubuntu has better documentation, and ships with GRUB 2.02 and more grub tools. This along side the community will make an initial dual-boot setup easier. Once you have a stable dual-boot setup, adding a third Linux distro is incredibly easy (although harder if you encrypt Kali root dir).

My current boot system is GRUB 2.02 with Windows 8.1, Ubuntu 14.04, and Kali (with Kali1 and generic kernels/initramfs).

Hope this helps someone along the way.

Share:
11,600

Related videos on Youtube

Ceyhun
Author by

Ceyhun

Updated on September 18, 2022

Comments

  • Ceyhun
    Ceyhun over 1 year

    I have Acer V3-772G 1 TB Harddisk. I shrinked my biggest partition in order to install Kali Linux. When installing Kali, GRUB couldn't detect windows 8 so I kept going on(I installed grub as my masterboot). After installed Kali there was no way to boot Windows 8.1, but booting Kali was OK with GRUB in legacy-BIOS. When I tried to change bios to UEFI it couldn't find any OS (took too much time, nearly 1 hour). So I tried to update GRUB with boot-repair within a Ubuntu Live USB. But after updating GRUB I terrified, in UEFI and Legacy mode grub couldn't find ANY OS (Both Kali and Windows) so I have no option other than using Ubuntu Live. I tried every possible options but nothing has worked for me. I tried rEFInd in UEFI mode it worked only for Kali. I still cannot boot my windows 8.1 . I considered to restore to factory setting with a Windows Rescue USB but kept telling me "No driver found". Please help me to dual boot or remove Kali and restore my Windows 8.1