"pkg: pkg is not installed" even after installing it

Matthew Seaman matthew at FreeBSD.org
Sun Jan 10 09:32:58 UTC 2016


On 10/01/2016 04:09, Perry Hutchison wrote:
> Why does it claim that pkg is not installed, when it just got through
> installing it?  Or, if the install failed part way through, why was there
> no error message?  And yes, the "pkg add" really did install something --
> /mnt/usr/local/sbin did not exist before running "pkg add" -- and what it
> installed is at least partly functional:
>   # ls -lR /mnt/usr/local
>   total 1
>   drwxrwxrwx  2 root    wheel  512 Jan  9 18:11 pkg
>   drwxr-xr-x  2 perryh  wheel  512 Jan  9 18:19 sbin
>   /mnt/usr/local/pkg:
>   total 2445
>   -r--r--r--  1 perryh  perryh  2487404 Jul 29 18:13 pkg.txz
>   -r--r--r--  1 perryh  perryh      727 Jul 30 17:59 pkg.txz.sig
>   /mnt/usr/local/sbin:
>   total 4472
>   -rwxr-xr-x  1 root  wheel  4559004 Jul 29 18:13 pkg-static

pkg(7) -- the shim that comes with the system -- is what produces the
'pkg is not installed' message.  That's the result of checking that
${LOCALBASE}/sbin/pkg exists and is executable.  ${LOCALBASE} defaults
to /usr/local.

It seems you have only /usr/local/sbin/pkg-static so your installation
of pkg(8) -- the actual pkg software -- looks to have fallen over
somewhere in the middle.  pkg-static is pulled out of the pkg.txz
tarball and installed first, then that copy of pkg-static is used to do
a full install of the entire set of stuff comprising pkg(8) from the
pkg.txz tarball.  That includes the dynamically linked pkg binary and
numerous man pages plus various other bits and pieces.

What it seems you are missing is are writable /var/db/pkg/ and
/var/cache/pkg directories -- this are where pkg(8) holds its database
of what packages have been installed, and where it holds copies of the
package tarballs, respectively.

It's definitely a bug that your procedure fails without any sort of
error message.  There should be load complaints from pkg(8) that it
cannot initialize the database, but somehow those are not making it
through to your console.  You should see some messages if you try running:

  /usr/local/sbin/pkg-static add /usr/local/pkg/pkg.txz

and that should show exactly what pkg(8) is having trouble with.

	Cheers,

	Matthew



-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 957 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20160110/a1f9bfb4/attachment.sig>


More information about the freebsd-questions mailing list