NetBSD 9.2へのアップグレード

2021.06.02

NetBSD 9.1からNetBSD 9.2へsysupdateを使ってアップグレード。

sysupgradeによるアップグレード

pkgsrcからsysutil/sysupgradeをインストール。

pkgin install sysupgrade

NetBSD Guide「Chapter 4. Upgrading NetBSD」の章にある「4.2. Using sysupgrade」の説明を参考にする。

sysupgrade auto http://cdn.NetBSD.org/pub/NetBSD/NetBSD-9.2/amd64

/etc内の設定について、新しいファイルに置き換えるか、マージするか等インタラクティブに聞かれる。 自分で過去に編集したファイルは残しておいたほうが安全だろう。

トラブルなく、無事アップデート完了。

pkgsrc用データベースの移行

NetBSD 9.2からpkgsrcのデータベースの場所が、/var/db/pkgから/usr/pkg/pkgdbへ移行した。

pkg_add(1): moved the default package database location on new installations from /var/db/pkg to /usr/pkg/pkgdb, for consistency with the pkgsrc bootstrap and pkgsrc on other platforms. It can be overridden in pkg_install.conf(5).

/usr/pkgsrc/_NetBSD-pkgdbがデータベース移行用のスクリプトになっている。

#!/bin/sh
# $NetBSD: _NetBSD-pkgdb,v 1.2 2020/12/29 17:56:14 gdt Exp $
# Copyright The NetBSD Foundation 2020

# This script is for NetBSD only.

# This script is intended to help with the process of migration of
# PKG_DBDIR from /var/db/pkg to /usr/pkg/pkgdb on NetBSD.  It can:
#
#   "check" the system, changing nothing
#
#   "fix" the system, leaving PKG_DBDIR as is and setting config files
#   to point to it.  Thus, one can easily postpone migration.
#
#   "migrate" the system, moving the contents of PKG_DBDIR to the new
#   location, and then setting pointers.
#
# In all cases, the script attempts to check assumptions it makes, and
# avoid trouble if those assumptions are not true.

# Note that PKG_DBDIR can be set in multiple places:
#   /etc/pkg_install.conf (base tools)
#   /usr/pkg/etc/pkg_install.conf (pkg tools)
#   /etc/mk.conf (variable when buidling)
#   /usr/pkgsrc/mk/ (default value of variable)

# This script takes the position that the PKG_DBDIR should be
# explicitly configured in pkg_install.conf in all cases, even if this
# is provably not necessary.  The theory is that a bit of explicit
# config is much less work than mysterious debugging.  If you don't
# like this, you are welcome to undo it, only use "check", or do the
# migration (or not) by hand.

# This script is aimed at the common case where the database was in
# /var/db/pkg and is moving to /usr/pkg/pkgdb, and sources are in
# /usr/pkgsrc (or a place that /usr/pkgsrc is symlinked to).

# This script should work to fix/migrate even on systems with older
# pkgsrc, e.g. if one wanted to stay on 2020Q3 on a system where the
# base system tools were updated.  "Fix" will set variables so
# everything should work correctly.

# The script is designed to do incremental fixes, so if you migrate by
# hand but do not patch up the refcount directory, or set variables,
# it should (NB: This is UNTESTED!) do those steps when run.

# The script is intentionally written to be easy to understand (as
# long as one is comfortable with shell functions), rather than
# compact, avoid repeated code, or elegant.

# This script assumes:
#   NetBSD 8 or newer
#   pkgsrc after about 2020-12-20 (including 2020Q4)
#   pkgsrc PREFIX as /usr/pkg
#   old PKG_DBDIR as /var/db/pkg
#   new/future PKG_DBDIR as /usr/pkg
#   no symlinks in old or new PKG_DBDIR location
#   base pkg_install may be old, or may be after the 2020-12 commit/pullups
#   pkgsrc sources, if they exist, are in /usr/pkgsrc (perhaps a symlink)

最初に関連設定ファイルに問題がないかチェックする。

./_NetBSD-pkgdb check

関連ファイルがない場合など、修正するためのコマンドを入力。

./_NetBSD-pkgdb fix

最後に、移行するためのコマンドを実行。

./_NetBSD-pkgdb migrate

これでデータベースのディレクトリが移行される。

参考


Recent Posts