UEFI boot issue: Replaced M.2 and returned it back to the system, now Q4.2 unable to boot (in between installed Q4.1 on the replacement)

Related chronologically to Lenovo T490 full freezes with Qubes 4.2 but likely the issue is not.

I installed a fresh Q4.2 on M.2 A. For reasons explained in the other post I replaced the M.2 for M.2 B (after shutdown of Q4.2) and installed Q 4.1 on M.2 B. During both installs, the T490 was set to “UEFI only” boot mode. Partition is defined by the setup in both cases, I did “reclaim all” and the installer “took the decision”

Now I tried to switch M.2 again, shutdown Q4.1 and replaced the M.2, but now Q4.2 does not boot up from M.2 A anymore. I only see a black screen for a fraction of a second and then return to boot device selection of the BIOS again. I booted a live linux and fscked the first partition. It said that Boot sector and boot sector backup differ (which is usually not a problem as fsck said). As I had a problem, I restored the backup boot sector - stil not able to boot.

I changed BIOS to “Legacy only” (CSM) and the only change is that the black screen is shown longer (up to a few seconds) before returning to boot device selection.

I read UEFI troubleshooting | Qubes OS
but it seems that none of the cases mentioned there apply. I assume efibootmgr should be able to fix this, but I have no idea what parameters to use.

Thanks for ideas on how to fix this. I have totally no idea how this was damaged. Lenovo storage self-test was fine for M.2 A

Awesome, it worked - but I’d really like to understand why:

I think what I just did (following the guide) was to create some kind of “EFI-default-filename-scheme” whereas the previous one (configured by the setup) was some kind of “custom-filename-scheme.”.

My first though now is that older UEFIs may only allow the default-filename but not the custom filename – but as the custom scheme worked on the same device before this cannot be the issue.

The second thing that comes to my mind is that there may be a reference in the BIOS itself that is set by the setup, that is different for Q4.2 and Q4.1 and that the Q4.1 setup changed the BIOS-side in a way that Q4.2 cannot boot - is that what happened here?

This happened because you’ve removed the disk with installed Qubes OS and booted the PC.
On boot the UEFI checks all entries and remove the ones that point to non-existing disks.
You can recreate the UEFI entry like this:

And it’ll work until you remove the disk with installed Qubes OS and boot the PC again.

The UEFI is using fallback path by default if it exists.

Do you know for what reason it is defined that way? CSM-disks can be put into any system and just boot and its successor UEFI needs machine-dependend host-BIOS entries even if you select “boot from this disk” and a manual intervention if that path changes? That sounds like a massive failed-by-design to me.

PS: Yes, there may be other issues with CSM like a wrong HAL in older windows versions, but that is at later steps of the boot process.

I don’t know why it was designed this way.

OK. Thanks a lot for your help!