Upgrade FreeBSD operating system

Upgrade FreeBSD system

Upgrade FreeBSD desktop or server operating system (OS). A step-by-step article for updating the current FreeBSD OS. It covers upgrading FreeBSD operating system to a new minor or major version.

Topics covered:
  • 3.1FreeBSD pkg update and upgrade
    • 3.1.1Update FreeBSD
    • 3.1.2Upgrade FreeBSD
    • 3.1.3FreeBSD version
  • 3.2Current version update
    • 3.2.1Fetch and apply patches
    • 3.2.2Install updates
  • 3.3New version upgrade
    • 3.3.1Upgrade FreeBSD version
    • 3.3.2Kernel components
    • 3.3.3Non-kernel components
    • 3.3.4Final reboot
  • 3.4Troubleshoot FreeBSD upgrade
    • 3.4.1Bootstrap pkg
    • 3.4.2Rollback

Buy this service

The service includes upgrading the FreeBSD operating system kernel and userland to the next minor or major OS version on a single FreeBSD server. The customer must provide remote SSH access to the FreeBSD VPS or cloud server.

Product name:
Upgrade FreeBSD Operating System
Product ID:
GWINC-SE-D1C1I3
Price*:
US $69.95 — Buy Now

*GST extra, please add 18% GST to the above price. GST is not applicable for orders outside India. International payments are accepted only through PayPal.

Affiliate links

Upgrading the FreeBSD server requires a VPS or a cloud server with root access. Use our affiliate links to purchase a VPS or cloud server from third-party vendors. The affiliate commissions we earn facilitate, Free website access for everyone.

The affiliate links are listed in alphabetical order without any favor. Users are encouraged to refer to the Global Webdynamics LLP Terms of Service governing the Third-party vendors.

3.1FreeBSD pkg update and upgrade

FreeBSD operating system provides an easy-to-use software package manager ( pkg ) to install, update, and upgrade system libraries and software applications.

3.1.1Update FreeBSD

When the FreeBSD package version ( package: 1302001 ) is newer than the kernel version ( running kernel: 1301000 ), the package manager shows the mismatch error. In this case, skip the package update by typing N at the command prompt and continue to topic 3.2 Current version update.

Terminal ~ 3.1-1
$ sudo pkg update -f
Updating FreeBSD repository catalogue...
Fetching meta.conf: 100%    163 B   0.2kB/s    00:01
Fetching packagesite.pkg: 100%    7 MiB   1.8MB/s    00:04
Processing entries:   0%
Newer FreeBSD version for package zstd:
To ignore this error set IGNORE_OSVERSION=yes
- package: 1302001
- running kernel: 1301000
Ignore the mismatch and continue? [y/N]: N

If the FreeBSD package manager version is compatible with the running FreeBSD kernel version, type y at the above command prompt and press the Enter key to start the update process.

Update again and make sure all repositories are up to date.

Terminal ~ 3.1-2
$ sudo pkg update -f
Updating FreeBSD repository catalogue...
Fetching meta.conf: 100%    178 B   0.2kB/s    00:01
Fetching data.pkg: 100%    7 MiB 317.7kB/s    00:23
Processing entries: 100%
FreeBSD repository update completed. 34104 packages processed.
All repositories are up to date.

3.1.2Upgrade FreeBSD

Before upgrading system libraries and software applications, the FreeBSD package manager ( pkg ) first checks whether a newer version of the package manager is available. If available ( pkg: 1.20.8 -> 1.20.9 ), the package manager prompts for a pkg version upgrade. At the command prompt, type y to proceed, and again, when prompted, type y to upgrade system libraries and software applications.

Terminal ~ 3.1-3
$ sudo pkg upgrade
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
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.20.8 -> 1.20.9

Number of packages to be upgraded: 1

9 MiB to be downloaded.

Proceed with this action? [y/N]: y
[1/1] Fetching pkg-1.20.9.pkg: 100%    9 MiB   2.3MB/s    00:04
Checking integrity... done (0 conflicting)
[1/1] Upgrading pkg from 1.20.8 to 1.20.9...
[1/1] Extracting pkg-1.20.9: 100%
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
Checking for upgrades (564 candidates): 100%
Processing candidates (564 candidates): 100%
The following 597 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
    AppStream: 1.0.0
    ...
    gtk-layer-shell: 0.8.2
    ...
    urw-base35-fonts: 20200910
    xfce-icons-elementary: 0.18_1

Installed packages to be UPGRADED:
    GraphicsMagick: 1.3.40_1,1 -> 1.3.40_3,1
    ...
    firefox: 115.0_1,2 -> 122.0_2,2
    ...
    gdm: 42.0_6 -> 42.0_7
    geany: 1.38_1 -> 2.0_1
    ...
    glib: 2.76.4,2 -> 2.78.3,2
    ...
    gnome-2048: 3.38.2_2 -> 3.38.2_3
    ...
    gtk3: 3.24.34_1 -> 3.24.38_1
    gtk4: 4.10.4 -> 4.12.4
    ...
    sqlite3: 3.42.0,1 -> 3.44.0_1,1
    ...
    vlc: 3.0.18_4,4 -> 3.0.20_3,4
    ...
    xfce: 4.18 -> 4.18_1
    ...
    zxing-cpp: 2.0.0 -> 2.2.1

Installed packages to be REINSTALLED:
    autoconf-2.71 (direct dependency changed: perl5)
    automake-1.16.5 (direct dependency changed: perl5)
    ...
    xfce4-wm-themes-4.10.0_2 (ABI changed: 'freebsd:13:x86:64' -> 'freebsd:13:*')

Number of packages to be installed: 34
Number of packages to be upgraded: 547
Number of packages to be reinstalled: 16

The process will require 381 MiB more space.
1 GiB to be downloaded.

Proceed with this action? [y/N]: y

3.1.3FreeBSD version

Check the currently installed running FreeBSD kernel ( -k ) version. Whether upgrading to a minor or major version, ignore the patch version ( -p6 ) as it may differ due to previous FreeBSD updates.

Terminal ~ 3.1-4
$ freebsd-version -k
13.1-RELEASE-p6

3.2Current version update

First, update the current version of the FreeBSD operating system using fetch and install commands. Always keep the current system up-to-date before upgrading to a newer version.

3.2.1Fetch and apply patches

Update the FreeBSD operating system patch version by fetching and applying kernel and userland patches. Once done, the updated files will be listed on the more command terminal. To exit the more terminal screen, type :Q (quit) multiple times till you see the command prompt again.

Terminal ~ 3.2-1
$ sudo freebsd-update fetch
Looking up update.FreeBSD.org mirrors... 3 mirrors found.
Fetching metadata signature for 13.1-RELEASE from update2.freebsd.org... done.
Fetching metadata index... done.
Fetching 2 metadata patches.. done.
Applying metadata patches... done.
Fetching 2 metadata files... done.
Inspecting system... done.
Preparing to download files... done.
Fetching 65 patches.....10....20....30....40....50....60.. done.
Applying patches... done.
The following files are affected by updates. No changes have
been downloaded, however, because the files have been modified
locally:
/etc/ssh/sshd_config
The following files will be updated as part of updating to
13.1-RELEASE-p9:
/bin/freebsd-version
/boot/kernel/kernel
/boot/kernel/mpr.ko
/boot/loader
...
:Q

3.2.2Install updates

Install the FreeBSD operating system's current version ( 13.1-RELEASE ) updates.

Terminal ~ 3.2-2
$ sudo freebsd-update install
Installing updates...Scanning //usr/share/certs/blacklisted for certificates...
Scanning //usr/share/certs/trusted for certificates...
Scanning //usr/local/share/certs for certificates...
 done.

3.3New version upgrade

Use the freebsd-update tool's upgrade command to upgrade the FreeBSD operating system from version 13.1-RELEASE to 13.2-RELEASE.

3.3.1Upgrade FreeBSD version

Upgrade the FreeBSD minor or major operating system version by fetching and applying kernel and userland patches. In the upgrade step, the freebsd-update tool also fetches the system files updates required by the kernel and userland.

The fetched new system files will be automatically merged into existing system files. The freebsd-update tool will prompt you to manually edit files and resolve the conflicts if the auto-merge fails.

After resolving and verifying the file conflicts, type :wq (write and quit) to exit the vi editor. The tool will prompt you to confirm the changes, type y, and press Enter key.

Terminal ~ 3.3-1
$ sudo freebsd-update upgrade -r 13.2-RELEASE
Looking up update.FreeBSD.org mirrors... 3 mirrors found.
Fetching metadata signature for 13.1-RELEASE from update1.freebsd.org... done.
Fetching metadata index... done.
Fetching 1 metadata patches. done.
Applying metadata patches... done.
Inspecting system... done.

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

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

Does this look reasonable (y/n)? y

Fetching metadata signature for 13.2-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 13.1-RELEASE for merging... done.
Preparing to download files... done.
Fetching 15447 patches.....10....20....30....40....50....60....70....
...
...15380....15390....15400....15410....15420....15430....15440... done.
Applying patches... done.
Fetching 1826 files... ....10....20....30....40....50....60....70....
...
.1800....1810....1820... done.
Attempting to automatically merge changes in files... done.

The following file could not be merged automatically: /etc/ssh/sshd_config
Press Enter to edit this file in /usr/bin/vi and resolve the conflicts
manually...
...
[Edit, resolve, and verify file conflicts]
...
:wq
...
The following changes, which occurred between FreeBSD 13.1-RELEASE and
FreeBSD 13.2-RELEASE have been merged into /etc/ssh/sshd_config:
...
Does this look reasonable (y/n)? y
The following files will be removed as part of updating to
13.2-RELEASE-p9:
/boot/kernel/iwlwifi-Qu-b0-hr-b0-68.ucode.ko
/boot/kernel/iwlwifi-Qu-b0-jf-b0-68.ucode.ko
...
/bin/ps
/bin/pwait
/bin/pwd
/bin/realpath
...
:Q

3.3.2Kernel components

Install the FreeBSD operating system's new kernel version ( 13.2-RELEASE ) updates. Once the kernel updates are installed, reboot and login to the FreeBSD system.

Terminal ~ 3.3-2
$ sudo freebsd-update install
Installing updates...
Kernel updates have been installed.  Please reboot and run
"/usr/sbin/freebsd-update install" again to finish installing updates.

$ sudo shutdown -r now

After login to the system check the newly installed FreeBSD kernel version.

Terminal ~ 3.3-3
$ uname -a
FreeBSD web1.gwinc.xyz 13.2-RELEASE-p8 FreeBSD 13.2-RELEASE-p8 GENERIC amd64

3.3.3Non-kernel components

With the new FreeBSD kernel version installed, install the new versions of FreeBSD userland tools and applications (non-kernel components).

Terminal ~ 3.3-4
$ sudo freebsd-update install
Installing updates... done.
...
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.

3.3.3-1Upgrade FreeBSD ports

Rebuild All Software Libraries and Applications installed from FreeBSD ports and run freebsd-update install again. Skip this step if the software applications are installed using the FreeBSD package manager.

Terminal ~ 3.3-5
$ cd /usr/ports/www/firefox
$ sudo make install
$ sudo freebsd-update install

3.3.3-2Upgrade FreeBSD packages

Upgrade the installed packages (libraries and applications) using the FreeBSD package manager ( pkg ). If the FreeBSD is upgraded to the major version, bootstrap the package manager. Refer to 3.4.1 Bootstrap pkg under Topic 3.4 Troubleshoot FreeBSD upgrade.

Terminal ~ 3.3-6
$ sudo pkg upgrade 

3.3.4Final reboot

Finally, reboot the system and login to the newly upgraded FreeBSD version.

Terminal ~ 3.3-7
# Restart now
$ sudo shutdown -r now

Check the installed FreeBSD kernel ( -k ) and userland ( -u ) versions. The kernel ( -p8 ) and userland ( -p9 ) patch versions may differ.

Terminal ~ 3.3-8
$ freebsd-version -k
13.2-RELEASE-p8

$ freebsd-version -u
13.2-RELEASE-p9

3.4Troubleshoot FreeBSD upgrade

Upgrading the FreeBSD operating system to a new version might have system library compatibility issues due to the pre-upgrade system state and may produce undesired results. Following are some FreeBSD system upgrade troubleshooting options.

3.4.1Bootstrap pkg

If the FreeBSD operating system is upgraded to the major version, bootstrap the package manager ( pkg ). Use pkg-static command to install or reinstall the package manager.

Terminal ~ 3.4-1
$ sudo pkg-static install -f pkg
$ sudo pkg upgrade -f

# If promted
$ sudo freebsd-update install

3.4.2Rollback

If the FreeBSD upgrade fails due to system errors or the system upgrade is not as expected then the freebsd-update utility provides a FreeBSD upgrade rollback option that will restore the FreeBSD to the previous version.

Terminal ~ 3.4-2
$ sudo freebsd-update rollback

Affiliate links

Upgrading the FreeBSD server requires a VPS or a cloud server with root access. Use our affiliate links to purchase a VPS or cloud server from third-party vendors. The affiliate commissions we earn facilitate, Free website access for everyone.

The affiliate links are listed in alphabetical order without any favor. Users are encouraged to refer to the Global Webdynamics LLP Terms of Service governing the Third-party vendors.