0

I am installing Ubuntu 22 in efi mode with the below curtin partition scheme;

storage:
      config:
        - grub_device: true
          id: sda
          path: /dev/nvme0n1
          ptable: gpt
          type: disk
          wipe: superblock-recursive
        - device: sda
          flag: bios_grub
          id: bios_boot_partition
          number: 1
          size: 1MB
          type: partition
        - device: sda
          flag: boot
          grub_device: true
          id: boot_efi_part
          number: 2
          path: /dev/nvme0n1p2
          preserve: false
          size: 6GB
          type: partition
          wipe: superblock-recursive
        - device: sda
          flag: boot
          id: rootvg_part
          number: 3
          path: /dev/nvme0n1p3
          size: 720GB
          type: partition
          wipe: superblock-recursive
        - fstype: ext3
          id: fs-root
          label: rootfs
          preserve: false
          type: format
          volume: rootvg_part
        - fstype: vfat
          id: boot_efi_fs
          preserve: false
          type: format
          volume: boot_efi_part
        - device: fs-root
          id: mount-root
          path: /
          type: mount
        - device: boot_efi_fs
          id: boot_efi_mount
          path: /boot/efi
          type: mount

I have disabled secure boot in Bios.

When the Ubuntu22 install completed, the os get struck at first booting and entering into the Grub rescue mode. After a lot of research, I was able to load the os using below commands in grub rescue mode;

grub> ls
(hd0) (hd0,gpt1) (hd0,gpt2) (hd0,gpt3)
grub> set root=(hd0,gpt3)
grub> linux /boot/vmlinuz-4.15.0-45-generic root=/dev/nvme0n1p3
grub> initrd /boot/initrd.img-3.13.0-29-generic
grub> boot

However, in each reboot I have to run the above commands to load the OS. In my further research I do see the below link;

"EFI\boot\bootx64.efi" vs "EFI\ubuntu\grubx64.efi" vs "/boot/grub/x86_64-efi/grub.efi" vs "C:\Windows\Boot\EFI\*"

Bootloader path for a permanently installed OS
----------------------------------------------
For Ubuntu, the pathname should be \EFI\Ubuntu\grubx64.efi if you don't need Secure Boot support, or \EFI\Ubuntu\shimx64.efi if the Secure Boot shim is used. The descriptive name is simply "ubuntu" and the optional data is not used.

However, in my installation the path '\EFI\Ubuntu' is not created with the files generated inside it. I don't know why?

Later, I tried an Ubuntu 18 installation on the same hardware with the above partition scheme, and I successfully installed ubuntu 18. And I can see that the /EFI/ubuntu folder is created with required boot files;

$ ls -l /boot/efi/EFI/ubuntu/
total 4328
-rwxr-xr-x 1 root root     108 Apr 30 01:53 BOOTX64.CSV
-rwxr-xr-x 1 root root     117 Apr 30 01:53 grub.cfg
-rwxr-xr-x 1 root root 2594696 Apr 30 01:53 grubx64.efi
-rwxr-xr-x 1 root root  860824 Apr 30 01:53 mmx64.efi
-rwxr-xr-x 1 root root  960472 Apr 30 01:53 shimx64.efi

As a try, I copied the files under /EFI/ubuntu of the 18 installation to my Ubuntu 22 installation after I loaded 22 OS with the grub rescue commands. And when I rebooting the ubuntu22 installation then, it is loading the OS and not entering to Grub rescue mode.

Why the /EFI/ubuntu files are not generating in my Ubuntu 22 installation?

1
  • You may be talking about two separate problems here. grub rescue typically means that the "early" part of grub cannot find its root (as in set root=(hd0,gpt3)), where its modules and cfg file resides. As for /EFI/ubuntu is missing, either you are looking at the wrong / not really looking at the EFI system partition (e.g. /boot/efi is not mounted or not mounted with the correct filesystem), or that you have installed Ubuntu/grub in BIOS/CSM/legacy mode instead of UEFI mode (which is likely the case given that you seem to have a bios_grub partition).
    – Tom Yan
    Commented Apr 30 at 17:49

1 Answer 1

0

I finally resolved the issue. Earlier I was able to generate the missing EFI bootloader files for the Ubuntu vendor using the below;

$ df -Th
Filesystem     Type   Size  Used Avail Use% Mounted on
tmpfs          tmpfs   13G  5.1M   13G   1% /run
/dev/nvme0n1p3 ext3   727G   12G  679G   2% /
tmpfs          tmpfs   63G     0   63G   0% /dev/shm
tmpfs          tmpfs  5.0M     0  5.0M   0% /run/lock
/dev/nvme0n1p2 vfat   6.0G  6.1M  6.0G   1% /boot/efi

$ ls -l /boot/efi/EFI/
total 8
drwxr-xr-x 2 root root 4096 Apr 30 05:33 BOOT
drwxr-xr-x 2 root root 4096 Apr 30 05:33 grub

$ sudo mount /dev/nvme0n1p2 /mnt

$ sudo grub-install --target=x86_64-efi --efi-directory=/mnt --bootloader-id=ubuntu --recheck

$ ls -l /boot/efi/EFI/
total 12
drwxr-xr-x 2 root root 4096 Apr 30 05:33 BOOT
drwxr-xr-x 2 root root 4096 Apr 30 05:33 grub
drwxr-xr-x 2 root root 4096 Apr 30 08:03 ubuntu

Now, the vendor specific boot files are there under EFI. When I rebooted the machine it is loading the os fine and not entering to the grub rescue mode anymore.

Later, I found that the file '/usr/lib/grub/grub-multi-install' is making issue in my case. So I removed that file from the original image. And the OS install for Ubuntu 22 is working absolutely fine.

Thank you All!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .