I did something similar to this once. I didn't write down the exact steps, but it wasn't too hard to remedy. (I also happened to need rEFInd but this should also work without it.) It went something like this:
- "Properly" install the same version of Ubuntu on a temp GPT-formatted disk or VM setup up as an UEFI system with a GPT virtual disk, as a "donor" dummy OS.
- If your main OS has been updated after install, then also update the dummy install.
- Shut down the dummy OS.
- Using some bootable recovery media or other bootable OS, copy the EFI partition from the dummy to your real machine.
- An Ubuntu boot DVD can be used for this, as it comes with GParted.
- If doing this via VM, boot the VM to a recovery ISO, or the Ubuntu install ISO file mounted as a virtual disc. Note that you can also mount your real OS disk within the VM, as a raw VMDK (if using VirtualBox, you'll need to use
vboxmanage
CLI to create it, and not that the mapping is not valid across host OS reboots). This will allow you to directly copy your "dummy" EFI partition directly to your real disk, which is a real time-saver if doing this in a VM. (You can even boot your real OS in the VM this way. Linux is smart enough to not load drivers for hardware that temporarily doesn't exist, even proprietary display drivers. The kernel already has - and will automatically load - basic open-source drivers for VirtualBox and VMware integration. In fact I usually install Ubuntu onto real disks this way, for later transplant into other machines, all via VM.)
- Before copying the EFI partition, make room for it as the first partition, by first shrinking and/or moving the existing partition out of the way. (Which is easy via GParted.) The new EFI partition won't be sda1 (as it would be with a correct install the first time), but if I remember correctly, EFI, Grub, rEFInd, etc. are OK with that.
- Map the partition to /boot/efi, in the installation's /etc/fstab file.
- Now you have two choices for getting a bootable system (again you can do this on bare metal or via VM with raw VMDK-mapped real disk):
- Use a boot repair tool such as Boot Repair to get everything to a bootable state, usually just by pressing one button.
- Note that you must run Boot Repair from an OS in UEFI mode, whether bare metal or VM.
- rEFInd should also be able to work with this configuration. But if not, and you really need rEFInd, you may need to run the previous step first.
- If you want to skip Grub and go "pure EFI", there are ways around that too, but beyond the scope of this answer (and my memory).
I'm curious as to why you want to use rEFInd? It's an amazing bit of code, and is practically required to navigate dual or triple-booting with MacOS, but if it's just dual booting with Linux/Windows, I've often found that Grub is easier, though uglier. There's less to mess with. Also, rEFInd is not "set and forget", it occasionally gets overwritten and needs reinstall, which can be a minor pain because typical *nix/Windows sysadmin skills don't map to rEFInd, and it happens infrequently enough so that you find yourself re-googling how to do it every time. (Or write it down and then try to remember where that note is.) Also, it sometimes "helpfully" creates icons to specific kernel versions, which tend to quickly become irrelevant. I believe there's a documented way to prevent that behavior or at least delete them after-the-fact, but I quit using it so I don't remember. This is just my experience though.
Good luck!