Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 22 May 2014 15:02:56 -0400
From:      Lowell Gilbert <freebsd-questions-local@be-well.ilk.org>
To:        Nagy =?iso-8859-1?Q?L=E1szl=F3?= Zsolt <gandalf@shopzeus.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: pkg upgrade not working properly [was: pkgng messed up]
Message-ID:  <44y4xtocv3.fsf@lowell-desk.lan>
In-Reply-To: <537E224C.9010000@shopzeus.com> ("Nagy =?iso-8859-1?Q?L=E1szl?= =?iso-8859-1?Q?=F3?= Zsolt"'s message of "Thu, 22 May 2014 18:14:04 %2B0200")
References:  <5374C16E.6000000@shopzeus.com> <44k39n2kg1.fsf@lowell-desk.lan> <5375B772.2050700@shopzeus.com> <537C4D66.6010306@shopzeus.com> <537C53E9.50905@FreeBSD.org> <537CD47A.6050802@shopzeus.com> <537CD7E3.6020501@freebsd.org> <537CF453.7090105@shopzeus.com> <537E224C.9010000@shopzeus.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Nagy L=E1szl=F3 Zsolt <gandalf@shopzeus.com> writes:

> All right, I guess nobody knows the answer. I give up on this
> one. Very bad first impression on pkg!

There *is* no "the answer." Once you manage to mess up your ports
database, there's no guarantee you'll ever be able to recover the data
that was lost. Fortunately, it is much more difficult to mess up the
ports database under pkgng than it was under the previous package
infrastructure, so in general things get much easier.

The thing you have to keep in mind is that pkgng actually stores its
data differently than the old package system did, and except for a few
special utilities like "pkg convert" (also known as pkg-convert(8)) and
"pkg2ng", they won't recognize changes made by the other system. I'm
just guessing, but my suspicion is that you did something like using
pkg_add after you converted your packages to pkgng. That won't work;
pkgng's database has no way to know that you added a package without
telling it.

> Next question: how do I remove all packages and reinstall all of them
> completely, from binaries?

A week or so ago, I suggested that this might be the easiest approach.

> Is this possible with the pkg command? Or should I use pkg_delete

If my suspicions are correct, neither one will do it, although a
combination of "pkg_delete -a" and "pkg delete -a" would probably do
better than either one alone.

I think a better course of action would be go around both old and new
commands; once you decide to remove anything anyway, there's no downside
to just deleting everything. The fundamenal approach is brute force:
"rm -rf /usr/local/* /var/db/pkg/*" (or something similar). Before doing
that, try to collect a list of leaf ports that you'll want to reinstall
later (this will save you a lot of time, unless your memory is a lot
better than mine), and any configuration files under /usr/local that you
have modified (I'd recommend just moving off the whole of /usr/local to
some safe place until the reinstall procedure is complete, but that may
be overkill in some cases). After emptying /usr/local and /var/db/pkg,
delete /usr/sbin/pkg_* to keep yourself from accidentally using them
again. Then reinstall packages with "pkg install".=20

Depending on what version of FreeBSD you're using, you might need to set
a variable in make.conf to get various utilities to know to use
pkgng. [I doubt this is necessary or useful any more, but I'm not
completely sure.]

Good luck.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?44y4xtocv3.fsf>