Reinstalling the GRUB boot loader

It is possible that you'll need to reinstall GRUB at some point after Window$ had force-upgraded itself, and apparently wiped any trace of your Linux installation. Or you might have installed Window$ after installing Linux, despite all the warnings, and now Linux is unbootable. Do not worry, your system is still there, and intact, only there is no way to boot into it just now.

(U)EFI Systems

If you encounter problems on an EFI this Debian Wiki article might have some solutions. Unfortunately (U)EFI implementations are random at best, mostly depending on the manufacturer. This Arch Wiki article has a good collection of vendor-specific (U)EFI implementations and their details, but you need to remember this is an Arch Linux specific page, so some commands might need to be changed for Debian.

Reinstalling GRUB 2 on non-EFI systems

Fortunately reinstalling the Grub bootloader is rather straightforward, and quick. All you need is your original Debian install CD, DVD or USB pendrive.

  • Boot your PC from the installer medium, and select Advanced Options by navigating to it with the arrow keys, then press Enter.

Debian installer GRUB menu

From the advanced menu, you will need to start the installer in "rescuse mode". There are two ways to do this, graphical, or CLI, just like when you have the installed Debian.

  • To continue with the graphical rescue mode, select Graphical rescue mode (who would have thought) with the arrow keys, and press Enter

Debian installer GRUB advanced menu

The installer will start, and go through the same steps as in normal mode. This means it will try to collect information about the hardware and even connect to the network. Don't worry, it will not install anything.

The next steps will be identical to the regular installation steps, in the following order:

  • Select installer language
  • Select location
  • Select keyboard layout
  • Specify hostname
  • Specify domain name

After you've gone through these initial steps, you will be presented with a list of available partition. You will need to select the one on which your Linux installation's root filesystem is located.

Debian installer rescue mode select partition

A typical non-EFI Window$ installation would have created at least two partitions for itself, and if you went with the default options during the installation, your Debian system should occupy two. If that is the case, you should select the one before the last, and click Continue.

Or, ideally, you should remember the partitioning layout. The good news is, you don't actually have to. When you select a partition, the installer will look or an existing Debian (or other Linux) installation. If it cannot find one, you'll get the following error:

Debian installer error

  • Click Continue to go back to the partition selector screen

  • You can continue like this until you find the partition you need. It can be (almost) any working Linux system really, but in this case, it will be most likely your Debian installation.

You will then be presented with further choices:

Debian installer rescue operations

There are a few options here, but one of them is called option called Reinstall GRUB boot loader. Can you guess which one you need to reinstall the GRUB boot loader?

  • Select it, and click Continue

You will then be explained what happens next. Typically, you would have installed GRUB on the MBR of the first disk. It's easy enough to assume that your first disk is called /dev/sda because your first disk will be called /dev/sda.

  • Type /dev/sda into the input field, and click Continue. (Unless you've had GRUB (manually) installed somewhere else, in which case you should probably know what else to write there.)

Debian installer reinstall GRUB

A progress bar will briefly appear, after which you will find yourself in the previous menu. Nothing will tell you that the installation succeeded, but if you are back where you've started from without an error message, you might as well assume it did.

Debian installer rescue options again

  • Select Reboot the system and click Continue to (you guessed right) reboot the system.
  • To continue with the CLI rescue mode, select Rescue mode with the arrow keys, and press Enter.

Debian installer GRUB advanced menu

The installer will start, and go through the same steps as in normal mode. This means it will try to collect information about the hardware and even connect to the network. Don't worry, it will not install anything.

The next steps will be identical to the regular installation steps, in the following order:

  • Select installer language
  • Select location
  • Select keyboard layout
  • Specify hostname
  • Specify domain name

After you've gone through these initial steps, you will be presented with a list of available partition. You will need to select the one on which your Linux installation's root filesystem is located.

Debian installer rescue mode select partition

A typical non-EFI Window$ installation would have created at least two partitions for itself, and if you went with the default options during the installation, your Debian system should occupy two. If that is the case, you should select the one before the last, and press Enter.

Or, ideally, you should remember the partitioning layout. The good news is, you don't actually have to. When you select a partition, the installer will look or an existing Debian (or other Linux) installation. If it cannot find one, you'll get the following scary-looking error:

Debian installer error

  • Select Continue with the Tab key if it's not already selected, and press Enter to go back to the partition selector screen.

  • You can continue like this until you find the partition you need. It can be (almost) any working Linux system really, but in this case, it will be most likely your Debian installation.

You will then be presented with further choices:

Debian installer rescue operations

There are a few options here, but one of them is called option called Reinstall GRUB boot loader. Can you guess which one you need to reinstall the GRUB boot loader?

  • navigate to it with the arrow keys it, and press Enter.

You will then be explained what happens next. Typically, you would have installed GRUB on the MBR of the first disk. It's easy enough to assume that your first disk is called /dev/sda because your first disk will be called /dev/sda.

  • Type /dev/sda into the input field, and press Enter. (Unless you've had GRUB (manually) installed somewhere else, in which case you should probably know what else to write there.)

Debian installer reinstall GRUB

A progress bar will briefly appear, after which you will find yourself in the previous menu. Nothing will tell you that the installation succeeded, but if you are back where you've started from without an error message, you might as well assume it did.

Debian installer rescue options again

  • Select Reboot the system with the arrow keys and press Enter to (you guessed right) reboot the system.

And you're done. GRUB should be restored, your Debian installations should be bootable once again.