EDIT: Add PKG_DBDIR
to /etc/pkg_install.conf
also.
EDIT: Also add same to /usr/pkg/etc/pkg_install.conf
0x1b I reinstalled last night, then followed these instructions just to make sure.
pin If you have downloaded a daily build from the last few days, then pkgdb is already at the new location.
If you install the latest -CURRENT or 9.1-STABLE and use only pkgin
, then there is an easy way to make sure that things are consistent.
With the latest -CURRENT and 9.1-STABLE, the /usr/sbin/pkg_*
binaries have all been fixed to use /usr/pkg/pkgdb
as the database dir. Check this:
$ strings /usr/sbin/pkg_add | fgrep /pkgdb
mv /var/db/pkg /usr/pkg/pkgdb
mv /var/db/pkg.refcount /usr/pkg/pkgdb.refcount
/usr/pkg/pkgdb
/usr/pkg/pkgdb
$
That looks OK. But, when I install pkgin
using pkg_add
(I use the 9.1 pkg branch), that brings in pkg_install-20200701
which installs /usr/pkg/sbin/pkg_*
files which still use /var/db/pkg
:
$ strings /usr/pkg/sbin/pkg_add | fgrep /pkgdb
# no newer /usr/pkg/pkgdb dir in code
$ strings /usr/pkg/sbin/pkg_add | | fgrep /db/
/var/db/pkg
# Definitely using the old /var/db/pkg dir.
$
Clearly, these still use /var/db/pkg
. So, we make things consistent (run as root):
# for f in /etc/mk.conf /etc/pkg_install.conf /usr/pkg/etc/pkg_install.conf
> do [ "$f" = "/usr/pkg/etc/pkg_install.conf" ] && mkdir -p /usr/pkg/etc
> fgrep -q 'PKG_DBDIR=/usr/pkg/pkgdb' $f ||
> echo 'PKG_DBDIR=/usr/pkg/pkgdb' >> $f
> done
# cd /usr/pkg/sbin
# for f in /usr/sbin/pkg_*
> do ln -sfv $f ${f##*/}
> done
pkg_add -> /usr/sbin/pkg_add
pkg_admin -> /usr/sbin/pkg_admin
pkg_create -> /usr/sbin/pkg_create
pkg_delete -> /usr/sbin/pkg_delete
pkg_info -> /usr/sbin/pkg_info
#
So, now we have:
pkgin
installed using latest (system) pkg_add
(DBDIR used is /usr/pkg/pkgdb
)
- Pkg binaries in
/usr/pkg/sbin/
replaced with system ones (so DBDIR is the same)
- As a back-up,
PKG_DBDIR
is set to the same places where needed.
With these simple things done, I've not had any issues so far.
Note that these instructions are for people using pkgin
. I don't use pkgsrc
. If you install packages from source, refer to instructions given by @pin