Upgrade FreeBSD 12 to 13

|
Last Updated:
|
|

With FreeBSD 13 having been released, it might be the right time to upgrade your FreeBSD 12 box to 13. Follow through this guide to learn how to upgrade FreeBSD 12 to 13.

You can read more about FreeBSD 13.0-RELEASE notes.

Before you can proceed, ensure that you backup all your data just in case something goes south with upgrades.

Upgrading FreeBSD 12 to 13

In our setup, we have FreeBSD 12.2 RELEASE version installed.

freebsd-version
12.2-RELEASE

Apply System Security Patches

freebsd-update command can be used download and install security patches on FreeBSD systems.

To download system security patches, run the commands below;

freebsd-update fetch

Sample output;

src component not installed, skipped
Looking up update.FreeBSD.org mirrors... 3 mirrors found.
Fetching public key from update1.freebsd.org... done.
Fetching metadata signature for 12.2-RELEASE from update1.freebsd.org... done.
Fetching metadata index... done.
Fetching 2 metadata files... done.
Inspecting system... done.
Preparing to download files... done.
Fetching 114 patches.....10....20....30....40....50....60....70....80....90....100....110.. done.
Applying patches... done.
Fetching 1 files...  done.
The following files will be removed as part of updating to
12.2-RELEASE-p6:
...

Next, you need to install downloaded security patches by running the command below;

freebsd-update install

You can simply execute both commands at the same time by running;

freebsd-update fetch install

Once the command above completes, you need to check if the system requires a reboot to apply the kernel patches, if at all it was patched.

To know if the system requires a reboot compare the output of the commands, freebsd-version -k and uname -r (to check the kernel versions);

freebsd-version -k

Sample output;

12.2-RELEASE-p6
uname -r
12.2-RELEASE

In such a scenario, the system requires a reboot since the kernel was upgraded. Hence, execute the command below to reboot your FreeBSD box;

shutdown -r now

When you check the outputs of the commands above after reboot, they should be same;

freebsd-version -k

Sample output;

12.2-RELEASE-p6
uname -r
12.2-RELEASE-p6

Upgrading FreeBSD 12 to FreeBSD 13

Once you have downloaded and installed security patches, you can then proceed to perform a major version upgrade of FreeBSD 12 to 13;

freebsd-update -r 13.0-RELEASE upgrade
src component not installed, skipped
Looking up update.FreeBSD.org mirrors... 3 mirrors found.
Fetching metadata signature for 12.2-RELEASE from update1.freebsd.org... done.
Fetching metadata index... done.
Inspecting system... done.

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

The following components of FreeBSD do not seem to be installed:
world/base-dbg world/lib32-dbg

Does this look reasonable (y/n)? y

Fetching metadata signature for 13.0-RELEASE from update1.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 12.2-RELEASE for merging... done.
Preparing to download files... done.
Fetching 10109 patches.....10....20....30...
...
/bin/pwait
/bin/pwd
/bin/realpath
/bin/red
/bin/rm
/bin/rmail
/bin/rmdir
To install the downloaded upgrades, run "/usr/sbin/freebsd-update install".

Depending on your internet speed, this might take sometime to complete.

Once the command above completes, proceed to install the downloaded upgrades by running the command;

freebsd-update install

Sample command output;

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.

So reboot and reinstall the updates;

shutdown -r now

Once the system boots, rerun the updates installation command;

freebsd-update install

At this stage, you have successfully upgraded FreeBSD 12.2 to FreeBSD 13.0;

freebsd-version
13.0-RELEASE

Upgrade Packages After a Major Version Upgrade

It is recommended that after a major version upgrade, all system packages be upgraded as well since “Major versions use different Application Binary Interfaces (ABIs), which will break most third-party applications. After a major version upgrade, all installed packages and ports need to be upgraded“.

Hence, execute the commands below;

pkg-static upgrade -f
pkg bootstrap -f

Once the package upgrades are complete, finalize the upgrade process by running;

freebsd-update install

Reboot once more;

shutdown -r now

Verify OS details after reboot;

pkg install neofetch
neofetch
```                        `       root@freebsd 
  ` `.....---.......--.```   -/    ------------ 
  +o   .--`         /y:`      +.   OS: FreeBSD 13.0-RELEASE amd64 
   yo`:.            :o      `+-    Uptime: 3 mins 
    y/               -/`   -o/     Packages: 6 (pkg) 
   .-                  ::/sy+:.    Shell: csh tcsh 6.21.00 
   /                     `--  /    Terminal: /dev/pts/0 
  `:                          :`   CPU: Intel i7-10510U (1) @ 2.304GHz 
  `:                          :`   GPU: SVGA II Adapter 
   /                          /    Memory: 108MiB / 990MiB 
   .-                        -.
    --                      -.                             
     `:`                  `:`                              
       .--             `--.
          .---.....----.

And that is it on how to upgrade FreeBSD 12 to FreeBSD 13. Enjoy.

Other Tutorials

Easily Install MariaDB 10.5 on FreeBSD

Install PHP 7.4 on FreeBSD

Install or Uninstall Software on FreeBSD using Ports Collection

SUPPORT US VIA A VIRTUAL CUP OF COFFEE

We're passionate about sharing our knowledge and experiences with you through our blog. If you appreciate our efforts, consider buying us a virtual coffee. Your support keeps us motivated and enables us to continually improve, ensuring that we can provide you with the best content possible. Thank you for being a coffee-fueled champion of our work!

Photo of author
koromicha
I am the Co-founder of Kifarunix.com, Linux and the whole FOSS enthusiast, Linux System Admin and a Blue Teamer who loves to share technological tips and hacks with others as a way of sharing knowledge as: "In vain have you acquired knowledge if you have not imparted it to others".

Leave a Comment