Rebuild EFI System Partition and Grub on a Hyper-V VM

General support questions
User avatar
TrevorH
Site Admin
Posts: 33202
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Rebuild EFI System Partition and Grub on a Hyper-V VM

Post by TrevorH » 2022/10/04 23:18:19

There's an Ubuntu article about grub2 problems that might have something useful. Look under the section titled "Specific Troubleshooting" on https://help.ubuntu.com/community/Grub2/Troubleshooting

Oh, one thing that did occur to me, have you tried booting rescue media and fsck'ing the EFI partition?
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

StephenJ
Posts: 9
Joined: 2022/09/20 11:12:33

Re: Rebuild EFI System Partition and Grub on a Hyper-V VM

Post by StephenJ » 2022/10/05 10:36:19

Hi,

Do you happen to know how CentOS uses the /boot/efi/EFI/BOOT directory structure? I am only concerning myself with /boot/efi/EFI/centos structure (where I told grub2-mkconfig to put the grub.cfg it made), and I don't care right now about the debian directory as I'm not concerned about that boot option.

The reason I'm asking is there is a grubx64.efi in BOOT too - but it never had a corresponding xxx.cfg file even on the physical machine.

Secondly, do you know why there is a seemingly 'double nested' /boot/efi/EFI/EFI/centos (down the bottom of this tree output).

Here's what I'm seeing, we also don't care about the shimxxx or mokmanager stuff as discussed previously:

[root@kelvin EFI]# tree /boot/efi/EFI -L 3
/boot/efi/EFI
├── BOOT
│   ├── BOOTX64.EFI
│   ├── fallback.efi
│   ├── fbx64.efi
│   └── grubx64.efi
├── centos
│   ├── BOOT.CSV
│   ├── BOOTX64.CSV
│   ├── fonts
│   │   └── unicode.pf2
│   ├── fw
│   ├── fwupia32.efi
│   ├── fwupx64.efi
│   ├── grub2
│   ├── grub.cfg
│   ├── grub.cfg.1568798124.rpmsave
│   ├── grubenv
│   ├── grubx64.efi
│   ├── mmx64.efi
│   ├── MokManager.efi
│   ├── shim.efi
│   ├── shimx64-centos.efi
│   └── shimx64.efi
├── debian
│   ├── BOOTX64.CSV
│   ├── fbx64.efi
│   ├── grub.cfg
│   ├── grubx64.efi
│   ├── mmx64.efi
│   └── shimx64.efi
└── EFI
└── centos
└── grubx64.efi

8 directories, 25 files

Regards,
Stephen.

StephenJ
Posts: 9
Joined: 2022/09/20 11:12:33

Re: Rebuild EFI System Partition and Grub on a Hyper-V VM

Post by StephenJ » 2022/10/05 10:44:50

Ignore the double nested bit - I think that was my initial experiments , I have sinced removed it and it behaves all the same. It also wasnt on the original physical machine.

User avatar
jlehtone
Posts: 4523
Joined: 2007/12/11 08:17:33
Location: Finland

Re: Rebuild EFI System Partition and Grub on a Hyper-V VM

Post by jlehtone » 2022/10/05 16:20:18

StephenJ wrote:
2022/10/05 10:36:19
The reason I'm asking is there is a grubx64.efi in BOOT too
The UEFI boot menu entries are stored somewhere in motherboard. They point to specific bootloaders.
However, even when there are no stored entries, the UEFI can use EFI\BOOT\BOOTX64.EFI
(I think that the installer image does use that feature.)

You can ask with rpm -qf filename whether that file is from some package (rather than created or a copy).

StephenJ
Posts: 9
Joined: 2022/09/20 11:12:33

Re: Rebuild EFI System Partition and Grub on a Hyper-V VM

Post by StephenJ » 2022/10/21 23:32:57

Just a quick poke , I havent forgotten this , I've been pulled off to do other work but will get back to it.
-Stephen.

Whoever
Posts: 1357
Joined: 2013/09/06 03:12:10

Re: Rebuild EFI System Partition and Grub on a Hyper-V VM

Post by Whoever » 2022/10/24 01:36:04

StephenJ wrote:
2022/10/04 23:07:15
Hi,

I had a play around with making a new menu option using efibootmgr , and it turns out that first digit after the HD is the partition number containing the bootloader for the menuentry , so in actual fact '1' is correct - it's the /boot/efi partition and the bootloader (grubx64.efi) is in /boot/efi/EFI/centos as discussed.

On the positive side I'm learning a lot about disks and grub2 :)
Grub also numbers partitions starting at 0, not 1.

Post Reply