27

I'm dual booting Windows 10 (pre-Anniversary Update) and Fedora 24 on a Lenovo IdeaPad N580 (Intel Pentium B960 2.2GHz, 4GB RAM, UEFI with Secure Boot disabled). I originally had just Windows 10 and then installed Fedora 23 alongside it and everything worked fine - it worked as well when I upgraded to Fedora 24. A while back, I decided I wanted to try out Ubuntu, and installed it only overwriting the root, /boot and SWAP partitions and keeping my home partition. Windows 10 can still boot here. Then I decided I didn't like Ubuntu and reinstalled Fedora, with the 24 installer, trying to do exactly what I did with Ubuntu. The interface was a bit different, but I'm sure I did it correctly: after I did all the partition configuring, it gave me a popup saying "We will only touch these partitions," and the partitions it listed were root, /boot and SWAP. Nothing else.

Then, when it finished installing, I rebooted. The only options in the GRUB menu were Fedora and Fedora Recovery - nothing else. No Windows.

I tried installing rEFInd, which has worked for me in the past. But it didn't help, it gave me those same two options.

The Windows partition still exists and I can access it from Fedora - important files such as /bootmgr and /Boot/BCD seem intact. The Windows partition is at /dev/sda5.

As well, in the BIOS settings where Windows Boot Manager used to appear, it doesn't. It just has rEFInd and an entry with the model number of my hard drive - which I'm assuming just brings me to the GRUB menu. (I haven't actually tried bringing it to the top of the list and rebooting though - I'm a bit lazy :P)

Can someone help?

UPDATE: Manoj identified the issue: by formatting the /boot partition I was getting rid of the Windows EFI files. So I need to reconstruct the files at /boot/efi/EFI/Microsoft. I think I've reconstructed the directory /boot/efi/EFI/Microsoft/Boot, but I need the other files in Microsoft. Could someone tell me what files I need there?

2 Answers2

34

Since you have copied all the required files to boot/efi/EFI/Microsoft/Boot, you need to rebuild Windows loader configuration. You will need a Windows bootable usb or dvd (64 bit will be preferable):

  1. Boot from your bootable medium. Make sure that you are booting in UEFI mode.

  2. At the first screen (where it asks you to choose language and keyboard), press Shift + F10. This will give you a command prompt.

  3. Type diskpartand then list disk (to list all available disks). Select appropriate hard drive by typing select disk #.

  4. Now type list partition and make sure that there is a partition of type system (the efi partition). Select this partition by typing select partition # and assign a temporary drive letter to it, say G by typing assign letter=G.

  5. Just to make sure that drive letter is correctly assigned, type list vol. You should see a volume with drive letter (Ltr) as G & file system (Fs) as FAT32

  6. Close diskpart by typing exit. Make sure that you are in X:\Sources.

  7. Type cd /d G:\EFI\Microsoft\Boot\. Now run these commands one by one.

    bootrec /scanos     
    bootrec /fixmbr    
    bootrec /fixboot
    bootrec /rebuildbcd    
    bcdboot C:\Windows /l en-us /s G: /f ALL
    
  8. Close the command prompt and restart the system. You should now be booting into Windows.

  9. Of course you may not or don't have the grub menu now. But installing grub is far more easy. Follow any one of these links for more info: link1, link2, link3

Sources : 1, 2, 3, 4.

EDIT - Make sure that you remove the drive letter G assigned to efi partition as soon as possible to keep it from showing up in My Computer.

genpfault
  • 555
Manoj
  • 856
  • 1
  • 10
  • 18
0

Before starting back up your boot partition using mkdir $HOME/backup && sudo cp -R /boot $HOME/backup. Boot partition is usually limited to 100MB so it should be really small.

If you still have a Windows 10 bootable medium (like a USB stick or a DVD), you will be able to find the EFI files over there.

If you don't have a Windows bootable medium you can mount the ISO (download if necessary) using the command sudo mkdir /tmp/win10iso && sudo mount -o loop /location/of/win10.iso /tmp/win10iso.

When you successfully copied those EFI files to the Windows partition add an entry to the file /etc/grub.d/40_custom.

The entry would look like this:

menuentry 'Windows 10' {
set root='(hd0,msdos5)'
chainloader +1
}

In GRUB configuration the hdX stands for /dev/sdX and msdosY stands for /dev/sdXY. Note that hdX starts at 0 and /dev/sdX starts at A.

After that's done, update your GRUB with sudo update-grub2. Windows boot entry should now be there.

Condor
  • 65
  • 8