Solved Boot environments with non-standard dataset layout and bectl / beadm

Hi FreeBSD community,

if you only have a two-level dataset layout, e.g. zroot/default instead of the standard layout zroot/ROOT/default, then bectl(8) cannot manage the boot environments. In this case bectl check returns with a statuscode different from 0, which means that the system does not support boot environments. I do not know what the rational behind this behavior of bectl(8) is, the zroot dataset should be perfectly capable of holding the different mountpoints for the boot environments.The requirement for an additional dataset ROOT should not be mandatory.

What is the reason for this behavior? Or is this just a bug?
 
I looked at /usr/local/sbin/beadm. The script defines that any system with less than three dataset-levels is not capable of boot environments. After changing a few lines and removing this artificial restriction, I could list, create and activate boot environments. The boot environments could also be displayed and selected without problems in the boot loader.

I skipped skimming through the code for bectl(8) and libbe(3). It probably just follows the same logic as beadm(1).

We can conclude that the system is perfectly capable of supporting boot environments with a non-standard dataset layout, but the current management tools require (at least) a three-level dataset-layout. I am fine with this, but it would be nice if at least the manpages would mention how the datasets have to be layed out in order to support boot environments.
 
I am running into the same issue. I used mfsbsd to set up default datasets. If using non-raid, by default, mfsbsd formats its zfs datasets for a single disk as follows:

Filesystem 1K-blocks Used Avail Capacity Mounted on
tank/root 302305222 9711156 292594065 3% /
devfs 1 1 0 100% /dev
tank/root/tmp 292594102 37 292594065 0% /tmp
tank/root/var 292924432 330366 292594065 0% /var


When I attempt to list bootable environments, it comes back empty.

[root@squid 11.Feb 12:20pm /usr]# bectl list
[root@squid 11.Feb 12:20pm /usr]#


bectl check does not return anything:

[root@squid 11.Feb 12:20pm /usr]# bectl check
[root@squid 11.Feb 12:20pm /usr]#


I would like to implement bootable environments on this particular server. steps would you care to share the modifications you made to get bectl working on two-level datasets? I will assume full responsibility for anything that may occur.

~Doug
 
Hi dougs, I didn't make any changes to bectl(8) or libbe(3) because I only investigated beadm(1). I assumed that bectl(8) follows the same logic.
In order to make beadm(1) work with a two-level dataset-layout I just changed different parts of the shell script /usr/local/sbin/beadm to remove the artificial restriction. Just look througth the script and make the obvious changes, e.g. at line 280:
Code:
if [ $( echo $(ROOTFS) | awk -F '/' '(print NF)' ) -lt 3]
The script has changed a little bit since the last time I looked at it, but you can identify the relevant parts rather quick. Every occurence of $(POOL)/$(BEDS)/$(ITEM) has to be adapted.
With bectl(8) and libbe(3) you have to make the appropriate changes in the C code, but I haven't looked at it.
Hopefully I could push you in the right direction.
 
Back
Top