Vivian Voss

bectl Takes the Patch Back

it philosophy freebsd zfs security

On Tuesday 17 November the classified network of the National Security Agency went into what the agency called a "temporary degradation during scheduled routine maintenance". The maintenance had a history. On 21 October the NSA had joined the FBI and CISA in telling organisations to patch a pair of critical PHP vulnerabilities, known together as PHP2Shell, and to do it immediately. The agency did as it had told everyone else to do. That afternoon Jay Clayton, the Director of National Intelligence, went on Fox Business and put it plainly: "The patching that has gone on following [a PHP vulnerability] has caused some of these systems to not come back up when you patch them as expected."

It was a busy week for that sort of sentence. The Federal Aviation Administration had halted flights nationwide the Friday before, JPMorgan Chase had stumbled on the Monday, and on the same Tuesday as the NSA, Apple reported that "an internal update caused some outages this morning". CNBC counted "four major system problems in four consecutive business days". Five days later Clayton told CNN to expect more "glitches, gaps, interruptions in service", adding, with the candour of a man who has read the briefing, "this is going to happen."

Detection got faster

The experts asked by ABC News agreed on the cause more readily than the officials did. Sarah Kreps of Cornell was "fairly confident" that the outages came mainly from the push to fix newly revealed vulnerabilities, with updates stacked "on top of very old infrastructure". Arun Sundararajan of New York University put the whole week into one line: "we have a detection system that's dramatically better but we don't have a correction system." Security researchers, with help from machines that read code tirelessly and without lunch breaks, now find holes faster than anyone can mend them, and every hole found arrives with a deadline attached.

Consider what that does to the person at the keyboard. A board, a regulator or a joint advisory says patch now, and on a server that cannot return to yesterday, patching now means betting the service on an update nobody has tried on this particular machine. Waiting means betting it on the attackers being slower than the advisory. Both bets cost money, and the administrator places one of them every week, usually on a Friday afternoon, touch wood. A deadline without a way back turns every fix into a wager, and November showed what the house collects when the wager goes wrong.

What a way back has to do

A proper way back has a handful of requirements, and they are best stated before anybody is measured against them. It has to keep the entire previous system in one piece, the kernel together with its userland, because an update that breaks the start usually breaks both in the same move. It has to be chosen at boot, before a single service runs, since a system that cannot come up cannot be asked to repair itself. It ought to try the new system once and fall back on its own if the try fails, because at three in the morning nobody is standing by the console. It must cost so little that nobody is tempted to skip it on a minor update. And it has to leave the data alone: rolling back the operating system should not roll back yesterday's logs, the mail or the customers' files.

That is a modest list, and an operator of serious infrastructure could reasonably expect every one of them from the box.

The standard Debian and Red Hat server

The Debian 13 installer has a clear view of the matter: "The default file system selected in most cases is ext4." An apt upgrade on that system replaces files in place, and the way back is the backup, if somebody restores it, or the installer, if nobody does. Red Hat's published limits for its enterprise system list the file systems it supports, ext3, ext4, GFS, GFS2 and XFS, and ZFS is not among them. The usual RHEL server, which Red Hat now calls package mode, updates with dnf, in place as well. Red Hat does offer rollback, in a second way of running the machine called image mode, available since RHEL 9.6, and its own page sells it with "image-based updates and rollbacks, just like your smartphone." An enterprise operating system advertising its recovery by comparison with a telephone is the sort of thing one reads twice, and then quite admires for its honesty.

For a while Ubuntu shipped zsys, a tool for ZFS boot environments that came with its experimental ZFS installer, until a Launchpad report in 2022 found it "in very low maintenance mode (critical bug fixes only)" and asked for its removal from the installer, which duly followed. ZFS on Linux itself lives outside the kernel tree, as a module the distribution builds separately, because its licence does not sit easily with the kernel's. And the best ZFS boot manager the Linux world has, ZFSBootMenu, is a volunteer project that describes itself, with charming modesty, as "a Linux bootloader that attempts to provide an experience similar to FreeBSD's bootloader." It is good work, and no enterprise distribution ships it or answers the telephone when it fails.

The stable server for serious operation is the ground the Linux world has long thought of as its home. On this particular question the home side has not yet left the dressing room.

The way back after an update, as installed Debian 13 RHEL, package mode Ubuntu Server FreeBSD 15.1 File system the installer picks ext4 XFS ext4 ZFS, first choice Earlier system kept before an update no no no yes, whole system Boot menu lists earlier systems older kernels only older kernels only older kernels only yes, key e Trial boot once, return if it fails no no no bectl activate -t

One team, one release

The FreeBSD 15.1 installer asks how the disk should be partitioned and offers "Auto (ZFS)", "Guided Root-on-ZFS", as its first answer. The layout it builds is the way back, prepared before the first update has arrived. The base system lives in one dataset called zroot/ROOT/default. The installer script keeps /usr and /var from mounting on their own, with a comment that explains itself: "Don't mount /usr so that 'base' files go to the BEROOT." Home directories, logs, mail, crash dumps and the ports tree get datasets of their own, so a system that goes back to yesterday takes nobody's files and none of today's log lines with it.

What a boot environment carries, and what it leaves alone zroot ROOT: the boot environments default running system earlier systems one per install kernel, userland, /etc, /usr, /var/db go back together in one reboot datasets outside ROOT home · tmp · usr/ports · usr/src var/audit · var/crash · var/log var/mail · var/tmp stay as they are From the installer's zfsboot script, FreeBSD 15.1: "Don't mount /usr so that 'base' files go to the BEROOT"

Then the updater does its part. Since July 2021, freebsd-update has created a boot environment before it installs anything: its configuration says "Create a new boot environment when installing patches", the option CreateBootEnv is on unless someone turns it off, and the script calls bectl create with the version and the time in the name. If that step fails, the installation stops, which is precisely the right way round. A boot environment is a ZFS clone of the whole system, so it costs only the blocks that change afterwards.

bectl, in the base system since FreeBSD 12.0, manages these clones and makes them "selectable directly from the boot loader", whose menu has an entry called Boot Environments, under the letter e. For the nervous Friday there is bectl activate -t, which, in the words of the manual, "takes effect only for the next boot". The one-time mechanism beneath it goes back to FreeBSD 11.1, and zfsbootcfg(8) states its consequence without ceremony: "If booting fails, the machine automatically reverts to the previous boot configuration." The NSA's patched systems, had they been built this way, would have tried the new world once, failed to come up, and woken in the old one with their network intact.

Loader and file system share one source tree with bectl and freebsd-update, and one project releases all four together, with one security team answering for them. Nothing in the chain is a third-party add-on, and nothing has to be bolted on after the installer has finished.

I looked at the server behind this blog this morning (3 December 2026, 08:26, read-only), which runs FreeBSD 15.1-RELEASE-p3. bectl list shows the running system and five earlier ones. freebsd-update made four of them unasked and named each after its version and minute: one on 11 September for 15.0-RELEASE, and three on 14 September, when the move from 15.0 to 15.1 ran through three installation passes in six minutes and left a bootable predecessor after each. The fifth was added by hand before the move as a belt-and-braces precaution. Each points at a complete system of between 704 MB and 1.19 GB. The clones themselves occupy 8 KB apiece, and the blocks that belong only to their snapshots come to 147 MB in all.

Five earlier systems on this blog's server 147 MB of their own blocks 5 earlier systems, 4 made by freebsd-update 704 MB to 1.19 GB each, about 5.0 GB in all 8 KB per clone 147 MB held only by their snapshots 15.0 to 15.1 in six minutes, three passes FreeBSD 15.1-RELEASE-p3, 3 December 2026, 08:26, read-only

The same hands for decades

The second reason a cautious enterprise ought to like this is that none of it changed how the administrator works. freebsd-update fetch install is the same pair of words it has been for years; it simply does one more thing first. rc.conf has configured FreeBSD since release 2.2.2 in 1997, and pf has been in the base system since 5.2. A standard Debian or Red Hat admin learns the daily handling in days, and what they learn will still be true in ten years' time, which is a rare thing to be able to say about any operating system.

The way back on Linux has changed with each attempt at it. Ubuntu had zsys and then mothballed it, openSUSE has snapper, the Fedora family has ostree and now bootc, and each comes with its own commands, its own layout and its own idea of which parts belong to the system. An enterprise that changes distribution changes its way back as well, and quite often its admins have to learn a new one in a crisis.

The strongest case for the standard server

The best answer from the other side is a good one. openSUSE and SUSE Linux Enterprise put the root on Btrfs and let snapper take a pair of snapshots "before and after each run of zypper", and GRUB can boot from them; on a default installation with a large enough root partition that is switched on. Fedora's atomic editions and Red Hat's image mode treat the whole system as an image, so that an update is one step and so is a rollback. And large fleets have long stopped repairing servers at all: they build a new image, roll it out to a few machines first and replace the rest when it holds, so the way back is the previous image.

All of that is real, and each of it is either a different distribution from the one most companies run or a different way of operating the machine from the one their admins know. The classified network of an intelligence agency and the one database server of a medium-sized firm each have a history of their own. They are patched in place because there is no other way to patch them, and on Debian or RHEL in its usual form they are patched without a net.

The limit

A boot environment covers the operating system. A fault that has sat unnoticed in an application for months, or a network change such as the FAA's work on its cabling, is out of its reach. The way back answers the update that does not come up, which in November was the NSA's case and Apple's.

Going back reopens the hole for a while. The previous environment is still unpatched, so a rollback buys hours to understand the failure, and bectl activate -t lets the patch be tried before it counts.

Applications keep their own state. A database that migrated its schema under the new version does not migrate back when the system does, because its data lives, quite rightly, in a dataset of its own. That part of a rollback is the application's business on every platform.

The packaged base system needs a hand. FreeBSD 15 introduced the option of installing the base system as packages, and pkg has no setting that creates a boot environment on its own; on such a system the administrator runs bectl create before the upgrade, which takes one line.

UFS and other platforms go without. A FreeBSD installed on UFS, or on an architecture where the installer does not offer ZFS, has freebsd-update rollback and no boot environments.

A patch deadline measures how brave an organisation is willing to be, and a boot environment is what allows it to be brave and still open on Monday.