Situation

A Linux system has been installed on a GPT disk, but the firmware has been booting it by “legacy BIOS”.

A properly populated /boot/efi/ is present, but on switching the firmware to UEFI, this EFI system partition (ESP) is not found.

Likely solution

Check the output of parted <disk> where <disk> is the whole disk containing the ESP.

Example:

parted /dev/nvme0n1
GNU Parted 3.2
Using /dev/nvme0n1
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print
Model: NVMe Device (nvme)
Disk /dev/nvme0n1: 512GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: pmbr_boot

Number  Start   End    Size    File system  Name                  Flags
 1      1049kB  524MB  523MB   fat16        EFI system partition  boot, esp
 2      524MB   194GB  193GB   btrfs                              legacy_boot
 6      195GB   507GB  312GB
 3      507GB   508GB  1074MB  ext3

The pmbr_boot disk flag is being read by the EFI firmware which prevents it from scanning the disk for an ESP.

Removing this flag with the parted command disk_set pmbr_boot off will allow the EFI firmware to see the ESP and boot from it.