pkgbase and automatic ZFS snapshots on upgrade

Hello,

I've been reading a bit on the new pkgbase system lately, and couldn't find an answer to the following: will there still be a mechanism that automatically creates a bootable ZFS snapshot whenever the base system is upgraded?

This a highly convenient feature of FreeBSD and I hope it will stay despite the deprecation of freebsd-update.
 
You do know that you can very easily create one by using bectl or vermaden's beadm, right? I realize that if you're used to it being automatic, it can seem a nuisance, but for me I find it relatively easy to remember to type
Code:
sudo bectl working-$(date +%F)
before upgrading.
Sorry, I realize this doesn't answer your question (as I don't know the answer), but there is that alternative (that is, manually creating the backup quickly before updating)
 
will there still be a mechanism that automatically creates a bootable ZFS snapshot whenever the base system is upgraded?
PKGBASE updates/upgrades are processed by ports-mgmt/pkg, at the moment there is no logic in pkg to create automatic ZFS boot environments as it is in /usr/sbin/freebsd-update [1]. I don't know if something similar is planed, perhaps ask on freebsd-pkgbase@ mailing list, or open an issue on https://github.com/freebsd/pkg.

[1]
Code:
    898         # Create a boot environment if enabled
    899         if [ ${BOOTENV} = yes ]; then
    900                 bectl check 2>/dev/null
    901                 case $? in
    902                         0)
    903                                 # Boot environment are supported
    904                                 CREATEBE=yes
    905                                 ;;
    906                         255)
    907                                 # Boot environments are not supported
    908                                 CREATEBE=no
    909                                 ;;
    910                         *)
    911                                 # If bectl returns an unexpected exit code, don't create a BE
    912                                 CREATEBE=no
    913                                 ;;
    914                 esac
    915                 if [ ${CREATEBE} = yes ]; then
    916                         echo -n "Creating snapshot of existing boot environment... "
    917                         VERSION=`freebsd-version -ku | sort -V | tail -n 1`
    918                         TIMESTAMP=`date +"%Y-%m-%d_%H%M%S"`
    919                         bectl create -r ${VERSION}_${TIMESTAMP}
    920                         if [ $? -eq 0 ]; then
    921                                 echo "done.";
    922                         else
    923                                 echo "failed."
    924                                 exit 1
    925                         fi
    926                 fi
    927         fi
 
I am using Void Linux for testing OCI containers between Podman on FreeBSD and Podman on Void Linux. My Void Linux machine is setup with ZFSBootMenu and bemgr which provides FreeBSD like boot environments on Void. I made a wrapper script for Void Linux package installer (xbps-install) which now creates a new BE every time packages are updated. I can never tell if a kernel update is being pulled in which I guess will be the same issue using pkgbase. I have got used to having a new BE every time I update Void packages and it just needs a bit of housekeeping using 'bemgr destroy' to get rid of the excess boot environments afterwards.

I am not intending using pkgbase on FreeBSD 15 until later in 2026, but I think I might use the same wrapper script on 'pkg upgrade -y' and 'pkg install' now on 14.3. I have found that being able to rollback after a failed update or install is fantastic especially when I forgot to manually take a snapshot beforehand.
 
Back
Top