index file /usr/ports/INDEX-6 not writable!

I'm new to FreeBSD and am trying to upgrade PHP on an existing server. It's clear that there are some corrupt ports on the server, so it seems logical that I need to update the ports. If I understand FreeBSD correctly, that means I first need to update my ports index. However, when I try to run portsdb -FUu I get the message:
Code:
Fetching the ports index ... index file /usr/ports/INDEX-6 not writable!
portsdb: index generation error
I'm running this command as root, and the related ls -l entries are:
Code:
-rw-r--r--     1 root  wheel  22990048 Sep 27 02:56 INDEX-6
-rw-r--r--     1 root  wheel  39577600 Feb 20 04:04 INDEX-6.db

What am I doing wrong?
 
I first need to update my ports index
No, you should update your ports tree. This is done by portsnap(8)() or by csup(1)(). The INDEX file is used to calculate the latest dependency structure for a given port, and not all port managers need the use of the INDEX file. ports-mgmt/portmaster for example does not need the INDEX.db but works through records in /var/db/ports and /var/db/pkg. I would give that a try. Also, both portmaster and portupgrade (the tool which uses an updated version of INDEX) can fetch and install pre-compiled packages (use -P flag).

But, whatever port management tool you choose, you are going to need an updated version of the ports tree. As to your original question, why the "fix-update" command fails: There could be many reasons and it's not necessarily uncommon. You could try:
# cd /usr/ports && make fetchindex which will get the file from the repository. You can also delete the INDEX.db and run the command again.
 
It might be easier and less time consuming to backup and perform a new installation instead of upgrading.

Most settings will be retained by backing up: /usr/local/etc

That includes both apache and php settings. Keep in mind that many php options have changed since then, especially the way extensions are handled.

A thorough investigation of /ports/UPDATING is required before attempting to upgrade any ports.
 
Back
Top