Solved How to set default bootfs

Due to some trouble (sm-mta of Sendmail refused to act) I have reverted my remote headless system to its previous state after upgrade to FreeBSD 14.3-RELEASE:

Code:
# bectl activate 14.3-RELEASE_2025-06-08_102651
Successfully activated boot environment 14.3-RELEASE_2025-06-08_102651
# bectl list
[…]
14.2-RELEASE-p3_2025-06-08_101922 -   -   215M  2025-06-08 10:19
14.2-RELEASE_2024-12-03_192038    -   -   20.9M 2024-12-03 19:20
14.2-RELEASE_2025-02-01_201421    -   -   436M  2025-02-01 20:14
14.3-RELEASE_2025-06-08_102651    NR  /   155G  2025-06-08 10:26
14.3-RELEASE_2025-06-09_171055    -   -   28.2M 2025-06-09 17:10
default                           -   -   41.7M 2022-03-09 13:58

I was surprised a bit that the active boot environment (NR /) is not renamed default as explained in bectl(8):

activate [-t | -T] beName
Activate the given beName as the default boot filesystem. If the -t flag is given, this takes effect only for the next boot. Flag -T removes temporary boot once configuration. Without temporary configuration, the next boot will use zfs dataset specified in boot pool bootfs property.

Should I rename this active ZFS snapshot to 'default' and destroy or rename the old 'default'? These zpoolprops(7) and zpool-get(8) commands seem to be redundant:

Code:
> zpool get bootfs
NAME   PROPERTY  VALUE                                      SOURCE
zroot  bootfs    zroot/ROOT/14.3-RELEASE_2025-06-08_102651  local

# zpool set bootfs=14.3-RELEASE_2025-06-08_102651 zroot/ROOT/default

# zfs zpoolprops bootfs=zroot/ROOT/14.3-RELEASE_2025-06-08_102651
 
It's not mandatory to rename a BE. Its name has no importance. But, it's convenient that the active BE on long term be named "default" (I do this too).

First rename or destroy default, then rename you current BE "default". I forgot: no need to modify bootfs, it should have been changed after renaming.
 
These zpoolprops(7) and zpool-get(8) commands seem to be redundant:
I'm not exactly sure what you mean. However, it might be that you see a certain overlap between the possibility of manually setting bootfs and bectl(8): there you would be right because there is overlap. By manipulation of the bootfs property and manually creating a ZFS clone (that is a writable ZFS snapshot) that can be booted from you can and would be doing the same as manipulating BEs (Boot Environments) through bectl(8).

Boot environments in FreeBSD were not there at its ZFS beginnings. Sometime after ZFS was ported to FreeBSD, vermaden developed and introduced beadm(8). beadm(8), sysutils/beadm, still works, and functions almost identical as bectl(8).

As beadm(8) is a sh(1) script you can easily follow what it is doing to manipulate BEs. ZFS creates the basis for BEs by virtue of its snapshots and clones. For some further info and links about Boot Environments: here.
 
Yes, I meant that bectl(8) is enough to activate BE from suitable snapshot, no need to add zpoolprops(7) nor zpool-get(8). And the obsolete beadm(8) is no longer needed, bectl(8) is based on it and does everything. I only asked why an activated (NR /) boot environment is not renamed as 'default' automatically, maybe there is some reason to keep the old 'default' snap.
 
why an activated (NR /) boot environment is not renamed as 'default' automatically
There is no special meaning behind the default name, it's just a BE name, and TBH I'd rather call it "initial" or something similar (to prevent misunderstanding like this, if anything).
 
And the obsolete beadm(8) is no longer needed
beadm isn't obsolete at all. I prefer it because it's long-tested and reliable. bectl had bugs and maybe it has yet. I only use it for scripting. Fact is bectl belongs to the base. Somehow, there is no need to install a tool like beadm.
 
Back
Top