Dual boot Fedora and Windows 8 gives error: you need to load the kernel first

9,368

The obvious answer is this is happening because grub can not find the windows boot loader. The less obvious answer is because the grub configuration file does not properly specify the root for the windows bootloader. The default operation seems to leave that line out. While it would be somewhat complicated to fix the default Windows Bootloader, the following instructions will allow you to have the system create a second one that works properly.

If you are using Fedora fc20, or another similarly configured system that is running grub2, the following steps should fix your problem provided you have not damaged your windows bootloader partition.

1) Find out which partition your windows bootloader is on.

[root@localhost]# fdisk -l

Disk /dev/sda: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: D733242D3-33B9-4C33-B33F-2C333DC52333

Device           Start          End   Size Type
/dev/sda1         2048       206847   100M EFI System
/dev/sda2       206848      2050047   900M Windows recovery environment
/dev/sda3      2050048      2312191   128M Microsoft reserved
/dev/sda4      2312192    988518399 470.3G Microsoft basic data
/dev/sda5   1911560192   1953523711    20G Windows recovery environment
/dev/sda6    988518400    989337599   400M EFI System
/dev/sda7    989337600    991385599  1000M Microsoft basic data
/dev/sda8    991385600   1911560191 438.8G Linux LVM

Disk /dev/mapper/fedora-swap: 7.8 GiB, 8396996608 bytes, 16400384 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

Disk /dev/mapper/fedora-root: 431 GiB, 462728200192 bytes, 903766016 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

2) Find out the UUID of that partition.

[root@localhost]# blkid /dev/sda1
/dev/sda1: LABEL="SYSTEM" UUID="1234-567A" TYPE="vfat" PARTLABEL="EFI system partition" PARTUUID="0c33e3ab-d3dc-3af3-333d-a33eee3c333c"

Note: Fedora will automatically generate a new configuration file when you do things like update the kernel so while you can manually edit the grub.cfg file, it is less work in the long term to edit the configuration stub files that are used to generate the grub.cfg file.

3) Add the menuentry text to the end of the /etc/grub.d/40_custom file. Use a text editor of your choice but you must be root to do so. I used vi. Make sure you substitute the UUID from step 2 for the 1234-567A shown here.

[root@localhost]# vi /etc/grub.d/40_custom

menuentry 'My Working Windows Bootloader' {
    search --no-floppy --fs-uuid --set=root '1234-567A'
    chainloader /EFI/Microsoft/Boot/bootmgfw.efi
    boot
}

4) Now generate the actual config file using the grub2-mkconfig command.

[root@localhost]# grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg
Generating grub.cfg ...
Found linux image: /boot/vmlinuz-3.16.7-200.fc20.x86_64
Found initrd image: /boot/initramfs-3.16.7-200.fc20.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-0b156afaadc545779646d809437ed977
Found initrd image: /boot/initramfs-0-rescue-0b156afaadc545779646d809437ed977.img
Found Windows Boot Manager on Microsoft/Boot/bootmgfw.efi
done

NOTE: Running this command by specifying /etc/grub2-efi.cfg as the output file deletes the symbolic link that is normally there and creates a new file instead of updating the actual config file.

5) You are done. When you reboot, you should now have access to your Windows and GNU/Linux operating systems.

Share:
9,368

Related videos on Youtube

R Schultz
Author by

R Schultz

Updated on September 18, 2022

Comments

  • R Schultz
    R Schultz over 1 year

    While there seem to be a lot of questions regarding dual booting Windows and Linux, I did not see one that seemed to cover this problem. That said, I believe a lot of the problems may be fixed in a similar manner.

    In Fedora fc20 with latest patches as of 11/9/2014, grub gives the following two errors when selecting the automatically generated Windows Bootloader entry.

    > error: file '/EFI/Microsoft/Boot/bootmgfw.efi' not found 
    > error: you need to load the kernel first
    

    Why is this happening and how do I fix it?