[Bug 2112632] Re: comands active and inactive do not work

Andreas Hasenack 2112632 at bugs.launchpad.net
Fri Jun 27 18:15:21 UTC 2025


Thanks for the bug and your analysis.

I found this bug[1] upstream which is a match.

The patch linked there is slightly different, but with the same purpose:

>From 3eac27c5fccf93d2d6e634d6fe2a76d06708ec6e Mon Sep 17 00:00:00 2001
From: kmicki <1463619+kmicki at users.noreply.github.com>
Date: Tue, 15 Nov 2022 14:37:25 +0100
Subject: [PATCH] Update efibootmgr.c

get_entry: return entry if it was found before reaching the end of the
list

Signed-off-by: kmicki <1463619+kmicki at users.noreply.github.com>
---
 src/efibootmgr.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/efibootmgr.c b/src/efibootmgr.c
index b980bcd..4b15d6d 100644
--- a/src/efibootmgr.c
+++ b/src/efibootmgr.c
@@ -1192,6 +1192,7 @@ get_entry(list_t *entries, uint16_t num)
 			entry = NULL;
 			continue;
 		}
+		return entry;
 	}
 
 	return entry;

Since that is what is committed upstream, I'll prefer that variant.
Would you be up to preparing a merge request with that upstream patch? I
can guide you through it. If not, I can also prepare the update.


1. https://github.com/rhboot/efibootmgr/issues/186
2. https://github.com/rhboot/efibootmgr/commit/3eac27c5fccf93d2d6e634d6fe2a76d06708ec6e

** Bug watch added: github.com/rhboot/efibootmgr/issues #186
   https://github.com/rhboot/efibootmgr/issues/186

** Also affects: efibootmgr (Ubuntu Oracular)
   Importance: Undecided
       Status: New

** Also affects: efibootmgr (Ubuntu Plucky)
   Importance: Undecided
       Status: New

** Also affects: efibootmgr (Ubuntu Questing)
   Importance: Undecided
       Status: New

** Also affects: efibootmgr (Ubuntu Noble)
   Importance: Undecided
       Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to efibootmgr in Ubuntu.
https://bugs.launchpad.net/bugs/2112632

Title:
  comands active and inactive do not work

Status in efibootmgr package in Ubuntu:
  New
Status in efibootmgr source package in Noble:
  New
Status in efibootmgr source package in Oracular:
  New
Status in efibootmgr source package in Plucky:
  New
Status in efibootmgr source package in Questing:
  New

Bug description:
  OS version: Ubuntu 24.04
  package version: 18-1build2

  My PCs has boot entries 0010, 0020 and 0021.

  $ sudo efibootmgr
  BootCurrent: 0010
  Timeout: 1 seconds
  BootOrder: 0020,0010
  Boot0010* NORMAL	HD(1,GPT,XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX,0x800,0x80000)/<<snip>>
  Boot0020* UPDATE	HD(1,GPT,XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX,0x800,0x80000)/<<snip>>
  Boot0021* UEFI: TOSHIBA, Partition 1	PciRoot(0x0)/Pci(0x14,0x0)/USB(16,0)/HD(1,GPT,XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX,0x800,0x80000)0000424f

  I tried to active/inactive 10 or 20 entry. But these are not found.

  $ sudo efibootmgr -A -b 0010
  efibootmgr: Boot entry 10 not found
  Could not set active state for Boot0010: No such file or directory
  $ sudo efibootmgr -A -b 0020
  efibootmgr: Boot entry 20 not found
  Could not set active state for Boot0020: No such file or directory
  $ sudo efibootmgr -a -b 0010
  efibootmgr: Boot entry 10 not found
  Could not set active state for Boot0010: No such file or directory
  $ sudo efibootmgr -a -b 0020
  efibootmgr: Boot entry 20 not found
  Could not set active state for Boot0020: No such file or directory

  I investigated the cause and found a problem with the get_entry()
  function in src/efibootmgr.c.

  static var_entry_t *
  get_entry(list_t *entries, uint16_t num)
  {
   list_t *pos;
   var_entry_t *entry = NULL;

   list_for_each(pos, entries) {
    entry = list_entry(pos, var_entry_t, list);
    if (entry->num != num) {
     entry = NULL;
     continue;
    }
   }

   return entry;
  }

  This code does not break the loop when an entry is found.
  Therefore, NULL is returned unless the matching entry is the last one.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/efibootmgr/+bug/2112632/+subscriptions




More information about the foundations-bugs mailing list