Uninstall GRUB and use Windows bootloader

1,130,229

Solution 1

This answer is for those with UEFI who have deleted the Ubuntu partitions before removing grub

You will be doing this from Windows 10. No bootable media required.

Where bootrec /fixmbr, bootsect /nt60 and the Ubuntu live with the boot-repair suggestions have failed, this has worked for me:

(This answer borrowed verbatim from here)

  1. Run a cmd.exe process with administrator privileges
  2. Run diskpart
  3. Type: list disk then sel disk X where X is the drive your boot files reside on
  4. Type list vol to see all partitions (volumes) on the disk (the EFI volume will be formatted in FAT, others will be NTFS)
  5. Select the EFI volume by typing: sel vol Y where Y is the SYSTEM volume (this is almost always the EFI partition)
  6. For convenience, assign a drive letter by typing: assign letter=Z: where Z is a free (unused) drive letter
  7. Type exit to leave disk part
  8. While still in the cmd prompt, type: Z: and hit enter, where Z was the drive letter you just created.
  9. Type dir to list directories on this mounted EFI partition
  10. If you are in the right place, you should see a directory called EFI
  11. Type cd EFI and then dir to list the child directories inside EFI
  12. Type rmdir /S ubuntu to delete the ubuntu boot directory

Assuming you only ever had two operating systems (Win 10 & Ubuntu) you should now be able to boot directly to Windows without hitting the black grub screen.

Solution 2

To restore Win 10 default bootloader follow these steps:

  • Log into Win 10
  • Open Command Prompt (Admin)
  • c:\> bootsect /nt60 <drive name>: /mbr

<drive name> is the drive letter where the Master Boot Record (MBR) will be updated

For example to update C master boot record this is the command:

c:\> bootsect /nt60 c: /mbr

For more help about bootsect command see here - https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/bootsect-command-line-options

Solution 3

You can restore the Windows bootloader with a Windows 8/8.1 DVD. These instructions are inspired by Manindra Mehra's answer, but I expanded it with full working details (verified with a Windows 8.1 DVD).

  1. Put the DVD in your optical drive and boot from it.

  2. Press a key when it displays Press any key to start from CD or DVD.

  3. Select your language etc. and click Next.

  4. Click Repair your computer.

  5. Click Troubleshoot.

  6. Click Advanced Options.

  7. Click Command Prompt.

  8. In the command prompt window, type bootrec /fixmbr

  9. Click the red X to close the command prompt.

  10. Click Turn off your PC.

  11. Turn the PC back on and it should boot directly into Windows.

This leaves the Ubuntu partition on your hard drive or SSD. To remove it:

  1. Hit Windows+X and select Disk Management.

  2. Find the Ubuntu partition. It will probably be a large partition without a drive letter.

  3. Be sure you have the correct partition!

  4. Right-click the partition and delete or reformat it with a Windows filesystem.

Solution 4

Remove Boot Loader EFI / System Partion in Windows 10

Quick Guide

Open PowerShell as Administrator

mountvol S: /S
S:
cd .\EFI\
dir
rd /S Ubuntu

Details

Administrator PowerShell

Enter powershell into the windows search of the start menu. Look for a blue icon with the label "Windows PowerShell", right click on the that and select "Run as Administrator" within the context menu.

Mount EFI/System Partition As Volume

To Mount the EFI System Partition on the given drive use the mountvol command by using the /S parameter. You can chose any free drive letter you want. For example "S".

mountvol S: /S

Access Mounted Volume

Now the partition is mounted. We can access the mounted volume by changing to the drive by the cd command and the drive letter S: as parameter

cd S:

To ensure we are at the root of this volume we should execute:

cd\

Type via the dir command to list the entries of the current path to ensure you on the right one.

dir

It should look like this:

Directory: S:\


Mode                LastWriteTime         Length Name
----                -------------         ------ ----
d-----       2019-01-17     12:55                EFI
-a----       2018-10-16     10:57             31 startup.nsh

Delete Boot Loaders

Your boot loaders are location in the EFI directory. Change to it by using the cd command and list the entries via the dir command.

cd .\EFI\
dir

Your output depends on the boot loaders you have installed, here is a example with Windows and Ubuntu.

Directory: S:\EFI


Mode                LastWriteTime         Length Name
----                -------------         ------ ----
d-----       2018-12-06     06:55                Ubuntu
d-----       2018-12-05     05:21                Microsoft
d-----       2019-01-17     12:55                Boot

Now you can delete unwanted loaders via the command Remove-Item and the parameter -Recurse.

DO NOT DELETE THE BOOT DIRECTORY OR THE WINDOWS DIRECTORY!

Remove-Item -Recurse .\ubuntu

Solution 5

To do so you will need a windows installation cd/dvd

  1. put it in your optical drive and boot from it
  2. on the installation screen where it asks you to install windows, click on Repair Your Computer on the lower left corner of your screen
  3. Now go to command prompt (It probably will show a window saying "Trying to repair windows automatically", close it) and type BootRec.exe /fixmbr
  4. after it finishes GRUB is gone and you can now boot into windows directly
  5. you have an Ubuntu partition left in your computer, that doesn't show in "My Computer", to access that, right click on "My Computer" and Select "Manage" and go to "Disk Management"
  6. Select the Ubuntu partition and format it to a file system that windows can use.
Share:
1,130,229
mrolive
Author by

mrolive

Updated on September 18, 2022

Comments

  • mrolive
    mrolive over 1 year

    I have Windows 8 pre-installed, and then I installed GRUB with Ubuntu. Ubuntu is not my thing, so now I want to remove it along with GRUB. From what I have learned, with UEFI, GRUB does not overwrite the windows bootloader in the EFI partition and is stored elsewhere. How would I remove GRUB and make my PC use the Windows bootloader instead? It should be noted that I created a separate /boot partition when installing Ubuntu.

    • Ilja KO
      Ilja KO about 2 years
      So for those who have dual boot windows and ubuntu on the same or different disks and don't want the grub loader to show up but default to windows bootup instead and keep ubunut as a second option to start from the UEFI by boot overloading, jsut change the boot order in your UEFI to have windows as first and ubuntu as second and this will do the trick
  • TheSchwa
    TheSchwa about 8 years
    Welcome to AskUbuntu! As it appears this was a copy paste, please consider linking to the original page at the end of your answer.
  • Pavel Niedoba
    Pavel Niedoba over 7 years
    This is by far best solution, one minute, no install disk, usb needed
  • flickerfly
    flickerfly over 7 years
    This was helpful in directing what I needed to do. I could delete the ubuntu partition in Windows using informaition from here: superuser.com/questions/662823/…
  • SeinopSys
    SeinopSys about 7 years
    Some CISCO Talos annoyware was preventing me from doing this from within my OS, but as of Windows 10 you no longer need an install disk to do this. I have just done this operation without one; all you need to do is log out so you're on the log in screen, then you start holding down Shift, and press the power icon in the bottom right, then click Restart, now let go of Shift. This will open the same menu as the repair disk. You just have to go to Troubleshoot > Advanced options > Command Line and run bootsect /nt60 c: /mbr. Grub will be gone in an instant.
  • Efi Kaltirimidou
    Efi Kaltirimidou about 7 years
    I preferred this solution because I did not want to create a bootable device and it worked perfectly
  • Yibo Yang
    Yibo Yang almost 7 years
    For completeness, also remove ubuntu from the efi boot menu. I think this should be added as step 7.
  • Chris Vilches
    Chris Vilches almost 7 years
    Please fix step 3 by explaining how to go to command prompt. Michael Geary's answer is more complete. This answer led me to reset my PC unnecessarily once because I didn't know how to go to command prompt.
  • Menasheh
    Menasheh almost 7 years
    Does not appear to work for me. Grub appears until I press exit. Updated NTFS filesystem bootcode. The update may be unreliable since the volume could not be locked during the update: Access is denied. \??\PhysicalDrive0 Bootcode is only updated on MBR partitioned disks. A different partitioning scheme is used on this disk. Bootcode was successfully updated on all targeted volumes. PS C:\WINDOWS\system32>
  • Admin
    Admin almost 7 years
    What does the /mbr do? I looked for documentation on bootsect, and I couldn't find anything about /mbr.
  • kross
    kross almost 7 years
    rebooting after this caused me to recieve Reboot and Select proper boot device.
  • kross
    kross almost 7 years
    I figured out there was a submenu under bios Boot menu that was still referencing the deleted ubuntu grub item. I set this to Windows and it worked.
  • wired00
    wired00 over 6 years
    Legend. This worked perfectly for me with a Razer blade stealth windows 10 with Ubuntu. I wanted to perform a complete factory restore for selling the laptop but needed to rid it of the bootmenu + ubuntu. Thanks
  • stackOverlord
    stackOverlord over 6 years
    wow everything was exactly where you said it would be!
  • Bram
    Bram over 6 years
    This worked for me, but I still have a question: does this actually remove grub or is in the background still something going on where grub hands things over to the windows boot loader?
  • armadadrive
    armadadrive about 6 years
    @Bram I can't say for certain because I am just not knowledgeable enough, but I would hazard the guess that these steps actually delete the program files for Grub and therefore it would be "gone" gone.
  • David Faure
    David Faure about 6 years
    @PieTillIDie /mbr means Master Boot Record, surely this is about writing to the MBR, to overwrite what grub put there.
  • dev_nut
    dev_nut about 6 years
    This is the solution that works. MBR does not exist anymore because of GPT.
  • sonlexqt
    sonlexqt about 6 years
    There's a video instructions here: youtube.com/watch?v=ZTMCKOx5Jz0 if you need it.
  • Salman Amintabar
    Salman Amintabar about 6 years
    It's doesn't work for me 😐
  • Anton
    Anton about 6 years
    beautiful!! after hours of trying, the only thing that has worked for me!
  • Abdul Mohsin
    Abdul Mohsin almost 6 years
    awesome. :) I wish I could upvote the answer multiple times :)
  • hsandt
    hsandt almost 6 years
    I really messed up my previous install attempts so I got a notification on rmdir: "The file or directory \EFI\ubuntu\fw is corrupt and unreadable. Please un the Chkdsk utility."
  • hsandt
    hsandt almost 6 years
    -> which I did, although I had to force dismount gulp. Removal worked, but I still see ubuntu in my boot menu.
  • petobens
    petobens over 5 years
    Hours of reading askubuntu and other stackexchange posts to finally hit this jackpot. Thanks a lot!
  • armadadrive
    armadadrive over 5 years
    You're welcome. I wish I could take credit for the answer, but alas I was just reposting steps that helped me. I'm glad it is working well for so many others!
  • Rigoxls
    Rigoxls over 5 years
    Great Man, it works !!!
  • Fezzo
    Fezzo about 5 years
    Spent hours trying to get rid of GRUB, and this worked. Thanks for the solution. I'm on a Surface Pro 3 as well, so this works on Surfaces. If you run the /dir command again, you'll see that the ubuntu folder is deleted, so it does remove it for good!
  • Force Hero
    Force Hero about 5 years
    This worked for me. I did this from a win 10 recovery USB. You start on X:\Windows\System32 I ran cd /d c: and then bootsect /nt60 c: /mbr I got one error about access denied and one success message. Unplugged the USB and rebooted and it worked!
  • tomsihap
    tomsihap about 5 years
    For those having a scary "System BootOrder not found. Initializing defaults" error, which causes a reboot loop, I had to F2 and select "Windows Boot Manager". Everything else is working like a charm!
  • udippel
    udippel about 5 years
    It worked without hitch on my MBR-install. I was confused, though, with the command line: c:\> further up is not what you enter. In my case it was some C:\windows32\something. The '>' is actually the last character of the command prompt. As user you start entering the command with the word 'bootsect'.
  • Sabrina
    Sabrina almost 5 years
    I'm so happy I could cry
  • Sagnik
    Sagnik almost 5 years
    This advice still works! Thanks a lot.
  • Casperrw
    Casperrw over 4 years
    From a live usb stick, starting with efibootmgr -v, then using -b 0002 -B worked for me after 'fixmbr' from windows didn't seem to work, and that solution seemed a lot easier than some of the other solutions.
  • alex
    alex over 4 years
    @ForceHero That does not work for me. It yields "The update may be unreliable since the volume could not be locked during the update - access denied".
  • Walter Schrabmair
    Walter Schrabmair over 4 years
    Great solution ! Thanks
  • devb
    devb over 4 years
    So, I followed this perfectly, but upon restarting, my laptop was stuck in an infinite bootloop. I somehow managed to enter the BIOS and was able to select Windows. How do i prevent this from happening?
  • user1686
    user1686 over 4 years
    If all you want is to assign a drive letter for the EIF system partition, DISKPART is a bit unnecessarily complex – you can collapse steps 2–7 to a single mountvol Z: /s command.
  • GMaster
    GMaster about 4 years
    For people wondering where to find this, go to your BIOS settings.
  • Jordan Rolph
    Jordan Rolph about 4 years
    This was a perfect solution! Thank you lots and lots
  • hunzter
    hunzter about 4 years
    This is the correct way to remove the boot entry
  • Faiz Hameed
    Faiz Hameed about 4 years
    How to remove the assigned letter afterwards its showing in file explorer now
  • Bhavesh G
    Bhavesh G about 4 years
    you sir, are a genius!
  • yushulx
    yushulx almost 4 years
    Only your answer worked for my case. Thanks!
  • NelsonGon
    NelsonGon almost 4 years
    Logged in to upvote this.
  • jerrymouse
    jerrymouse almost 4 years
    Solution to the error: The update may be unreliable since the volume could not be locked during the update: Access is denied. \??\PhysicalDrive0. 1. Reboot and press F12 to open your bios screen (It could be F8 or F2 depending on your model). 2. You should see Ubuntu Grub as the first bootloader and Windows as the second one. 3. Follow the instructions in your BIOS to change the order. This video might help - youtube.com/watch?v=46OofQo1W_4
  • RohitS
    RohitS almost 4 years
    Awesome and Thanks! :D
  • Chemist
    Chemist almost 4 years
    This is confirmed to work with windows installation on mbr partition
  • KhoPhi
    KhoPhi almost 4 years
    Note from present self to future self: This is the ONLY solution that worked
  • BlueDev
    BlueDev almost 4 years
    In PowerShell instead of command 'rd /S ubuntu', I had to use 'Remove-Item ubuntu'.. Thanks for sharing this solution!
  • Ashu
    Ashu over 3 years
    not working in my case. UEFI Dell XPS desktop
  • Ashu
    Ashu over 3 years
    worked for me - deleted the ubuntu directory recursively but PC is going into BIOS - if i ESC or come out of it - it is shutting down and not booting into Windows
  • pgalilea
    pgalilea over 3 years
    After a lot of workarounds this finally worked!!
  • cloverink
    cloverink over 3 years
    thx you save my day
  • Seamus
    Seamus over 3 years
    This is the correct answer for systems with EFI, especially if you installed linux on a separate drive which is the optimal way to go. Goodness, so many complicated answers out there and its really simple to do.
  • John Strood
    John Strood over 3 years
    Even though this is correct, this is not sufficient. The BIOS boot menu still has ubuntu in it. I removed it completely using efibootmgr application - askubuntu.com/a/923231/452738
  • Botond Balázs
    Botond Balázs over 3 years
    This is the perfect solution. I registered only to upvote it. Thank you!
  • armadadrive
    armadadrive over 3 years
    @BotondBalázs Haha, thanks - but I can only take credit for reposting the steps I found in the linked article.
  • geras
    geras over 3 years
    Did you maybe mean to write rd /s ubuntu instead of rd /S ubuntu? There is no /S option in the manual of rd and it didn't work for me. I used Remove-Item ubuntu instead, like @BlueDev did.
  • geras
    geras over 3 years
    There was still an "Ubuntu" entry left in the boot menu after I did this so I just deleted it.
  • Felix Quehl
    Felix Quehl over 3 years
    @geras I changed the command. Thanks for the feedback.
  • drerD
    drerD over 3 years
    got a error "Virtual Disk Service error: Assigning or removing drive letters on the current boot or pagefile volume is not allowed."
  • Pakpoom Tiwakornkit
    Pakpoom Tiwakornkit over 3 years
    How do I restore the deleted EFI/ubuntu folder after doing these esteps?
  • Bang Dao
    Bang Dao about 3 years
    I comment just to show how much I love you
  • rothermere
    rothermere about 3 years
    @geras There is still an Ubuntu entry left in the Boot menu. How did you delete that? The commands I executed: mountvol S: /S S: cd .\EFI\ dir Remove-Item -Recurse .\ubuntu
  • Felix Quehl
    Felix Quehl about 3 years
    When you are sure that you are not having a typo in the folder name, you could try adding the -Force paramter to the Remove-Item command: Remove-Item -Recursive -Force .\ubuntu
  • Tek
    Tek about 3 years
    This is mind-blowingly the easiest way to get rid of a boot entry. THANK YOU. Links are broken by the way.
  • oldfred
    oldfred about 3 years
    Removed broken links, add suggestion for example in man page for efibootmgr. A few Manufacturers, do not recognized efibootmgr and then your only choice is to go into UEFI menu (not UEFI one time boot menu) and on boot tab edit entries.
  • Madhusudan chowdary
    Madhusudan chowdary over 2 years
    Thanks , this worked for me
  • VijayRana
    VijayRana over 2 years
    I just signed up to upvote this answer. Super helpful and works perfectly.
  • evening_g
    evening_g over 2 years
    I just wanted to add. If you don't want to see the volume after that, you can remove the letter in same diskpart. Select the volume and then just type remove
  • H2-san
    H2-san over 2 years
    This works extremely well for cleaning up after any EFI-capable distro (such as Ubuntu) on an active system and stopped tricking my UEFI system. Thank you so much - this MUST be accepted as the answer, @mrolive
  • Josh Zwiebel
    Josh Zwiebel about 2 years
    this works perfectly
  • ianaz
    ianaz about 2 years
    Thanks! I can tell it works for Windows 11 as well
  • Admin
    Admin almost 2 years
    thanks, this worked
  • Admin
    Admin almost 2 years
    Great Solution!