4

Basically I've lost my Windows 8 boot option and the boot repair from Windows installation media doesn't fix the problem.

I know this is more-or-less a Windows' problem but I'm seeking a efibootmgr solution rather than a solution that uses the much more awkward Windows based bcdedit command. Hence I ask here instead of super user.

The detailed background is here, basically my system was initial setup in BIOS/MBR/CSM mode, Windows 10 is refusing to be installed there, so I have to converted my MBR disk to GPT. I got everything on the Linux side working afterward, but fixing Windows boot via Windows installation media failed.

  • All my Linux OS/partitions were found by update-grub, but my Windows 8 is missing from the GRUB menu.
  • The os-prober was not able to list/find my Windows 8 either.

I hope the fix is simply adding my Windows 8 back as an boot entry using efibootmgr, but this is where I got lost and need help. Again further detailed like current partition schema can be found here. Thx.

Maybe my Windows 8 was installed in BIOS/MBR/CSM mode, and has no EFI booting capability as I don't see a /EFI directory within it? Here are all root level directories in my Windows 8 partition:

$Recycle.Bin/              ProgramData/
$WINDOWS.~BT/              Programs/
$Windows.~WS/              Recovery/
BOOTNXT                    Recovery.txt
BOOTSECT.BAK               System Volume Information/
Boot/                      Tmp/
Documents and Settings/    Users/
ESD/                       Windows/
Intel/                     bootmgr
Program Files/             pagefile.sys
Program Files (x86)/       swapfile.sys

Or maybe I don't need efibootmgr at all, just a custom entry in /etc/grub.d/40_custom like the following?

menuentry "Windows 8 BIOS MBR" {
     insmod part_msdos
     insmod ntldr
     insmod ntfs
     ntldr (hd0,msdos1)/bootmgr
}
5
  • 1
    This has now essentially nothing to do with Linux/Unix, so it is likely to get redirected to SuperUser.SE. But now you'll need a UEFI-bootable Windows installation media so you can run the boot repair process in UEFI mode to write the Windows UEFI bootloader onto the ESP partition. See this link.
    – telcoM
    Sep 5, 2021 at 22:39
  • OK, you're right @telcoM. Running the boot repair process in UEFI mode from Windows installation media failed, but your link seems to be feasible. So, would you or any one be able to move it for me pls?
    – xpt
    Sep 5, 2021 at 22:43
  • Discussion threads can't be moved, "redirection" in practice means you get a comment "This question is outside of the scope, you could try in SuperUser", and the original thread gets closed. Sep 5, 2021 at 22:55
  • 1
    chainloader /EFI/Microsoft/Boot/bootmgfw.efi would be the GRUB configuration line that fires up the Windows boot manager on the ESP partition. NTLDR is for Windows XP and older only. But bootmgfw.efi requires a number of other files to accompany it, and one of them is BCD which needs to be tailored for your installation. The repair tools on the installation media should be able to do it.
    – telcoM
    Sep 5, 2021 at 23:23
  • @xpt - please make it a proper answer then and close the question. It is okay to answer ones own question and better than having a link that might die sooner or later.
    – FelixJN
    Sep 6, 2021 at 14:06

1 Answer 1

5

OK, as per @FelixJN's request, here is the answer instead of a link.

My purpose was to seek a Linux based solution, as at least using ntldr loading Windows' bootmgr were the trick I used to use back in the old grub / grub4dos days. Like, this should work:

menuentry "Windows 8 UEFI/GPT" {
    insmod part_gpt
    insmod search_fs_uuid
    insmod chain
    search --fs-uuid --no-floppy --set=root 28cf-35de
    chainloader ($root)/EFI/Microsoft/Boot/bootmgfw.efi
}

but I didn't try it as I don't have much faith in grub2 and its documentation, but turned to the solution from Windows instead, just as @telcoM summerized,

run the boot repair process in UEFI mode to write the Windows UEFI bootloader onto the ESP partition

Here are the details steps taken from here.

  1. Insert the Media (DVD/USB) in your PC and restart.

  2. Boot from the media.

  3. Select Repair Your Computer.

  4. Select Troubleshoot.

  5. Choose Command Prompt from the menu :

    1. Type and run the command :

      diskpart
      
    2. Type and run the command :

      sel disk 0
      
    3. Type and run the command :

      list vol
      
  6. Verify that the EFI partition (EPS - EFI System Partition) is using the FAT32 file system and assign a drive letter to it (Assign a letter that isn't already in use.):

  7. Type and run the command :

     sel vol <number of volume>
    
  8. Type and run the command :

     assign letter=<drive letter>:
    
  9. Type and run the command :

     exit
    
  10. In order to repair the boot record :

    1. Type and run the command :

      cd /d <drive letter>:\EFI\Microsoft\Boot\
      
    2. Type and run the command :

      bootrec /FixBoot
      

The next step is the same across all the operating systems at this point :

  1. Rebuild the BCD store

  2. First run the command below to backup the old BCD :

     ren BCD BCD.old
    
  3. Now recreate it using this command :

     bcdboot c:\Windows /l en-us /s <boot letter>:All
    
1
  • Thanks for the detailed instructions. bootrec /FixBoot returned "Access Denied" for me but i ran all the other commands and windows was able to boot afterwards.
    – psmith
    Oct 11, 2023 at 14:34

You must log in to answer this question.

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