Common GRUB issues
In this post I am going to compile several GRUB-related issues and how to solve them.
Table of Contents
GRUB command line
When installing or removing an operating system on a dual-boot system, you may see this window on boot (instead of the boot menu):
- GRUB has some issues to find the right EFI file, so you need to tell GRUB where is it. Type
lsto see the partition list. You will see something like this:
(proc) (hd0) (hd0,gpt3) (hd0,gpt2) (hd0,gpt1)
- EFI partition is usually the first disk partition (
/dev/sda1) so we are going to run
lsto list the contents of
- If you see a
efifolder, great! you are on the right partition. If not, try repeating
lscommand with the other partitions.
- Now we are going to change the
rootto our EFI partition.
- Then, if you type
ls /, GRUB will display the root folder of the EFI partition. Let’s find GRUB EFI file using
grub> ls / efi/ grub> ls /efi debian/ grub> ls/efi/debian shinmx64.efi grubx64.efi mmx64.efi ... grub.cfg
- You may see different output, look for the
grubx64.efifile. that’s GRUB boot menu. Run
chainloaderwith the full path of
- Finally, run
boot. That’s it.
Note: you can access GRUB command line from the boot menu by pressing C. Then, press Esc to go back to boot menu.
Growing EFI partition
If you need to increase your EFI partition, first you need to use a Live system (mounted on a USB) to be able to resize disk partitions. You can use almost any Linux operating system that alows you to use it without install it on the hard drive. I am going to use Arch Linux as the Live system.
Once you have booted your Live system, copy EFI partition files to another disk partition. To do that, mount the EFI partition and the disk partition where you want to copy the files. To simplify the process, I recommend you to use your operating system main partition to place copied files. By doing this, you can mount your system partition on
/mntand EFI partition where is usually mounted on your system (e.g.:
Then, to mount the partition, use
lsblk -o name,parttypenameto locate EFI partition and the partition where you want to place copied files:
NAME PARTTYPENAME sda ├─sda1 EFI System ├─sda2 Linux filesystem ├─sda3 Linux filesystem
- In this case,
/dev/sda3is the main system partition. Now, mount the partitions (ensure you have root permissions, or use
mount /dev/sda3 /mnt mount /dev/sda1 /mnt/boot
rsync -ato copy boot files to the other partition. Create a folder if needed. (remember to use
sudoif you are not the
mkdir /mnt/home/user/efifiles rsync -a /mnt/boot /mnt/home/user/efifiles
- Check files have been copied. Unmount the partitions (first unmount the EFI one).
umount /dev/sda1 umount /mnt/sda3
Grow EFI partition using
fdisk, GParted or similar tool. If you have unused partitions between EFI and system partitions, you can simply delete those unused partitions (and EFI partition), and create a new partition that takes all unused space. If there is no unused partitions, you may need to shrink a system partition to create a new boot partition. Remember to set partition type to
EFI System(or something like that, check your partition tool) and format the partition as
Once you have your new boot partition, mount the two partitions again (check their name with
rsync -ato copy EFI files to the new partition.
mount /dev/sda3 /mnt mount /dev/sda1 /mnt/boot rsync -a /mnt/home/user/efifiles/ /mnt/boot/
- Finally, we are going to reinstall GRUB on the new boot partition. Run
arch-chroot(if you are using Arch Linux as the Live system) to set the root to your system main partition mount point.
- Then, reinstall GRUB (check
grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB
- And re-make
grub.cfgfile (check the file path on your system before running the command).
grub-mkconfig -o /boot/grub/grub.cfg
Edit your system’s
/etc/fstab file to ensure it has the right configuration (with the new EFI partition).