Installing Grub happens at the end of a Linux installation, and if it fails, the installation usually aborts. It’s important to realise that at this point your Linux installation is fine you don’t need to go through the installer again. Hopefully your installer will handle this sensibly and not crash out to a wall of error messages. You need the installer to finish setting up your system.
Depending on your installation, you might be presented with the option to skip installing Grub and to continue. Choose that option if you can, otherwise leave the installer alone for the moment and try to switch into another shell by pressing
ctrl-alt-F1 (or F2, F3, whichever gives you a login prompt), or see if there’s a way to go into a shell without quitting the installer.
Just get to a root shell, it doesn’t matter whether it’s booted your system or not. Any Linux shell will do.
With a shell - any shell - you first need to mount all the filesystems needed. We’re going to
chroot into your installation to fix this.
This is the partition that would be mounted as
/ in Linux. It might be
mount /dev/sda1 /mnt
Linux has several virtual filesystems that need mounting
mount --bind /dev /mnt/dev mount --bind /proc /mnt/proc mount --bind /sys /mnt/sys
Find out which parition is your EFI system partition.
fdisk will tell you. It might be
/dev/sda2. In a multi-drive system it could be on another drive. If you’re dual-booting Windows, and installed that first, it’ll be on your Windows drive.
mount /dev/sda2 /mnt/boot/efi mount -o remount,rw /dev/sda2 /mnt/boot/efi
Also mount the
mkdir /mnt/hostrun mount –bind /run /mnt/hostrun
Now go into your Linux installation using
You are now inside the Linux installation. Anything you type will be as if you’d booted your machine into the Linux installation on your hard disk.
If your disks were set up using LVM, follow this too
mkdir /run/lvm mount --bind /hostrun/lvm /run/lvm
Finally, now we’ve dug right down into our Linux installation, we can run the Grub installer by hand
grub-install /dev/sda update-grub
Note, there are no partition numbers on the end of
/dev/sda, and it refers to the drive Linux is installed onto.
This should work, and there should be no errors(!) If there are, hopefully they’re more detailed than the errors given by the Linux installer.
Now, just exit the chroot environment and unmount everything
umount /mnt/dev umount /mnt/proc umount /mnt/sys umount /mnt/boot/efi umount /mnt/hostrun umount /mnt/run/lvm umount /mnt
If you need to, figure out how to tell your Linux installer to finish. Alternately, if you can’t, sit through the whole installation again. The fixes done in the previous section should be enough to let the installer put Grub on itself.