FreeBSD 13 released: Here is how to upgrade FreeBSD 12 to 13

FreeBSD 13 verfication
The FreeBSD project released FreeBSD version 13. The new version comes with updated software and features for a wild variety of architectures. The latest release provides performance improvements and better support for FreeBSD. One can benefit greatly using an upgraded version of FreeBSD. Let us see what’s new and quickly update FreeBSD 12 to 13 using the CLI.

FreeBSD 13 released – What’s new?

  1. OpenZFS now provide the ZFS implementation on FreeBSD 13. In other words, you will get the same ZFS version on Linux and FreeBSD.
  2. The NFS client and server now support NFSv4.2 with extended attributes.
  3. Also, the NFS client and server now support NFS over TLS for security and privacy reasons.
  4. FreeBSD 13 removed several network drivers for obsolete Ethernet adapters such as Crystal Semiconductor CS8900/CS8920 and others.
  5. They added the qat driver, supporting some of the Intel QuickAssist (QAT) device’s cryptographic acceleration functions.
  6. Additional boot loader changes for EFI system partition.
  7. FreeBSD 13 features a rewritten routing stack. It is based on the introduction of next hops – objects holding all necessary states to pass a packet to the desired destination.
  8. Multipath routing support has been rewritten in a more scalable fashion.
  9. The 64-bit ARM architecture known as arm64 or AArch64 is promoted to Tier-1 status for FreeBSD 13.
  10. The bhyve(8) utility works reliably with more VNC clients including the macOS “Screen Sharing” application. See the release note for all features.

How to upgrade FreeBSD 12 to 13

Let us note down the FreeBSD version by running the following commands:
uname -mrs

Make sure you apply all existing pending updates for FreeBSD 12.x:
# freebsd-update fetch
# freebsd-update install
# pkg upgrade

I already had all updates applied using Ansible, but you may see the update and might need to reboot your FreeBSD system if the kernel patch is installed. See FreeBSD Applying Security Updates Using pkg/freebsd-update for more info.

WARNING: Make sure you backup all important data, config files, and database tables/DBS. The nixCraft is not responsible for any data loss, and upgrading FreeBSD should only be attempted after backing up all data.

Upgrading from previous releases of FreeBSD 12.2 to 13.0 using binary method

I tested the following instructions with my AWS EC2 FreeBSD AMD64 VM. Please note that upgrading powerpc64 systems from earlier FreeBSD Releases is NOT supported. Users need to reinstall, due to using new ABI. Binary upgrades between RELEASE versions are recommended using the freebsd-update command-line utility. Hence, run the following freebsd-update command:
# freebsd-update -r 13.0-RELEASE upgrade

Binary upgrades started on my FreeBSD EC2 AWS cloud server

The freebsd-update will assess the configuration files and might prompt you as follows for config file merging and other options as per your installed apps and customizations. Read them carefully:
..11090....11100....11110....11120....11130....11140....11150....11160....11170... done.
Applying patches... 
Fetching 627 files... ....10....20....30....40....50....60....70....80....90....100
Attempting to automatically merge changes in files... done.
The following file will be removed, as it no longer exists in
FreeBSD 13.0-RELEASE: /etc/motd
Does this look reasonable (y/n)? y
To install the downloaded upgrades, run "/usr/sbin/freebsd-update install".

Now that updates are downloaded, merged in a directory, it is time to commit changes to the disk. In other words, type the following command on your FreeBSD box to apply 12 to 13 updates:
# freebsd-update install
Here is what I saw:

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.

Therefore, I reboot the FreeBSD box:
# shutdown -r now
## OR ##
# reboot

My ssh session disconnected:

Connection to ec2.freebsd-nixcraft.wan.sweet.home closed by remote host.
Connection to ec2.freebsd-nixcraft.wan.sweet.home closed.

Removing all old shared libraries and object files

After sometimes the system will come back online, restart the freebsd-update session using the following command:
# freebsd-update install

Updating all apps and packages

Now the base FreeBSD system is fully patched and updated. It is time to update all binary packages too due to ABI changes. We simply run the following pkg command:
# pkg-static install -f pkg
# pkg bootstrap -f
# pkg update
# pkg upgrade

Now I installed all 3rd party apps such as Python, Nginx, and so on. We need to run the following command one more time for removing old shared object files. Hence, make sure one more last time you run the following command and you are done with updating FreeBSD from 12 to 13 using the CLI:
# freebsd-update install

src component not installed, skipped
Installing updates... done.

Is is also possible to upgrade the system using source based method. You need to read the information provided in /usr/src/UPDATING file.
# vim /usr/src/UPDATING

Verifying FreeBSD 12 to 13 upgrade

Make sure all services are running:
# ps aux
# sockstat -l
# sockstat -4
# sockstat -6
# netstat -a -n | grep LISTEN

Related: FreeBSD Unix Find Out Which Programs Are Listening On a Given Port Number

Check out for errors in log file using the cat command/grep command/egrep command and other tools:
# tail -f /var/log/messages
# tail -f /var/log/nginx/myapp.log
# grep error /path/to/app
# egrep -i 'err|warn|cri' /var/log/messages

See version:
uname -mrs

Remove Unwanted/Unused Dependencies in FreeBSD package (optional)

Upgrade may leave some orphan binary packages, and we can get rid of them too using the pkg command:
# pkg autoremove

How to upgrade FreeBSD jail from 12 to 13

We can upgrade jail too. The concept is the same, but you need to tell the current version as follows. Get jail name and base dir:
# jls
My jail:

   JID  IP Address      Hostname                      Path
     1                  dnscrypt                      /jails/dnscrypt

Now run :
# freebsd-update -b /jails/dnscrypt/ --currently-running 12.2-RELEASE -r 13.0-RELEASE upgrade

  1. -b /jails/dnscrypt/ : Operate on a system mounted at jail basedir /jails/dnscrypt/.
  2. --currently-running 12.2-RELEASE : We need to tell freebsd-update like this when using the upgrade command or fetch command for jail upgrades. Do not detect the currently-running release. Only needed when upgrading jails.
  3. -r 13.0-RELEASE upgrade : Specify the new release to which should jail upgrade.

Next, running subsequent jail upgrade and install commands can be done normally with -b for jail dircotry:
## 1. Install downloaded upgrades for jail ##
# freebsd-update -b /jails/dnscrypt/ install
## 2. Reboot/restart our jail ##
# /etc/rc.d/jail restart
# freebsd-update -b /jails/dnscrypt/ install
# jls
## 3. Note down jail id and gain shell ##
# jexec 2 sh
## 4. Upgrade all package inside jail too ##
# pkg-static install -f pkg
# pkg bootstrap -f
# pkg update
# pkg upgrade
## 5. Exit out of jail ##
# exit

A note about upgrading ZFS storage pools version on FreeBSD

When we run the zpool status command we will see the message as follows:

status: Some supported features are not enabled on the pool. The pool can
	still be used, but some features are unavailable.

In other words, it is time to upgrade the zpool version on FreeBSD:
$ sudo zpool upgrade -a
See “How to upgrade ZFS storage pools version on FreeBSD” for detailed information.

Summing up

FreeBSD 13 continues to lead as a robust BSD family of the operating system for end-users. It still maintains classic Unix features while giving out cutting-edge features such as Jails, Bhyve, powerful networking stack, firewalls, and more. I would strongly suggest that you head ahead to the FreeBSD download page and read the release note too.

🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 4 comments so far... add one

CategoryList of Unix and Linux commands
Disk space analyzersdf ncdu pydf
File Managementcat tree
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network UtilitiesNetHogs dig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
4 comments… add one

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum