10

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 Sawai 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?

  • 1
    is there a Microsoft folder in your /boot/efi/EFI? There is a chance that you may have formatted /boot which also removed the windows 10 efi files. – Manoj Sawai Aug 9 '16 at 14:20
  • @ManojSawai No there isn't. Could that be the problem? (I did format /boot) – TheInitializer Aug 9 '16 at 14:41
  • /boot/efi/EFI/Microsoft/Boot contains some efi ( see here : imgur.com/a/5ZZnc ) which are required for booting up windows. I will do some more research and let you know if it is possible to get the original contents of /boot back. – Manoj Sawai Aug 9 '16 at 15:07
  • @ManojSawai That looks exactly like what I have in my Windows partition/Boot folder! storage9.static.itmages.com/i/16/0809/… (left is my Windows partition/Boot, right is your screenshot) Do you think I could just copy all those files over? – TheInitializer Aug 9 '16 at 15:14
  • oh, the bootmgfw.efi, bootmgr.efi and memtest.efi aren't there... – TheInitializer Aug 9 '16 at 15:20
11
+50

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.

  • Thank you, but I don't have a recovery USB (kinda stupid of me) and I can't create one without access to Windows. I'll try to find a way to make one – TheInitializer Aug 9 '16 at 17:12
  • 1
    Thanks you so much, this worked!! Posting from Windows :D – TheInitializer Aug 15 '16 at 0:33
  • 1
    bootrec /rebuildbcd failed for me but it worked anyway after I skipped it. – en4bz Nov 5 '16 at 2:34
  • 1
    Thanks for the Source links, helped understand and apply only the necessary. Afterwards to get rEFInd bootloader loading again I used bcdedit as described here : bcdedit /set "{bootmgr}" path \EFI\refind\refind_x64.efi – Pau Coma Ramirez Sep 4 '18 at 16:05
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.

  • Thanks, I'm downloading the ISO right now (it's a big file!) – TheInitializer Aug 9 '16 at 18:21
  • I've mounted the ISO, and have a question - which files am I supposed to copy, and to which folder? My guess is from Windows ISO/boot to /boot/efi/EFI/Microsoft, but I'm really not sure. – TheInitializer Aug 9 '16 at 21:19

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.