Solving circular dependency?
- Edited
EDIT: Add PKG_DBDIR
to /etc/pkg_install.conf
also.
EDIT: Also add same to /usr/pkg/etc/pkg_install.conf
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
rvp 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:
This exactly why you should delete pkgin
and build it from source after building pkg_install
tools.
Symlinking is an alternative to copy the tools and have them in two places.
pin This exactly why you should delete pkgin and build it from source after building pkg_install tools.
I understand building pkg_install
, but, why compile pkgin
too. Has its database directory also been moved?
pin Symlinking is an alternative to copy the tools and have them in two places.
That's why I symlinked. I didn't want the confusion of 2 copies.
- Edited
rvp I understand building pkg_install, but, why compile pkgin too. Has its database directory also been moved?
Because pkgin
uses pkg_install
's PKG_DBDIR information to find the database.
But, this is not the end of it, I found another problem today, see http://mail-index.netbsd.org/pkgsrc-users/2020/12/13/msg032860.html
Some packages have hard-coded paths that will be used at compile time. I found one, Gutteridge another in a few hours looking for issues. Are there more? Probably, I'm getting, ...shall we say, not so happy with this move.
I feel like there are many people who are unhappy about this move, and its un-announcement.
I would not have known about it had I not asked in irc, and someone pointed me to a mailing list message.
I'm not subscribed to that list, so maybe that's my fault. But then, system breaking changes don't usually occur until after they have been at least tested? Could be wrong.
pin Because pkgin uses pkg_install's PKG_DBDIR information to find the database.
Not directly, according to the sources. It calls pkg_admin config-var PKG_DBDIR
(change made in 2012). So, as long as you have the new pkg_install
, pkgin
should work OK.
pin But, this is not the end of it, I found another problem today
pkg_alternatives
is a problem if you call it directly. Otherwise, it uses the PKG_DBDIR
environment variable set by the pkg_install
stuff. So, that too just worked for me.
pin Can you pkg_delete them? Try with one package to see if it removes both entries in pkgdb. If, this works it should be possible. I thought it was easier to just wipe the disk clean.
There's another way of doing this but, I don't even dare to write this here, so check if you can delete one package first.
pkg_delete
does indeed remove both duplicate pakages, then pkgin install
installs the single package in /usr/pkg/pkgdb
Let me know if there is a way to bulk delete packages using pkg_delete
. Luckily for me, I made a package list not to long before this shit happened so I know what to reinstall.
As for your other way of doing it I'm open to it. Worst case for me is to reinstall, I really cbf doing that but will if I have to so lets try some dodgy methods first
- Edited
pin haha one at a time ay? I'm going to need a tall beer tonight then.
What should I do about my pkgtools though? as I stated above, I just did: doas cp /usr/sbin/pkg* /usr/pkg/sbin/
Should I symlink them instead? or what is the preferred method for installing pkgtools into usr/pkg/sbin
?
pfr haha one at a time ay? I'm going to need a tall beer tonight then.
This is unnecessary, take a bunch at the time, your call how many. 10, 20? Up to you.
pfr What should I do about my pkgtools though? as I stated above, I just did: doas cp /usr/sbin/pkg* /usr/pkg/sbin/
Should I symlink them instead?
Use either, not both.
- Edited
rvp Quoting Christos Zoulas, one of the major devs, on the mailing-lists
I don't think that's the best solution. I think that backwards
compatibility should be provided all the time (until everyone has
migrated). The new tools can nag, but still be able to use the
old location. To silence them one should be able to make symlinks.
New installations can use the new location. Forcing changes like
this serve only to piss off users.
christos
Migration script, https://mail-index.netbsd.org/pkgsrc-users/2020/12/28/msg032958.html
Please refer to http://pkgsrc.org/pkgdb-change/ for clear instructions on how to, keep or migrate pkgdb