Windows cannot boot in legacy or UEFI

max_rofl

Reputable
Oct 23, 2015
28
0
4,540
So I changed the boot mode in my BIOS from UEFI to Legacy for a completely unrelated project (a Linux distro on my USB). Now I want to go back to using Windows on my internal HDD however when booting in UEFI I get the error "No bootable media found" and when booting in legacy I only get recovery options in Windows. How can I fix this?
 
Solution
If you are now willing to fresh install since nothing else worked, when you get to screen where it gave the MBR error, delete all the partitions on the drive and click next. Windows should create the partitions it needs. If it still gives an error, close the installer, restart PC and try again as some PC need a restart before that works.

I hope that works, I honestly don't know why its taken this much effort just to get the thing to boot.

Colif

Win 11 Master
Moderator
See if this helps

download the Windows 10 media creation tool and use it to make a win 10 installer on USB - its just aboot disc, don't bother if you have it already

change boot order so USB is first, hdd second
boot from installer
on screen after languages, choose repair this pc, not install.
choose troubleshoot
choose advanced
choose command prompt
We need to use the Bootrec.exe tool. Click on command prompt and type in the following commands, one after the other:
bootrec /RebuildBcd
bootrec /fixMbr
bootrec /fixboot
Exit

Now go ahead and reboot your system. In some cases you may need to run some additional commands.
bootsect /nt60 SYS or bootsect /nt60 ALL
 

max_rofl

Reputable
Oct 23, 2015
28
0
4,540


What should I make the boot mode before I do all this?

edit: I get the following error when running "bootrec /RebuildBcd" The requested system drive cannot be found.

It says drive E under "identified windows installations" Should I be looking for a drive C? How can I make it recognize my HDD
 

Colif

Win 11 Master
Moderator
can you do this and tell me what you see
Press Shift F10 on the installation screen, this will open cmd
type diskpart and press enter
type list disk and press enter
this shows all drives available, DVD/USB and hdd

if you boot off USB the drive letters get mixed up., Usually it makes C into D but its possible in your PC its made it E


 

max_rofl

Reputable
Oct 23, 2015
28
0
4,540


When using list disk it shows me my internal HDD as well as my usb. Diskpart just shows some copyright and version info.
 

Colif

Win 11 Master
Moderator
I should have asked you to do 2 more steps

type cd X - X being drive letter of hard drive, change it to match it.
type list volume - this will show all the partitions on the hard drive

trying to work out why your windows partition is E drive, can you list what you see here? knowing what sizes and descriptions are will help.

another fix that might work is
boot from installer
on screen after languages, choose repair this pc, not install.
choose troubleshoot
choose advanced
choose start up repair - this will scan PC and maybe fix this - will ask for logon info
 

max_rofl

Reputable
Oct 23, 2015
28
0
4,540


It doesn't allow me to CD to another drive. Just says it isn't found. When I used list disk it shows my internal HDD as Disk 0.

edit: In my BIOS setup under boot sequence I can actually find and access my HDD. It lists all my files and directories, is there a specific windows boot file I should try to add?
 

Colif

Win 11 Master
Moderator
the bootrec/rebuild bcd command I gave you above were meant to fix your boot files, but it said it couldn't find an operating system, and then said E drive was windows.
did you try the other two commands under it?

All I been trying to do is figure out what your partitions look like on drive 0, try the list volume command and see if it shows a break down - I had thought you would need to swap to the hdd using CD X but perhaps not.

could the linux distro overwritten the EFI partition with its own files?
 

max_rofl

Reputable
Oct 23, 2015
28
0
4,540


http://paste.ubuntu.com/24508144/ Maybe this can help?
 

max_rofl

Reputable
Oct 23, 2015
28
0
4,540


Hello again! I've followed all the steps as follows (essentially what you had me do):

diskpart
DISKPART> list disk
DISKPART> select disk 0
DISKPART> list volume
# find your system partition with fat32 file system. Here to assume it as volume 2.
DISKPART> select volume 2
# To assign drive letter.
# If you want to remove drive letter, use remove command.
DISKPART> assign letter=b:
# To terminate diskpart command.
DISKPART> exit

# Now, you sould move to b:\EFI\Microsoft\Boot\, as windows stores BCD in this folder.
cd /d b:\EFI\Microsoft\Boot\
# this is not necessary.
ren BCD BCD.bak
# To write a new bootsector on your system partition.
bootrec /fixboot
# If your windows running, you should do from here.
# To create BCD store. "/f ALL" is to update BIOS setting including UEFI firmware/NVRAM.
# Replace "ja-JP" with your language or remove "/l" option if you use English, of course.
# It might be sense only typing "bcdboot c:\Windows".
bcdboot c:\Windows /l ja-JP /s b: /f ALL

everything works good except on the last step I receive the error: "Failure when attempting to copy boot files."
 

max_rofl

Reputable
Oct 23, 2015
28
0
4,540


Yes I do that and when I enter the final command it just says "Failure trying to copy boot files" what should I be doing different?

edit: I also able to change which partition is active, which partition should it be? I have 3, an OEM, a small (13mb) one, and my 450gb one
 

Colif

Win 11 Master
Moderator
Has boot method in bios been UEFI this whole time? I just noticed the question in your 1st reply

of the 3 partitions shown, i cannot tell which should be active. The active partition is the boot partition, normally it is a 450mb partition, and you didn't mention one of those, so it is difficult for me to tell. I cannot tell what the maker of your device has chosen as active since they altered the normal layout of partitions. If it had been upgraded from win 8, then the boot partition should be 350mb,m and if it were an upgrade from win 7 then it uses MBR instead and should have one of those as 1st partition on drive - I am guessing its not as switching from uefi to legacy is what started all this


I wonder if it would be faster to just reinstall windows 10 instead of trying to fix the boot details? If you can boot off that Linux USB drive again, you should be able to use it to copy any files off the hdd
 

max_rofl

Reputable
Oct 23, 2015
28
0
4,540


I can reinstall windows and keep my files but I'd lose all my settings and installed programs. The only thing I did was switch from UEFI to Legacy. Is there a way to just reinstall a boot partition or something? I feel like this shouldn't be so complicated.
 

max_rofl

Reputable
Oct 23, 2015
28
0
4,540

Colif

Win 11 Master
Moderator
The mbr2gpt tool came with the latest version of win 10. the 2nd option on that link I gave was booting from the win 10 installer. So if you are using a new copy of the installer made by media creation tool, it should know that command?
 

max_rofl

Reputable
Oct 23, 2015
28
0
4,540


It's just telling me 'mbr2gpt' is not a recognized command. I really need to figure this out.
 

Colif

Win 11 Master
Moderator
if you have iso of 1703, then i cannot understand why it would be telling you that. This shows it can be used to do command - https://docs.microsoft.com/en-us/windows/deployment/mbr-to-gpt

I would make a post on tenforums as they wrote the tutorial, they know more about this stuff than even Microsoft on a lot of occasions. I would link to this thread so they don't make you repeat anything I already suggested. Really interested to find out the answer.
 

max_rofl

Reputable
Oct 23, 2015
28
0
4,540


At this point Im going to try to reinstall without losing files. What partition or volume needs to be active to get the recovery screen without the external media, I changed it before and forgot.