Update FreeBSD
FreeBSD Systems can be easily updated using the freebsd-update command line tool. In this article we show how to install software updates (including security updates) with this tool using FreeBSD 12.0 as an example.
Get FreeBSD version and patch level
With the command freebsd-version version and patch level of kernel and userland tools can be queried. The command offers the following options:[1]
freebsd-version option | Description |
---|---|
-k | Shows the version and patch level of the installed kernel (installed "-k"ernel). In contrast to the uname command, the new kernel version is shown here already after installing updates, even if the system has not yet been restarted. |
-r | Shows the version and patch level of the running kernel ("-r"unning kernel). Unlike the uname command, the output is not affected by environment variables. |
-u | Shows the version and patch level of the Userland Tools ("-u"serland tools). |
The command displays the following output on the test system:
root@freebsd12:~ # freebsd-version -kru 12.0-RELEASE 12.0-RELEASE 12.0-RELEASE-p1
Download updates
freebsd-update fetch downloads available updates to the system. The output also shows which files are added or changed by the update:
root@freebsd12:~ # freebsd-update fetch src component not installed, skipped Looking up update.FreeBSD.org mirrors... 3 mirrors found. Fetching metadata signature for 12.0-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 50 patches.....10....20....30....40....50 done. Applying patches... done. Fetching 1 files... done. The following files will be added as part of updating to 12.0-RELEASE-p2: /usr/share/zoneinfo/Asia/Qostanay The following files will be updated as part of updating to 12.0-RELEASE-p2: /bin/freebsd-version /boot/kernel/cc_cdg.ko /boot/kernel/cc_chd.ko /boot/kernel/cc_cubic.ko /boot/kernel/cc_dctcp.ko The following files will be updated as part of updating to 12.0-RELEASE-p2: /bin/freebsd-version /boot/kernel/cc_cdg.ko /boot/kernel/cc_chd.ko /boot/kernel/cc_cubic.ko /boot/kernel/cc_dctcp.ko /boot/kernel/cc_hd.ko /boot/kernel/cc_htcp.ko /boot/kernel/cc_vegas.ko /boot/kernel/kernel /boot/kernel/t4_tom.ko /usr/bin/svnlite /usr/bin/svnliteadmin /usr/bin/svnlitebench /usr/bin/svnlitedumpfilter /usr/bin/svnlitefsfs /usr/bin/svnlitelook /usr/bin/svnlitemucc /usr/bin/svnliterdump /usr/bin/svnliteserve /usr/bin/svnlitesync /usr/bin/svnliteversion /usr/include/netinet/cc/cc.h /usr/include/netinet/cc/cc_cubic.h /usr/include/private/sqlite3/sqlite3.h /usr/include/private/sqlite3/sqlite3ext.h /usr/lib/libhdb.a /usr/lib/libhdb.so.11 /usr/lib/libhdb_p.a /usr/lib/libpmc.a /usr/lib/libpmc.so.5 /usr/lib/libpmc_p.a /usr/lib/libprivatesqlite3.a /usr/lib/libprivatesqlite3.so.0 /usr/lib/libprivatesqlite3_p.a /usr/share/zoneinfo/Africa/Casablanca /usr/share/zoneinfo/Africa/El_Aaiun /usr/share/zoneinfo/Africa/Sao_Tome /usr/share/zoneinfo/America/Metlakatla /usr/share/zoneinfo/Asia/Hong_Kong /usr/share/zoneinfo/Asia/Qyzylorda /usr/share/zoneinfo/Asia/Tehran /usr/share/zoneinfo/Pacific/Chuuk /usr/share/zoneinfo/Pacific/Guam /usr/share/zoneinfo/Pacific/Kosrae root@freebsd12:~ #
Install updates
With freebsd-update install you can now install the updates:
root@freebsd12:~ # freebsd-version -kru 12.0-RELEASE 12.0-RELEASE 12.0-RELEASE-p1 root@freebsd12:~ # uname -a FreeBSD freebsd12 12.0-RELEASE FreeBSD 12.0-RELEASE r341666 GENERIC amd64 root@freebsd12:~ # freebsd-update install src component not installed, skipped Installing updates... done. root@freebsd12:~ # freebsd-version -kru 12.0-RELEASE-p2 12.0-RELEASE 12.0-RELEASE-p2 root@freebsd12:~ # uname -a FreeBSD freebsd12 12.0-RELEASE FreeBSD 12.0-RELEASE r341666 GENERIC amd64 root@freebsd12:~ # reboot
After the reboot, the new kernel is active:
root@freebsd12:~ # freebsd-version -kru 12.0-RELEASE-p2 12.0-RELEASE-p2 12.0-RELEASE-p2
Updates for packages via pkg
If you have installed additional software components using the pkg command, upgrade them using the pkg upgrade command.
Further information
- FreeBSD Update (FreeBSD Handbook)
References
Author: Werner Fischer Werner Fischer, working in the Knowledge Transfer team at Thomas-Krenn, completed his studies of Computer and Media Security at FH Hagenberg in Austria. He is a regular speaker at many conferences like LinuxTag, OSMC, OSDC, LinuxCon, and author for various IT magazines. In his spare time he enjoys playing the piano and training for a good result at the annual Linz marathon relay.
|