systemd version the issue has been seen with
v245
Used distribution
NixOS unstable
Expected behaviour you didn't see
The bootloader should select a default entry which does not have 0 tries left.
Unexpected behaviour you saw
The bootloader selected a default entry which has 0 tries left.
Steps to reproduce the problem
Place two entries, foo.conf and bar+0-3.conf into /boot/loader/entries.
Also ensure there is no default entry in /boot/loader/loader.conf and that the LoaderEntryDefault EFI var not set.
I would expect the entry corresponding to foo.conf to be selected by default. However, the entry corresponding to bar+0-3.conf is selected by default.
My understanding after reading https://systemd.io/AUTOMATIC_BOOT_ASSESSMENT/ is that bar+0-3.conf is considered "bad" because it has no tries left, and as a result, it would be ordered at the end of the list.
Implementing this, config_entry_compare from src/boot/efi/boot.c ensures that the entries which have no tries left will be ordered at the end of the list. But reading config_default_entry_select in this same file, it appears that the last suitable entry is selected, not the first suitable entry. As a result, entries which have no tries left would be selected by default.
systemd version the issue has been seen with
Used distribution
Expected behaviour you didn't see
Unexpected behaviour you saw
Steps to reproduce the problem
Place two entries,
foo.confandbar+0-3.confinto/boot/loader/entries.Also ensure there is no
defaultentry in/boot/loader/loader.confand that theLoaderEntryDefaultEFI var not set.I would expect the entry corresponding to
foo.confto be selected by default. However, the entry corresponding tobar+0-3.confis selected by default.My understanding after reading https://systemd.io/AUTOMATIC_BOOT_ASSESSMENT/ is that
bar+0-3.confis considered "bad" because it has no tries left, and as a result, it would be ordered at the end of the list.Implementing this,
config_entry_comparefromsrc/boot/efi/boot.censures that the entries which have no tries left will be ordered at the end of the list. But readingconfig_default_entry_selectin this same file, it appears that the last suitable entry is selected, not the first suitable entry. As a result, entries which have no tries left would be selected by default.