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



## MacSean (Feb 20, 2012)

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:

```
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:

```
-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?


----------



## Beeblebrox (Feb 20, 2012)

> 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.


----------



## SirDice (Feb 20, 2012)

FreeBSD 6 went end-of-life in November 2010.


----------



## Beeblebrox (Feb 20, 2012)

That means Sean, that you need to run
`# freebsd-update -r upgrade`
but make a back-up and for all means, read freebsd-update(8)() and supporting documentation carefully before you do anything.


----------



## gkontos (Feb 20, 2012)

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.


----------



## SirDice (Feb 20, 2012)

Beeblebrox said:
			
		

> That means Sean, that you need to run
> `# freebsd-update -r upgrade`
> but make a back-up and for all means, read freebsd-update(8)() and supporting documentation carefully before you do anything.



Depending on the version, freebsd-update(8) might not exist. It appeared in FreeBSD 6.2.


----------

