First time portupgrade - includes installing the needed tools: (top)
# Install "text mode" cvsup
cd /usr/ports/net/cvsup-without-gui
make install clean
# Optional: Install the utility "fastest_cvsup" to decide which CVSup server is best for you
cd /usr/ports/sysutils/fastest_cvsup
make install clean
# Synchronize your ports collection (using the fastest_cvsup tool to get the fastest CVSup server - example checks in US only)
FASTEST_CVSUP=`fastest_cvsup -Q -c us`; echo $FASTEST_CVSUP
/usr/local/bin/cvsup -g -L 2 -h $FASTEST_CVSUP /usr/share/examples/cvsup/ports-supfile
or
# Synchronize your ports collection (just choosing any CVSup server)
/usr/local/bin/cvsup -g -L 2 -h cvsup17.freebsd.org /usr/share/examples/cvsup/ports-supfile
# Install portupgrade
cd /usr/ports/sysutils/portupgrade (old directory)
cd /usr/ports/ports-mgmt/portupgrade (new directory)
make install clean
# Update the ports database
/usr/local/sbin/portsdb -Uu
# List the installed ports which need upgrading
/usr/local/sbin/portversion -l "<"
# Upgrade the installed ports
/usr/local/sbin/portupgrade -arR
# Run
# /usr/local/sbin/pkgdb -F
# if you are prompted to.
# Run
# /usr/local/sbin/pkgdb -fu
# if everything goes wrong.
Just upgrading ports - assumes that cvsup-without-gui, portupgrade, and (optionally) fastest_cvsup already are installed: (top)
# Synchronize your ports collection (using the fastest_cvsup tool to get the fastest CVSup server)
FASTEST_CVSUP=`fastest_cvsup -Q -c us`; echo $FASTEST_CVSUP
/usr/local/bin/cvsup -g -L 2 -h $FASTEST_CVSUP /usr/share/examples/cvsup/ports-supfile
or
# Synchronize your ports collection (just choosing any CVSup server)
/usr/local/bin/cvsup -g -L 2 -h cvsup17.freebsd.org /usr/share/examples/cvsup/ports-supfile
# Update the ports database
/usr/local/sbin/portsdb -Uu
# List the installed ports which need upgrading
/usr/local/sbin/portversion -l "<"
# Upgrade the installed ports
/usr/local/sbin/portupgrade -arR
# Run
# /usr/local/sbin/pkgdb -F
# if you are prompted to.
# Run
# /usr/local/sbin/pkgdb -fu
# if everything goes wrong.
Some times it may be necessary to uninstall and then reinstall one or more ports manually.
Troubleshooting experiences:(top) 1.General error - general solution(top)
In case of an error, always try this first:
/usr/local/sbin/pkgdb -fu
From man portupgrade:
"Even if you don't do anything wrong, a package database may get corrupt somehow when it is heavily updated.
In such cases, run ``pkgdb -fu'."
2.'PkgDB::DBError' (2005-12-17) - Solution: /usr/local/sbin/pkgdb -fu(top)
I ran
root@jf# /usr/local/sbin/portversion -l "<"
[Updating the pkgdb <format:bdb1_btree> in /var/db/pkg ... - 515 packages found
(-1 +8) (...)........ done]
(? bsdpan-CGI-Application-Plugin-DBH-3.00)(? bsdpan-DBD-Mock-0.26)(? bsdpan-Pars
e-RecDescent-1.94)/usr/local/lib/ruby/site_ruby/1.8/pkgdb.rb:351:in `deorigin_gl
ob': Invalid argument (PkgDB::DBError)
from /usr/local/lib/ruby/site_ruby/1.8/pkgtools.rb:177:in `config_includ
e?'
from /usr/local/lib/ruby/site_ruby/1.8/pkgtools.rb:172:in `each'
from /usr/local/lib/ruby/site_ruby/1.8/pkgtools.rb:172:in `config_includ
e?'
from /usr/local/lib/ruby/site_ruby/1.8/pkgtools.rb:162:in `config_held?'
from /usr/local/sbin/portversion:310:in `check_pkgs'
from /usr/local/sbin/portversion:300:in `each'
from /usr/local/sbin/portversion:300:in `check_pkgs'
from /usr/local/sbin/portversion:260:in `main'
from /usr/local/sbin/portversion:77:in `initialize'
from /usr/local/sbin/portversion:77:in `new'
from /usr/local/sbin/portversion:77:in `main'
from /usr/local/sbin/portversion:347
root@jf#
Forgot about my own suggestion on this very page :-(
# Run
/usr/local/sbin/pkgdb -fu
# if everything goes wrong.
After that I could run both
/usr/local/sbin/portversion -l "<"
and
/usr/local/sbin/portupgrade -arR
without any problem.
3.'make: don't know how to make describe.' - Solution: refetch and restore the ports collection(top)
Once I was dumb enough to install a port while I was running a portupgrade.
I don't know what part of the ports collection became corrupt, but I tried many ways to fix it.
Error before the fix:
bash-2.05b# /usr/local/sbin/portsdb -Uu
Updating the ports index ... Generating INDEX.tmp - please wait..make: don't know how to make describe. Stop
===> textproc/p5-Sort-PolySort failed
*** Error code 1
1 error
The final solution was to refetch the entire ports collection (almost as quick as a portupgrade, just add the time for downloading the ports collection).
4.'Port info line must consist of 10 fields' - Solution: deinstall/reinstall portupgrade(top)
This problem will probably occur only on old versions on FreeBSD, with an old version of portupgrade installed.
Check your portupgrade version:
pkg_info -I portupgrade\*
If your portupgrade version is more recent or equal to 20040701_3, you can stop read here - your problem isn't version-related.
Long description:
Once I had an unexpected power-off during the portsdb -Uu command.
After rebooting and trying to continue portsdb -Uu, the command failed with the following error:
...
/usr/ports/INDEX-5:3:Port info line must consist of 10 fields.
/usr/ports/INDEX-5:4:Port info line must consist of 10 fields.
/usr/ports/INDEX-5:5:Port info line must consist of 10 fields.
...
I just waited until the next day, ran cvsup again, and some ports were updated, so then I had a new INDEX.
(I also browsed mailing lists confirming that this was the way to go in case of a ports collection out of sync.)
Then I had a new error message:
bash-2.05b# /usr/local/sbin/portsdb -Uu
Updating the ports index ... Generating INDEX.tmp - please wait..make: don't know how to make describe. Stop
===> ftp/lukemftpd failed
*** Error code 1
1 error
********************************************************************
Before reporting this error, verify that you are running a supported
version of FreeBSD (see http://www.FreeBSD.org/ports/) and that you
have a complete and up-to-date ports collection. (INDEX builds are
not supported with partial or out-of-date ports collections -- in
particular, if you are using cvsup, you must cvsup the "ports-all"
collection, and have no "refuse" files.) If that is the case, then
report the failure to ports@FreeBSD.org together with relevant
details of your ports configuration (including FreeBSD version,
your architecture, your environment, and your /etc/make.conf
settings, especially compiler flags and WITH/WITHOUT settings).
Note: the latest pre-generated version of INDEX may be fetched
automatically with "make fetchindex".
********************************************************************
*** Error code 1
Stop in /usr/ports.
*** Error code 1
Stop in /usr/ports.
failed to generate INDEX!
portsdb: index generation error
I tested
cd /usr/ports
make fetchindex
which downloaded a pre-generated INDEX-5 file, but portsdb -Uu still failed with the same error.
I tried cvsup again, and then portsdb -Uu.
This did not work either.
I tried various cvsups and portupgrades without success.
Finally, I found a thread at http://www.mail-archive.com/freebsd-questions@freebsd.org/msg72733.html, which indicated a format change for portupgrade.
The solution was to deinstall the current portupgrade version, and reinstall it.
As the cvsup already had upgraded the port's info, I just did:
cd /usr/ports/sysutils/portupgrade
make deinstall
make install clean
Then /usr/local/sbin/portsdb -Uu worked just fine.
See also:(top)
Read more about portupgrade from
Dru Lavigne's excellent portupgrade tutorial.
The only thing where I do things in a different order from her tutorial, is synchronizing the ports collection before installing the portupgrade port the first time I upgrade the ports collection on a new system.
This has saved me a lot of trouble, as an upgraded version of portupgrade does not suffer from broken dependencies.