# Question about portupgrade -af



## prdeltoid (Jun 17, 2010)

> This process will remove old object files and libraries which will break most third party applications. It is recommended that all installed ports either be removed and re-installed or upgraded later using the ports-mgmt/portupgrade utility. Most users will want to run a test build using the following command:
> # portupgrade -af
> 
> This will ensure everything will be re-installed correctly. Note that setting the BATCH environment variable to yes will answer yes


Can someone explain in simple terms why this ensures that everything will be re-installed correctly? I don't understand. Also, it's not a "test build" is it? In other words, it doesn't test to see if portupgrade will work, you're just running portupgrade.


----------



## fronclynne (Jun 17, 2010)

Typo for `# portupgrade -afn` perhaps?  It certainly doesn't look like a test to me either, unless "test" is a synonym for "final examination" here.

[red]-af[/red] will (or should) cause portupgrade to rebuild everything starting at the base of the tree and working outward to the leaf packages, which theoretically is every bit as good as removing everything and installing from scratch.  Reality does have a bad habit of intruding, though.


----------



## yks (Jun 17, 2010)

What if an installed port's newer version requires a new dependency port which is not installed? Will portupgrade -af automatically install the new dep or?
In my practice, portupgrade -af never succeeded for all installed ports. I always had to at least manually reinstall things or sometimes do a make clean, in few cases it required more actions. That's about the intruding reality. And, since portupgrade uses much time to evaluate dependencies and it does not seem to skip once evaluated ones, it's sometimes faster and safer to deinstall/reinstall.
By the way, a strange behavior is shown by portupgrade -NRn portX which is expected (to my mind) to show all ports that would be installed as dependencies for portX, but it shows nothing except the very portX (i.e. without recursion).


----------



## wblock@ (Jun 17, 2010)

prdeltoid said:
			
		

> Can someone explain in simple terms why this ensures that everything will be re-installed correctly? I don't understand. Also, it's not a "test build" is it? In other words, it doesn't test to see if portupgrade will work, you're just running portupgrade.



Where's the quote from?  Looks like the last "n" got cut off.

What does it do?  "a" is for all, and "f" is for force.  So portupgrade will check every installed package and and upgrade/rebuild it even if it is already a current version.  See the portupgrade man page.

Typically this is needed after upgrading FreeBSD major versions, like 7 to 8.

However, it's often faster to backup, make a list of your installed ports with pkg_info, delete them all with pkg_delete, then reinstall them.  If you install some of the big ports like firefox, they will pull in most of the common dependencies as they build.


----------



## prdeltoid (Jun 17, 2010)

http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/updating-upgrading-freebsdupdate.html


----------



## wblock@ (Jun 17, 2010)

prdeltoid said:
			
		

> http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/updating-upgrading-freebsdupdate.html



Looks kind of confused.  Maybe the term "run a test build" should be "rebuild all ports".

I would suggest you enter a PR at http://www.freebsd.org/send-pr.html.


----------



## prdeltoid (Jun 17, 2010)

I just sent one. I've been sitting here for 30 minutes waiting for it to finish and it might be the wrong command to use? x(


----------



## prdeltoid (Jun 17, 2010)

What have you been going by to update, if you didn't or don't read the handbook's updating section?
I just reinstalled everything from scratch to start over because I don't know what I just did. I need to read a lot more before I know what I'm doing and I want everything in pristine condition until then. :beergrin


----------



## prdeltoid (Jun 17, 2010)

What about this:


> All third party software will now need to be rebuilt and re-installed. This is required as installed software may depend on libraries which have been removed during the upgrade process. The ports-mgmt/portupgrade command may be used to automate this process. The following commands may be used to begin this process:
> # portupgrade -f ruby
> # rm /var/db/pkg/pkgdb.db
> # portupgrade -f ruby18-bdb
> ...


Why the specific number? ruby18-bdb? The number won't change here, or this is just the most up-to-date description of how to do this? What if you have an older release, how would you know what commands to use? Will this change in the future or has it changed? Say you upgrade from 8.0 to 8.1. If the handbook still says "-f ruby18-bdb" that will be correct?


----------



## wblock@ (Jun 17, 2010)

prdeltoid said:
			
		

> What about this:
> 
> Why the specific number? ruby18-bdb? The number won't change here, or this is just the most up-to-date description of how to do this? What if you have an older release, how would you know what commands to use? Will this change in the future or has it changed? Say you upgrade from 8.0 to 8.1. If the handbook still says "-f ruby18-bdb" that will be correct?



It's correct.  ruby18-bdb is /usr/ports/databases/ruby-bdb built for ruby1.8, the default ruby.  ruby 1.9 may become the default someday... but not today.


----------

