Reinstalling Grub

This guide will help you reinstall grub. It can be done from your Ubuntu install or from a Live USB by using a chroot.

Setup a Chroot

If you don't know how to setup a chroot of your Ubuntu install click on How to Setup a Chroot.

Reinstalling Grub

If you're using UEFI mode, typing grep efi /etc/fstab should give a line back. If nothing is shown then you're using Legacy.

If you're using UEFI mode, type sudo grub-install

Then type sudo update-grub

If you're using CSM Legacy, type sudo parted -ls

You should get a list of the disks and partitions
ubuntu@ubuntu:~$ sudo parted -ls
Model: ATA HGST HTS541010A9 (scsi) <---- Disk name
Disk /dev/sda: 1000GB <---- Disk name as known to Linux with size
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Disk Flags: 
Number  Start   End     Size    File system     Name                  Flags
 1      1049kB  316MB   315MB   fat16           EFI Partition         boot, esp
 4      316MB   9979MB  9664MB  linux-swap(v1)
 5      9979MB  16.8GB  6784MB  ext4
 2      16.8GB  896GB   880GB   ntfs            Microsoft basic data  msftdata
 3      896GB   1000GB  104GB   ext4

Model: Seagate BUP Slim BK (scsi)
Disk /dev/sdb: 2000GB
Sector size (logical/physical): 512B/4096B
Partition Table: msdos
Disk Flags: 
Number  Start   End     Size    Type     File system  Flags
 1      1049kB  2000GB  2000GB  primary  ntfs         boot
Get the name of the disk that has Ubuntu installed, such as /dev/sda in the example above.

Type sudo grub-install --recheck <disk name here> such as sudo grub-install --recheck /dev/sda

Then type sudo update-grub

Reinstalling the Grub Packages

If using grub-install did not work, the grub packages might not be installed.

In order to install them, if you're using UEFI type sudo apt-get install --reinstall grub-efi-amd64-signed

If you're using CSM Legacy type sudo apt-get install --reinstall grub-pc

Updating the Initramfs

Sometimes it's useful to update the initramfs, especially if new hardware is added.

Type sudo update-initramfs -u -k all

Then reinstall grub as above.

RELATED TOPICS
Live USB, Ubuntu, Booting, Partition table, Partitions, BIOS, UEFI