# Boot environments utility



## jbo (Jan 5, 2022)

I'm looking at both bectl(8) and beadm(1). Having a hard time figuring out pros/cons between the two. Please share your personal experiences & opinions


----------



## zirias@ (Jan 5, 2022)

Quick personal opinion: I use `bectl` cause it's in base and just works for me


----------



## mer (Jan 5, 2022)

They are basically interchangeable, syntax is pretty much the same.  
I think the biggest difference is related to destroying a boot environment;  default behavior is slightly different between the two.

I agree with Zirias about bectl.


----------



## angry_vincent (Jan 5, 2022)

compared to `beadm` which is a shell script, potential advantage of `bectl`, is that there is also `libbe` library, on top of which bectl itself is an command line tool. I don't know if libbe has an API, so that this library can be used by some 3rdparty tool, if one create such


----------



## angry_vincent (Jan 5, 2022)

by looking in libbe(3) it does, indeed, has an API to work with, so that one can create some tool, instead of bectl


----------



## Erichans (Jan 5, 2022)

jbodenmann said:


> I'm looking at both bectl(8) and beadm(1).


As to beadm, I suggest: look at beadm(8) belonging to sysutils/beadm/ (Port Added: 2012-09-12); not beadm(1) belonging to sysutils/beadm-devel/ (Port Added: 2012-04-28).


----------



## grahamperrin@ (Jan 5, 2022)

Go for what's integral to the OS: *bectl*. Some bug reports, nothing onerous.

Part of the history is under <https://www.freebsd.org/status/report-2018-01-2018-09.html#HardenedBSD-2018Q3-Update>; there's more, but I don't have a link handy.

Managing Boot Environments | Klara Inc. (not dated)

From zectl ZFS Boot Environment Manager for Linux | John Ramsden (2020-03-18):



> … Seeing bectl’s impressive implementation I was inspired to do the rewrite in C. …



<https://old.reddit.com/r/zfs/duplicates/fkx780/zectl_zfs_boot_environment_manager_for_linux/>


----------



## _martin (Jan 5, 2022)

When ZFS became a thing on FreeBSD vermaden and others ported, or rather wrote from scratch if I remember correctly, beadm from Solaris. I liked they used the same naming convention for that tool too. I started using it on FreeBSD the same way as I'm used to on Solaris.

What mer mentioned is very important - it does behave differently when it comes to destroying stuff. I once tested it in VM and was very disappointed (as I'm used to different behavior). For that reason I do stick to the beadm as I'm using it for over a decade.

For a new user I'd probably recommend using bectl as it's in the base.


----------



## grahamperrin@ (Jan 5, 2022)

_martin said:


> destroying



You want the -o effect, yes?

A few months ago someone (it might have been Kyle Evans) mentioned the possibility (likelihood?) of making it default behaviour.


----------



## grahamperrin@ (Jan 5, 2022)

jbodenmann said:


> between the two



Maybe not the most recent comparison, but <https://vermaden.files.wordpress.com/2018/11/nluug-zfs-boot-environments-reloaded-2018-11-15.pdf> page 61 reminds me of an essential difference:

*proceeding without confirmation*.


bectl

Via <https://dan.langille.org/category/open-source/freebsd/bectl/>: 

Deleting old FreeBSD boot environments – Dan Langille's Other Diary



grahamperrin said:


> there's more, but I don't have a link handy.



Found:

I got into Google Summer of Code w/ @freebsd! So excited to be working w/ @allanjude & the rest of the folks in the community! (Kyle Kneitinger, 2017-05-04)
FreeBSD bug 230323 – Idea/Feature Request - include beadm in the base (2018-08-03)
Using Boot Environments at Scale - Allan Jude (EuroBSDcon 2018 | 20-23 Sept 2018) – _GSoC Mentor for bectl(8)_
(I couldn't find it earlier because I was seeking _summer_ when I should have sought _GSoC_.)


----------



## Erichans (Jan 5, 2022)

If I may suggest one level higher(*): ZFS Boot Environments at  PBUG by vermaden.

___
(*) that will probably also be better/easier searchable


----------



## grahamperrin@ (Jan 5, 2022)

Ah, thanks Erichans I never paid attention to the short URLs, now I see :

<https://is.gd/BEADM> was _ZFS Boot Environments_ (PBUG) in July 2018
bug report 230323 began and ended
<https://is.gd/BECTL> was _ZFS Boot Environments Reloaded_ (NLUUG) in November 2018.


----------



## vermaden (Jan 6, 2022)

grahamperrin said:


> Ah, thanks Erichans I never paid attention to the short URLs, now I see :
> 
> <https://is.gd/BEADM> was _ZFS Boot Environments_ (PBUG) in July 2018
> bug report 230323 began and ended
> <https://is.gd/BECTL> was _ZFS Boot Environments Reloaded_ (NLUUG) in November 2018.


Yeah, that is good timeline 

Generally the NLUUG is the most up to date presentation then PBUG one.

On the FreeBSD land nothing changed since the presentation I think ... if so then please let me know.

On the Linux side one thing changed - now the https://zfsbootmenu.org/ exists - which makes selection of _ZFS Boot Environment _much easier. The Ubuntu Linux also has ZFS on root install now but they do not use _ZFS Boot Environments_ - they use only snapshots - which is far less useful then Boot Environments.

... and also while https://zfsbootmenu.org/ exists ... there is still ZERO Linux distributions that would integrate that and allow you to 'just' install Linux with root on ZFS and with https://zfsbootmenu.org/ and with working _ZFS Boot Environments_. You still need to setup everything yourself and have faith that it will not break in the upcoming upgrade.


----------

