Restore Grub After Windows Install

If you install in Legacy mode and then delete the Ubuntu partition You'll most likely end up in a grub rescue prompt on the next boot. You'll need a bootable recovery disk (either Windows or Linux) to help you restore your Windows boot sector. Here is a similar question that can help in this case. HOWTO Restore GRUB After Installing Windows by Bob Kashani on Oct 19, 2004 (UPDATED 2004-12-15). If you're like most people you probably have a dual boot system which allows you to boot into either Linux or Windows.

This week they released the RTM Version of Windows 10, and I decided to install it on my laptop. Most of my development is done on my desktop Mac at home, but the laptop is good for collaborating, coffee shop coding, etc. I decided Windows 10 and Visual Studio 2015 would be good for this. There’s only one issue: I also have Arch Linux on this laptop, and it’s dialed in very nice and I definitely don’t want to remove it.

Restore Grub After Windows Install

Restore Grub After Windows Install

I haven’t upgraded Windows on this machine since I put Windows 8.1 on it over a year ago, so I never had to deal with the issue of fixing grub. It is slightly different from other distributions, and there is no “boot repair” yet. I decided to Google a few things and figure out how to restore it but didn’t find a complete article on it, so I decided to write one. I installed Windows 10 on the machine without changing any of the partition data, and that’s crucial. After doing that it would only boot into Windows 10, so here’s what I did.

1. Download an Arch Linux ISO

Download a live ISO for Arch Linux here. If you’re using Windows, LiLi is a great free tool for creating bootable Linux USBs.

Install and run Docker Desktop on Mac 🔗 Double-click Docker.dmg to open the installer, then drag the Docker icon to the Applications folder. Double-click Docker.app in the Applications folder to start Docker. (In the example below, the Applications folder is in “grid” view mode.). Installing Docker for Mac OS The first thing SQL developers should do is installing the Docker Desktop app on Mac OS. The installation steps are well described at docs.docker.com web portal. In fact, all you will do is downloading the application provided by Docker Desktop for. Download Docker on Mac OS X Go to the docker hub page to get the community edition of the Docker. Click the Get Docker link from the browser or use the command to download the files from Url in the downloads folder. % cd Downloads. Docker install for mac First install Docker Desktop for Mac. One thing to note, though: Both Vagrant and Docker-Machine (or Docker for Mac) run a virtual machine (VirtualBox in most cases) that will block some of the host system's resources. Depending on how you scale that VM, you. Learn why Docker Desktop is the preferred choice for millions of developers building containerized applications. Download for Mac or Windows. Simply install from a single package and have your first containers running in minutes. You get certified Kubernetes and Docker, for developers of all levels of container expertise.

Windows

boot to this USB drive and you’ll be taken to a command prompt.

2. Restore Grub

This assumes of course that you were using GRUB to begin with, but here’s how to restore it.

Find the partition your Linux is installed on:

You’ll see something like this:

In my case my Linux installation is at /dev/sda4. Note where yours is, then exit this application.

So mount your Linux partition:

Then, change root with this command (specific to Arch Linux)

and restore GRUB:

And yes, it does detect Windows 10 properly.

After you reboot, you’ll see your familiar boot screen again:

And you can now boot into Linux (or Windows) again.

Configure Grub

Now if you’re like me (which you probably are if you’re reading this blog) you will be bothered that it incorrectly says “Windows 8” or whatever your previous version was. This is easy to fix by editing some entries in your Grub configuration:

Restore Grub After Windows Install

Make a backup of your grub.cnf

Recover Grub

Edit the file:

Look for the Windows 8 or Windows 7 entry in the file:

Restore

and change it to whatever you want. Then reboot. Now it should look like this:

This is how I have mine set up. If you’d like to learn more about GRUB menu options click here

Summary

This is how you can restore your dual boot options if you reinstall or upgrade Windows on a dual boot Arch Linux system. I have heard of people just reinstalling Linux afterword, and it’s a terrible idea unless you were going to change it anyway. It only takes a few minutes to fix.

A note about Arch Linux:

As I said in the article I have Arch Linux installed and it’s “dialed in” meaning I have a nice system compiled with only what I need, lean custom kernel, and my development environment is all set up. I wouldn’t advise an Arch install to everyone, but it has been fantastic for me personally. It runs very fast and reliably and it’s easy to update everything.

Restore Grub After Windows Install

If you’re looking for a new Linux distribution or just want to escape the Ubuntu crowd, you should give it a try. It has a steep learning curve as you’ll need to know Linux really well, or be able to follow the directions explicitly, but if you do you’ll find a nice solid system that’s fast and lean.

-Jeremy


Published: Aug 1, 2015 by Jeremy Morgan. Contact me before republishing this content.

I had made a partition backup of a machine using Clonezilla and wanted to restore it. The restore was successful but because I had only restored the partitions rather than the full disk Grub was not installed in the MBR. Without Grub in the MBR the system failed to boot.

I mounted the new filesystem to /mnt while still using the live Clonezilla disk that I had used for the backup. Then I chrooted using the following command

chroot /mnt

then while in the chroot I attempted to reinstall grub, and since this was a Cloudlinux/Centos install I performed

grub-install /dev/sda

But grub-install complained that it couldn’t find /dev/sda or that /dev/sda was not a valid block device. So then hunting around on the internet for a little bit I came across this article which showed basically how to ensure that your current live

  • /dev
  • /sys
  • /proc

Restore Grub After Windows 10 Install Manjaro

filesystems are accessible inside of your current chroot.

So I ran the following commands outside of the chroot before entering it again.

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

Then I chrooted to /mnt again and ran my grub-install command and all was well. The machine booted perfectly after that.

Shameless Plug

If you need to repartition or reformat a drive. Or resize partitions and check the health of your drive for Linux or Windows based machines give Parted Magic a try. It takes your favorite open source tools and puts them in an easy to use bootable linux CD. It has become my goto tool for all hard drive management tasks.