Talk:Restore the GRUB Bootloader

From Manjaro Linux
Jump to: navigation, search

New updated simplified proposal Some questions

  • In BIOS setups, if there is a separate /boot does mhwd-chroot auto mounts it along with the rest mounts or does it need to be done manually?



Overview

In order to boot Manjaro, a Linux-capable boot loader such as GRUB, rEFInd or Syslinux needs to be installed to the Master Boot Record (MBR) or the GUID Partition Table (GPT) of the media containing the Operating System. The boot loader used on official Manjaro installations and generaly suggested is GRUB. Sometimes the MBR or GPT gets corrupted, erased or misconfigured for various reasons resulting to a black screen with a failure message during boot, like No boot loaders found in /dev/....

Tip: More information about the boot process on Archlinux based distributions is available at Archwiki

Fortunatelly, there is a way to restore GRUB without re-installing your OS or losing your data. For this, you will need your Manjaro installation media (such as a CD/DVD or USB Flashdrive) and mhwd-chroot, which is a tool to easily run commands as if you were booted to an installed Linux system (chroot=Change Root).

Tip: If mhwd-chroot is not installed in your live media you can install it, after you have booted, with this terminal command:
  • sudo pacman -S mhwd-chroot

Chroot to your Manjaro Installation

1. Insert and boot your Manjaro installation media.

2. Select Manjaro Linux Live

3. Identify the target partition

Tip: You have to identify the partition where your Manjaro installation that controls the active Grub menu resides and which needs repairing.
  • Start an application called GPartEd, which should be in Menu > System > GPartEd. This will provide a simple visual illustration of the partitions on your hard drive(s).
  • To do the same thing from terminal or TTY you can use this command
lsblk -f

Inspect the partition table structure and try to identify the one you need. Note down its name i.e. /dev/sda3

For example, in a usual Manjaro installation you will have something like this:


NAME   FSTYPE LABEL    UUID                                 MOUNTPOINT
sda
├─sda1 fat32  Boot     BE362378362330B7                   
├─sda2 ext4   Swap     97175fff-fd70-4198-9c2c-3f9ef6aedd88
├─sda3 ext4   Manjaro  b2b7c07b-f029-4b56-871d-77f774e6a2ba
└─sda3 ext4   Data     58549d1d-bbb3-40f9-b369-7ccc0468e500

  • /dev/sda1: Boot partition ~500MB or up to 1GB
  • /dev/sda2: Swap partition usually ~4GB
  • /dev/sda3: Manjaro system usually >15GB
  • /dev/sda4: Space for personal files

Start mhwd-chroot from your Start Menu (System -> Chroot) or in your terminal with:

sudo mhwd-chroot

You will be presented with a terminal. Wait until it shows a list with the available system partitions on your computer and choose the one you want to repair.

In our used example you choose /dev/sda3

Restore GRUB

For BIOS Systems

1. Install a new GRUB bootloader with the following command:

grub-install /dev/sda
note: sda is the disk device where you want to install GRUB. It is the disk that your target partition is (without the partition number).


2. Recheck to ensure the that installation has completed without any errors:

grub-install --recheck /dev/sda


3. Finally, configure the freshly installed GRUB bootloader:

update-grub


All done! Now close the terminal and reboot your system to use your freshly re-installed GRUB.