Lifeforms

publications thesis contact

Downgrading FreeBSD 10 to 9 with freebsd-update

24 Dec 2014

There's a moment in every nerd's life when you wished you hadn't updated to that shiny latest software version. For us, such a moment happened with FreeBSD 10.1, with freezes and panics all over the place. So what do you do? Well, you can do a tedious clean install... Or just downgrade your running system to FreeBSD 9.3! It turns out that freebsd-update makes this hilariously easy. When life gives you eggs, make eggstasy!

When upgrading FreeBSD with freebsd-update, you probably use the familiar procedure from the handbook to update the base system, and then reinstall your packages. To refresh, when upgrading to FreeBSD 10.1, you'd do something like this:

freebsd-update upgrade -r 10.1-RELEASE
freebsd-update install
reboot
freebsd-update install
pwd_mkdb /etc/master.passwd
pkg-static install -fy pkg
pkg upgrade -fy
freebsd-update install
reboot

The first freebsd-update install installs the new kernel. Then, you reboot into that new kernel. Running the new kernel before installing the new userland is a must, as the new userland will depend on new kernel features. Meanwhile, your existing programs normally should continue to work. This ensures that your system keeps working during most of the procedure, and your downtime is really low.

However, when you are downgrading to an older release, you want to stay in the newest kernel as long as possible. If you reboot after installing the kernel, you will be in trouble. Your system will run the low-version kernel, but still have the high-version userland and packages, and you'll break your system. For instance, when booting your FreeBSD 10.1 system in a FreeBSD 9.3 kernel, you'll notice that ifconfig stops working, and after rebooting, you'll be left without networking. You could fix this from the console, but you'll have serious downtime.

It turns out that, with a slight change in workflow, it's possible to downgrade FreeBSD quite painlessly. Just skip the first reboot. While still running the high-version kernel, install the low-version userland, reinstall the packages, clean up, and finally reboot into the lower release. For downgrading FreeBSD 10.1 to FreeBSD 9.3, you would do:

freebsd-update upgrade -r 9.3-RELEASE
freebsd-update install
freebsd-update install
pwd_mkdb /etc/master.passwd
pkg-static install -fy pkg
pkg upgrade -fy
freebsd-update install
reboot

This rite can be carried out over an SSH connection, but be careful not to close your session, because the ssh program and all packages will be overwritten at some point, so you might not have a working ssh or your favorite shell at all times.

Conclusion: With a slight change in workflow, you can use freebsd-update to 'downdate' to an earlier FreeBSD version.

Disclaimer: Some people might think you're crazy if you do this, so it could be harder to get help. As always, ensure that your hardware is supported, and make a backup of your system before doing any up- or downgrade. If you're skeptical, try it in a virtual machine first!