# pkg upgrade wants to restore deleted pkg's



## gjpc (Jul 12, 2014)

My ISP updated my jail to BSD 9 so I took the opportunity to move completely to pkgng. In fact everything was going so smoothly I updated my apache22 to apache24, swithced to the ports bugzilla and tweaked my favorite php ports using the port tree.

I performed a 

```
pkg install apache24
pkg delete apache22
```
however now when I do a upgrade I get the following:

```
pkg upgrade
Updating repository catalogue
Upgrades have been requested for the following 6 packages:

        Installing apache22: 2.2.27_4
        Reinstalling p5-GD-2.53 (direct dependency changed)
        Reinstalling php5-5.4.30 (options changed)
        Reinstalling php5-extensions-1.7 (options changed)
        Reinstalling bugzilla44-4.4.4_1 (options changed)
        Reinstalling mod_php5-5.4.30,1 (direct dependency changed)

The upgrade will require 19 MB more space

2 MB to be downloaded
```
Why is pkg trying to reinstall apache22?
How do I really delete an unwanted port for pkg?
I used portmaster to install the php ports because I needed the php_mod for apache24, is pkg going to try and remove my changes?
Is pkg going to try an eradicate my custom changes to bugzilla?

Should I just pkg block these and go along my merry way?

One more pkg problem:

```
pkg_info |grep binutil
pkg_info: the package info for package 'gdbm-1.11_2' is corrupt
pkg_info: the package info for package 'gettext-0.18.3.1_1' is corrupt
pkg_info: the package info for package 'libiconv-1.14_3' is corrupt
pkg_info: the package info for package 'pkg-1.2.7_2' is corrupt
pkg_info: the package info for package 'portmaster-3.17.6' is corrupt
pkg_info: the package info for package 'python27-2.7.6_4' is corrupt
```

I have found no way in the docs how to correct the corruptions

Any advice is greatly appreciated.


----------



## kpa (Jul 12, 2014)

The only way at the moment is to build everything yourself, many of the packages that are for the Apache web server have hard coded dependencies to www/apache22 and those can't be changed when installing the binary packages.

You are mixing the old pkg_* package tools with the new PKGNG tools, you must stop using `pkg_info` etc. and use `pkg info` etc. instead after converting to PKGNG.


----------



## gjpc (Jul 12, 2014)

kpa said:
			
		

> The only way at the moment is to build everything yourself, many of the packages that are for the Apache web server have hard coded dependencies to www/apache22 and those can't be changed when installing the binary packages.
> 
> You are mixing the old pkg_* package tools with the new PKGNG tools, you must stop using `pkg_info` etc. and use `pkg info` etc. instead after converting to PKGNG.



Thanks for the swift reply kpa. I am not using any of the`pkg_*` commands, in fact I removed all of them with `pkg`. But I am using the `make` in the port tree to install some of my ports in lieu of `pkg install`

You made me noticed the `pkg_*` port is not showing up in the `pkg upgrade` after I used a `pkg delete` to remove it. 

Curiouser and Curiouser.


----------



## kpa (Jul 12, 2014)

gjpc said:
			
		

> kpa said:
> 
> 
> 
> ...



Yes you are using the old package tools, your first post shows that you're using pkg_info(1):



> One more pkg problem:
> 
> ```
> pkg_info |grep binutil
> ...



PKGNG no longer uses the ascii file based database under /var/db/pkg but an SQLITE database that is named /var/db/pkg/local.sqlite, the old pkg_* tools know nothing about this new database that's why they can no longer be used after converting to PKGNG packages.


----------



## gjpc (Jul 13, 2014)

My Bad, that is what up arrow in bash gets you without looking too carefully.

So the whole corruption thing is my own carelessness. So do I just get rid of `pkg_` by deleting them from /usr/sbin?

```
pkg which /usr/sbin/pkg_info
/usr/sbin/pkg_info was not found in the database
```

Also what about apache22 wanting to come back an haunt me in an `pkg upgrade`?


----------



## kpa (Jul 13, 2014)

gjpc said:
			
		

> My Bad, that is what up arrow in bash gets you without looking too carefully.
> 
> So the whole corruption thing is my own carelessness. So do I just get rid of `pkg_` by deleting them from /usr/sbin?
> 
> ...




If you're building FreeBSD from source you can do this in /etc/src.conf and run `make -C /usr/src delete-old delete-old-libs`:


```
WITHOUT_PKGTOOLS=1
```

That will prevent the old package tools from being built and the `make -C /usr/src delete-old delete-old-libs` command will remove all of the old tools from your current installation.

Like I said the only way to get those packages to depend on www/apache24 at the moment is to build everything from ports yourself. I'm using my own package builder based on ports-mgmt/poudriere for that. A HOWTO is here if you're interested:

Thread 38859


----------



## junovitch@ (Jul 16, 2014)

The default version just changed two days ago to Apache 2.4.  That means the packages publically available will use Apache 2.2 right now.  The package builds start every Wednesday so in a few days you can probably run `pkg upgrade` and it will be Apache 2.4.


----------

