GRUB is a small program used to manage booting into operating systems, loaded by the MBR. It allows you to select operating systems to boot and specify boot options for each.

GRUB could get corrupted or deleted in events like installing Microsoft Windows, making you unable to load your other operating systems.

GRUB configuration is stored in your Linux root partition. It makes it possible to restore deleted or corrupted GRUB from the remaining configuration files.

Steps to recover deleted GRUB bootloader in Linux:

  1. Boot into Linux using Live CD or USB Drive.
  2. Get into Live CD mode if available.

    For Ubuntu installer, click on the Try Ubuntu button.

  3. Launch Terminal.

    If no Live CD mode available, press <ctrl> + <alt> + <f2> keys to get to the terminal. For Ubuntu, the default username is ubuntu and the password is empty (just press enter at the password prompt).

  4. Find Linux partition with working GRUB configuration.
    $ lsblk
    loop0    7:0    0  1.9G  1 loop /rofs
    loop1    7:1    0 89.3M  1 loop /snap/core/6673
    loop2    7:2    0 53.7M  1 loop /snap/core18/941
    sda      8:0    0   20G  0 disk
    └─sda1   8:1    0   20G  0 part
    sr0     11:0    1    2G  0 rom  /cdrom
  5. Create temporary directory to mount Linux partition.
    $ mkdir tmp
  6. Mount Linux partition to the newly created temporary directory.
    $ sudo mount /dev/sda1 tmp/
  7. Mount /dev and /proc folders folders to the Linux partitions' mount point.
    $ sudo mount --bind /dev tmp/dev
    $ sudo mount --bind /proc tmp/proc
  8. chroot to the Linux partition.
    $ sudo chroot tmp/
  9. Re-install GRUB bootloader from existing configuration files.
    root@ubuntu:/# grub-install /dev/sda
    Installing for i386-pc platform.
    Unknown device "/dev/sda1": No such device
    Unknown device "/dev/sda1": No such device
    Unknown device "/dev/sda1": No such device
    Unknown device "/dev/sda1": No such device
    Unknown device "/dev/sda1": No such device
    Unknown device "/dev/sda1": No such device
    Installation finished. No error reported.
  10. Exit chroot environment.
    root@ubuntu:/# exit
  11. Shutdown the system.
    $ sudo poweroff
  12. Remove the Live-CD / USB Drive.
  13. Boot the system.
Discuss the article:

Comment anonymously. Login not required.