# Problem with new pkg and pkg2ng



## ProServ (Feb 16, 2014)

Hi,
This morning, on an 8.3 amd64 server, followed the page: https://wiki.freebsd.org/pkgng 

After all is said and done, `pkg2ng`shows a ton of fstat() failed....

I had to clean all ports with `pkg_delete -a` (doing first what Using portmaster to do a complete reinstallation of all your ports states.

After `pkg_delete -a` is finished and there is ONLY local.sqlite left in /var/db/pkg.  Subsequently running any `make` (in ports) for the ports which were previously installed, displays failure as it sees the port as already installed.

In /etc/make.conf I now have it as:

```
# WITH_PKGNG=yes
NO_WARNING_PKG_INSTALL_EOL=yes
```

Right now, just installing samba4 from ports and it seems to be going okay.

So I am kind of at a loss here as to how to get the new pkg working properly.

Thanks for your help!


----------



## wblock@ (Feb 16, 2014)

You have to stop mixing the two package databases.  Normally, it goes like this:


 While still using the old package system (pkg_*), install ports-mgmt/pkg.
 Edit /etc/make.conf, adding 
	
	



```
WITH_PKGNG=yes
```

 Run `pkg2ng` to import the old package information into the new database.
 Stop using the old pkg_* commands forever.

By commenting out WITH_PKGNG=yes, you are using the old package database.  However, since you have deleted the old package database with pkg_delete -a, there may not be a way to recover that data even after enabling the new package database.


----------



## SirDice (Feb 17, 2014)

Since everything has already been removed I suggest removing /var/db/pkg/local.sqlite. Then first install ports-mgmt/pkg and run `pkg2ng`. The only package installed should be pkg. After that re-install everything using pkg(8).


----------

