# pkg2ng help please



## kapetros (Oct 16, 2012)

Hello, I'm on FreeBSD 9.0 Stable, and after todays ports update, I show the new pkg2ng thing.
Is this only for Current? because it broke my pkgdb, after executing the portmaster instructions in ports Updating file.


----------



## cpm@ (Oct 16, 2012)

Please read carefully:


> 20121010:
> AFFECTS: users of *CURRENT (OSVERSION >= 1000017)*
> AUTHOR: *bapt@FreeBSD.org*
> 
> ...


----------



## wmoreno3 (Oct 17, 2012)

*That is seems, to be use with stable version ?*


```
20121015:
  AFFECTS: users of ports-mgmt/portmaster
  AUTHOR: bdrewery@FreeBSD.org

  Portmaster now supports pkgng. To use pkgng, enable the patch in the port,
  enable pkgng in your make.conf, and convert your existing /var/db/pkg
  database. Also see UPDATING entry 20121010 if you are on a recent CURRENT
  and do not want to use pkg.

  # make -C /usr/ports/ports-mgmt/portmaster config build deinstall install clean
  # echo 'WITH_PKGNG=yes' >> /etc/make.conf
  # pkg2ng

20121015:
  AFFECTS: users of ports-mgmt/portupgrade
  AUTHOR: bdrewery@FreeBSD.org

  Portupgrade now supports pkgng. To use pkgng, enable it in your make.conf,
  and convert your databases.

  # echo 'WITH_PKGNG=yes' >> /etc/make.conf
  # pkg2ng
  # pkgdb -fu
```


----------



## kpa (Oct 17, 2012)

To make the point more clear, the mentioned tools do support PKGNG but nothing forces you to use PKGNG at this point. It's only if you're on 10-CURRENT PKGNG is turned on by default.


----------



## SirDice (Oct 17, 2012)

kapetros said:
			
		

> Hello, I'm on FreeBSD 9.0 Stable, and after todays ports update, I show the new pkg2ng thing.
> Is this only for Current? because it broke my pkgdb, after executing the portmaster instructions in ports Updating file.



It's not only for -CURRENT. It works just fine on my 9-STABLE. But you have to realise both portmaster(8) and portupgrade(1) use the 'old' style pkg_tools. It stores it's data differently and thus these tools can't handle it. Hence the recent patches to both of them.


----------



## kapetros (Oct 17, 2012)

Well thanks for the answers, the thing is that when I run the pkg2ng, *perl-5.16.0* didn't installed because it was installing files in the same place with *p5-IO-Compress-2.055*, so the conversion ended up in failure.

While executing the steps below to recover my system, pkgdb complained that there wasn't any packages in the database.

```
# rm -/var/db/pkg/pkgdb.db
# pkgdb -Ffuv
```
For now luckily I had a backup of my system, so I restore it to the original state.


----------



## wmoreno3 (Oct 21, 2012)

I was using portmanager before, I think that I must be reinstall all system in order to rebuilds the system with portmaster, portupgrade or pkgng.


```
server# make install clean
/usr/ports/ports-mgmt/pkg/work/pkg-1.0.1/pkg-static/pkg-static: not found
*** Error code 127

Stop in /usr/ports/ports-mgmt/pkg.
server#
```


----------



## wblock@ (Oct 21, 2012)

No, but you should reinstall the port upgrade programs after rebuilding them with the patches so they will see the new package information.  It's not just a rebuild, use make config in the port directory to turn on the pkgng patches.


----------



## mariourk (Oct 26, 2012)

I had the same problem. I followed the instructions to use pkgng and suddenly my pkgdb was gone, the system kept telling me no packages were installed. Luckily I was able to undo all this, by restoring /var/db/pkg.bak, comment WITH_PKGNG=yes in /etc/make.conf and recompile ports-mgmt/portmaster and ports-mgmt/portupgrade without PKGNG support.

However, I do like to know what went wrong. Can someone explain this to me?


----------



## SirDice (Oct 26, 2012)

Nothing went wrong, it did exactly what it's supposed to do. PKGNG is a replacement for the pkg_tools. If you start using it the old tools won't work anymore. This is by design.


----------



## mariourk (Oct 26, 2012)

So, commands like 
	
	



```
pkg_version -v | grep '<'
```
 suddenly don't work anymore? What am I supposed to use instead? Probably kicking in an open door, but is there some documentation that sheds some light on this? :q


----------



## SirDice (Oct 26, 2012)

mariourk said:
			
		

> So, commands like
> 
> 
> 
> ...


Correct.



> What am I supposed to use instead?


A similar command:
`# pkg version -v | grep '<'`



> Probably kicking in an open door, but is there some documentation that sheds some light on this? :q



pkg(8) (For some reason the FreeBSD manual browser doesn't seem to have it, it should be on your system though)

http://wiki.freebsd.org/pkgng


----------



## mariourk (Oct 26, 2012)

Aha, now I know what I did wrong.

Thanks for enlightening me :beer


----------



## phoenix (Oct 26, 2012)

SirDice said:
			
		

> Nothing went wrong, it did exactly what it's supposed to do. PKGNG is a replacement for the pkg_tools. If you start using it the old tools won't work anymore. This is by design.



And, for every pkg_* command, there is an equivalent "pkg *" command.  It's not quite exactly 1:1, but it's very close.

For example:

pkg_add --> pkg add
pkg_version --> pkg version
pkg_info --> pkg info
pkg_delete --> pkg delete or pkg remove
pkg_audit --> pkg audit
And so on.

Once you install pkg(8) and convert the package database using pkg2ng(8), don't ever touch the pkg_* tools again.  Only use the pkg equivalents.


----------



## jb_fvwm2 (Oct 27, 2012)

SirDice said:
			
		

> Nothing went wrong, it did exactly what it's supposed to do. PKGNG is a replacement for the pkg_tools. If you start using it the old tools won't work anymore. This is by design.


I'm wondering if anyone could code up a /ports-mgmt/legacy-pkg which would formulate a /var/db/pkg  "v9" database on top of the pkg database after pkg is installed. (And maybe legacy command front-ends for the newer ones...) 
Sounds difficult, but I see no other reasons why not.


----------



## wmoreno3 (Oct 27, 2013)

I am using the old system until pkg2ng is the default, in order to do not have any problem.


```
FreeBSD mydomain 9.2-RELEASE FreeBSD 9.2-RELEASE #0 r255898: Thu Sep 26 22:50:31 UTC 2013     root@bake.isc.freebsd.org:/usr/obj/usr/src/sys/GENERIC  amd64
```


----------

