# pkg strange error - each port want to 'reinstall' (not install)



## ilil (Jun 10, 2015)

Intro:
FreeBSD 10.1-RELEASE-p3
make.conf has line WITH_PKGNG="YES"
Everything is done inside a jail.
Port tree is updated using `ezjail-admin update -P` and mounted to jail.


Problem:
Cant update/install near (90%) of ports.
Each `make install` (or `portinstall misc/bash`) want to 'reinstall' already installed port (of same version).

Doing `make deinstall reinstall` works fine, but this is needed for EACH port now :-(


```
[root@svn /usr/ports/shells/bash]# make install
===>  bash-4.3.39 depends on executable: bison - not found
===>  Verifying install for bison in /usr/ports/devel/bison
===>  bison-2.7.1,1 depends on package: m4>=1.4.16,1 - found
===>  bison-2.7.1,1 depends on executable: msgfmt - found
===>  bison-2.7.1,1 depends on file: /usr/local/bin/perl5.18.4 - found
===>  bison-2.7.1,1 depends on shared library: libintl.so - not found
===>  Verifying for libintl.so in /usr/ports/devel/gettext-runtime
===>  Installing for gettext-runtime-0.19.4
===>  gettext-runtime-0.19.4 depends on executable: indexinfo - found
===>  Checking if gettext-runtime already installed
===>  gettext-runtime-0.19.4 is already installed
  You may wish to ``make deinstall'' and install this port again
  by ``make reinstall'' to upgrade it properly.
  If you really wish to overwrite the old port of gettext-runtime
  without deleting it first, set the variable "FORCE_PKG_REGISTER"
  in your environment or the "make install" command line.
*** Error code 1
```


----------



## SirDice (Jun 10, 2015)

ilil said:


> make.conf has line WITH_PKGNG="YES"


You can remove this, it's not needed. It was used on 9.x systems to differentiate between the old and the new package system. FreeBSD 10 never had the old system. It's not even needed on 9.x any more as the old system has been completely deprecated. 



> Everything is done inside a jail.


Check to make sure pkg(8) works and finds packages: `pkg version -v`
You can also try `pkg update -f`.


----------



## ilil (Jun 10, 2015)

`pkg version` works. (`portupgrade -vvRrai` also correctly see ports to update)


```
pkg version -v

[root@svn /usr/ports/shells/bash]# pkg version -v
apache24-2.4.12  =  up-to-date with index
apr-1.5.1.1.5.3  <  needs updating (index has 1.5.2.1.5.4)
asciidoc-8.6.9_3  <  needs updating (index has 8.6.9_4)
autoconf-2.69  =  up-to-date with index
autoconf-wrapper-20131203  =  up-to-date with index
automake-1.14  <  needs updating (index has 1.15)
automake-wrapper-20131203  =  up-to-date with index
bash-4.3.11_2  <  needs updating (index has 4.3.39)
bigreqsproto-1.1.2  =  up-to-date with index
bison-2.7.1,1  =  up-to-date with index

.....
```


But `pkg update -f` not because I am only using source updates in jail

```
pkg update -f
No active remote repositories configured.
```


----------



## ilil (Jun 10, 2015)

PS: This system was 8.x, than updated (by source) to 9.x and currently 10.x
this is why WITH_PKGNG still there.


----------



## junovitch@ (Jun 11, 2015)

Does doing a `pkg check -Bd` help?  There had been changes in library registration in the past and that has been a recommendation that helps the issue.


----------



## kpa (Jun 11, 2015)

Please see this thread and see if you can apply the same `make delete-old` trick to your jail, I suspect that your problem is the same:

Unable to update any installed ports on my 10.1 server without using FORCE_PKG_REGISTER=yes


----------



## ilil (Jun 11, 2015)

1) just done `make delete-old delete-old-libs`  for base system and all jails.
2) deleted near all packages (by `pkg delete ...`) - a lot of files not deleted because of "checksum mismatch".  (may be a reason of FORCE_PKG_REGISTER earlier)
3) No errors for `pkg check -Bd`
4) installed `portupgrade` by "hands"  (`make install clean`)
5) [root@svn /usr/ports/ports-mgmt]# `portinstall misc/mc`

resulted to same problem :-(


```
====> Compressing man pages (compress-man)
===>  Installing for libssh2-1.4.3_5,2
===>  Checking if libssh2 already installed
===>  libssh2-1.4.3_5,2 is already installed
  You may wish to ``make deinstall'' and install this port again
  by ``make reinstall'' to upgrade it properly.
  If you really wish to overwrite the old port of libssh2
  without deleting it first, set the variable "FORCE_PKG_REGISTER"
  in your environment or the "make install" command line.
*** Error code 1

Stop.
make[3]: stopped in /basejail/usr/ports/security/libssh2
*** Error code 1

Stop.
make[2]: stopped in /basejail/usr/ports/security/libssh2
*** Error code 1

Stop.
make[1]: stopped in /basejail/usr/ports/misc/mc
*** Error code 1

Stop.
```

Same output for `make install clean` in /usr/ports/misc/mc/


----------



## ilil (Jun 11, 2015)

Thanks to everyone!
SOLVED.

Reason is `make delete-old delete-old-libs`
But it should run on BASEJAIL (not jail directory), because base system in jail is mounted from ../basejail

Everything working fine after:
`yes | make delete-old delete-old-libs DESTDIR=/raid/jails/basejail`


----------



## SirDice (Jun 11, 2015)

ilil said:


> Everything working fine after:
> `yes | make delete-old delete-old-libs DESTDIR=/raid/jails/basejail`


`make -DBATCH_DELETE_OLD_FILES delete-old delete-old-libs DESTDIR=/raid/jails/basejail`


----------

