freebsd-upgrade In A Boot EnvironmentJul 27, 2017 · 2 minute read · Comments
Yesterday FreeBSD 11.1 was released. Once I got into work I started upgrading the VM I use for day to day activities. After creating a Boot Environment (BE) using beadm(1), and running the upgrade and install parts of freebsd-update(8), I rebooted into a newly activated BE only to find I had an 11.1 kernel, but a 11.0 userland…
I had no idea what I’d done wrong. After some questions on the FreeBSD Forums, I figured it out. Previously, I had only run the install process once; the install process needs to be done three times:
- Install the kernel
- Install userland
Usually, one would reboot between these actions. This is what I had attempted, but when I rebooted into my new BE I got the familiar message:
No updates are available to install. Run '/usr/sbin/freebsd-update fetch' first.
So, what’s the correct procedure? Hunting across the Internet, I found many examples of how people thought it should be done. Most commonly was:
- Create a BE
- Activate the BE
- Reboot into the BE
- Fetch the upgrade
- Install the upgraded kernel
- Install upgraded userland
- Reboot (sometimes this seemed optional)
- Run install again for cleanup
Now, that seems like an awful lot of downtime. Back at Sun, BEs were introduced to me as a convenient roll-back method if things go wrong, and also to reduce downtime caused by upgrade (this was called Live Upgrade). Having all of this downtime did not appeal to me one bit.
So, how can we reduce downtime while using FreeBSD Boot Environments? Run all three installation tasks one after each other. Since we are upgrading an essentially dormant system (the BE hasn’t been activated and rebooted into yet) we don’t need to do the in-between reboots. Here’s my process:
Now you can keep the previous BE around until you’re happy everything is working and then destroy it.
I’ve not tried it, but I see no reason why this wouldn’t work for updates (e.g. 11.0-RELEASE-p0 to 11.0-RELEASE-p1) too.