Upgrading packages - portupgrade confusion

Michael Powell nightrecon at hotmail.com
Sun Sep 12 12:51:43 UTC 2010

Kaya Saman wrote:

> [...]

>> csup -L 2 ports && portsdb -uF && pkgdb -u && portversion

To elaborate a little. csup -L 2 ports is what refreshes the ports tree. 
Portupgrade is a third party app you can install to assist in automating the 
updating process. Once you've installed portupgrade there are man pages for 
portsdb, pkgdb, and portversion to see what the switches described above do. 
The commands above are just strung together to prepare a system for 
updating. portupgrade -a is actually what does the actual updating.

There are other tools as well, I'm just not as familiar with them. I think 
the other one is called portmaster. It may even be better, I don't know as I 
tend to stick with what I know as long as it keeps doing the job.  

> I didn't actually refresh the ports tree so I'm gona have to do that.
> The thing I don't quite understand though is that if the ports tree gets
> refreshed, do the packages get upgraded or will I need to rebuild them??

I don't know if I can properly explain well enough, but I'll take a stab at 
it anyways. But I believe the first answer here would be no. Refreshing the 
ports tree does not install or update any installed software. 

I kind of keyed in on your mentioning of portupgrade. Portupgrade is a tool 
for automating the upgrading of installed software. While I believe it, and 
possibly portmaster can operate on pre-built packages I myself stopped using 
packages a long time ago. I compile everything.

A pre-built package is built from the same ports system that you would use 
if you were compiling locally yourself. It's just someone else has done it 
for you. The thing to know is that in either situation, e.g. pre-built 
package or compile it yourself the ports tree is where the versioning and 
dependency tracking happens.

There is more information in the Handbook, and probably presented better 
there than I can. It is spread out in several locations however. It may not 
be immediately apparent when reading the "How to install software" section 
that you also need to read the other sections further down that explain 
csup, portmaster, etc. The main thing we will keep reiterating though is the 
first step for updating installed apps is always refresh the ports tree 
> I slightly recall the csup commnad, however I've never actually
> performed an inplace upgrade of a package in BSD. Only done this kind of
> thing in Linux - Debian/Ubuntu, CentOS and Solaris - OpenSolaris,
> Belenix where they have package managers.
> What's the process for upgrading a package? make reinstall clean??

Since I don't use packages my vantage point is centered around compiling 
locally myself. However, most of what I describe applies to both situations. 
Typically the first thing to do is update/refresh the ports tree. Should you 
determine something needs to be updated the manual approach would be to 
change to the directory of the app in ports system and do make, followed by 
make deinstall, and then make reinstall. The deinstall/reinstall leaves your 
configurations for installed apps in place.

Portupgrade is a tool that automates this. After refreshing the ports tree 
the portupgrade -a command will pretty much do what was described in the 
previous paragraph automagically. It isn't perfect and sometimes it hiccups. 
I've noticed that doing this more often so that only a few out of date apps 
need upgrading at any one time is smoother. It's when you have a hundred 
things that are really old and out of date because updating has been 
infrequent is when you are most likely to experience trouble.

Hope this helps. I'm not the best at explaining things, but the Handbook is 
a most excellent resource to be studied extensively. It is written much 
better than anything I can manage. And while much of it may seem cryptic at 
first glance, most of what you need to know is in there.


More information about the freebsd-questions mailing list