Today I got around to updating my VPS (the one serving this website) from FreeBSD 14.3 to 15.0. Unlike past major version upgrades, this one was surprisingly difficult, involving a reboot into into single user mode and a fraught hour this morning.

#Upgrading

Normally when I upgrade this machine to a new major version of FreeBSD, it’s a straight-forward process, as outlined by the FreeBSD Handbook:

$ sudo freebsd-update -r $newVersion upgrade
$ sudo reboot
...
$ sudo freebsd-update install

This is about all it takes. Sometimes there’s some merging of config files, or some manual package reinstallation.

Last night, I ran the upgrade, and left the reboot for this morning.

$ sudo freebsd-update -r 15.0-RELEASE upgrade

After the reboot, I found myself unable to run basic administration commands like sudo and pkg. These commands yielded an error:

ld-elf.so.1: Shared object "libutil.so.9" not found, required by "pkg"

Some searching around the internet suggested I needed to run a bootstrapping command to rebuild the pkg database.

$ pkg bootstrap -f

But because of the ld error above, I was unable to do that.

#Changing my Root Password

Being unable to sudo left me with just su. Unfortunately, it had been so long since I’d needed to actually log in as root that I had forgotten my root password. So, I had to reboot into single user mode to change the root password before I could continue.

FreeBSD’s boot loader boot to single user mode if you press 2 at the menu. You can also press Space to pause the countdown.

Once rebooted, passwd does the trick.

#Bootstrapping pkg

That wasn’t quite the end of my time in single user mode because I was still getting some frustraing errors from pkg when I ran the bootstrapping command above.

The package management tool is not yet installed on your system.
Do you want to fetch and install it now? [y/N]: y
Bootstrapping pkg from pkg+https://pkg.freebsd.org/FreeBSD:15:amd64/quarterly, please wait...
Verifying signature with trusted certificate pkg.freebsd.org.2013102301... done
pkg: failed to extract pkg-static: Can't unlink already-existing object
Bootstrapping pkg from pkg+https://pkg.freebsd.org/FreeBSD:15:amd64/kmods_quarterly_0, please wait...
pkg: Error fetching https://pkg.freebsd.org/FreeBSD:15:amd64/kmods_quarterly_0/Latest/pkg.pkg: Not Found
A pre-built version of pkg could not be found for your system.

Some more help suggested I build a small temporary library path with the few libraries pkg needed pointing to the previous versions.

$ mkdir libtmp

$ ls -l libtmp
total 3
lrwxr-xr-x  1 root wheel 21 Mar  7 16:35 libssl.so -> /usr/lib/libssl.so.35
lrwxr-xr-x  1 root wheel 21 Mar  7 16:34 libssl.so.30 -> /usr/lib/libssl.so.35
lrwxr-xr-x  1 root wheel 18 Mar  7 16:34 libutil.so.9 -> /lib/libutil.so.10

$ export LD_LIBRARY_PATH=`pwd`/libtmp

$ pkg bootstrap -f

This worked!

#Finishing the Upgrade

After rebooting back into multiuser mode, I was able to upgrade the rest of the installed packages in the usual way.

$ sudo pkg upgrade