]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
boot: never auto-boot a menu entry with the non-default profile
authorLennart Poettering <lennart@amutable.com>
Fri, 17 Apr 2026 10:19:58 +0000 (12:19 +0200)
committerLuca Boccassi <luca.boccassi@gmail.com>
Fri, 22 May 2026 12:32:04 +0000 (13:32 +0100)
When figuring out which menu entry to pick by default, let's not
consider any with a profile number > 0. This reflects that fact that
additional profiles are generally used for
debug/recovery/factory-reset/storage target mode boots, and those should
never be auto-selected. Hence do a simple check: if profile != 0, simply
do not consider the entry as a default.

We might eventually want to beef this up, and add a property one can set
in the profile metadata that controls this behaviour, but for now let's
just do a this simple fix.

(cherry picked from commit a93fa2c6b45c6b18f0cb3a16a793edb71ae6b444)

src/boot/boot.c

index a692cad06d8cf094b811b305ae4586dd1a662a44..2cf828cf91b79dcf0d21a3403760e22f910d276e 100644 (file)
@@ -1914,11 +1914,15 @@ static void config_select_default_entry(Config *config) {
         }
 
         /* select the first suitable entry */
-        for (i = 0; i < config->n_entries; i++)
+        for (i = 0; i < config->n_entries; i++) {
+                if (config->entries[i]->profile > 0)
+                        continue; /* For now, never select any non-default profile */
+
                 if (LOADER_TYPE_MAY_AUTO_SELECT(config->entries[i]->type)) {
                         config->idx_default = i;
                         return;
                 }
+        }
 
         /* If no configured entry to select from was found, enable the menu. */
         config->idx_default = 0;