Public bug reported:

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.

dev@spike (N101-7069):~$ sudo efibootmgr -A -b 0010
efibootmgr: Boot entry 10 not found
Could not set active state for Boot0010: No such file or directory
dev@spike (N101-7069):~$ sudo efibootmgr -A -b 0020
efibootmgr: Boot entry 20 not found
Could not set active state for Boot0020: No such file or directory
dev@spike (N101-7069):~$ sudo efibootmgr -a -b 0010
efibootmgr: Boot entry 10 not found
Could not set active state for Boot0010: No such file or directory
dev@spike (N101-7069):~$ 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.

** Affects: efibootmgr (Ubuntu)
     Importance: Undecided
         Status: New

** Description changed:

  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,416189f1-8d0d-4be6-a8b7-631c91d73a07,0x800,0x80000)/<<snip>>
- Boot0020* UPDATE      
HD(1,GPT,416189f1-8d0d-4be6-a8b7-631c91d73a07,0x800,0x80000)/<<snip>>
- Boot0021* UEFI: TOSHIBA, Partition 1  
PciRoot(0x0)/Pci(0x14,0x0)/USB(16,0)/HD(1,GPT,3de10ebe-8024-409f-bdc8-2251bb1bcd83,0x800,0x80000)0000424f
+ 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.
  
  dev@spike (N101-7069):~$ sudo efibootmgr -A -b 0010
  efibootmgr: Boot entry 10 not found
  Could not set active state for Boot0010: No such file or directory
  dev@spike (N101-7069):~$ sudo efibootmgr -A -b 0020
  efibootmgr: Boot entry 20 not found
  Could not set active state for Boot0020: No such file or directory
  dev@spike (N101-7069):~$ sudo efibootmgr -a -b 0010
  efibootmgr: Boot entry 10 not found
  Could not set active state for Boot0010: No such file or directory
  dev@spike (N101-7069):~$ 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.
+ 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_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;
-               }
-       }
+  list_for_each(pos, entries) {
+   entry = list_entry(pos, var_entry_t, list);
+   if (entry->num != num) {
+    entry = NULL;
+    continue;
+   }
+  }
  
-       return entry;
+  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.

** Description changed:

  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.
  
  dev@spike (N101-7069):~$ sudo efibootmgr -A -b 0010
  efibootmgr: Boot entry 10 not found
  Could not set active state for Boot0010: No such file or directory
  dev@spike (N101-7069):~$ sudo efibootmgr -A -b 0020
  efibootmgr: Boot entry 20 not found
  Could not set active state for Boot0020: No such file or directory
  dev@spike (N101-7069):~$ sudo efibootmgr -a -b 0010
  efibootmgr: Boot entry 10 not found
  Could not set active state for Boot0010: No such file or directory
  dev@spike (N101-7069):~$ 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.
+ 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.

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

Title:
  comands active and inactive do not work

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


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to