# pkg broken after ugrading FreeBSD from 10.1 to 10.2



## cellini (Aug 15, 2015)

ports-mgmt/pkg broke when I upgraded to 10.2 from 10.1
I run

```
root@aasennas:/ # cd /usr/ports/ports-mgmt/pkg
root@aasennas:/usr/ports/ports-mgmt/pkg # make deinstall
```

But now I cant re install it

```
checking for struct sockaddr_storage.__ss_family... no
checking for IPv6 support... yes
checking for pkg-config... /usr/local/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for git... yes
checking for git head...
checking for library containing lzma_version_string... -llzma
checking for library containing BZ2_bzReadOpen... -lbz2
checking for library containing zlibVersion... -lz
checking for library containing archive_read_open... -larchive
checking archive.h usability... no
checking archive.h presence... yes
configure: WARNING: archive.h: present but cannot be compiled
configure: WARNING: archive.h:  check for missing prerequisite headers?
configure: WARNING: archive.h: see the Autoconf documentation
configure: WARNING: archive.h:  section "Present But Cannot Be Compiled"
configure: WARNING: archive.h: proceeding with the compiler's result
configure: WARNING:  ## --------------------------------------------- ##
configure: WARNING:  ## Report this to https://github.com/freebsd/pkg ##
configure: WARNING:  ## --------------------------------------------- ##
checking for archive.h... no
configure: error: Unable to find the libarchive headers
===>  Script "configure" failed unexpectedly.
Please report the problem to pkg@FreeBSD.org [maintainer] and attach the
"/usr/ports/ports-mgmt/pkg/work/pkg-1.5.6/config.log" including the output
of the failure of your make command. Also, it might be a good idea to provide
an overview of all packages installed on your system (e.g. a
/usr/ports/ports-mgmt/pkg/work/pkg-1.5.6/src/pkg-static info -g -Ea).
*** Error code 1

Stop.
make[2]: stopped in /usr/ports/ports-mgmt/pkg
*** Error code 1

Stop.
make[1]: stopped in /usr/ports/ports-mgmt/pkg
*** Error code 1

Stop.
make: stopped in /usr/ports/ports-mgmt/pkg
root@aasennas:/usr/ports/ports-mgmt/pkg #
```
 when typing the pkg command i get this response


```
root@aasennas:/usr/ports/ports-mgmt/pkg # pkg
Shared object "libucl.so.1" not found, required by "pkg"
```

Any tips?

Tried running `portmaster -fa`


```
root@aasennas:/usr/ports/ports-mgmt/pkg # portmaster -fa
===>>> Gathering distinfo list for installed ports

  ===>>> No ORIGIN in /var/db/pkg/automake-1.15/+CONTENTS

  ===>>> No ORIGIN in /var/db/pkg/cmake-3.1.3/+CONTENTS

  ===>>> No ORIGIN in /var/db/pkg/cmake-modules-3.1.3/+CONTENTS

  ===>>> No ORIGIN in /var/db/pkg/compat9x-amd64-9.2.902000.201310/+CONTENTS

  ===>>> No ORIGIN in /var/db/pkg/expat-2.1.0_2/+CONTENTS

  ===>>> No ORIGIN in /var/db/pkg/gcc-4.8.4_1/+CONTENTS

  ===>>> No ORIGIN in /var/db/pkg/gettext-runtime-0.19.4/+CONTENTS

  ===>>> No ORIGIN in /var/db/pkg/glib-2.42.2/+CONTENTS

  ===>>> No ORIGIN in /var/db/pkg/gmake-4.1_1/+CONTENTS

  ===>>> No ORIGIN in /var/db/pkg/gnustep-base-1.24.6_6/+CONTENTS

  ===>>> No ORIGIN in /var/db/pkg/gtk-update-icon-cache-2.24.27/+CONTENTS

  ===>>> No ORIGIN in /var/db/pkg/gtk2-2.24.27/+CONTENTS

  ===>>> No ORIGIN in /var/db/pkg/i386-wine-compholio-1.7.39,1/+CONTENTS

  ===>>> No ORIGIN in /var/db/pkg/indexinfo-0.2.3/+CONTENTS

  ===>>> No ORIGIN in /var/db/pkg/intltool-0.50.2/+CONTENTS

  ===>>> No ORIGIN in /var/db/pkg/libao-1.2.0_1/+CONTENTS

  ===>>> No ORIGIN in /var/db/pkg/libc++-208080/+CONTENTS

  ===>>> No ORIGIN in /var/db/pkg/libcxxrt-20131225_1/+CONTENTS

  ===>>> No ORIGIN in /var/db/pkg/libmemcached-1.0.18/+CONTENTS

  ===>>> No ORIGIN in /var/db/pkg/libmodplug-0.8.8.5_2/+CONTENTS

  ===>>> No ORIGIN in /var/db/pkg/libtool-2.4.5/+CONTENTS

  ===>>> No ORIGIN in /var/db/pkg/linux-c6-alsa-lib-1.0.22_2/+CONTENTS

  ===>>> No ORIGIN in /var/db/pkg/linux-c6-alsa-plugins-oss-1.0.21_3/+CONTENTS

  ===>>> No ORIGIN in /var/db/pkg/linux-c6-atk-1.30.0/+CONTENTS

  ===>>> No ORIGIN in /var/db/pkg/linux-c6-cairo-1.8.8_1/+CONTENTS

  ===>>> No ORIGIN in /var/db/pkg/linux-c6-curl-7.19.7_1/+CONTENTS

  ===>>> No ORIGIN in /var/db/pkg/linux-c6-cyrus-sasl2-2.1.23_1/+CONTENTS

  ===>>> No ORIGIN in /var/db/pkg/linux-c6-dri-10.1/+CONTENTS

  ===>>> No ORIGIN in /var/db/pkg/linux-c6-expat-2.0.1_1/+CONTENTS

  ===>>> No ORIGIN in /var/db/pkg/linux-c6-flashplugin-11.2r202.451_1/+CONTENTS

  ===>>> No ORIGIN in /var/db/pkg/linux-c6-fontconfig-2.8.0_1/+CONTENTS

  ===>>> No ORIGIN in /var/db/pkg/linux-c6-gdk-pixbuf2-2.24.1/+CONTENTS

  ===>>> No ORIGIN in /var/db/pkg/linux-c6-gtk2-2.24.23_1/+CONTENTS

  ===>>> No ORIGIN in /var/db/pkg/linux-c6-jpeg-1.2.1_1/+CONTENTS

  ===>>> No ORIGIN in /var/db/pkg/linux-c6-libasyncns-0.8_1/+CONTENTS

  ===>>> No ORIGIN in /var/db/pkg/linux-c6-libsigc++20-2.2.4.2/+CONTENTS

  ===>>> No ORIGIN in /var/db/pkg/linux-c6-libssh2-1.4.2_1/+CONTENTS

  ===>>> No ORIGIN in /var/db/pkg/linux-c6-libv4l-0.6.3_1/+CONTENTS

  ===>>> No ORIGIN in /var/db/pkg/linux-c6-nspr-4.10.6/+CONTENTS

  ===>>> No ORIGIN in /var/db/pkg/linux-c6-nss-3.16.1/+CONTENTS

  ===>>> No ORIGIN in /var/db/pkg/linux-c6-openldap-2.4.39/+CONTENTS

  ===>>> No ORIGIN in /var/db/pkg/linux-c6-openssl-1.0.1e_4/+CONTENTS

  ===>>> No ORIGIN in /var/db/pkg/linux-c6-openssl-compat-0.9.8e_1/+CONTENTS

  ===>>> No ORIGIN in /var/db/pkg/linux-c6-pango-1.28.1_1/+CONTENTS

  ===>>> No ORIGIN in /var/db/pkg/linux-c6-png-1.2.49_1/+CONTENTS

  ===>>> No ORIGIN in /var/db/pkg/linux-c6-sqlite-3.6.20_1/+CONTENTS

  ===>>> No ORIGIN in /var/db/pkg/linux-c6-tiff-3.9.4_1/+CONTENTS

  ===>>> No ORIGIN in /var/db/pkg/linux-c6-xorg-libs-7.4_1/+CONTENTS

  ===>>> No ORIGIN in /var/db/pkg/linux-f10-atk-1.24.0_1/+CONTENTS

  ===>>> No ORIGIN in /var/db/pkg/linux-f10-cairo-1.8.0_3/+CONTENTS

  ===>>> No ORIGIN in /var/db/pkg/linux-f10-curl-7.19.6_1/+CONTENTS

  ===>>> No ORIGIN in /var/db/pkg/linux-f10-cyrus-sasl2-2.1.22_3/+CONTENTS

  ===>>> No ORIGIN in /var/db/pkg/linux-f10-expat-2.0.1_1/+CONTENTS

  ===>>> No ORIGIN in /var/db/pkg/linux-f10-flashplugin-11.2r202.451_1/+CONTENTS

  ===>>> No ORIGIN in /var/db/pkg/linux-f10-fontconfig-2.6.0_1/+CONTENTS

  ===>>> No ORIGIN in /var/db/pkg/linux-f10-gtk2-2.14.7_5/+CONTENTS

  ===>>> No ORIGIN in /var/db/pkg/linux-f10-jpeg-6b/+CONTENTS

  ===>>> No ORIGIN in /var/db/pkg/linux-f10-libssh2-0.18_1/+CONTENTS

  ===>>> No ORIGIN in /var/db/pkg/linux-f10-nspr-4.7.6_1/+CONTENTS

  ===>>> No ORIGIN in /var/db/pkg/linux-f10-nss-3.12.3.99.3_2/+CONTENTS

  ===>>> No ORIGIN in /var/db/pkg/linux-f10-openldap-2.4.12_2/+CONTENTS

  ===>>> No ORIGIN in /var/db/pkg/linux-f10-openssl-0.9.8g_1/+CONTENTS

  ===>>> No ORIGIN in /var/db/pkg/linux-f10-pango-1.28.3_1/+CONTENTS

  ===>>> No ORIGIN in /var/db/pkg/linux-f10-png-1.2.37_2/+CONTENTS

  ===>>> No ORIGIN in /var/db/pkg/linux-f10-sqlite3-3.5.9_2/+CONTENTS

  ===>>> No ORIGIN in /var/db/pkg/linux-f10-tiff-3.8.2/+CONTENTS

  ===>>> No ORIGIN in /var/db/pkg/linux-f10-xorg-libs-7.4_1/+CONTENTS

  ===>>> No ORIGIN in /var/db/pkg/linux_base-c6-6.6_3/+CONTENTS

  ===>>> No ORIGIN in /var/db/pkg/linux_base-f10-10_9/+CONTENTS

  ===>>> No ORIGIN in /var/db/pkg/lzo2-2.09/+CONTENTS

===>>> Starting check of installed ports for available updates
  ===>>> No ORIGIN in /var/db/pkg/nspluginwrapper-1.4.4_4/+CONTENTS

  ===>>> No ORIGIN in /var/db/pkg/automake-1.15/+CONTENTS


===>>> Cannot continue
===>>> Aborting update

  ===>>> No ORIGIN in /var/db/pkg/nvidia-driver-340-340.76/+CONTENTS

  ===>>> No ORIGIN in /var/db/pkg/nvidia-driver-346.47/+CONTENTS

  ===>>> No ORIGIN in /var/db/pkg/p5-XML-Parser-2.41_2/+CONTENTS

  ===>>> No ORIGIN in /var/db/pkg/pipelight-0.2.7.3_7/+CONTENTS

  ===>>> No ORIGIN in /var/db/pkg/pkg-1.4.10/+CONTENTS

  ===>>> No ORIGIN in /var/db/pkg/pkg-1.4.12/+CONTENTS

  ===>>> No ORIGIN in /var/db/pkg/pkg-1.5.2/+CONTENTS

  ===>>> No ORIGIN in /var/db/pkg/pkgconf-0.9.7_1/+CONTENTS

  ===>>> No ORIGIN in /var/db/pkg/plexmediaserver-plexpass-0.9.12.2.1124/+CONTENTS

  ===>>> No ORIGIN in /var/db/pkg/py27-Jinja2-2.7.3/+CONTENTS

  ===>>> No ORIGIN in /var/db/pkg/py27-docutils-0.12/+CONTENTS

root@aasennas:/usr/ports/ports-mgmt/pkg #
```


----------



## kpa (Aug 15, 2015)

Do this:

`# /usr/sbin/pkg bootstrap`

After that you should make sure your ports tree is upto date, your ports-mgmt/portmaster looks seriously out of date because it's still using the old style package database and not the new pkg database:

https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/ports-using.html

Reinstall ports-mgmt/portmaster:

`make -C /usr/ports/ports-mgmt/portmaster clean install clean`


----------



## cellini (Aug 15, 2015)

```
root@aasennas:/ # /usr/sbin/pkg bootstrap
Shared object "libucl.so.1" not found, required by "pkg"
```

Same result? I thought I had updated portmaster(8). I ran the `# pkg upgrade` command less than a week ago, won't that upgrade everything?


----------



## kpa (Aug 15, 2015)

cellini said:


> ```
> root@aasennas:/ # /usr/sbin/pkg bootstrap
> Shared object "libucl.so.1" not found, required by "pkg"
> ```
> ...



Post the output of `ls -l /usr/lib/private`. The libucl.so.1 file is supposed to be there, if it's not there you have a seriously broken system and a reinstall from scratch is recommended.


----------



## cellini (Aug 15, 2015)

libucl.so.1 seems to be missing yes

```
root@aasennas:/ # ls -l /usr/lib/private
total 9648
-r--r--r--  1 root  wheel  9118 Jan 16  2014 libheimipcc.a
lrwxr-xr-x  1 root  wheel  17 Jan 16  2014 libheimipcc.so -> libheimipcc.so.11
-r--r--r--  1 root  wheel  10032 Aug 15 13:50 libheimipcc.so.11
-r--r--r--  1 root  wheel  10014 Jan 16  2014 libheimipcc_p.a
-r--r--r--  1 root  wheel  14842 Jan 16  2014 libheimipcs.a
lrwxr-xr-x  1 root  wheel  17 Jan 16  2014 libheimipcs.so -> libheimipcs.so.11
-r--r--r--  1 root  wheel  15312 Aug 15 13:50 libheimipcs.so.11
-r--r--r--  1 root  wheel  16234 Jan 16  2014 libheimipcs_p.a
-r--r--r--  1 root  wheel  574550 Jan 16  2014 libldns.a
lrwxr-xr-x  1 root  wheel  12 Jan 16  2014 libldns.so -> libldns.so.5
-r--r--r--  1 root  wheel  375976 Aug 15 13:50 libldns.so.5
-r--r--r--  1 root  wheel  642564 Jan 16  2014 libldns_p.a
-r--r--r--  1 root  wheel  980268 Aug 15 13:50 libssh.a
lrwxr-xr-x  1 root  wheel  11 Jan 16  2014 libssh.so -> libssh.so.5
-r--r--r--  1 root  wheel  569864 Aug 15 13:50 libssh.so.5
-r--r--r--  1 root  wheel  1025878 Aug 15 13:50 libssh_p.a
-r--r--r--  1 root  wheel  1606954 Aug 15 13:50 libunbound.a
lrwxr-xr-x  1 root  wheel  15 Jan 16  2014 libunbound.so -> libunbound.so.5
-r--r--r--  1 root  wheel  1037160 Aug 15 13:50 libunbound.so.5
-r--r--r--  1 root  wheel  1717506 Aug 15 13:50 libunbound_p.a
-r--r--r--  1 root  wheel  163488 Jan 16  2014 libyaml.a
lrwxr-xr-x  1 root  wheel  12 Jan 16  2014 libyaml.so -> libyaml.so.1
-r--r--r--  1 root  wheel  120440 Aug 15 13:50 libyaml.so.1
-r--r--r--  1 root  wheel  176032 Jan 16  2014 libyaml_p.a
```

But it was missing before the upgrade to, but then pkg was working ?


```
root@aasennas:/ # ls -l /.zfs/snapshot/auto-20150814.2000-00/usr/lib/private/
total 9388
-r--r--r--  1 root  wheel  9118 Jan 16  2014 libheimipcc.a
lrwxr-xr-x  1 root  wheel  17 Jan 16  2014 libheimipcc.so -> libheimipcc.so.11
-r--r--r--  1 root  wheel  9976 Jan 16  2014 libheimipcc.so.11
-r--r--r--  1 root  wheel  10014 Jan 16  2014 libheimipcc_p.a
-r--r--r--  1 root  wheel  14842 Jan 16  2014 libheimipcs.a
lrwxr-xr-x  1 root  wheel  17 Jan 16  2014 libheimipcs.so -> libheimipcs.so.11
-r--r--r--  1 root  wheel  15248 Jan 16  2014 libheimipcs.so.11
-r--r--r--  1 root  wheel  16234 Jan 16  2014 libheimipcs_p.a
-r--r--r--  1 root  wheel  574550 Jan 16  2014 libldns.a
lrwxr-xr-x  1 root  wheel  12 Jan 16  2014 libldns.so -> libldns.so.5
-r--r--r--  1 root  wheel  375976 Jul 15 20:56 libldns.so.5
-r--r--r--  1 root  wheel  642564 Jan 16  2014 libldns_p.a
-r--r--r--  1 root  wheel  980268 Mar 26 17:39 libssh.a
lrwxr-xr-x  1 root  wheel  11 Jan 16  2014 libssh.so -> libssh.so.5
-r--r--r--  1 root  wheel  569864 Jul 15 20:56 libssh.so.5
-r--r--r--  1 root  wheel  1025878 Mar 26 17:39 libssh_p.a
-r--r--r--  1 root  wheel  1553014 Jan 29  2015 libunbound.a
lrwxr-xr-x  1 root  wheel  15 Jan 16  2014 libunbound.so -> libunbound.so.5
-r--r--r--  1 root  wheel  1005288 Mar 26 17:39 libunbound.so.5
-r--r--r--  1 root  wheel  1661830 Jan 29  2015 libunbound_p.a
-r--r--r--  1 root  wheel  163488 Jan 16  2014 libyaml.a
lrwxr-xr-x  1 root  wheel  12 Jan 16  2014 libyaml.so -> libyaml.so.1
-r--r--r--  1 root  wheel  117456 Jan 16  2014 libyaml.so.1
-r--r--r--  1 root  wheel  176032 Jan 16  2014 libyaml_p.a
```

Could it be that I mixed userland and kernel versions the last time I upgraded?
Sorry if I am wrong I am pretty new to the whole UNIX universe so I don't understand that much yet. Old windows user.


----------



## kpa (Aug 15, 2015)

You were probably upgrading from a very old version of ports-mgmt/pkg that used a statically linked version libucl or it didn't use it at all. Since your system is missing some crucial system libraries I would reinstall a fresh 10.2. Make a backup of your system first if there's something important in it now:

http://www.wonkity.com/~wblock/docs/html/backup.html

Verify that you can restore the backup as well.


----------



## cellini (Aug 15, 2015)

Thanks for all the help, I will do that 
I am using zfs and have mirrored my root pool to a block device on my storage pool so everything is copied already.


```
pool: zroot
state: ONLINE
status: Some supported features are not enabled on the pool. The pool can
  still be used, but some features are unavailable.
action: Enable all features using 'zpool upgrade'. Once this is done,
  the pool may no longer be accessible by software that does not support
  the features. See zpool-features(7) for details.
  scan: resilvered 94.0M in 0h0m with 0 errors on Sat Aug 15 14:49:37 2015
config:

  NAME  STATE  READ WRITE CKSUM
  zroot  ONLINE  0  0  0
  mirror-0  ONLINE  0  0  0
  gptid/19ee6322-a174-11e4-a9a7-6805ca174f29  ONLINE  0  0  0
  zvol/yoda/zrootdisk  ONLINE  0  0  0

errors: No known data errors
```


----------



## maquis196 (Aug 21, 2015)

Hi¸ I have the exact same problem but my version of pkg isn't more then a week or so old since I upgrade often. I'll try and fix this somehow, hopefully one of my jails is "out-of-date" and can steal some files from there. 

Bottom line is, this was working before the 10.2 upgrade, and now it's not and I'd much rather avoid a fresh install considering what is on the box.


----------



## maquis196 (Aug 21, 2015)

`pkg-static upgrade -f pkg`

The above seems to fix the problem quite nicely. 3 cheers for a static pkg and pint the genius who thought of it!


----------



## cellini (Aug 21, 2015)

I upgraded another box today, and ended up with the same issue, but this time I tarred down the lib files from the freshly installed 10.2 and untarred them on the upgraded one, and it seems to work fine so far, but I am going to try `pkg-static upgrade -f pkg` the next time I upgrade my box.


----------



## venix (Aug 24, 2015)

In file /usr/include/strings.h on row 64 change xlocale/_strings.h with /usr/src/include/xlocale/_strings.h and rebuild.


----------



## talsamon (Aug 24, 2015)

I think you mean
Replace: 
	
	



```
#include <xlocale/_strings.h>
```
With: 
	
	



```
#include </usr/src/include/xlocale/_strings.h>
```

I wrote this to prevent misunderstoods, cause there are two ways to include files:
e.g. "somefile.h" and <somefile.h> and this means different pathes.


----------



## niklaas (Aug 27, 2015)

Although I have not upgraded to 10.2 yet and am sticking to my 10.1 installation, I would like add the following: I encountered the error


```
Shared object "libucl.so.1" not found, required by "pkg"
```

in one of my jails after upgrading with `ezjail-admin update -u`. Then `freebsd-update install` was complaining that it could only upgrade the system partially. I found this thread here https://forums.freebsd.org/threads/ezjail-warning-about-partial-upgrade.52030/#post-297471 and the provided solution only worked partly. Although `ezjail-admin update -u` was able to update the jails, I still got the error about the missing library.

The only way to solve the problem was by installing the entire basejail again with `ezjail-admin install`.


----------



## robert1307 (Jan 25, 2016)

For me `pkg-static upgrade -f pkg` didn't resolve the issue. The only way to solve that was:


```
find /usr -name 'pkg'
/usr/share/keys/pkg
/usr/local/sbin/pkg
/usr/sbin/pkg
```

`cp /usr/local/sbin/pkg /usr/sbin/pkg`


----------

