bsdinfo

FreeBSD 12.0-RELEASE was released today, and that means it’s time to upgrade 2 of FreeBSD 11.2 machines to this latest version.

One of my FreeBSD boxes is a desktop used at work, and the upgrade went well without any issues. In this post, I’m going to document how the upgrade is done on my nas server at home.

First ensure that the FreeBSD is up to date:

root@nas:~ # freebsd-update fetch
src component not installed, skipped
Looking up update.FreeBSD.org mirrors... 2 mirrors found.
Fetching metadata signature for 11.2-RELEASE from update1.freebsd.org... done.
Fetching metadata index... done.
Inspecting system... done.
Preparing to download files... done.

No updates needed to update system to 11.2-RELEASE-p6.

Begin to perform the upgrade:

# freebsd-update -r 12.0-RELEASE upgrade
src component not installed, skipped
Looking up update.FreeBSD.org mirrors... 2 mirrors found.
Fetching metadata signature for 11.2-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 world/base

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

Does this look reasonable (y/n)? y

Fetching metadata signature for 12.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.
...

Then time I was asked to manually resolve conflicts in a few files: /etc/master.passwd and /etc/passwd.

Next, the machine required to be reboot:

# reboot

After rebooting, resume with the command freebsd-upgrade install:

# freebsd-update install
src component not installed, skipped
Installing updates...
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.

Before running pkg upgrade, I should also update the pkg package first:

# pkg-static install -f pkg
pkg-static: Warning: Major OS version upgrade detected.  Running "pkg-static install -f pkg" recommended
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
The following 1 package(s) will be affected (of 0 checked):

Installed packages to be REINSTALLED:
        pkg-1.10.5_5 (ABI changed: 'freebsd:11:x86:64' -> 'freebsd:12:x86:64')

Number of packages to be reinstalled: 1

3 MiB to be downloaded.

Proceed with this action? [y/N]: y                                                 
[1/1] Fetching pkg-1.10.5_5.txz: 100%    3 MiB 848.8kB/s    00:04               
Checking integrity... done (0 conflicting)                                      
[1/1] Reinstalling pkg-1.10.5_5...                                                
[1/1] Extracting pkg-1.10.5_5: 100% 
# pkg upgrade
...
Number of packages to be upgraded: 1
Number of packages to be reinstalled: 56

The process will require 3 MiB more space.
250 MiB to be downloaded.

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

The last step is to update the ZFS Zpool, though this can be done at anytime. On my nas server, there are 2 pools: tank and zroot. First, let’s update the tank zpool as it’s simple:

# zpool upgrade tank
This system supports ZFS pool feature flags.

Enabled the following features on 'tank':
  large_dnode
  spacemap_v2

Next, let’s update zroot:

# zpool upgrade zroot
This system supports ZFS pool feature flags.

Enabled the following features on 'zroot':
  large_dnode
  spacemap_v2

If you boot from pool 'zroot', don't forget to update boot code.
Assuming you use GPT partitioning and da0 is your boot disk
the following command will do it:

        gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 da0

Notice that I also need to update the boot code. Let’s find out the boot disk on my server:

 # gpart show
=>       34  488397101  ada4  GPT  (233G)
         34       1024     1  freebsd-boot  (512K)
       1058    4194304     2  freebsd-swap  (2.0G)
    4195362  484201766     3  freebsd-zfs  (231G)
  488397128          7        - free -  (3.5K)

On my system, the boot disk is ada4.

# gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 ada4
partcode written to ada4p1
bootcode written to ada4

VoilĂ , the upgrade is complete.

By the way, this is first blog post I wrote in markdown after switching from Wordpress to Hugo. I quite like this way of blogging, and I have a feeling that a few months from now I’m gonna get real good at markdown.

Ref: