While GRUB usually works just fine, there can be cases where everything doesn’t work as expected and you might just find yourself in a situation where you can’t get GRUB to load, especially if you have more than one OS installed. These instructions have helped me fix most that problem in most cases.
Capital letters in commands in the following instructions are variables which you should replace with appropriate values for your setup.
Boot into a live environment
Mount your root partition into
sudo mount /dev/sdXY /mntwhere X is the number of the disk and Y is the lowercase letter of the partition.
If your disk is encrypted, you can use the
cryptsetupcommand to decrypt it:
sudo cryptsetup luksOpen /dev/sdXY sdXY--crypt. After decrypting, the decrypted data is available at
If the encrypted partition is using LVM, the LVM partitions will be available under
/dev/mapperwith the partition names provided during setup. On Ubuntu, the main partition should be something like
Check if there are any files in
/mnt/boot. If you can find files with names containing
vmlinuz, you can skip the next step since you most likely don’t have a separate boot partition.
Mount your boot partition into
sudo mount /dev/sdXY /mnt. X (the disk number) is probably the same as in step 2, but Y (the partition letter) will not be the same. The boot partition is usually in
If you have an EFI partition, mount it into
sudo mount /dev/sdXY /mnt/boot/efi.
To determine if you have an EFI partition, simply use
sudo fdisk -l | grep -i efi. If you have an EFI partition, the first column in the output will be the full path to the EFI partition (i.e. what you replace
/dev/sdXYin the command with)
Mount the special Linux directories to
for i in proc sys dev dev/pts run do sudo mount -o bind /$i /mnt/$i done
You may replace newlines with semicolons (
;) to write the script in one line:
for i in proc sys dev dev/pts run; do sudo mount -o bind /$i /mnt/$i; done
sudo chroot /mnt
Finally fix the GRUB installation:
sudo grub-install /dev/sdXwhere
Xis the same as
Xin step 4 or step 2.