pkg: sqlite error while executing grmbl in file update.c:154: NOT NULL constraint failed: packages.path

pkg updateで突然下記エラーが出るようになったときの覚書。
Gemini 3 Pro Previewと対話。

環境: FreeBSD 14.3-RELEASE-p7 arm64
(Mac mini上のVMware Fusion仮想マシン)


1. pkgエラー発生

エラーの内容。
# pkg update

Updating FreeBSD repository catalogue...
Fetching meta.conf: 100%    179 B   0.2kB/s    00:01
Fetching data.pkg: 100%   10 MiB  10.4MB/s    00:01
Processing entries:  99%
pkg: sqlite error while executing grmbl in file update.c:154: NOT NULL constraint failed: packages.path
pkg: sqlite error while executing grmbl in file update.c:154: NOT NULL constraint failed: packages.path
pkg: sqlite error while executing INSERT OR REPLACE INTO packages (origin, name, version, comment, desc, arch, maintainer, www, prefix, pkgsize, flatsize, licenselogic, cksum, path, manifestdigest, olddigest, vital)VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9, ?10, ?11, ?12, ?13, ?14, ?15, ?16, ?17) in file update.c:158: not an error
Processing entries:  99%
Unable to update repository FreeBSD
Updating FreeBSD-kmods repository catalogue...
Fetching meta.conf: 100%    179 B   0.2kB/s    00:01
Fetching data.pkg: 100%   16 KiB  16.9kB/s    00:01
Processing entries: 100%
FreeBSD-kmods repository update completed. 70 packages processed.
Error updating repositories!

Gemini 先生曰く。

現在参照している「Quarterly(四半期更新)」リポジトリのデータ(aarch64版)自体に不具合(バグのあるレコード)が含まれています。

それらしいバグ報告が上がっている。
参考: while updating repos, pkg: sqlite error while executing grmbl in file update.c:171: NOT NULL constraint failed: packages.path · Issue #2575 · freebsd/pkg
参考: 292332 – ports-mgmt/pkg sqlite error on ARM64

大人しく待つ。

ちなみに本番環境のamd64では起こらなかった。


2.パッケージリポジトリをlatestに変更

3日経っても直らないので、パッケージリポジトリを変更してみる。
スナップショットを取っておく。
# less /etc/pkg/FreeBSD.conf

FreeBSD: {
  url: "pkg+https://pkg.FreeBSD.org/${ABI}/latest",
  mirror_type: "srv",
  signature_type: "fingerprints",
  fingerprints: "/usr/share/keys/pkg",
  enabled: yes
}
FreeBSD-kmods: {
  url: "pkg+https://pkg.FreeBSD.org/${ABI}/kmods_latest_${VERSION_MINOR}",
  mirror_type: "srv",
  signature_type: "fingerprints",
  fingerprints: "/usr/share/keys/pkg",
  enabled: yes
}

キャッシュを利用せず更新。
# pkg update -f

無事、完了した。

# pkg upgrade

quarterlyとlatestの違い

  • quarterly: 更新頻度が四半期版(3ヶ月に1回)。基本的にバージョンは固定。セキュリティ修正や重大なバグ修正のみ適用される。
  • latest : ポーツツリー(ports)の最新状態が即座に反映される。


arm64のリポジトリの問題ということが分かったので、スナップショットで元に戻して様子をみることにした。

エラーが発生してから5日で直った。
# pkg update -f


▼ 関連記事