freebsd-update

FreeBSD Update
FreeBSD-Update (de)
FreeBSD Update (en)

Tech Stuff – FreeBSD Update Survival Guide

freebsd-update and custom kernels

Upgrades from one minor version of FreeBSD to another, like from FreeBSD 9.0 to FreeBSD 9.1, are called minor version upgrades. Major version upgrades occur when FreeBSD is upgraded from one major version to another, like from FreeBSD 9.X to FreeBSD 10.X. Both types of upgrades can be performed by providing freebsd-update with a release version target.

Upgrade to a new Patch-Level

FreeBSD 12.0-RELEASE-p9 GENERIC
$ freebsd-update fetch
$ freebsd-update install
$ reboot

FreeBSD 12.0-RELEASE-p10 GENERIC
$  freebsd-version -kru
-k   version and patch level of the installed kernel
-r   version and patch level of the running kernel
-u   version and patch level of the installed userland

12.0 to 12.2

# freebsd-update upgrade -r 12.2-RELEASE
src component not installed, skipped
Looking up update.FreeBSD.org mirrors... 2 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.
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 12.2-RELEASE from update2.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.0-RELEASE for merging... done.
Preparing to download files... done.
Fetching 10713 patches... [...]
Applying patches... done.
Fetching 11146 files... done.
Attempting to automatically merge changes in files... done.

The following changes, which occurred between FreeBSD 12.0-RELEASE and
FreeBSD 12.2-RELEASE have been merged into /etc/group:
[...]
Does this look reasonable (y/n)? y

The following changes, which occurred between FreeBSD 12.0-RELEASE and
FreeBSD 12.2-RELEASE have been merged into /etc/master.passwd:
[...]
Does this look reasonable (y/n)? y

The following changes, which occurred between FreeBSD 12.0-RELEASE and
FreeBSD 12.2-RELEASE have been merged into /etc/passwd:
[...]
Does this look reasonable (y/n)? y

The following changes, which occurred between FreeBSD 12.0-RELEASE and
FreeBSD 12.2-RELEASE have been merged into /etc/profile
[...]
Does this look reasonable (y/n)? y

The following files are affected by updates, but no changes have
been downloaded because the files have been modified locally:
[...]
The following files will be removed as part of updating to 12.2-RELEASE-p9:
[...]
The following files will be added as part of updating to 12.2-RELEASE-p9:
[...]
The following files will be updated as part of updating to 12.2-RELEASE-p9:
[...]
To install the downloaded upgrades, run "/usr/sbin/freebsd-update install".

Upgrade to a new Release Version

$ uname -a
FreeBSD gateway 10.0-RELEASE [...] GENERIC  amd64

$ freebsd-update upgrade -r 10.2-RELEASE
$ /usr/sbin/freebsd-update install
$ reboot
$ /usr/sbin/freebsd-update install
$ pkg upgrade -f
$ /usr/sbin/freebsd-update install
$ uname -a
FreeBSD ns2.te-clan.ch 10.1-RELEASE [...] NS2-BACHI-NET  amd64

$ df
Filesystem  1K-blocks    Used    Avail Capacity  Mounted on
/dev/ada0p2   2031132  969868   898776    52%    /      <== includes /boot
                                                            kernel uses ca. 450 MB
devfs               1       1        0   100%    /dev
/dev/ada0p3   8106716  452652  7005528     6%    /var
/dev/ada0p4   4053308   35020  3694024     1%    /tmp
/dev/ada0p6  64995324 7673760 52121940    13%    /usr
/dev/ada0p7  42651260   32836 39206324     0%    /web
/dev/ada0p8  26396824   32836 24252244     0%    /db
devfs               1       1        0   100%    /var/named/dev

$ cd /usr/src
$ make kernel __MAKE_CONF=/dev/null SRCCONF=/dev/null
/boot/kernel/kernel        <- GENERIC kernel
/boot/kernel.old/kernel    <- your kernel

$ rsync -a /boot/kernel /boot/GENERIC
$ rm /boot/kernel
$ mv /boot/kernel.old /boot/kernel

$ sysctl -n kern.bootfile
/boot/kernel.old/kernel

$ sysctl kern.bootfile=/boot/kernel/kernel
kern.bootfile: /boot/kernel.old/kernel -> /boot/kernel/kernel

$ sysctl -n kern.bootfile
/boot/kernel/kernel

$ freebsd-update upgrade -r 10.2-RELEASE
Looking up update.FreeBSD.org mirrors... none found.
Fetching public key from update.FreeBSD.org... done.
Fetching metadata signature for 10.1-RELEASE from update.FreeBSD.org... done.
Fetching metadata index... done.
Fetching 2 metadata files... done.
Inspecting system... done.

WARNING: This system is running a "ns2-bachi-net" kernel, which is not a
kernel configuration distributed as part of FreeBSD 10.1-RELEASE.
This kernel will not be updated: you MUST update the kernel manually
before running "/usr/sbin/freebsd-update install".

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

The following components of FreeBSD do not seem to be installed:
world/games

Does this look reasonable (y/n)? y

Fetching metadata signature for 10.2-RELEASE from update4.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 10.1-RELEASE for merging... done.
Preparing to download files... done.
Fetching 39913 patches.....10....20....30....40....50....60
[...]
Applying patches... done.
Fetching 6731 files... done.
Attempting to automatically merge changes in files... done.

The following file could not be merged automatically: /etc/dhclient.conf
Press Enter to edit this file in vi and resolve the conflicts
manually...

The following files are affected by updates, but no changes have
been downloaded because the files have been modified locally:
/.profile
/root/.profile

The following files will be removed as part of updating to 10.2-RELEASE-p8:
[...]
To install the downloaded upgrades, run "/usr/sbin/freebsd-update install".

$ /usr/sbin/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 freebsd-update upgrade -r 9.1-RELEASE

[ warnings about custom kernel ]

$ sudo freebsd-update install

[ this is when the new generic kernel is installed if we weren't running a custom kernel ]

$ cd /usr 
$ mv src{,-8.2}
$ sudo svn co https://svn.freebsd.org/base/releng/9.1/
$ sudo cp src{-8.2,}/sys/i386/conf/PULP
$ cd src

$ sudo rsync -a /boot/kernel{,-8.2}/
$ sudo make kernel-toolchain
$ sudo make buildkernel KERNCONF=PULP
$ sudo make installkernel KERNCONF=PULP

$ sudo reboot

$ sudo freebsd-update install
$ sudo reboot

Custom kernel in loader.conf

How to keep freebsd-update from trashing custom kernel?
FreeBSD Boot Process

Just an idea, not tested: Leave the GENERIC kernel updated
by freebsd-update, and put your own kernel unter a different
name into /boot, for example:

	/boot/kernel/kernel		<- GENERIC kernel
	/boot/mykernel/kernel		<- your kernel

Then change /boot/loader.conf to contain:

	kernel="mykernel"
	bootfile="/boot/mykernel/kernel"

1 thought on “freebsd-update

  1. Pingback: FreeBSD 12: Mail Server Installation | Andreas' Blog

Leave a Reply

Your email address will not be published. Required fields are marked *