Installed windows after linux

Linux Developer Space

October 11, 2017

As you know, the most common, and probably the most recommended way of dual booting Ubuntu and Windows is to install Windows first and then Ubuntu. But what if you want to install Windows second on a computer with Ubuntu/Linux already installed?

This guide assumes that you have Ubuntu already installed on your system, and will guide you through installing Windows 7/8/8.1/10 when you have a working Ubuntu/Linux partition.

The problem here is that the Windows installer tends to overwrite Grub bootloader or whatever making only the Windows installation bootable. But the good news is that your Linux partition is untouched, including the original bootloader and the other Grub configurations. So restoring or recovering Grub is just a matter of running a few commands on the terminal.

Install Windows on a Separate Partition

If your Ubuntu installation occupies the entire hard drive, to be able to create free space for the Windows installation, you may have to shrink an existing partition using a disk utility like GParted. GParted comes preinstalled on Ubuntu LiveCD.

Boot into a Windows installation media and complete the installation

Once installed, because of Microsoft’s false assumption that there are no non-Microsoft operating systems you’ll be taken straight into Windows.

Restore / Reinstall Grub 2 with a Ubuntu Live Media

  1. Now boot into a Ubuntu Live/USB or CD.
  2. Open a terminal. (Ctrl + Alt + t)
  3. Use a command like lsblk, blkid or GParted to identify your Linux root, and boot partitions. You may or may not have a separate boot partition.

Find Linux Partitions

/dev/sda1 is the Linux boot partition

/dev/sda2 is the Linux root partition

/dev/sda3 is the Windows partition

Setup a Chroot Environment

Now we’ll be repairing our old grub bootloader in a chroot environment.

Mount your root filesystem under /mnt

If you’re using BTRFS (New Linux B-Tree File System) instead of EXT4, the above command should change to sudo mount -t btrfs -o subvol=@ /dev/sda2 /mnt/

Run ls /mnt to verify that the correct partition is mounted. It should list the content of your root.

Mount the boot partition. (SKIP if you don’t have a separate boot partition)

If you have an EFI partition you should mount that also. It is basically a small FAT32 partition around 100mb. Please refer to the section on how to reinstall Grub in an EFI system.

Bind these directories, so grub can detect other operating systems, like so.

Let’s chroot into our existing Ubuntu/Linux system on the hard disk.

Once you’ve successfully reinstalled Grub, restart the computer. On next reboot Grub will be the default bootloader and you’ll be presented with a list of operating systems to choose from (Ubuntu and Windows, of course).

Reinstalling Grub in an EFI Based System

Reinstalling Grub bootloader in a UEFI based computer is no different from installing Grub on a legacy BIOS system. Here we also mount the EFI partition before chrooting, as we’d do with the boot partition.

Case #2

Here /dev/sda1 is the EFI partition and /dev/sda2 is the root.

Mount EFI partition under ‘/mnt/boot/efi’

Forgetting to do so will result in errors being thrown while trying to execute grub-install: “/boot/efi does not appear to be the EFI partition”

As shown previously, bind the /dev , /dev/pts , /proc , and /sys directories.

In some rare occasions, Grub might not detect Windows. In that case just login to Ubuntu (installed one on the disk, not the bootable Live USB/CD) and execute,

9 responses

Just wanted to give you a heads up. I recently followed your guide for repairing Grub after installing windows but wanted to let you know I had to deviate due to a typo I noticed. I worried someone else might make a catastrophic mistake if they didn’t notice so I’m letting you know.

In the section about Reinstalling Grub in an EFI based system, the example under “Mount EFI partition under ‘/mnt/boot/efi’” says to mount /dev/sda2, when I believe it should actually be /dev/sda1, according to your system layout shown earlier.

It’s possible I’m wrong, I’m not extremely well versed, but changing it worked for me and it looks like following the guide to the tee would result in installing Grub in the wrong partition.

Kane – June 19th, 2019

Thanks for the heads up. I fixed the typo that you pointed out.

Gayan Weerakutti – June 20th, 2019

I need your help. I have both Linux mint and Ubuntu installed on my system. I had Windows 8.1 before and I tried dual booting with Linux mint, I failed so I ended up with just Linux mint because i really wanted it. I installed Ubuntu later on, but I don’t like it.

The problem now is that there are applications I need to use which only support windows. I want to reinstall windows 8.1 on the Ubuntu partition but I keep getting error 0xc000000f. I do not mind doing a clean install of windows and dual boot later, but I’m stuck with that error. Please help.

Bongi – December 15th, 2019

It’s hard to tell without knowing the exact error, your partition scheme, when and how you got it. But what I’d do is to install GParted on Linux Mint. Then would create, and format partitions as necessary to install Windows. Find out if you’re currently using BIOS or UEFI. Boot into your Windows installation media in the same boot mood. Then would follow this article to recover Grub.

Gayan Weerakutti – December 15th, 2019

Thanks for the how-to. Worked like a charm.

MJ Patterson – February 12th, 2020

This has been so helpful for me ! Thanks a lot

Anonymous Coward – April 19th, 2020

Hi, In the case of a separate /home partition, should we also mount it? Thanks, Nivs

Nivs – May 2nd, 2020

Not it’s not necessary to mount a /home partition or any other partition that is not mentioned in the post.

Gayan Weerakutti – May 2nd, 2020

Hi, have very little knowledge but a new laptop came with ubuntu installed I would like windows 10 which I have just purchased but it does not install saying unable to use this file type? I cannot create a suitable partition for the install any ideas please?

Pete – May 16th, 2020

Leave a comment

© 2021 Gayan Weerakutti, unless otherwise noted.

Установка Windows после Ubuntu 18.04

Всем привет! Хочу поделиться опытом по установки windows после ubuntu, с возможностью оставить загрузчик GRUB и вашу версию Ubuntu.

Вообще я очень люблю Linux, и когда я только с ним познакомился, не совсем понимал его особенности, но все как говориться приходит с опытом. Не давно я купил новый компьютер и по старой традиции решил установить на весь жесткий диск Ubuntu, за долгое время работы на Linux я абсолютно разучился делать что то серьезное на Windows, я думаю что есть люди которые меня поймут)) В какой то момент мне понадобился Adobe XD для UX и UI дизайна мобильных интерфейсов, но вот задачка он идет только на MAC И Windows.

Первые проблемы от монтирования коренного dev/sda1

Перед установкой загрузчика windows нужно разметить диск, есть стандартная и пожалуй лучшая утилита GParted. Для начала нужно разметки диска его нужно от монтировать sda1, и тут возникает ошибка:

В этой ситуации я пробовал от монтировать его через терминал использую различные методы прочитанные в интернете, но все оказалось без полезно. Дело в том что это- корневой диск, и на нем запущен процесс, если бы у меня было несколько разделов, то все должно было бы получиться. Я так же пробовал использовать swap подкачку, но и это не дало результатов, кто то скажет «чувак это можно сделать через BIOS». Да согласен но моя версия BIOS старая и на ней нет возможности вносить изменения в жесткий диск.

Самый простой и безотказный способ создать новый раздел

Не доводя дело до фанатизма я смекнул, что будет если установлю еще одно версию Ubuntu, с помощью установщика выделю отдельный раздел, после установки форматирую его, поменяю файловую систему раздела под windows, и наконец установлю загрузчик windows. Ну как вам идейка? По моему не плохо.

Установка еще одной версии Ubuntu и создания нового раздела

Для начала выберите версию ubuntu, посмотрите их здесь После того как вы загрузите iso файл, его можно распаковать с помощью стандартной программы ‘ загрузочный диск ‘. вам тут даже флешка не нужна, но рекомендую на нее записать iso файл, позже я скажу зачем.

Теперь когда вы при установки Ubuntu дошли до раздела, » разметка жесткого диска » Выберите сколько места вам нужно в разделе sda2. После установки ubuntu, в утилите GParted вы увидите 2 раздела, sda1, sd2. Скорее всего новый раздел будет sda2, вам нужно будет выбрать пункт в меню GParted ‘ форматировать в ‘.

На рисунки выше показан формат ntfs, он как раз рассчитан под файловую систему windows.

Загрузчик Windows

Теперь возьмите другою флешку, и запишите на нее iso файл, для распаковки iso файлов под linux существуют различные утилиты. например DD, UNETBOOTIN, ETCHER, YUMI, но так как у моей сестры был windows, я не стал сильно в них разбираться и воспользовался Rufus. Эта утилита идет только на windows, но она самая простая в использовании, очень важный момент при записи загрузочного диска ubuntu, на рисунки ниже показано как должны выглядеть настройки, потому что вы с linux на windows записываете, а не на оборот, иначе при запуски загрузчика windows, BIOS его не уведет ubuntu, и не забудьте в BIOS указать приоритет USB.

Куда пропал GRUB после установки windows

Когда вы начали установку Windows не забудьте установить его рядом с ubuntu в раздел 2, не небу подробно говорить об установки windows. Я расскажу о том как вернуть GRUB, так как вы установили windows при включении компьютера, он вам почему то не предлагает выбрать операционную систему, а автоматически заходит windows. Помните я говорил о первой флешки, тут то она и нужна, есть 2 варианта. Первый выделить 10-15 GB под вторую Ubuntu, а после установки форматировать этот раздел, второй вариант, если же основная ubuntu для вас не важна, просто установите ее заново рядом с windows.

Надеюсь эта статья была для вас полезной, если вам что то не понятно или у вас есть способ на много проще, пишите обсудим

Данная статья не подлежит комментированию, поскольку её автор ещё не является полноправным участником сообщества. Вы сможете связаться с автором только после того, как он получит приглашение от кого-либо из участников сообщества. До этого момента его username будет скрыт псевдонимом.

Can’t boot windows after linux install

Replies (5) 

Was this reply helpful?

Sorry this didn’t help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

1 person found this reply helpful

Was this reply helpful?

Sorry this didn’t help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

From your booted Linux system, use the following command in a terminal:

This should detect Windows 8.1 and add it or fix it.

If nothing happens, boot from the Windows 8.1 CD and go to recovery console:

As you are in the recovery mode, use Windows 8.1 fix boot errors tool. (Forgot the exact name of the tool) and reboot.

Now you would have Windows but not Linux.

Try reinstalling Linux — put MBR partition into sda (as opposed to sdb like before) or try sudo update-grub from the live CD.

3 people found this reply helpful

Was this reply helpful?

Sorry this didn’t help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How to install Windows after installing and deleting Linux

After installing Linux Mint I formatted my HDD (using the bootable usb linux mint’s partition manager Gparted) (ntfs formatted). The reason was that I want to install windows. I have my bootable windows usb which booted up fine before installing linux mint. The error that I get now is something like: SYSLINUX . Copyright Peter.

So in other words, I can’t get the windows installer to boot up after installing Linux Mint and after deleting it by formatting it to ntfs.

3 Answers 3

Seems like you are still booting from the hard drive and not starting the windows dvd. You have to change boot priority of the dvd drive (or usb drive in case you want to install from that) to be before the hard disk in the bios/uefi.

You just have to do a fresh install like normally, give priority to USB drive from BIOS or . After that format all the hdd, cancel all the possible partitions found and start the installation. The actual OS that is on HDD doesn’t really matter if you format the hdd

Since this question already has multiple answers and they all point to the same thing, here’s a generic guide to change boot device priority:

  1. Get into your BIOS. This is usually done by pressing DEL key repeatedly right after the unit starts. If that does not work, try f2 or TAB key, though you can usually read it as it flashes quickly on the screen.
  2. Navigate using your arrow keys. Go to your boot settings/menu.
  3. Look for a list of boot devices. This may be inside of a menu option or it may be shown up front.
  4. Change boot order. It might be by numbering, or might be tabbing or using arrow keys, or using f5/f6 (Phoenix on laptops). Place flash drive on top of the list, or above the hard disk drive (whichever you prefer). In case of numbering, give the flash drive a higher priority than the hard disk.
  5. Boot up and do your thing. Install/Delete OS’es, or just booting from an external device. Your call.

tl;dr. If this does not help, a quick search of your BIOS manufacturer and version should give more info.

Читайте также:  Sim manager для windows
Оцените статью