# Is it possible to upgrade binary packages and ports?



## crocket (Mar 3, 2018)

I want to know whether it's possible to upgrade binary packages from remote repositories and ports without turning one into the other.


----------



## Lamia (Mar 3, 2018)

crocket said:


> without turning one into the other.


How do you mean?

You can upgrade ports with portsnap "fetch update && portsnap fetch install" and pkgs with "pkg update".


----------



## crocket (Mar 3, 2018)

Do ports and pkg have different package databases?


----------



## Lamia (Mar 3, 2018)

The source code(ports) with its compilation (packages) are fetched from the same source in your host.
Check /usr/local/etc/pkg/repos/.


----------



## crocket (Mar 3, 2018)

I haven't used FreeBSD for a long time, but I'm considering trying FreeBSD again. I don't have access to a FreeBSD system, yet.
Can FreeBSD distinguish compiled ports from binary packages on official repository?


----------



## HL1234 (Mar 3, 2018)

crocket said:


> I want to know whether it's possible to upgrade binary packages from remote repositories and ports without turning one into the other.


No! I got a lot of trouble to try to do so. But it is just simple to understand: In /usr/ports/ are most actual software delivered in source code. If you install them they will get at the end of the process a package what will be installed. If you installed a precompiled binary package, the software is maybe older and it contains only the config-settings what was set by anybody other. But on most desktop solutions this is sufficient.
You can now understand what does happens when you mix both kinds of installations. Especial beware of installation-ed packaged dependencies. I would recommend: decide for one way and only do the other if you sure the software didn't depend on anything you installed the one way.


----------



## scottro (Mar 3, 2018)

You can upgrade a package with pkg upgrade <pkg-name>.   Packages are usually taken from a repository updated quarterly.  You can look at /etc/pkgs/FreeBSD.repo to see.  Ports are updated far more frequently and this is something that can cause a problem. For example, pkg A uses libA, but then the latest port uses lib2A, so it won't install. If you remove libA it turns out there are 4 other packages that need it too. 

While I won't recommend mixing packages and ports, I have found, that for the packages I generally use, if I change using quarterly packages to using latest packages, I run into fewer issues and can generally, if I run into something like what I described above, I can usually fix it (mostly  by removing the package and reinstalling the package from ports.)

If changing packages from quarterly to latest, don't use /etc/pkg/FreeBSD.conf, create /usr/local/etc/pkg/repos/FreeBSD.conf. You can copy the existing /etc/pkg/FreeBSD.conf and change quarterly to latest.


----------



## PacketMan (Mar 3, 2018)

crocket said:


> Can FreeBSD distinguish compiled ports from binary packages on official repository?



Compiled ports do not exist on a repository external to your machine. Only source code and packages (pre-compiled) exist on the offiial repository.  Do not mix the use of ports and packages; there must be a thousand discussion threads already on that. Doing that will muck up your machine; though its a decent way to learn.  So use ports and a tool like portmaster(8) only, or use packages only with pkg(8).

As an alternative, to get the best of both worlds, consider using a tool like ports-mgmt/synth or ports-mgmt/poudriere.  These allow you to download source code from ports, and compile them into packages locally on your machine.  Synth can also download prefetch packages when possible.  I'm not sure this answers what you are trying to determine, but using the right tools can ensure your system has no internal conflicts. These tools do the checking to prevent the conflicts.


----------



## drhowarddrfine (Mar 3, 2018)

Adding on to scottro's post, new people seem to miss the point that *packages are the exact same thing as ports* if you ignore that packages are updated quarterly while ports are continuously updated. *Packages are created from ports.* There is no difference otherwise.


----------



## Snurg (Mar 3, 2018)

Except for that packages necessarily lag a bit behind ports due to the need to get built etc, even if one uses the "latest" repo.
This alone can be sufficient to cause occasional problems.


----------

