0

I installed windows 7 and Kali Linux in my laptop, but when I turn on the computer, it starts Windows automatically. For Kali to start, I have to enter the boot order menu, and select laptop hard disk boot option, and then it starts running grub with Kali.

The other option, the one that executes first is OS boot administrator, that I think is the Windows boot loader, although it's the last in the boot order in the BIOS.

I figured that the partitions are configured so grub boots, but the uefi is set up so it starts from the SO boot manager first, which only boots windows.

Bios setup Image

In order to boot Kali, I have to insert manually to boot from drive:

Boot options Image

Change boot order The third option boots grub, and the first boots windows, which is the first one by defect and I can't change it. Any Ideas how to configure grub into the OS boot manager, or making the hard drive boot first?

4
  • Using Kali you're expected to know a lot more about the boot process than what you're showing. Try booting Kali and then run sudo update-grub.
    – user772515
    Commented Apr 5, 2018 at 11:52
  • There is no need for degrading comments, especcially If you don't know. I've tried it, the problem I found is the Bios itself is broken, because it still uses UEFI system even though it's set on legacy. So no matter what it starts with the Windows boot loader.
    – gramsch
    Commented Apr 5, 2018 at 17:43
  • unix.stackexchange.com/questions/399626/…
    – user772515
    Commented Apr 5, 2018 at 18:03
  • Great article, it proposes a debate that doesn't concern this Question, but thanks for sharing it
    – gramsch
    Commented Apr 5, 2018 at 18:47

1 Answer 1

1

I found out that some computers (Especcially HP), have malfunctioning BIOS, which maintain the uefi configuration for boot afer legacy is especified, which executes the Windows .efi file first (I fount out it always does it).

The best solution would be to return it on the premise that the Bios has bugs, so they don't keep making them. I worked out a way around, which is really not recommended (It never is to mess with the boot).

  1. you detect your "EFI partition system" partition, it usually is in /dev/sda1, but It may vary. you can check the partitions with sudo fdisk -l.

  2. Mount the EFI partition in /mnt (or wherever, but that's why /mnt is there).

  3. In this partition, there should be at least 2 folders after EFI (if you have Windows and Linux): one named Microsoft, and the other with the name of the Linux OS you have (In my case was Kali), sometimes it may say Debian or Fedora if it's a distro derived from one of those (I will put it as [OS]).

The UEFI OS boot manager runs the file EFI/Microsoft/Boot/bootmgfw.efi, this is the chainloader that executes all the rest of the files to Boot Windows. The Linux grub is in the [OS] folder (the name may be grubx64.efi or grubia32.efi depending on the architecture).

  1. Copy the file /mnt/EFI/Microsoft/Boot/bootmgfw.efi into the main folder, you can do so (from /EFI/) like this: sudo cp MIcrosoft/Boot/bootmgfw.efi bootmgfw.efi

  2. Copy the grub file to the windows as bootmgfw.efi with (from /mnt/EFI/): sudo cp kali/grubx64.efi /Microsoft/Boot/bootmgfw.efi.

  3. Umount the partition and restart, now It should boot directly to grub, but the Windows would loop back to the grub. To fix this, you can change the configuration pressing e before selecting the Windows partition, and changing where it says chainloader +1 to chainloader /EFI/bootmgfw.efi.

  4. To make it permanent, boot into linux, and edit the /boot/grub/grub.cfg file, in the menuentry for Windows 7. then run update-grub and grub-install.

Note: Be very careful to not change anything else, because It may cause the computer to not be able to boot anything. Changing the grub file is really not recommended.

1
  • After searching for a day, this finally solved my issue... At first I doubt the trick but it seems to be working just fine... Thank you
    – Hayyaun
    Commented Feb 26 at 17:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .