Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 07 Jan 2026 18:24:53 +0000
From:      Kyle Evans <kevans@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: e30086ab4c87 - main - lualoader: fix pruning of non-existent default kernel
Message-ID:  <695ea4f5.3a485.58c3c65c@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch main has been updated by kevans:

URL: https://cgit.FreeBSD.org/src/commit/?id=e30086ab4c8778ea70a3b19e83546ce1b4a16492

commit e30086ab4c8778ea70a3b19e83546ce1b4a16492
Author:     Kyle Evans <kevans@FreeBSD.org>
AuthorDate: 2026-01-07 18:20:05 +0000
Commit:     Kyle Evans <kevans@FreeBSD.org>
CommitDate: 2026-01-07 18:20:05 +0000

    lualoader: fix pruning of non-existent default kernel
    
    Removing the kernel from the list of available kernels is sufficient to
    avoid rendering it in the list, but we need more for booting to actually
    work.  Notably, the 'kernel' loader.conf var was left intact to its
    default value, so if one didn't use the kernel selector in the menu then
    we'd try to boot the nonexistent 'kernel' instead of the new default
    (first autodetected).
    
    There's room to improve the error messages here, but for now let's just
    make it actually work correctly.
    
    PR:             292232
    Fixes:  d04415c520b03 ("loader: lua: remove the default kernel [...]")
---
 stand/lua/core.lua | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/stand/lua/core.lua b/stand/lua/core.lua
index ad417e5f97e5..b1b321d10868 100644
--- a/stand/lua/core.lua
+++ b/stand/lua/core.lua
@@ -289,6 +289,12 @@ function core.kernelList()
 				kernels[n] = kernels[n + 1]
 			end
 		end
+
+		-- The config/boot bits use the env var as a fallback if the
+		-- menu's kernel selector remains untouched, so we want to
+		-- update our notion of the default kernel to one that is
+		-- actually present.
+		loader.setenv("kernel", kernels[1])
 	end
 
 	core.cached_kernels = kernels


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?695ea4f5.3a485.58c3c65c>