Problem with graphics/png reinstallation as a dependency

Hi,

I have a non-fatal trouble with graphics/png.
On a system recently upgraded to FreeBSD 10.1 (Stable) I've rebuilt all ports as necessary. I noticed that some ports tried to re-build graphics/png and stopped with error as port was already installed/updated. Now I'm trying to upgrade misc/mc and I end with the same error for graphics/png and devel/libslang2. I see an error
Code:
===>  libslang2-2.3.0 depends on shared library: libpng.so - not found
but:
Code:
root:/usr/ports/devel/libslang2 # pkg version -v | grep png
png-1.6.16  =  up-to-date with index
and
Code:
root:/usr/ports/devel/libslang2 # ls -l /usr/local/lib/libpng.*
lrwxr-xr-x  1 root  wheel  10 Mar 28 19:36 /usr/local/lib/libpng.a -> libpng16.a
lrwxr-xr-x  1 root  wheel  11 Mar 28 19:36 /usr/local/lib/libpng.so -> libpng16.so

The error may be overrided by deinstalling both graphics/png and devel/libslang2 and reinstalling misc/mc by cd /usr/ports/misc/mc && make install clean but that's really annoying.
The same situation for emulators/virtualbox:
Code:
===>  Returning to build of virtualbox-ose-4.3.26
===>  virtualbox-ose-4.3.26 depends on executable: pkgconf - found
===>  virtualbox-ose-4.3.26 depends on package: py27-setuptools27>0 - found
===>  virtualbox-ose-4.3.26 depends on file: /usr/local/bin/python2.7 - found
===>  virtualbox-ose-4.3.26 depends on executable: python2 - found
===>  virtualbox-ose-4.3.26 depends on shared library: libpng.so - not found
===>  Verifying for libpng.so in /usr/ports/graphics/png
===>  Found saved configuration for png-1.6.16
===>  png-1.6.16 depends on file: /usr/local/sbin/pkg - found
===> Fetching all distfiles required by png-1.6.16 for building
===>  Extracting for png-1.6.16
....
====> Compressing man pages (compress-man)
===>  Installing for png-1.6.16
===>  Checking if png already installed
===>  png-1.6.16 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 png
  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 /usr/ports/graphics/png
*** Error code 1

Stop.
make[2]: stopped in /usr/ports/graphics/png
*** Error code 1

Stop.
make[1]: stopped in /usr/ports/emulators/virtualbox-ose
*** Error code 1

Stop.
make: stopped in /usr/ports/emulators/virtualbox-ose


My ports tree is installed and updated via portsnap and the FreeBSD is installed and updated via freebsd-update.

Do I miss something?
Thanks in advance!
 
Hi,

Have you been following any relevant instructions in /usr/ports/UPDATING before updating your ports each time? There was an entry some months ago about rebuilding all installed ports that depend on graphics/png.
 
Thank you for the quick reply!
Yes, I read the /usr/ports/UPDATING. All the ports in my case were rebuilt by portmaster -fa so even if I forgot to rebuild them some months ago (dec-2014) I did it after freebsd-update.
 
Ok, but there were a lot of other entries in /usr/ports/UPDATING since then, some of which could also apply to your system. Re-installing all of your installed ports via portmaster -fa won't fix some of the entries that are in that file(ports that have been renamed for example). Could you install the sysutils/bsdadminscripts port, run pkg_libchk without any flags, and post the output in your post if there are any entries? If there is a long list of entries, please post the output to a website like http://pastebin.com and add the link to your post instead.
 
The problem is that neither the ports(7) system or portmaster(8) are capable of detecting the changed shared library dependency on their own (meaning portmaster -a for example won't rebuilt anything because there are no new versions to build). You have to do the rebuilding manually with the knowledge of what needs to be rebuilt. With ports-mgmt/portmaster you can use the -r option to force rebuild of all installed ports that depend on a particular port. For example:

portmaster -r graphics/png
 
I had the same problems and IMO the problem is portmaster which I am using and it didn't update correct. I deleted some and use
Code:
make install
and I don't have any problems more.
 
portmaster -af doesn't always update everything reliably. If you look at the portmaster(8) man page it specifically recommends completely deleting and re-installing all installed ports. This procedure is however out of date and there is an updated version in diff(1) form here that wblock@ has helpfully pointed out in another thread. In this case since the output of pkg_libchk showed no entries, running portmaster -r graphics/png as stated above should fix this issue.
 
running portmaster -r graphics/png as stated above should fix this issue.

Sadly that didn't help. During portmaster -r png only graphics/png was rebuilt and the problem with attempted re-install of this port persists:
Code:
-- Installing: /usr/ports/graphics/png/work/stage/usr/local/lib/libpng/libpng16-release.cmake
====> Compressing man pages (compress-man)
===>  Installing for png-1.6.16
===>  Checking if png already installed
===>  png-1.6.16 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 png
  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 /usr/ports/graphics/png
*** Error code 1

Stop.
make[2]: stopped in /usr/ports/graphics/png
*** Error code 1

Stop.
make[1]: stopped in /usr/ports/graphics/php5-gd
*** Error code 1

Stop.
make: stopped in /usr/ports/graphics/php5-gd

===>>> make build failed for graphics/php5-gd
===>>> Aborting update

===>>> Update for graphics/php5-gd failed
===>>> Aborting update
 
Other solution is to add this to your /usr/local/etc/portmaster.rc (create if missing):

Code:
PM_MAKE_ARGS='-DFORCE_PKG_REGISTER'
 
But remove that setting after getting it installed.

I'd like to point out that the setting is in the sample portmaster.rc as an example but commented out and it has been a recommended way to overcome the problem of reinstalling ports that are required by other ports for a long time:

Code:
...
# Arguments to pass to make (-m)
# PM_MAKE_ARGS='-DFORCE_PKG_REGISTER'
...
 
cd /usr/ports/graphics/png
make deinstall clean
cd /usr/ports/graphics/php5-gd
make install clean

That's exactly the way I solved the problem but during major update I have to deinstall graphics/png too many times...

It should not normally be required. If it is, something else is probably wrong.

I'm sure it is. Probably the best solution is to deinstall all ports, fetch the ports tree again and reinstall everything. Typing this answer I remember on this server I've used pkg2ng to migrate to new package system rather "fresh" reinstall as you kindly recommend here: https://forums.freebsd.org/threads/how-to-rebuild-all-programs.44500/
 
wblock@: I don't really understand why your are against FORCE_PKG_REGISTER. You can't really recursive reinstall ports with portmaster without it. Portmaster stops too often. I have used this option very often and it causes never a problem. Also I can't reinstall in the port without it. You can't deinstall everything, then it will be faster to reinstall whole system… I never noticed that a package will be registered twice.
 
talsamon The difference is that you never know if your builds ended successfully or just somehow.
The latter is "convenient" (a term becoming used more frequently here). :)

Forced options are meant to be a last resort not a default, like warnings that are implemented for reading, not ignoring. ;)

It turns out that make reinstall now sets FORCE_PKG_REGISTER anyway so the point is moot, you're force fed the setting if you use the correct make reinstall to reinstall/update a port.

From /usr/ports/Mk/bsd.port.mk:
Code:
# Reinstall
#
# Special target to re-run install

.if !target(reinstall)
reinstall:
        @${RM} -f ${INSTALL_COOKIE} ${PACKAGE_COOKIE}
        @cd ${.CURDIR} && DEPENDS_TARGET="${DEPENDS_TARGET}" ${MAKE} -DFORCE_PKG_REGISTER install
.endif
If you're still wondering why it has to be done this way, this is just another design flaw in the ports system. There is no upgrade target or anything like that, only a forced delete and install sequence for installed ports that are required by other installed ports.
 
Portmaster should ask if it should delete the port and reinstall. This could do portmaster, it's not necessaire to do this per hand. This gives time to save if needed config-files, and you could continue normal with portmaster.
 
kpa IMO it is not so much moot. :)

Your point is that FORCE_PKG_REGISTER is set anyway. So setting it does not make much difference. Got you right?

My argument is let /usr/ports/Mk/bsd.port.mk set it when it is needed, namely when reinstalling has to be done.

But having it set all the time gets you some information missing that you might want to know. Isn't it? After that one can decide to set it manually for having temporarily a workaround.

Having set FORCE_PKG_REGISTER permanently may be convenient, but probably at some cost when it gets used not during reinstalls.

Its only use is when a port is required by other ports, preventing the normal deinstallation with pkg delete (which surprise surprise is the way ports get deinstalled, no "port" specific deinstallation, it's all done by the packaging backend pkg(8)). What the setting does is to turn the deinstallation into pkg delete -f. When used with a "leaf" port the setting is a no-op essentially.

I told you it's crude and archaic but it's what we have now ;)
 
Probably the best solution is to deinstall all ports, fetch the ports tree again and reinstall everything.

There is no need to fetch the ports tree again. Port building or installing does not affect it. Just update it.

It should also be mentioned here that the usual cause of problems with ports is not checking /usr/ports/UPDATING every time before updating or installing new ports.
 
the usual cause of problems with ports is not checking /usr/ports/UPDATING every time before updating or installing new ports
I have to admit I oftenly omit this step...
I agree that -DFORCE_PKG_REGISTER should be the avoided. I've never used this option for more than 10 years of FreeBSD experience. Thanks for pointing me that fetching ports tree again is unnecessary. I should rebuild installed ports because I can't reproduce this issue on another server with same version of base and ports and I'm afraid something in package database might be wrong. I can't find another explanation for attempts of reinstalling the same version of already installed port.
 
Update:

Today I have enough free time and good mood to reinstall all ported software on my server. First I deinstalled all:
pkg delete -fa
Then I started over, first lang/perl5.20, dns/bind910,mail/dovecot2-pigeonhole and on security/clamav:
Code:
==>  Installing for gettext-runtime-0.19.4
===>  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

Stop.
make[4]: stopped in /usr/ports/devel/gettext-runtime
*** Error code 1

Stop.
make[3]: stopped in /usr/ports/lang/python27
*** Error code 1

Stop.
make[2]: stopped in /usr/ports/lang/python27
*** Error code 1

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

Stop.
make: stopped in /usr/ports/security/clamav

I deinstalled everything again and did
rm -rf /var/db/pkg
The result was the same. Then
rm -rf /var/db/pkg
rm -rf /var/db/ports
rm -rf /usr/local/
with no effect.
As a last resort I fetched the ports tree again
mv /usr/ports /usr/ports.old
portsnap fetch extract
and started over. No luck with even more attemts to reinstall already installed ports.

By removing /usr/ports, /usr/local/*, /var/db/pkgand /var/ports I think my system was as it would be after a fresh install before installing ports collection.

I can't reproduce this on any other system and I'll have to FORCE_PKG_REGISTER to bring the server back to life. The mystery remains...
 
Back
Top