diff --git a/src/boot/boot.c b/src/boot/boot.c index 4ef519d4040..759f0f9ea33 100644 --- a/src/boot/boot.c +++ b/src/boot/boot.c @@ -1783,13 +1783,13 @@ static void config_select_default_entry(Config *config) { assert(config); i = config_find_entry(config, config->entry_oneshot); - if (i != IDX_INVALID) { + if (i != IDX_INVALID || config->entries[i]->tries_left != 0) { config->idx_default = i; return; } i = config_find_entry(config, config->use_saved_entry_efivar ? config->entry_saved : config->entry_default_efivar); - if (i != IDX_INVALID) { + if (i != IDX_INVALID || config->entries[i]->tries_left != 0) { config->idx_default = i; config->idx_default_efivar = i; return; @@ -1800,14 +1800,14 @@ static void config_select_default_entry(Config *config) { i = config->use_saved_entry_efivar ? IDX_INVALID : config_find_entry(config, config->entry_saved); else i = config_find_entry(config, config->entry_default_config); - if (i != IDX_INVALID) { + if (i != IDX_INVALID || config->entries[i]->tries_left != 0) { config->idx_default = i; return; } /* select the first suitable entry */ for (i = 0; i < config->n_entries; i++) - if (config->entries[i]->type != LOADER_AUTO && !config->entries[i]->call) { + if (config->entries[i]->type != LOADER_AUTO && !config->entries[i]->call && config->entries[i]->tries_left != 0) { config->idx_default = i; return; }