Using efibootmgr -A -b 0001 was not disabling the Boot0001 entry as expected.
It turns out that it was using Boot0001-00000000-0000-0000-0000-000000000000 instead of Boot0001-8be4df61-93ca-11d2-aa0d-00e098032b8c because set_active_state uses boot->guid which is set to 0 in read_vars (because of memset() at src/efibootmgr.c:108)
So I set it to EFI_GLOBAL_GUID when reading vars.
FYI, I use that feature to disable Windows boot entry so I can boot Linux without modifying Windows' bootmgfw.efi (my BIOS reset the boot order at every boot so the Windows entry is the first).
In my /sys/firmware/efi/vars/ i have duplicated BootXXXX entries like that:
Using
efibootmgr -A -b 0001
was not disabling the Boot0001 entry as expected. It turns out that it was usingBoot0001-00000000-0000-0000-0000-000000000000
instead ofBoot0001-8be4df61-93ca-11d2-aa0d-00e098032b8c
because set_active_state usesboot->guid
which is set to 0 in read_vars (because of memset() at src/efibootmgr.c:108)So I set it to EFI_GLOBAL_GUID when reading vars.
FYI, I use that feature to disable Windows boot entry so I can boot Linux without modifying Windows' bootmgfw.efi (my BIOS reset the boot order at every boot so the Windows entry is the first).