# portmaster treats pre-installation as error.



## eonil (Oct 13, 2013)

I was trying `portmaster` to install multiple ports as fast as possible.


```
cd /usr/ports
cd ports-mgmt/portmaster; make install clean; cd ../..
portmaster -GPv lang/python lang/perl5.14 ftp/curl devel/git net/rsync shells/zsh devel/llvm lang/clang
```


And this failed due to this error.


```
(a lot of output...)
===>   python2-2_1 depends on file: /usr/local/bin/python2.7 - found
===>   Generating temporary packing list
===>  Checking if lang/python2 already installed
/bin/ln -sf /usr/local/bin/idle2.7 /usr/local/bin/idle2
/bin/ln -sf /usr/local/bin/pydoc2.7 /usr/local/bin/pydoc2
/bin/ln -sf /usr/local/bin/python2.7 /usr/local/bin/python2
/bin/ln -sf /usr/local/bin/python-shared2.7 /usr/local/bin/python-shared2
/bin/ln -sf /usr/local/bin/2to3-2.7 /usr/local/bin/2to3-2
/bin/ln -sf /usr/local/bin/smtpd2.7.py /usr/local/bin/smtpd2.py
/bin/ln -sf /usr/local/bin/python2.7-config /usr/local/bin/python2-config
/bin/ln -sf /usr/local/bin/python-shared2.7-config /usr/local/bin/python-shared2-config
===>   Registering installation for python2-2_1
===>   Returning to build of python-2.7_1,2
===>   Generating temporary packing list
===>  Checking if lang/python already installed
===>   python-2.7_1,2 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 lang/python
      without deleting it first, set the variable "FORCE_PKG_REGISTER"
      in your environment or the "make install" command line.
*** [check-already-installed] Error code 1

Stop in /usr/ports/lang/python.
*** [build-depends] Error code 1

Stop in /usr/ports/devel/git.

===>>> make failed for devel/git
===>>> Aborting update

===>>> Update for devel/git failed
===>>> Aborting update

===>>> Killing background jobs
Terminated
===>>> There are messages from installed ports to display,
       but first take a moment to review the error messages
       above.  Then press Enter when ready to proceed.
```


I think there's exactly same version of python installation. And it caused `make install` to fail. And that cause portmaster to fail. And whole procedure has aborted.

I have no idea how I handle this situation. If a package is installed while installing other port, then portmaster seems to fail.

Currently git is not installed. So postmaster failed.


```
root@devm:/usr/ports # git
git: Command not found.
```

Here's my system version.

```
root@devm:/usr/ports # uname -a
FreeBSD devm 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
```


How can I portmaster to handle this situation gracefully? For instance, if the exisitng installation for a port discovered, I want it to be passed, reinstalled or upgraded. Just to finish the whole process.

Or should I install all each ports using separated portmaster command?


----------



## jb_fvwm2 (Oct 13, 2013)

There are better ways, but if one is in a hurry to finish one can in another terminal or `xterm` delete the existing one.  The proper fix, maybe, may be to figure out the code in `portmaster` that causes the error [one can examine it as it is a shell script], and revise it so that the error does not occur. [I could, but after one attempt I knew it would take too much time... [cmd=] cp -iv /usr/local/bin/portmaster /usr/local/bin/portmaster_revised && nano -w /usr/local/bin/portmaster-revised [/cmd] for example.


----------



## kpa (Oct 13, 2013)

Why can't people read anymore? The error message has at least two suggestions that you should have tried by now


Anyway, the solution is to use the FORCE_PKG_REGISTER variable as the error message suggests. With ports-mgmt/portmaster this setting can be made the default by adding this line to /usr/local/etc/portmaster.rc:


```
PM_MAKE_ARGS='-DFORCE_PKG_REGISTER'
```


----------



## ShelLuser (Oct 13, 2013)

These problems are somewhat common and happen more often when you're using "meta packages". For example; I've had quite a few issues in the past when having to deal with print/ghostscript9 and print/ghostscript9-nox11.

Because my server does not have (nor need) the X window system most ports will fall back to using the nox11 version of the Ghostscript port. Unfortunately, during upgrading, some will easily fall back to the main print/ghostscript9 port which introduces a similar problem. Because both port entries provide the same software; the main difference is the setting of the X11 option.

Still; the best way is to remove the package (or optionally specify FORCE_PKG_REGISTER) and let portmaster sort it all out. That's because this way you can be sure that all dependencies are being kept in place the way they should be.

Hope this can help too.


----------



## wblock@ (Oct 13, 2013)

It is a bug, though.  portmaster occasionally can't figure out that the package it has just rebuilt is already installed, and it would be nice to see that fixed.  I suspected it was due to the difference between installed package names and port names (py27-cairo versus graphics/py-cairo), but that is not the problem with the Python language port.  There is some work going on in the ports system that may improve this.


----------



## eonil (Oct 13, 2013)

Thanks for replies.
I will try `FORCE_PKG_REGISTER` flag for next chance.


----------

