Skip to content

Instantly share code, notes, and snippets.

@ryumada
Last active February 11, 2024 16:11
Show Gist options
  • Save ryumada/a6339151511630facb977b11bf45ed38 to your computer and use it in GitHub Desktop.
Save ryumada/a6339151511630facb977b11bf45ed38 to your computer and use it in GitHub Desktop.
Grub not showing the grub menu instead It just showing the minimal-bash.

Overview

The problem of grub not showing the default grub menu is because it can't read your grub.cfg file in your EFI System Partition. EFI System Partition is tagged as its name in the partition list.

This command is used to list the disk using bash:

sudo fdisk -l

example output:

Device         Start       End   Sectors   Size Type
/dev/sda1       2048   1187839   1185792   579M Microsoft basic data
/dev/sda2    1187903   1802239    614337   300M EFI System
...

EFI System Partition is the partition marked with EFI System type. On the example output above, it is /dev/sda2.

Mount /dev/sda2 to /boot/efi:

Mount the partition to /boot/efi directory, so you can do grub-install. The command need to find the EFI directory which is your mounted EFI System's partition.

sudo mount /dev/sda2 /boot/efi

🔴 The Problem (in my case)

In my case, I'm using KDE Neon which is based ubuntu LTS. The OS created a folder named neon in my EFI System partition (.../EFI or /boot/efi/EFI/) that contains files needed to start KDE Neon Grub in /boot/grub directory.

Here is the flow how the UEFI load the Grub Menu:

  1. The system start the efivar boot (neon GNU Linux) registered in your system EFI menuentry.
  2. Then it start the grubx64.efi (.../EFI/your-distribution/grubx64.efi).
  3. The file executed and then read grub.cfg file (.../EFI/your-distribution/grub.cfg).
  4. Normally after that the grub will start the menu installed in my root directory (/boot/grub), But it doesn't.

I have tried to reinstall the grub by doing:

  1. Uninstall all grub packages from my linux
  2. Reinstall the grub package (sudo apt install grub-efi)
  3. install the grub to my EFI (sudo grub-install).
  4. update the grub (sudo update-grub).

🔧 The Solution

It doesn't read the GRUB's menu inside /boot/grub because the .../EFI/your-distribution/grubx64.efi misread the location of your .../EFI/your-distribution/grub.cfg.

In my case, the .../EFI/neon/grubx64.efi (because I'm using KDE Neon) doesn't read .../EFI/neon/grub.cfg instead it searches for the grub.cfg file in .../EFI/ubuntu/grub.cfg. I should move .../EFI/neon/grub.cfg into .../EFI/ubuntu/grub.cfg to fix it.

sudo mv /boot/efi/EFI/neon/grub.cfg /boot/efi/EFI/ubuntu/grub.cfg

There is other people who also experienced this. https://unix.stackexchange.com/questions/615109/wrong-grub-prefix-efi-grub-install-and-update-grub-doesnt-fix-it

Useful Commands

Install grub-efi or grub-efi-amd64

  • install the package
sudo apt install grub-efi

Normally if you install grub-efi, grub-efi-amd64 will be included in the installation process.

or

sudo apt install grub-efi-amd64

Install the grub to your EFI Partition /boot/efi/EFI/<your-distribution>/

sudo grub-install

Update the grub Configuration at /boot/grub/grub.cfg in KDE Neon

sudo update-grub
@dvs-111
Copy link

dvs-111 commented Feb 11, 2024

For me, in KDE Neon, the command sudo grub-install --bootloader-id=ubuntu helped
In this way, no need to copy/link/etc any files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment