FreeBSD 13.1 stable version is officially released. This tutorial walks you through the steps to upgrade to FreeBSD 13.1 from FreeBSD 12.3 and older versions.
Table of Contents
Introduction
The FreeBSD Release Engineering Team is recently announced the availability of FreeBSD 13.1-RELEASE. This is the second release of the stable/13 branch.
FreeBSD 13.1 is shipped with many updated set of features. It supports several architectures including amd64, i386, powerpc, powerpc64, powerpc64le, powerpcspe, armv6, armv7, aarch64, and riscv64.
If you prefer a fresh installation, head over to the FreeBSD 13.1 download page and get a suitable version for your architecture. And then refer to the following guide to know how to install FreeBSD.
If you're already running older versions (E.g. FreeBSD 12.x), you can directly upgrade FreeBSD 12.x to FreeBSD 13.1. In this step by step guide, let us see how to upgrade to FreeBSD 13.1 from FreeBSD 12.3 version.
Update FreeBSD 12
First things first. Take a backup of everything that you can't afford losing. FreeBSD upgrade process worked just fine in my case. However, I strongly recommend you to backup your data.
Let us now go ahead and update the current FreeBSD version.
Check FreeBSD OS version and kernel version using commands:
# freebsd-version -k
Sample output:
12.3-RELEASE
$ uname -mrs
Sample output:
FreeBSD 12.3-RELEASE amd64
As you see above, the installed version is FreeBSD 12.3-RELEASE.
Before upgrading to next available major version, we must update our current FreeBSD 12.x version.
To download and install the FreeBSD security patches, run the following commands as root
user:
# freebsd-update fetch
# freebsd-update install
# pkg upgrade
Once the packages are upgraded, reboot your system:
# shutdown -r now
Or,
# reboot
It is time to upgrade FreeBSD 12 to FreeBSD 13.
Upgrade to FreeBSD 13 From FreeBSD 12
As of writing this guide, the latest stable FreeBSD version 13.1.
Run the following command to upgrade to FreeBSD 13.1-RELEASE from FreeBSD 12.x version:
# freebsd-update -r 13.1-RELEASE upgrade
Once you run this command, the freebsd-update
command will evaluate the configuration file and current system in an attempt to gather the information necessary to perform the upgrade.
During the upgrade, you will be asked what to install, what to remove or how to proceed. You may need to type y
and hit ENTER
a few times to continue.
Sample output:
src component not installed, skipped Looking up update.FreeBSD.org mirrors… 2 mirrors found. Fetching metadata signature for 12.3-RELEASE from update1.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 src/src 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 13.1-RELEASE from update2.freebsd.org… done. Fetching metadata index… done. Fetching 1 metadata patches. done. Applying metadata patches… done. Fetching 1 metadata files… [...]
The above command will start to download all packages. Sit back and relax. It will take several minutes depending upon the Internet speed and the number of installed packages on your FreeBSD system.
During the upgrade task, Configuration files will then be merged. The results of every successful merge will be shown to the user as the process continues.
Please note that the current system is not being altered yet, because all merging and patching is happening in another directory.
Once all patches have been applied successfully, all configuration files have been merged, run the following command to commit all changes to the disk:
# freebsd-update install
Sample output:
ZFS filesystem version: 5 ZFS storage pool version: features support (5000) Installing updates… Kernel updates have been installed. Please reboot and run "/usr/sbin/freebsd-update install" again to finish installing updates.
All Kernel updates have been installed in your FreeBSD, reboot your system to apply the patches.
After logging into the system, run the following command again to finish installing updates:
# freebsd-update install
After all updates are installed, you will see the following output:
[...] 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.
Once again the run the same command to remove old shared libraries and complete FreeBSD 13.1 upgrade task.
# freebsd-update install
Finally, reboot your system to complete the upgrade task.
Verify if FreeBSD 13.1 is upgraded successfully by checking the OS version.
# freebsd-version -k 13.1-RELEASE
And check the FreeBSD Kernel version:
# uname -mrs FreeBSD 13.1-RELEASE amd64
Congratulations! We just upgraded to FreeBSD 13.1.
We need to do one more thing as well. After a major version upgrade, all installed packages and ports should be upgraded.
Update all installed packages and ports collections using the following commands:
# pkg-static install -f pkg
# pkg bootstrap -f
# pkg update
# pkg upgrade -y
That's it. Reboot once again and start using FreeBSD version.
Troubleshooting Pkg Update Error in FreeBSD
After upgrading to FreeBSD 13, I got the following error when I try to update the ports collections:
pkg-static: Warning: Major OS version upgrade detected. Running "pkg-static install -f pkg" recommended Updating FreeBSD repository catalogue… pkg-static: repository meta has wrong version 2 pkg-static: Repository FreeBSD load error: meta cannot be loaded No error: 0 Fetching meta.txz: 100% 916 B 0.9kB/s 00:01 pkg-static: repository meta has wrong version 2 repository FreeBSD has no meta file, using default settings Fetching packagesite.txz: 100% 6 MiB 1.6MB/s 00:04 pkg-static: repository meta has wrong version 2 pkg-static: Repository FreeBSD load error: meta cannot be loaded No error: 0 Unable to open created repository FreeBSD Unable to update repository FreeBSD Error updating repositories!
This usually happens when we upgrade 12.0 to 12.1 or 2.
To fix this issue, update ports-mgmt/pkg
from the ports tree using ports-mgmt/portmaster
.
Fetch the ports tree using commands if you haven't done it already:
# portsnap fetch
Sample output:
Looking up portsnap.FreeBSD.org mirrors… 4 mirrors found. Fetching public key from ipv4.aws.portsnap.freebsd.org… done. Fetching snapshot tag from ipv4.aws.portsnap.freebsd.org… done. Fetching snapshot metadata… done. Fetching snapshot generated at Sat May 28 05:59:31 IST 2022: 552628c35b88d79f5a54b7774ddca0463fde713e43f367 88 MB 3233 kBps 28s Extracting snapshot… done. Verifying snapshot integrity… done. Fetching snapshot tag from ipv4.aws.portsnap.freebsd.org… done. Fetching snapshot metadata… done. Updating from Sat May 28 05:59:31 IST 2022 to Sat May 28 17:23:31 IST 2022. Fetching 5 metadata patches… done. Applying metadata patches… done. Fetching 0 metadata files… done. Fetching 18 patches. (18/18) 100.00% done. done. Applying patches… done. Fetching 0 new ports or files… done.
Next run the following command to download and extract the entire ports tree to the /usr/ports
directory.
# portsnap extract
And then run:
# pkg bootstrap -f
# pkg update -f
# pkg upgrade -f
This usually happens when we do minor upgrade i.e. 12.0 to 12. After running pkg bootstrap -f
everything worked as expected.
Change Hostname (Optional)
I used to set the hostname to any Linux or Unix systems with the operating system's version. For instance, I will usually set name as "freebsd12" for FreeBSD 12 systems. If you're anything like me, you should update your hostname to reflect the current version.
As root
user, type "hostname <new hostname>", and the hostname will be changed immediately.
# hostname freebsd13.ostechnix.lan
Replace "freebsd13.ostechnix.lan" with your own hostname.
To make this change permanent across reboots, edit the file "/etc/rc.conf
" using a text editor:
# vi /etc/rc.conf
Add/modify the following line:
hostname="freebsd13.ostechnix.lan"
Reboot your system to take effect the changes.
Check if the hostname is changed with command:
# hostname freebsd13.ostechnix.lan
Perfect! Start using your FreeBSD 13.1 system!!
Related read: