25

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?

7

2 Answers 2

32
+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.

7
  • 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 Commented Aug 9, 2016 at 17:12
  • 1
    bootrec /rebuildbcd failed for me but it worked anyway after I skipped it.
    – en4bz
    Commented Nov 5, 2016 at 2:34
  • 1
    What can you do if your partition isn't listed by list disk?
    – arshbot
    Commented Jun 13, 2019 at 5:32
  • As a remark to anyone who has issues with creating a bootable windows stick under linux: Download the official iso from the microsoft site and copy it onto your usb stick using the tool woeusb. I was trying dd and other things but only this approach has worked. Following the above steps afterwards helped to reconstruct the dual boot.
    – apparat
    Commented Jan 29, 2020 at 10:10
  • 2
    Perfect solutio ! :) Worked fine for me ... I just had a couple of problems, firstly the cd /d G:\EFI\Microsoft\Boot` didn't work because the folder didn't exist so I mkdir it :) Then the bootrec /fixboot` didn't work because it told me Unauthorized permission ... But at the end everything's working fine now :) Thanks a lot Commented Jun 16, 2021 at 21:08
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.

3
  • Thanks, I'm downloading the ISO right now (it's a big file!) Commented Aug 9, 2016 at 18:21
  • 1
    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. Commented Aug 9, 2016 at 21:19
  • @TheInitializer I would like to know this too. So what did you end up doing?
    – pavlee
    Commented Aug 7, 2020 at 13:30

You must log in to answer this question.

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