Samir Parikh / Blog


Originally published on 27 December 2018

I recently decided to spin up a few FreeBSD virtual machines on Azure. Normally, you can provision FreeBSD 11.2 but since FreeBSD 12.0 recently came out, I thought it would be a good idea to upgrade to 12.0-RELEASE before doing too much work on them. Fortunately, the Release Engineering team publishes a great set of upgrade instructions with each release that you can easily follow.

The first thing to do is to switch over to root.

$ sudo su

The current release level of the operating system can be found by using uname(1):

# uname -r
11.2-RELEASE-p2

Then, it's just a matter of using the freebsd-update(8) utility as described in the upgrade instructions to update your system:

# freebsd-update fetch
src component not installed, skipped
Looking up update.FreeBSD.org mirrors... 3 mirrors found.
Fetching public key from update2.freebsd.org... done.
Fetching metadata signature for 11.2-RELEASE from update2.freebsd.org... done.
Fetching metadata index... done.
Fetching 2 metadata files... done.
Inspecting system... done.
Preparing to download files... done.
Fetching 13 patches.....10. done.
Applying patches... done.
Fetching 34 files... done.

# freebsd-update install
src component not installed, skipped
Installing updates... done.

# freebsd-update upgrade -r 12.0-RELEASE
src component not installed, skipped
Looking up update.FreeBSD.org mirrors... 3 mirrors found.
Fetching metadata signature for 11.2-RELEASE from update4.freebsd.org... done.
Fetching metadata index... done.
Fetching 1 metadata files... done.
Inspecting system... done.

The following components of FreeBSD seem to be installed:
kernel/generic kernel/generic-dbg world/base world/base-dbg world/doc
world/lib32 world/lib32-dbg

The following components of FreeBSD do not seem to be installed:

Does this look reasonable (y/n)? y

Fetching metadata signature for 12.0-RELEASE from update4.freebsd.org... done.
Fetching metadata index... done.
Fetching 1 metadata patches. done.
Applying metadata patches... done.
Fetching 1 metadata files... done.
Inspecting system... done.
Fetching files from 11.2-RELEASE for merging... done.
Preparing to download files... done.
Fetching 1172 patches.....10....20....30....40....50....60....70....80....90....100....110....120....130....140....150....160....170....180....190....200....210....220....230....240....250....260....270....280....290....300....310....320....330....340....350....360....370....380....390....400....410....420....430....440....450....460....470....480....490....500....510....520....530....540....550....560....570....580....590....600....610....620....630....640....650....660....670....680....690....700....710....720....730....740....750....760....770....780....790....800....810....820....830....840....850....860....870....880....890....900....910....920....930....940....950....960....970....980....990....1000....1010....1020....1030....1040....1050....1060....1070....1080....1090....1100....1110....1120....1130....1140....1150....1160....1170. done.
Applying patches... done.
Fetching 10643 files...

<snip...>

To install the downloaded upgrades, run "/usr/sbin/freebsd-update install".

# freebsd-update install
src component not installed, skipped
Installing updates...
Kernel updates have been installed.  Please reboot and run
"/usr/sbin/freebsd-update install" again to finish installing updates.

Reboot your system with the newly installed kernel before updating the non-kernel components:

# reboot

Rerun freebsd-update(8) to install the new userland components:

# freebsd-update install
src component not installed, skipped
Installing updates...
Completing this upgrade requires removing old shared object files.
Please rebuild all installed 3rd party software (e.g., programs
installed from the ports tree) and then run "/usr/sbin/freebsd-update install"
again to finish installing updates.

Then, according to the upgrade instructions:

At this point, users of systems being upgraded from earlier FreeBSD releases will be prompted by freebsd-update(8) to rebuild all third- party applications (e.g., ports installed from the ports tree) due to updates in system libraries.

After updating installed third-party applications (and again, only if freebsd-update(8) printed a message indicating that this was necessary), run freebsd-update(8) again so that it can delete the old (no longer used) system libraries.

# freebsd-update install
src component not installed, skipped
Installing updates...rmdir: ///var/db/etcupdate/current/usr/share/openssl/man/en.ISO8859-1: Directory not empty
rmdir: ///var/db/etcupdate/current/usr/share/openssl/man: Directory not empty
rmdir: ///var/db/etcupdate/current/usr/share/openssl: Directory not empty
rmdir: ///var/db/etcupdate/current/usr/share/man/en.UTF-8: Directory not empty
rmdir: ///var/db/etcupdate/current/usr/share/man/en.ISO8859-1: Directory not empty
rmdir: ///var/db/etcupdate/current/usr/share/man: Directory not empty
rmdir: ///usr/tests/lib/libpam: Directory not empty
rmdir: ///usr/tests/bin/rcp: Directory not empty
rmdir: ///usr/lib/debug/usr/tests/lib/libpam: Directory not empty
 done.

You can now reboot(8) into your newly upgraded system:

# reboot

Now verify your current release level.

$ uname -r
12.0-RELEASE

Finally, you need to resolve the "ld-elf.so.1: Shared object 'libssl.so.8' not found, required by 'pkg'" error that you will get if you try to update or install packages. Please see this thread and pkg(8) for additional details.

# pkg-static install -f pkg
pkg-static: Warning: Major OS version upgrade detected.  Running "pkg-static install -f pkg" recommended
Updating FreeBSD repository catalogue...
pkg-static: Repository FreeBSD has a wrong packagesite, need to re-create database
Fetching meta.txz: 100%    944 B   0.9kB/s    00:01    
Fetching packagesite.txz: 100%    6 MiB   6.5MB/s    00:01    
Processing entries: 100%
FreeBSD repository update completed. 31475 packages processed.
All repositories are up to date.
New version of pkg detected; it needs to be installed first.
The following 1 package(s) will be affected (of 0 checked):

Installed packages to be UPGRADED:
    pkg: 1.10.5_1 -> 1.10.5_5

Number of packages to be upgraded: 1

3 MiB to be downloaded.

Proceed with this action? [y/N]: y
[1/1] Fetching pkg-1.10.5_5.txz: 100%    3 MiB   3.4MB/s    00:01    
Checking integrity... done (0 conflicting)
[1/1] Upgrading pkg from 1.10.5_1 to 1.10.5_5...
[1/1] Extracting pkg-1.10.5_5: 100%
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
Checking integrity... done (0 conflicting)
The following 1 package(s) will be affected (of 0 checked):

Installed packages to be REINSTALLED:
    pkg-1.10.5_5

Number of packages to be reinstalled: 1

Proceed with this action? [y/N]: y
[1/1] Reinstalling pkg-1.10.5_5...
[1/1] Extracting pkg-1.10.5_5: 100%

# pkg upgrade -f
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
Checking for upgrades (25 candidates): 100%
Processing candidates (25 candidates): 100%

<snip...>

You should now have a fully upgraded system in which to install and upgrade additional packages.