It’s another night with another FreeBSD problem. Well, I could just use Linux like Ubuntu or Void, but then things would just work. Where is the fun? 😉

So, I’ve been having problem with upgrading or installing new binary packages on a machine running FreeBSD 12.0 for a few days now.

root@vansota:~ # pkg upgrade
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
Checking for upgrades (13 candidates): 100%
Processing candidates (13 candidates): 100%
The following 6 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
	p5-Locale-gettext: 1.07

Installed packages to be REINSTALLED:
	xorg-server-1.18.4_6,1 (needed shared library changed)
	xf86-input-synaptics-1.9.0 (options changed)
	texinfo-6.5,1 (options changed)
	m4-1.4.18,1 (options changed)
	help2man-1.47.5 (options changed)

Number of packages to be installed: 1
Number of packages to be reinstalled: 5

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

Proceed with this action? [y/N]: y
[1/6] Fetching xorg-server-1.18.4_6,1.txz: 100%    1 MiB 184.0kB/s    00:08    
pkg: cached package xorg-server-1.18.4_6,1: size mismatch, fetching from remote
[2/6] Fetching xorg-server-1.18.4_6,1.txz:  18%  272 KiB 180.2kB/s    00:08 ETA

First I’d thought it was just some FreeBSD mirrors were out of sync of each others. This happens quite frequently with Ubuntu mirrors. Usually, we give it a bit of time and the problem will fix itself.

However, the mismatch issue still happened tonight. My first attempt to fix it was running this command:

root@vansota:~ # pkg update -f
Updating FreeBSD repository catalogue...
Fetching meta.txz: 100%    940 B   0.9kB/s    00:01
Fetching packagesite.txz: 100%    6 MiB 377.0kB/s    00:16
Processing entries:   0%
pkg: Newer FreeBSD version for package qt5-x11extras:
- package: 1200057
- running kernel: 1200056
pkg: repository FreeBSD contains packages for wrong OS version: FreeBSD:12:amd64
Processing entries: 100%
Unable to update repository FreeBSD
Error updating repositories!

Unfortunately, it didn’t fix. Then I stumbled on this bug report 225104. A work around is to add this “magic” number in "OSVERSION = 9999999;" to /usr/local/etc/pkg.conf.

After that, I re-ran the pkg update -f:

root@vansota:~ # pkg update -f
Updating FreeBSD repository catalogue...
Fetching meta.txz: 100%    940 B   0.9kB/s    00:01
Fetching packagesite.txz: 100%    6 MiB 208.0kB/s    00:29
Processing entries: 100%
FreeBSD repository update completed. 28567 packages processed.
All repositories are up to date.

Thing looked good this time. Let’s see if I can upgrade the existing installed packages:

root@vansota:~ # pkg upgrade
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
Checking for upgrades (16 candidates): 100%
Processing candidates (16 candidates): 100%
The following 9 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
	p5-Locale-gettext: 1.07

Installed packages to be UPGRADED:
	icu: 60.2_1,1 -> 60.2_2,1
	gpu-firmware-kmod: g20170829_1 -> g20180206
	go: 1.9.3,1 -> 1.9.4,1

Installed packages to be REINSTALLED:
	xorg-server-1.18.4_6,1 (needed shared library changed)
	xf86-input-synaptics-1.9.0 (options changed)
	texinfo-6.5,1 (options changed)
	m4-1.4.18,1 (options changed)
	help2man-1.47.5 (options changed)

Number of packages to be installed: 1
Number of packages to be upgraded: 3
Number of packages to be reinstalled: 5

The process will require 6 MiB more space.
63 MiB to be downloaded.

Proceed with this action? [y/N]: y
[1/9] Fetching xorg-server-1.18.4_6,1.txz: 100%    1 MiB 163.6kB/s    00:09    
[2/9] Fetching xf86-input-synaptics-1.9.0.txz: 100%   45 KiB  45.9kB/s    00:01    
[3/9] Fetching texinfo-6.5,1.txz: 100%    1 MiB 179.7kB/s    00:07    
[4/9] Fetching m4-1.4.18,1.txz: 100%  205 KiB 104.8kB/s    00:02    
[5/9] Fetching icu-60.2_2,1.txz: 100%    9 MiB 316.5kB/s    00:31    
[6/9] Fetching help2man-1.47.5.txz: 100%  137 KiB 139.8kB/s    00:01    
[7/9] Fetching gpu-firmware-kmod-g20180206.txz: 100%    2 MiB 205.6kB/s    00:12    
[8/9] Fetching go-1.9.4,1.txz: 100%   49 MiB 348.9kB/s    02:26    
[9/9] Fetching p5-Locale-gettext-1.07.txz: 100%   16 KiB  16.8kB/s    00:01    
Checking integrity... done (0 conflicting)
[1/9] Reinstalling xorg-server-1.18.4_6,1...
[1/9] Extracting xorg-server-1.18.4_6,1: 100%
[2/9] Installing p5-Locale-gettext-1.07...
[2/9] Extracting p5-Locale-gettext-1.07: 100%
[3/9] Reinstalling xf86-input-synaptics-1.9.0...
[3/9] Extracting xf86-input-synaptics-1.9.0: 100%
[4/9] Reinstalling texinfo-6.5,1...
[4/9] Extracting texinfo-6.5,1: 100%
[5/9] Reinstalling m4-1.4.18,1...
[5/9] Extracting m4-1.4.18,1: 100%
[6/9] Upgrading icu from 60.2_1,1 to 60.2_2,1...
[6/9] Extracting icu-60.2_2,1: 100%
[7/9] Reinstalling help2man-1.47.5...
[7/9] Extracting help2man-1.47.5: 100%
[8/9] Upgrading gpu-firmware-kmod from g20170829_1 to g20180206...
[8/9] Extracting gpu-firmware-kmod-g20180206: 100%
[9/9] Upgrading go from 1.9.3,1 to 1.9.4,1...
[9/9] Extracting go-1.9.4,1: 100%

So the package upgrade is fixed for now. The status of bug #225104 is still New as of today. If you have the same issue and wonder why the magic number fixed the problem, check that bug report. As for me, I’m heading to bed!

References:

  • Bug 225104 ports-mgmt/pkg: “pkg update” fails to update package database saying that kernel too old for some package