Restore Windows 10 MBR


  • Considered Harmful

    I installed Kali Linux on a thumb drive.

    For some reason, it, without asking, overwrote my master boot record on my hard disk with Grub. Grub can't read NTFS, so it just immediately dumps me into grub rescue.

    I have a working Windows 7 laptop and an empty thumb drive.

    How do I fix this mess?


  • Considered Harmful

    I'm trying to create bootable media here: https://www.microsoft.com/en-us/software-download/windows10

    Hopefully I can use it to repair the MBR.


  • Grade A Premium Asshole

    @error boot from a Win10 install CD (seems you are already on your way to that. When it boots select "Repair your computer", then "Troubleshoot" and then "Command Prompt". At the command prompt run these commands in this order:

    bootrec /FixMbr
    bootrec /FixBoot
    bootrec /ScanOs
    bootrec /RebuildBcd
    

    Cross your fingers, reboot and pray.

    I know that a hundred people are going to come in and disagree with me, but dual booting Linux and Windows is a pain in the ass and prone to failure. If at all possible, I would suggest you use any of the virtualization programs that run within Windows and run your Linux OSs from there.



  • Is this a UEFI system? Because MBR might not even be necessary in that case, you'd just change the default OS in the firmware.

    But to repair the MBR is pretty easy once you have a bootable Windows installer: run in "repair mode" or however it's called now, get to the CMD tool (they keep hiding it more and more), then simply run bootrec /FixMbr

    To quote a post I made years ago:

    @anonymous234 said in WTF Bites:

    I cloned a Windows +Linux system to a new disk, but deleted the Linux partition. Tried to boot. Error.

    Of course, I had deleted the GRUB files so it couldn't boot until I restored the original Windows MBR. So I used another Windows system. to create a "repair disk", then booted it in the first system.

    Here comes the WTF:
    The Windows repair disk has an option that says "start-up repair". This option failed to detect any issues in the system. But then I opened the command line and typed bootrec /FixMbr and it worked like a charm.

    What the fuck is the option to repair startup even doing if it doesn't even try the one fucking command that will fix startup in 50% of the cases?


  • Considered Harmful

    @Polygeekery That agrees with what Google told me, which is reassuring that I'm on the right track.

    I'm not going to try to dual boot - that's why I installed it to a thumb drive. (Yes, I know, the Live option exists, but that won't let me change it persistently. I want an actual installation on a thumb drive.) The damn thing should not have touched my hard drive at all.



  • @Polygeekery said in Restore Windows 10 MBR:

    I know that a hundred people are going to come in and disagree with me, but dual booting Linux and Windows is a pain in the ass and prone to failure

    No one will disagree that it's a pain in the ass, we'll disagree on who's at fault and how to fix it.

    GRUB can boot Windows and Windows' bootloader can boot Linux, and they're both very flexible once you learn the overly complicated configuration system, so technically any combination is possible.

    Wikipedia has a nice article if anyone wants to learn more:

    Edit: OK, I guess some people could disagree... almost all Linux distros will add a GRUB entry for Windows, so I guess as long as that works and you don't touch anything, it will work. Still, bootloaders are inherently messy and any mistakes (yours or by the programmers) will break your machine.


  • Considered Harmful

    @Polygeekery said in Restore Windows 10 MBR:

    I would suggest you use any of the virtualization programs that run within Windows and run your Linux OSs from there.

    I tried that first, actually, but Kali Linux wanted some low level access to a physical device that the virtualization wouldn't provide.


  • Considered Harmful

    Now then. Answers have been posted, so...

    @error said in Restore Windows 10 MBR:

    I installed Kali Linux on a thumb drive.

    You're likely to be eaten by the Grub 🐠


  • Grade A Premium Asshole

    @error said in Restore Windows 10 MBR:

    @Polygeekery said in Restore Windows 10 MBR:

    I would suggest you use any of the virtualization programs that run within Windows and run your Linux OSs from there.

    I tried that first, actually, but Kali Linux wanted some low level access to a physical device that the virtualization wouldn't provide.

    Can you boot from live media and do what you want to do that way? Or, what sort of device are you wanting to run it on? Desktop or laptop? If live media won't do what you need to, perhaps booting from an external hard drive, or bootable USB or some other method?

    Whenever possible I try not to dick around with the bootloaders or dual boot. That path leads to frustration.


  • Considered Harmful

    @Polygeekery said in Restore Windows 10 MBR:

    bootable USB

    This is exactly what I'm trying to accomplish.

    @Polygeekery said in Restore Windows 10 MBR:

    I try not to dick around with the bootloaders or dual boot.

    It was the installer's idea, not mine.



  • @error said in Restore Windows 10 MBR:

    This is exactly what I'm trying to accomplish

    If Microsoft's tool doesn't work (and sometimes it doesn't), there's many 3rd party tools that can make bootable Windows USBs from an ISO image, such as Rufus.


  • Grade A Premium Asshole

    @error ohhhhhhh, yes, you did say that. I just didn't read that.

    Hmmmmmm, I am going to assume that the installer saw the USB drive as another hard drive, installed the OS files to there and then rewrote the bootloader to match.

    What you want to do is download a bootable image and write that to the USB drive, not install as though you would from optical media and such. I mean, you could do it that way if you wish, but it would be best to pull the existing hard drive before you do that. Or, alternatively, see if you can disable it in BIOS/EFI so that it is inaccessible during the install process.

    I only scanned over this guide so I cannot guarantee its reliability, but I believe this is how you need to do it:

    https://devanswers.co/guide-kali-linux-2018-live-usb-persistence-windows/


  • Grade A Premium Asshole

    @anonymous234 said in Restore Windows 10 MBR:

    there's many 3rd party tools that can make bootable Windows USBs from an ISO image, such as Rufus.

    Which is the one I prefer to use. Clean and intuitive interface, requires no installation, works quite well.


  • Considered Harmful

    It's fixed!

    I mostly used @Polygeekery's advice (huge THANK YOU), though I ran into complications with ACCESS DENIED. I ended up having to reformat the BCD partition and reinstall it.

    Everything seems intact!


  • Grade A Premium Asshole

    @error glad to hear, but the advice was hardly "sage". My advice usually falls under "drunken bumbling idiot that occasionally gets something correct".


Log in to reply