How to upgrade a whole FreeBSD platform
On July 26th 2017 FreeBSD version 11.1 was announced. At that point in time almost the complete SoCruel.NU platform was running FreeBSD version 11.0.
This post describes the procedure used to upgrade the version 11.0 systems to version 11.1. Due to the changed support model, this upgrade procedure must be performed within 3 months of July 26th 2017.
Last but not least is it important to know that SoCruel.NU uses both Poudriere and SaltStack.
Requirements
The following requirements have to be in place to be able to implement what is described in this post:
Overview
The high level steps of the upgrade procedure used to upgrade all the SoCruel.NU systems to FreeBSD 11.1 are:
- Step 1: test upgrade on 1 or more test systems
- Step 2: do the upgrade of the Poudriere system, including building a new Poudriere 11.1 jail
- Step 3: upgrade a test system
- Step 4: upgrade all other systems
Step 1: test upgrade on test systems
The SoCruel.NU platform has several test systems running. The first step of this whole procedure is just to test an upgrade on one of the test systems. In case standard FreeBSD packages are used the commands to perform such an upgrade are:
$ sudo freebsd-update -r 11.1-RELEASE upgrade $ sudo freebsd-update install $ sudo reboot $ sudo freebsd-update install $ sudo pkg upgrade --force $ sudo freebsd-update install $ sudo reboot
The SoCruel.NU platform uses its own Poudriere system for its packages. Also the test systems are configured to use this Poudriere system. Therefor the last 3 commands of the sequence above can not be performed.
But this step was just to verify if an upgrade would work or not. This as all SoCruel.NU are build the same way. So we are now confident that upgrading any other system will also be successfull.
Step 2: do the upgrade of the Poudriere system
The steps used to upgrade the Poudriere system are (this system is a virtual machine):
On the hypervisor:
- shutdown the system - make a snapshot of the system - boot up the system
And then on the system itself:
$ sudo freebsd-update -r 11.1-RELEASE upgrade $ sudo freebsd-update install $ sudo reboot $ sudo freebsd-update install $ sudo poudriere jail -c -j 'jail name' -v 11.1-RELEASE $ sudo poudriere ports -u -p 'ports name' $ sudo poudriere bulk -j 'jail name' -p 'ports name' -f 'port list'
At this point we have the FreeBSD 11.1-RELEASE packages available on the system. This system was configured to use its own Poudriere repository. So now we have to change this to the 11.1 version by changing the poudriere.conf
file in the /usr/local/etc/pkg/repos
folder. This is the configuration file for our Poudriere repository. The poudriere.conf
file should include a line like the below after we have changed it:
url: "file:///usr/local/poudriere/data/packages/freebsd_11-1x64-HEAD"
The next step is to finish the upgrade of the Poudriere system:
$ sudo pkg upgrade --force $ sudo freebsd-update install $ sudo reboot
Step 3: upgrade test system
We have a working Poudriere system now. This means we can do a full upgrade of one of the test systems. The procedure for this is:
$ sudo freebsd-update -r 11.1-RELEASE upgrade $ sudo freebsd-update install $ sudo reboot $ sudo freebsd-update install
At this point we need to upgrade the packages of the system. The packages are managed through Poudriere. This means we need to change the client configuration on our system to point to the 11.1 packages. We can do this by changing the poudriere.conf
file in the /usr/local/etc/pkg/repos
folder. This is the configuration file for our Poudriere repository. The poudriere.conf
file should include a line like the below after we have changed it:
url: "https://'FQDN Poudriere System'/packages/111x64-HEAD/",
At SoCruel.NU the above Poudriere client process is done through SaltStack.
Now we can continue with the upgrade process of our system:
$ sudo pkg upgrade --force $ sudo freebsd-update install $ sudo reboot
Step 4: upgrade all other systems
The upgrade procedure for all other SoCruel.NU virtual FreeBSD machines is the same as described in the chapter above. The step to change the poudriere.conf
file was done using SaltStack. In this way the total time to upgrade a virtual system was about 20 minutes.
Resources
Some (other) resources about this subject: