Unable to boot into Windows after installing Ubuntu, how to fix?

I installed Windows on my computer, followed by an installation of Ubuntu. However, now I’m unable to boot into my Windows install.

What can I do to fix this?

Asked By: Vishnu Bathala

||

There is no way to undo the partition changes to Windows. You will have to reinstall or recover Windows, then reinstall Ubuntu.

First, try running Boot-Repair(info) and see if this helps. To run this:

  1. Boot from a Ubuntu live DVD or USB.

  2. Type these lines in the terminal one line at a time.

    sudo add-apt-repository ppa:yannubuntu/boot-repair
    sudo apt-get update
    sudo apt-get install boot-repair
    
  3. Search for Boot-Repair in the Dash and launch it.

    enter image description here

To fix your computer with Boot-Repair, simply click the “Recommended Repair” button. If it worked, you are done.


If Boot Repair didn’t work, run a repair with a Windows Recovery CD (ask for one from your PC manufacturer).

  1. Boot from a recovery CD. You should see this.

  2. Open the Command Prompt app and type bootrec /fixmbr.


    (images from HowtoGeek)

  3. Close the Window and choose “Startup Repair” this time. Wait until the process is completed. It usually takes about 30 minutes-2 hours.

If Windows is successfully repaired, you are done. If it is not, you will have to reinstall Windows with a Windows Installation CD.

If you don’t have a Windows Installation CD, you could boot an Ubuntu live DVD/USB and install a bootloader with equivalent function to the Windows bootloader.

sudo apt-get update   
sudo apt-get install lilo  
sudo lilo -M /dev/sda mbr  

Lilo will give you a warning after it’s installed, but you can ignore that as lilo works fine when it is used as a Windows style bootloader.


Next, after Windows is installed or recovered, you will have to delete the Ubuntu partitions. Identify them and delete it with the Disk management Utility in Windows.

enter image description here

After that, reinstall Ubuntu the same way.

Answered By: Emerson Hsieh

I am going to make some assumptions:

  1. That Windows is installed and configured to boot via UEFI.
  2. Ubuntu is installed and configured to boot via UEFI.
  3. You’re currently seeing the grub menu at boot.

If any of those assumptions is false, then the following advice will not help you (though it won’t hurt anything either):

Create a file, /boot/grub/custom.cfg (by running sudo -H gedit /boot/grub/custom.cfg) with these contents:

#This entry should work for any version of Windows installed for UEFI booting

menuentry "Windows (UEFI)" {
 search --set=root --file /EFI/Microsoft/Boot/bootmgfw.efi
 chainloader /EFI/Microsoft/Boot/bootmgfw.efi
}

(Copy and paste the above into the Gedit window that comes up, then save and quit Gedit)

Reboot and you should see an entry titled “Windows (UEFI)” and if you select it then Windows should boot. If that does not work, please run boot info script (http://bootinfoscript.sourceforge.net/ ) and post the RESULTS.txt that it produces so that I have the information needed to give you proper advice.

Answered By: Jordan Uggla

Boot-Repair will take care of this.

First open a new Terminal, then type:

sudo add-apt-repository ppa:yannubuntu/boot-repair
sudo apt-get update
sudo apt-get install -y boot-repair
boot-repair

Boot-Repair

See also reference and how-to for this tool

Answered By: Vishnu Bathala

Some secure boot machines cannot seem to boot Windows from grub.
A workaround is to provide a different set of EFI files for each type
of boot, putting the second set for Ubuntu on a USB stick, and
leaving the EFI files on the hard disk for Windows.

You have a working Ubuntu set of EFI files already on the
hard disk, so take a (small) USB stick (empty, as you will lose all data
on it), put a GPT partition table on it, and make a 250M partition for
the EFI files. Copy the hard disk’s EFI files to the stick. They will
appear in the /boot/efi directory, under the directory EFI.

Take the EFI
directory and all its contents, and put it on the USB partition.
I’d suggest editing the stick version of EFI/ubuntu/grub.cfg to change
the name of the menu item “Ubuntu” to “Ubuntu on USB” or something to
make it obvious which set of files you are booting with.

Now
try booting from the USB, and see if you get the altered menu item,
and that it works. When the USB boot is working, you may simply go
to /boot/efi/EFI/Boot, which should be the hard disk’s EFI partition, and
it should contain copies (possibly with different names) of the Ubuntu
versions of the boot files, which should also be in /boot/efi/EFI/ubuntu.
Use md5sum to confirm that you have copies of all files which are in
/boot/efi/EFI/Boot, because you are going to delete them! Copy and
rename the file /boot/efi/EFI/Microsoft/bootxmgfw.efi to /boot/efi/EFI/Boot/bootx64.efi
and you should be able to boot windows from the hard disk again — remove
the stick and try the Windows boot.

When you update the kernel, and get a new grub.cfg generated on the hard
disk (unused, since the hard disk boots only Windows), you will have to
copy it yourself to the USB stick’s EFI/ubuntu/grub.cfg.

Hopefully, at some point, the issue of grub not booting Windows on your
machine will be fixed, and you can simply replace the hard disk’s EFI/Boot
file with the ones on the stick’s EFI/Boot.

Just make sure you have copies of anything you delete, so you can replace them
if necessary. This technique worked for me on a Toshiba.

Answered By: ubfan1

First we will bring back the windows MBR then we will reinstall the grub and bring linux back

Fixing Windows MBR(You can either go for solution 1 or solution 2 both works)
Boot Linux and make sure you’ve a working Internet connection and type the following on the terminal.

1. Solution

sudo apt-get install syslinux

If the package got installed, use the following command to write the MBR:

sudo dd if=/usr/lib/syslinux/mbr.bin of=/dev/sda

2. Solution

sudo apt-get install mbr

If the package got installed use following to write the MBR.

sudo install-mbr -i n -p D -t 0 /dev/sda

Common for both

Replace sda if you want to install the MBR to a different drive. Do not put sda1,sda2, or sda3. Just put it as sda for the hard disk.

Next we need to install the grub,rerunning the boot-repair will fix this and reinstall grub.Reboot and both will work

Answered By: Stormvirux

All the options that you have tried seem to be for Windows 8 in mbr mode,
but you are using UEFI, so you should repair UEFI partition; when my windows bootloader got corrupted,
i tried the following command.

bcdboot c:windows /s f: /f ALL

here c:windows is the location of the windows folder on the windows (c:) partiton.

/s is an option which allows to install the UEFI bootloader files on the UEFI System Partition , which is fat32 formatted and in my case was (/dev/sda4 ) so f:

(f: is the letter of the uefi partiton)

after this command has executed you would get installtion successful/failed

This should re-install your windows 8 boot code in the UEFI partition.

This command i had tried when booting from the repair disk and select advanced option and then command line repair.

You can create a recovery disk by by going in the control panel, and choosing backup and recovery -> create recovery disk/usb or you could borrow it from someone.

PS.
If you have not already tried, then you could try all the options displayed in your grub menu, particularly refind, which automatically detects all UEFI OS.
You could also try all the windows entries in the grub menu to check if any one of them works.
Then you could switch your uefi mode to BIOS from your BIOS menu at system startup and then checkout what options its displaying there, and if any of them work.

Answered By: abchk1234

Follow these steps:

  1. Open terminal by pressing Ctrl+Alt+T Or Search Terminal in Dash.

  2. Enter the following command in Terminal:

    sudo -H gedit /etc/default/grub
    

    (This will open grub configuration file in gedit.)

  3. Edit the file and change following options as following (remove comments # before any of below lines) and save the file:

    GRUB_DEFAULT=0  
    GRUB_HIDDEN_TIMEOUT=0
    GRUB_HIDDEN_TIMEOUT_QUIET=false
    GRUB_TIMEOUT=10  
    
  4. Run the following command in new instance of terminal:

    sudo update-grub
    
  5. Restart your computer, you should be now able to boot Windows if you partitioned your system correctly

Answered By: Faizan Akram Dar

Press and hold Shift during booting this should bring you the Grub Menu. Or if you just want the menu to appear always then edit your /etc/default/grub file

sudo gedit /etc/default/grub

Insert “#” at the start of the line GRUB_HIDDEN_TIMEOUT=0.

Now save then run:

sudo update-grub

This should be fine to make Grub menu appears on every boot.

It’s better to take a look for this GRUB wiki https://help.ubuntu.com/community/Grub2

Answered By: Maythux

Make sure you boot in UEFI mode. Use sudo efibootmgr -t nn to utilize your EFI’s menu. You can choose Windows Boot Manager or ubuntu (GRUB).
NOTICE: Windows will erase GRUB installation at its own EFI system partition each time BOOTMGR is updated.

Answered By: Erkin Alp Güney

If you are using Bitlocker, you probably made some changes to the partitions right before installing Ubuntu (like freeing up unallocacted space for the Ubuntu installation), then you may get that problem because GRUB cannot deal with the security prompt that appears when starting windows that asks you for the bitlocker recovery key.

I had almost the same problem after installing Ubuntu 16.04.02 alongside Windows 7. Ubuntu would start fine, but after choosing the Windows 7 loader from GRUB, the screen would show some strange pattern of regular multicolored skewed lines and stay stuck there until the processor fan would turn on and hot and I decided to shut down the computer to avoid damage.

Salvation came from using Hiren’s Boot CD and using the Boot Windows 7 option in the main menu therein, which allowed me to get to the prompt for the bitlocker recovery key, enter the key, suspend and resume bitlocker in my windows session, and use my dual boot system as intended afterwards.

Answered By: kdarras

GRUB menu does not appear

If the computer boots into Ubuntu automatically without showing the GRUB menu at all, sometimes you can press the manufacturer’s BIOS/UEFI key at boot time and while in UEFI or BIOS mode from the firmware menus select the operating system you need. Common keys used are Esc, Delete, F1, F2, F10, F11, or F12. On tablets, common buttons are Volume up or Volume down. During startup, there’s often a screen that mentions the key. If there’s not one, or if the screen goes by too fast to see it, check your manufacturer’s website.*

If this doesn’t work when the GRUB menu does not appear at boot time, immediately after the motherboard / computer manufacturer logo splash screen appears when the computer is booting, with BIOS, quickly press and hold the Shift key, which will bring up a GNU GRUB menu screen. With UEFI press (perhaps several times) the Esc key to get to the GNU GRUB menu screen. Sometimes the manufacturer’s splash screen is a part of the Windows bootloader, so when you power up the machine it goes straight to the GNU GRUB menu screen, and then pressing Shift is unnecessary.

If this doesn’t work when the GRUB menu does not appear at boot time, then try the answers to:


Boot Repair

From Ubuntu open the terminal and type:

sudo add-apt-repository ppa:yannubuntu/boot-repair  
sudo apt update  
sudo apt install -y boot-repair
sudo boot-repair  

Open the Boot Repair application and select Advanced Options -> Other Options tab -> Repair Windows boot files. The boot flag should be placed on the same partition on which Ubuntu is installed. The partition on which Ubuntu is installed can be identified from the Disks application which is built-in in Ubuntu.

enter image description here

If you’re unable to select the Repair Windows boot files option because it’s grayed out, refer to this answer.


Rescatux

Rescatux is a free bootable live CD/USB that can repair GRUB and the Windows bootloader. Rescatux has a graphical interface with a menu of operating system rescue tasks. If your hard disk has the MBR partitioning format, you can select the Restore Windows MBR (BETA) option to repair the Windows bootloader. If your computer has UEFI firmware, you can select among the UEFI boot options.

Boot options:

  • (>=0.41 beta 1) Update UEFI order
  • (>=0.41 beta 1) Create a new UEFI Boot entry
  • (>=0.41 beta 1) UEFI Partition Status
  • (>=0.41 beta 1) Fake Microsoft Windows UEFI
  • (>=0.41 beta 1) Hide Microsoft Windows UEFI
  • (>=0.41 beta 1) Reinstall Microsoft Windows EFI
  • (>=0.41 beta 1) Check UEFI Boot

GRUB options:

  • (>=0.40 beta 11) Easy GNU/Linux Boot Fix
  • Restore GRUB and GRUB2
  • (>=0.31 beta 4) Update any GRUB2 menu
  • Update Debian/Ubuntu GRUB menus

Windows options:

  • Restore Windows MBR (BETA)
  • Clear Windows passwords
  • (>=0.31 beta 4) Promote a Windows user to Administrator role
  • (>=0.41 beta 1) Reinstall Microsoft Windows EFI
  • (>=0.31 beta 4) Unlock Windows user

Password options:

  • Change GNU/Linux Password
  • Regenerate sudoers file
  • Clear Windows passwords

Expert tools:

  • Boot-Repair
  • GParted
  • OS-Uninstaller
  • Clean-Ubiquity
  • PhotoRec
  • TestDisk

enter image description here
Rescapp is a nice wizard that will guide you through your rescue tasks.


How to make a Rescatux live USB from Ubuntu

  1. Install GParted partition editor with sudo apt install gparted.

  2. Insert a USB flash drive and check if the boot flag has been enabled on the flash drive using the GParted application. Unmount the USB flash drive. Open GParted and select the USB flash drive from the menu list of drives. From the GParted menu select: Partition -> Manage Flags -> check boot.

  3. It is very important to verify that the device that you are installing the Rescatux live USB to is indeed your flash drive, so that you don’t overwrite any of your system or personal files which may make your operating system unbootable. In Ubuntu you can find the device name of the flash drive using the Disks application.

  4. Unmount the USB partition device. Let’s say the USB partition device is /dev/sdc1

     sudo umount /dev/sdc1 # replace sdc1 with the partition name of your USB drive
    
  5. Change directories using cd to the path of the directory where the Rescatux iso file that you downloaded is located.

  6. Write the Rescatux iso file to the USB flash drive. In the following command replace rescatux_0.xxxx.iso with the name of the Rescatux iso file you downloaded.

     sudo dd if=rescatux_0.xxxx.iso of=/dev/sdc # this command also works in Windows Subsystem for Linux 2 
     sudo sync  
    

I have also been able to make a Rescatux live USB using the built-in Startup Disk Creator app.

Windows 10/11 factory reset repair of the Windows bootloader

source

Open Settings

On the pinned apps section on the left side of the Start menu, locate the Settings app. It’s typically represented by a gear icon. Click the Settings app to open the Windows Settings app. You can also select the Settings app from the app list. Under Settings, click Update & Security to continue.

Choose Recovery Options

Click the Recovery tab and select Get started under Reset this PC.

Save or Remove Files

At this point, you have two options. You can either choose to keep your personal files and only remove downloaded apps and settings, or you can wipe everything and start from scratch. Each choice will also give you an additional setting to change.

If you choose Keep my files, apps and settings will default to what they were when the PC was brand new. This setting can be turned off by clicking the Change settings link and switching it off. If you choose Remove everything, there’s also a way to remove your personal files while saving apps and settings. Click the Change settings link and toggle the Data erasure option to on.

Reset Your Computer

Once you decide what should be removed from the computer, hit Next and Windows will tell you what will be deleted before you make a final decision. If you selected Keep my files, you can look at a list of apps that will be removed with the reset.

Finally, click Reset to actually commit. Your computer will restart, and after several minutes, it will boot back up again. When you return to Windows, you’ll see that whatever you selected to be removed has been wiped from the machine. If you backed up your files, they can now be restored to the machine.

Answered By: karel

The already installed Windows OS wasn’t detected when you installed Ubuntu. os-prober from the default Ubuntu repositories detects other OSs available on a system and outputs the results in the terminal. If os-prober doesn’t work, check if the command sudo fdisk -l is able to find the Windows partition.

If you found the Windows partition then type sudo update-grub . sudo update-grub updates the GRUB bootloader and corrects incorrect entries. This command solved my problem which is shown below.

sudo update-grub && sudo reboot updates the GRUB bootloader and reboots.

I installed Ubuntu alongside Windows 10. Now I can’t see the option to
start Windows in the GRUB boot menu.

Note: the partitions still exist.

enter image description here

Answered By: Karim Mokhtar

If the OSs were installed in different modes, dual booting Windows and Ubuntu can’t work. If your Windows is installed in BIOS mode, it is recommended to install your Ubuntu in BIOS mode, but if it’s installed in UEFI mode, then do the same with Ubuntu. The easiest way to find out if you are running UEFI or BIOS is to look for a folder named /sys/firmware/efi. The folder will be missing if your system is using BIOS.

enter image description here
          BIOS vs. UEFI

If you have installed Ubuntu in legacy mode on the same drive with GPT partitioning, you can use Boot Repair’s Advanced options to uninstall grub-pc and install grub-efi-amd64. That converts the Ubuntu installation from BIOS boot to UEFI boot, the same firmware as most recently manufactured laptops with Windows pre-installed have.

Converting Ubuntu into UEFI mode

  1. Start Boot-Repair, and select Advanced options -> GRUB location tab.
  2. If you do not see a Separate /boot/efi partition option, this means that your PC does not have any UEFI partition.
  3. If you see a Separate /boot/efi partition option, put a checkmark in the checkbox to the left of it, then click the Apply button in the lower right corner.

    enter image description here

  4. Set up your BIOS so that it boots the hard drive in UEFI mode. The way to adjust this setting depends on the specific model of the computer, but generally this setting is located in the boot priority settings under the Boot tab of the BIOS/UEFI setup utility.

For more information about converting Ubuntu into UEFI mode review https://help.ubuntu.com/community/UEFI in the section about Converting Ubuntu into UEFI mode.

The grub bootloader can also be converted in the opposite direction from UEFI to BIOS. Linux can boot fine from a GPT disk in BIOS mode. See this question: Convert from EFI to BIOS boot mode

Answered By: Boris

Method1

1.Enter Windows recovery mode by pressing “esc“(may be different way on your computer) while booting.

2.Click on “Troubleshoot

3.Click “Advanced options

4.Choose “Command Prompt” 

5.Type the following commands: 

bootrec /fixmbr
bootrec /fixboot
bootrec /scanos
bootrec /rebuildbcd

6.Now restart your computer

Good if this works for you, if not then try

Method2.

1.Use Rufus to make Ubuntu live USB drive and boot into Ubuntu.

2.Start terminal type

sudo fdisk -l

3.Note down the root partion of linux installation.
Example: (/dev/sda8) in my case.
and your boot partion which is indicated by *
sign.
Example : (/dev/sda6) in my case.

4.Now mount your root partion to make some changes and some binding.
Below replace “/dev/sda8” with your root partion.

sudo mount /dev/sda8 /mnt
sudo mount --bind /dev /mnt/dev
sudo mount --bind /proc /mnt/proc
sudo mount --bind /sys /mnt/sys

5.Now change the root directory from usb drive to the hardrive’s root directory

sudo chroot /mnt

6.Now install the grub to the boot partion of your’s, which you noted down with the * sign
replace “/dev/sda6” with your boot partion.

grub-install /dev/sda6

7.Now type.

exit

8.Unmount partation previously mounted earlier.

sudo unmount /mnt/dev
sudo unmount /mnt/proc
sudo unmount /mnt/sys
sudo unmount /mnt

9.Remove the pendrive and reboot your pc.

And next time while dual booting window and linux refer this answer
Dual boot Windows and linux

Answered By: Prashant Mishra

Make sure that the Windows 10 installation partition is still there and proceed according to this answer:

The default installation of Windows 10 requires a minimum of 4
partitions:

  1. sda1 (Recovery)
  2. sda2 (For computers that boot in EFI mode the EFI System Partition (ESP) is normally mounted at /boot/efi.)
  3. sda3 (MSR)
  4. sda4 (Windows OS, usually “C”)

If the /boot/efi partition or the MSR partition has been damaged
or deleted during the Ubuntu installation, you might not be able to
see Windows in grub. Try the following command in Ubuntu to show all
the available partitions:

sudo lsblk -o NAME,FSTYPE,SIZE,MOUNTPOINT,LABEL

It should give you an idea of what happened to your system and allow
you to check if all the partitions are still there. You might try to
repair Windows with the Windows installation DVD/USB.

You can try to install the Grub Customizer application and see if Windows is available in
the list:

sudo add-apt-repository ppa:danielrichter2007/grub-customizer
sudo apt-get update
sudo apt-get install grub-customizer

Then you can launch Grub Customizer and change which operating systems are available to boot.

Here’s a screenshot of what a correct installation looks like:

enter image description here

Answered By: SIDDHARTH

In my case I made clean install of Windows 7, left some space unallocated on SSD and during subsequent Mint 18.3 install with default “Alongside” option did not got Windows in grub boot menu.

The solution was simple: ran command below in Mint and Windows 7 was added to grub menu along with Memtest btw.

sudo update-grub
Answered By: Alex Martian

I had a similar problem. After changing order of boot in bios, it booted on Windows but only on safe mode. To solve that I did Windows+R->msconfig->boot:normal. And everything was solved. Hope this can help.

Answered By: zeslayer

First try this source:

Insert your Windows installation DVD/USB and boot from it. Choose your language and click Next. When prompted to Install now just look left down to that window and click Repair your computer. Wait and a new window will pop up with the operating systems installed in your PC. Click on Windows 7/8/10 and click Next. In the next window click Command prompt. When the command prompt appears type this:

bootrec /fixboot

Press Enter and type:

bootrec /fixmbr

Press Enter again and then close that command prompt window and restart your PC. Don’t forget the space between bootrec and /.

After that you will no longer have the option to choose between operating systems to boot on startup. You will have to repair grub. You can do that with an Ubuntu live DVD/USB. The easy way is after repairing the Windows bootloader, format the Ubuntu partition(s) and reinstall Ubuntu. To repair grub after repairing the Windows bootloader, try this.

To repair grub:

  1. Boot from the Ubuntu live DVD/USB.

  2. Open the terminal and run sudo fdisk -l to see where Ubuntu is installed.

  3. Run sudo mount /dev/sdaX /mnt where X is the partition number in which you found Ubuntu installed.

  4. Run sudo grub-install --root-directory=/mnt /dev/sda

To install grub:

  1. Run sudo update-grub to update grub, and if this command didn’t work run it after rebooting.

  2. Reboot with sudo reboot.

Note:
For me the command in step 5. didn’t work, so I restarted the computer and after restarting the computer booted directly to Ubuntu, so I logged in as root and ran this command:

update-grub

That solved the problem.

Answered By: Damon Hill

i have a boot fixer too… not (sorry i couldn’t resist 😉

Running the update-grub from live Stick ruined my boot entries.
but let me boot into the installed system. (ubuntu 20.04)

In my simple case I just had to run update-grub again from the installed and properly booted linux system.
which would find the windows bootloader…
and an ‘grub-install’ after would persist it.

I have a triple boot system. so this is becoming a common process.
its not like 10 years ago anymore 😉

Answered By: U.V.

I am going to make some assumptions:

  1. That Windows is installed and configured to boot via UEFI.
  2. Ubuntu is installed and configured to boot via UEFI.
  3. You’re currently seeing the grub menu at boot.
  4. After Windows has been upgrade to 2021 April? Grub Menu disappeared
  5. I use UBUNTU USB BOOTED AND Install Boot-repair and chosen auto-repair
    and successfully install grub menu again.
  6. But fail to boot into Windows 10.

I failed to use Boot-Repair to make Windows 10 to boot successfully.
When Windows attempted to auto repair start up it failed.

Solution that worked for me finally.
(with our using any command line or other programs)

  1. I used
    https://launchpad.net/grub-customizer
    to load up in UBUNTU 20.04.3
    and just click SAVE after it finished loaded.
  2. reboot
  3. go to windows boot in the grub menu.
  4. Allow it to auto repair by itself.
  5. The finished success repaired displayed.
  6. Reboot.

My Windows 10 now booted normally.

Answered By: aimwin
Categories: Answers Tags: , , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.