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

Perry Hutchison perryh at pluto.rain.com
Mon Jan 11 03:15:48 UTC 2016

Matthew Seaman <matthew at freebsd.org> wrote:
> 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?  ...
> 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.

That doesn't produce any output, either.  However, after mounting
tmpfs on /var/db/pkg and /var/cache, I got:

  # chroot -u 0 -g 0 -G 105,0,5,20,25 /mnt pkg-static add /usr/local/pkg/pkg.txz
  Installing pkg-1.5.4...
  Extracting pkg-1.5.4: 100%
  ldconfig: mkstemp(/var/run/ld-elf.so.hints.6wHhnd): Read-only file system
  pkg-static: POST-INSTALL script failed
  Message for pkg-1.5.4:
  If you are upgrading from the old package format, first run:

    # pkg2ng

  # chroot -u 0 -g 0 -G 105,0,5,20,25 /mnt pkg -N
  pkg: 1 packages installed

This time it installed a bunch of stuff in /usr/local and a
"local.sqlite" in /var/db/pkg -- but nothing in /var/cache,
so maybe that isn't needed when installing from a tarball
that is already local.

More information about the freebsd-questions mailing list