Got this grub freeze issue in 2020
Tried these
grub2 hangs / freezes when external USB hard drive is connected
GRUB freezes if external hard drive is connected. Can I simply make it invisible to GRUB? (this page)
Even I had clear external disk first partition (dd if=/dev/zero of=/dev/sda1=[EFI part]) and clear all boot etc flags from this partition,
still grub was getting freezed and I tried grub with some debug flag set but did not get any solution.
As a work around I was booting system with external harddisk removed, then later I attach it after system booted.
In between 2021-22, in a different system I got struck with another efi related issue
Could not prepare Boot variable: No space left on device grub-install: error: efibootmgr failed to register the boot entry: Input/output error
UEFI problem: Could not prepare boot variable: No space left on device / Installation / Arch Linux Forums
efibootmgr: Could not prepare Boot variable: No space left on device
SOLVED - How to restore UEFI entries with efibootmgr
Which I got solved via https://bbs.archlinux.org/viewtopic.php?pid=1591882#p1591882
rm /sys/firmware/efi/efivars/*
and
sudo efibootmgr -v
Yesterday again I started searching for the solution of grub freeze, and found this page
again followed advice making first partition to FAT
also I tried dd if=zero of=first_partion and removing all flags but it did not helped.
Not sure somewhere while searching solution to this issue, I seen reference of efi issue
and finally recalled that earlier I was using present external device as my main
internal device, and was booting linux from that then later I bought SSD and replaced SSD in place of this HDD
and moved this HDD in caddy
then thought earlier reference this HDD will be in efi somewhere and now same
device changed its location from internal to external may be confusing grub
then I again followed
efibootmgr -v
rm /sys/firmware/efi/efivars/*
efibootmgr -v
Here all entried are cleared
and then
Reinstalled grub in EFI
then again
efibootmgr -v
Here seeing only one entry
Now rebooted, found that this issue is fixed
May be this case could be reproduced with Virtual Machine
first make a disk as internal the replace it with other disk
and change that first disk to external
which may could help grub to add fix to handle this kind of situation.
Thanks