Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 09 Feb 2026 05:39:18 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 293054] Document the FreeBSD BootEnv and NextBootEnv EFI variables
Message-ID:  <bug-293054-227@https.bugs.freebsd.org/bugzilla/>

index | next in thread | raw e-mail

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=293054

            Bug ID: 293054
           Summary: Document the FreeBSD BootEnv and NextBootEnv EFI
                    variables
           Product: Documentation
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: Manual Pages
          Assignee: bugs@FreeBSD.org
          Reporter: bblake@techie.com
                CC: doc@FreeBSD.org

In loader.efi(8), there is a section, "Additional Environment Variables".  It
currently reads:

     loader.efi loads some extra variables early in startup from
     /efi/freebsd/loader.env from the EFI partition.  Only simple variables
     can be set here.  It can be useful to specify the root filesystem:

           rootdev=disk0s1a

What it doesn't say is that that pathname is a default that can be changed. 
Specifically, the FreeBSD EFI variable LoaderEnv sets that pathname, which
defaults to /efi/freebsd/loader.env if the variable does not exist.  Also,
NextLoaderEnv can be set to a pathname and that variable is then deleted after
it is used. My suggested documentation change is:

========

loader.efi can set variables early in startup from a file on the EFI partition.
By default, that file is /efi/freebsd/loader.env.  It can be changed by setting
the FreeBSD EFI variable LoaderEnv, as in:

        echo -n /efi/freebsd/alt.env | efivar -w -t 7 -n
cfee69ad-a0de-47a9-93a8-f63106f8ae99-LoaderEnv

After that is executed, the file /efi/freebsd/alt.env is used instead of
/efi/freebsd/loader.env.  See efivar(8) for more information on setting EFI
variables.

In addition, the EFI variable NextLoaderEnv can be set to the pathname of a
second startup file.  That variable is deleted immediately after its value is
retrieved, so setting it will affect only the next boot attempt.  For either
variable, a missing file is silently ignored.

A typical use for the startup file is to change the boot partition.  To do
that, you can put something like rootdev=disk0p15 into the file. The set of
useful variables is small, as most will be changed later.  In addition, setting
those variables that are supposed to cause side effects when set does not work
and may cause breakage; don't do that.

The startup file contains a series of assignments separated by spaces, tabs, or
newlines.  Quotes are not given any special treatment.  If no =value is given,
the value 1 is used.  Invalid syntax and the like are silently ignored.

========

loader.efi uses code from sys/kern/subr_boot.c to parse the files and that code
parses boot flags as well.  But the "howto" variable is discarded, making that
useless.  However, -S<text> is handled exactly as if comconsole_speed=<text>
had been entered, setting the variable.  That's probably unintentional since
none of the other boot flags can be set from the files, so this probably
shouldn't be documented.  Still, if one wanted to be completist, an additional
paragraph could be added to the description.

-- 
You are receiving this mail because:
You are the assignee for the bug.

home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-293054-227>