PDA

View Full Version : kali w10 uefi dual boot



Ekynox360
2017-11-23, 20:20
Hi everybody :D

I've seen a lot of topics about the problems Kali and Windows have with dual boot in UEFI mode.

Can you tell me if you have a definitive solution for two physical disks ?
If so, do you have a link ?
If not, would you be willing to help me ?

I tried some manipulations without success.

My MB is B150A GAMING PRO (manual download.msi.com/archive/mnu_exe/E7978v1.0.zip).

First SSD : Windows 10

Second SSD : Kali but i can't boot on it (no grub nor manual boot by selecting this device)

Best regards
Alex

jcadduono
2017-11-24, 03:53
Hi everybody :D

I've seen a lot of topics about the problems Kali and Windows have with dual boot in UEFI mode.

Can you tell me if you have a definitive solution for two physical disks ?
If so, do you have a link ?
If not, would you be willing to help me ?

I tried some manipulations without success.

My MB is B150A GAMING PRO (manual download.msi.com/archive/mnu_exe/E7978v1.0.zip).

First SSD : Windows 10

Second SSD : Kali but i can't boot on it (no grub nor manual boot by selecting this device)

Best regards
Alex

In your BIOS make sure your EFI mode is set to generic/normal/"Others" and not Windows mode as this will only allow Windows to boot.
You should also disable Secure Boot unless you want to go through the complications of setting up signed grub. (not covered here)

You have a few different ways you can set it up. You can share your EFI partition with Windows (risky, Windows will probably wipe out grub with updates) or you can use a second EFI partition on your 2nd disk and make that your main boot option. I will cover that.

Your partitions should look somewhat like this:

disk1, (/dev/sda or /dev/nvme0n1) set up by Windows:
- partition 1: 500 MB Windows 10 recovery partition
- partition 2: 100 MB fat32 EFI system partition
- partition 3: NTFS Windows OS partition (remaining space)

disk2, (/dev/sdb or /dev/nvme0n2) set up by Kali installer OR parted magic OR any other Linux rescue CD
- partition 1: 100 MB fat32 EFI system partition (make sure it is marked as esp by gparted or installer)
- partition 2: Linux 200 MB ext4 /boot partition (can help get you recovery options if you experience file system corruption problems)
- partition 3: Linux system (/) partition (12 GB is usually a good choice, choose any file system you want, ext4 is almost certainly the best choice)
- (optional) partition 4: Linux home (/home) partition (remaining space, any file system, f2fs is a great option for speed on SSD/NVMe but is prone to bad corruption in power failures)
- (optional) partition 5: swap partition (it's not as important these days unless you are low on ram, I don't like using precious disk write cycles)

You can combine /, /boot, and /home to give you more freedom with your space, of course.

If you mark a partition as esp in the Kali installer then it should automatically choose to install grub-efi instead of grub. At the end of the installer it should auto-detect your Windows partition as well.
Once the install is finished, you simply go into your BIOS and change the boot priority so that your EFI partition on 2nd disk has higher priority than the Windows one.

If the installer fails to set up grub-efi properly then you may need to boot a live CD then do in a terminal as su:


mkdir /mnt/disk2
mount /dev/sdb3 /mnt/disk2
cd /mnt/disk2
mount /dev/sdb2 boot
mount /dev/sdb1 boot/efi
mount -t sysfs - sys
mount -t proc - proc
mount -o bind /dev dev
mount -o bind /dev/shm dev/pts
mount -o bind /dev/pts dev/shm
chroot .
apt-get update
apt-get install grub-efi
grub-install
# Installing for x86_64-efi platform.
# Installation finished. No error reported.
update-grub


While you are in the chrooted environment, you might as well also do this:


mkdir /boot/efi/EFI/boot
cp /boot/efi/EFI/debian/grubx64.efi /boot/efi/EFI/boot/bootx64.efi

This will put a copy of your grub efi boot binary in the standard EFI boot location, which might fix boot issues with older UEFI BIOSes which have hardcoded paths. I know it fixes VirtualBox at least.

Another option is to create a startup.nsh script.

cat <<EOF > /boot/efi/EFI/startup.nsh
fs0:
\EFI\debian\grubx64.efi
EOF
This tells the UEFI BIOS to execute this script (hardcoded like autorun in UEFI BIOSes) which will load the grubx64.efi file immediately.

I did both of the above things to make sure I was compatible with most if not all UEFI supported boards that I plugged my drive into.

Hopefully everything should be working on the next reboot.

bigbiz
2017-11-24, 08:23
In your BIOS make sure your EFI mode is set to generic/normal/"Others" and not Windows mode as this will only allow Windows to boot.
You should also disable Secure Boot unless you want to go through the complications of setting up signed grub. (not covered here)

You have a few different ways you can set it up. You can share your EFI partition with Windows (risky, Windows will probably wipe out grub with updates) or you can use a second EFI partition on your 2nd disk and make that your main boot option. I will cover that.

Your partitions should look somewhat like this:

disk1, (/dev/sda or /dev/nvme0n1) set up by Windows:
- partition 1: 500 MB Windows 10 recovery partition
- partition 2: 100 MB fat32 EFI system partition
- partition 3: NTFS Windows OS partition (remaining space)

disk2, (/dev/sdb or /dev/nvme0n2) set up by Kali installer OR parted magic OR any other Linux rescue CD
- partition 1: 100 MB fat32 EFI system partition (make sure it is marked as esp by gparted or installer)
- partition 2: Linux 200 MB ext4 /boot partition (can help get you recovery options if you experience file system corruption problems)
- partition 3: Linux system (/) partition (12 GB is usually a good choice, choose any file system you want, ext4 is almost certainly the best choice)
- (optional) partition 4: Linux home (/home) partition (remaining space, any file system, f2fs is a great option for speed on SSD/NVMe but is prone to bad corruption in power failures)
- (optional) partition 5: swap partition (it's not as important these days unless you are low on ram, I don't like using precious disk write cycles)

You can combine /, /boot, and /home to give you more freedom with your space, of course.

If you mark a partition as esp in the Kali installer then it should automatically choose to install grub-efi instead of grub. At the end of the installer it should auto-detect your Windows partition as well.
Once the install is finished, you simply go into your BIOS and change the boot priority so that your EFI partition on 2nd disk has higher priority than the Windows one.

If the installer fails to set up grub-efi properly then you may need to boot a live CD then do in a terminal as su:


mkdir /mnt/disk2
mount /dev/sdb3 /mnt/disk2
cd /mnt/disk2
mount /dev/sdb2 boot
mount /dev/sdb1 boot/efi
mount -t sysfs - sys
mount -t proc - proc
mount -o bind /dev dev
mount -o bind /dev/shm dev/pts
mount -o bind /dev/pts dev/shm
chroot .
apt-get update
apt-get install grub-efi
grub-install
# Installing for x86_64-efi platform.
# Installation finished. No error reported.
update-grub


While you are in the chrooted environment, you might as well also do this:


mkdir /boot/efi/EFI/boot
cp /boot/efi/EFI/debian/grubx64.efi /boot/efi/EFI/boot/bootx64.efi

This will put a copy of your grub efi boot binary in the standard EFI boot location, which might fix boot issues with older UEFI BIOSes which have hardcoded paths. I know it fixes VirtualBox at least.

Another option is to create a startup.nsh script.

cat <<EOF > /boot/efi/EFI/startup.nsh
fs0:
\EFI\debian\grubx64.efi
EOF
This tells the UEFI BIOS to execute this script (hardcoded like autorun in UEFI BIOSes) which will load the grubx64.efi file immediately.

I did both of the above things to make sure I was compatible with most if not all UEFI supported boards that I plugged my drive into.

Hopefully everything should be working on the next reboot.

When you install kali at the partition editing stage. Make sure you move the boot option from the windows part. to your kali partition. The installer will reconize the windows partitions and then when all is setup you should now get the kali boot screen with three options
1kali boot option
2 kali advanced boot options
3 windows 10
I have windows 7 on my computer . But works out. Youll know you move the option because there should now be a B. at the location.

_defalt
2017-11-24, 15:47
https://forums.kali.org/showthread.php?36601-UEFI-How-to-repair-kali-linux-grub-dual-boot-with-Windows-10

Ekynox360
2017-11-24, 22:06
Hi @jcadduono, @bigbiz and @_defalt,


In your BIOS make sure your EFI mode is set to generic/normal/"Others" and not Windows mode as this will only allow Windows to boot.

Currently, my BIOS is configured like this:

Boot mode select UEFI
Windows 8.1/10 WHQL Support enabled
Windows 7 Installation disabled
MSI Fast Boot disabled
Fast Boot disabled
Secure Boot Support disabled
Secure Boot Mode standard


Your partitions should look somewhat like this:

Currently, my partitions schema looks like this:


Disk /dev/sdb: 232.9 GiB, 250059350016 bytes, 488397168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: C7CF0CFC-0360-42F1-B5AD-2B77BCC98B68

Device Start End Sectors Size Type
/dev/sdb1 2048 1050623 1048576 512M EFI System
/dev/sdb2 1050624 455219199 454168576 216.6G Linux filesystem
/dev/sdb3 455219200 488396799 33177600 15.8G Linux swap


Disk /dev/sda: 232.9 GiB, 250059350016 bytes, 488397168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: E340917F-2729-4684-9571-C41929A7CE1E

Device Start End Sectors Size Type
/dev/sda1 2048 923647 921600 450M Windows recovery environment
/dev/sda2 923648 1126399 202752 99M EFI System
/dev/sda3 1126400 1159167 32768 16M Microsoft reserved
/dev/sda4 1159168 488396799 487237632 232.3G Microsoft basic data


Disk /dev/sdc: 29.8 GiB, 32010928128 bytes, 62521344 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: C307B6DF-79AC-4A18-9AAC-3B70ECC7E0C8

Device Start End Sectors Size Type
/dev/sdc1 2048 62521310 62519263 29.8G Microsoft basic data


Disk /dev/loop0: 2.6 GiB, 2779897856 bytes, 5429488 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


If you mark a partition as esp in the Kali installer then it should automatically choose to install grub-efi instead of grub.

I can see that grub-efi installs itself automatically without any intervention from me.


Once the install is finished, you simply go into your BIOS and change the boot priority so that your EFI partition on 2nd disk has higher priority than the Windows one.

The problem is that my second disk disappears after installing Kali in my BIOS but I can see it from Windows.


When you install kali at the partition editing stage. Make sure you move the boot option from the windows part. to your kali partition.

How to do this?

bigbiz
2017-11-25, 05:30
Hi @jcadduono, @bigbiz and @_defalt,



Currently, my BIOS is configured like this:

Boot mode select UEFI
Windows 8.1/10 WHQL Support enabled
Windows 7 Installation disabled
MSI Fast Boot disabled
Fast Boot disabled
Secure Boot Support disabled
Secure Boot Mode standard



Currently, my partitions schema looks like this:


Disk /dev/sdb: 232.9 GiB, 250059350016 bytes, 488397168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: C7CF0CFC-0360-42F1-B5AD-2B77BCC98B68

Device Start End Sectors Size Type
/dev/sdb1 2048 1050623 1048576 512M EFI System
/dev/sdb2 1050624 455219199 454168576 216.6G Linux filesystem
/dev/sdb3 455219200 488396799 33177600 15.8G Linux swap


Disk /dev/sda: 232.9 GiB, 250059350016 bytes, 488397168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: E340917F-2729-4684-9571-C41929A7CE1E

Device Start End Sectors Size Type
/dev/sda1 2048 923647 921600 450M Windows recovery environment
/dev/sda2 923648 1126399 202752 99M EFI System
/dev/sda3 1126400 1159167 32768 16M Microsoft reserved
/dev/sda4 1159168 488396799 487237632 232.3G Microsoft basic data


Disk /dev/sdc: 29.8 GiB, 32010928128 bytes, 62521344 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: C307B6DF-79AC-4A18-9AAC-3B70ECC7E0C8

Device Start End Sectors Size Type
/dev/sdc1 2048 62521310 62519263 29.8G Microsoft basic data


Disk /dev/loop0: 2.6 GiB, 2779897856 bytes, 5429488 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes



I can see that grub-efi installs itself automatically without any intervention from me.



The problem is that my second disk disappears after installing Kali in my BIOS but I can see it from Windows.



How to do this?

If you click on the kali partion to edit it you should see. Boot option- no ( or something like that) click on this option it will automaticly change the boot option to yes. (Or true) cant remember. The B should now be beside the kali partition not the windows.

_defalt
2017-11-25, 10:38
Till now you didn't provide any information on what problem you are trying to fix and what you want to do. You heard a lot of topics about the problems Kali and Windows have with dual boot in UEFI mode but this doesn't answer what you are facing.

There is no problem with dual boot of kali with windows 10 and neither UEFI mode creates any issue with the installation. It is just that people follow ancient YouTube guides and blogs without realizing what actually is written on the screen and what is installer asking you to do. Then they get stuck and blame kali for booting issues.

Ekynox360
2017-11-25, 11:41
Till now you didn't provide any information on what problem you are trying to fix and what you want to do. You heard a lot of topics about the problems Kali and Windows have with dual boot in UEFI mode but this doesn't answer what you are facing.

There is no problem with dual boot of kali with windows 10 and neither UEFI mode creates any issue with the installation. It is just that people follow ancient YouTube guides and blogs without realizing what actually is written on the screen and what is installer asking you to do. Then they get stuck and blame kali for booting issues.

I can't boot on my second disk where kali is installed. He disappeared from my bootable available peripherals.

Besides, I never put the blame on your system. It's probably a lack of skills on my part.

_defalt
2017-11-25, 15:30
In UEFI settings, there is a feature from where you can manually add the entry of bootloaders. Find that option.

OR you can follow this:
Boot into kali live USB and follow the instructions:


mount /dev/sdb2 /mnt
mount --bind /dev /mnt/dev
mount --bind /proc /mnt/proc
mount --bind /sys /mnt/sys
mount --bind /sys/firmware/efi/efivars /mnt/sys/firmware/efi/efivars
mkdir /mnt/boot/efi
mount /dev/sdb1 /mnt/boot/efi
mount -o remount,rw /dev/sda+ /mnt/boot/efi
mkdir /mnt/hostrun
mount --bind /run /mnt/hostrun
chroot /mnt
mkdir /run/lvm
mount --bind /hostrun/lvm /run/lvm
grub-install /dev/sda
update-grub
exit
umount /mnt/dev
umount /mnt/proc
umount /mnt/sys
umount /mnt/sys/firmware/efi/efivars
umount /mnt/boot/efi
umount /mnt/hostrun
umount /mnt/run/lvm
umount /mnt
REBOOT

Ekynox360
2017-11-25, 20:15
update-grub
Generating grub configuration file ...
Found background image: /usr/share/images/desktop-base/desktop-grub.png
Found linux image: /boot/vmlinuz-4.12.0-kali1-amd64
Found initrd image: /boot/initrd.img-4.12.0-kali1-amd64
WARNING: Device /dev/loop0 not initialized in udev database even after waiting 10000000 microseconds.
WARNING: Device /dev/sda1 not initialized in udev database even after waiting 10000000 microseconds.
WARNING: Device /dev/sda2 not initialized in udev database even after waiting 10000000 microseconds.
WARNING: Device /dev/sda3 not initialized in udev database even after waiting 10000000 microseconds.
WARNING: Device /dev/sda4 not initialized in udev database even after waiting 10000000 microseconds.
WARNING: Device /dev/sdb1 not initialized in udev database even after waiting 10000000 microseconds.
WARNING: Device /dev/sdb2 not initialized in udev database even after waiting 10000000 microseconds.
WARNING: Device /dev/sdb3 not initialized in udev database even after waiting 10000000 microseconds.
WARNING: Device /dev/sdc1 not initialized in udev database even after waiting 10000000 microseconds.
Adding boot menu entry for EFI firmware configuration
done

I installed Debian 9 in UEFI mode without problem to boot.

Ekynox360
2017-11-25, 20:28
EDIT : after debian was installed, I reinstalled Kali. Now i can boot on Kali. It works.

I don't know what happened.