I have got a major debian apt problem that has got me stumped.

The apt database on one of my sarge debian servers has recently become messed up in such a way that php and a number of other important packages are not installed and cannot be reinstalled. It appears that some packages think that they should be installing etch versions rather than sarge. I did at one point in the distant past add testing to my sources list while trying to install a more recent version of something like hddtemp. My sources file has only stable in it since.

This all started when I did an "aptitude update", saw the was a new version of squirrelmail available and did a "aptitude upgrade". It wouldn't upgrade squirrelmail because of held back packages.

At some point during this problem I had lots of packages in a held state, I did a "dist-upgrade" to try and clear them as that seemed to be the advice I googled.

I then removed some packages including php to try and reinstall them, but that has just made things worse.

For example when I try to do "aptitude install php4" I get:

E: Unable to correct problems, you have held broken packages.
E: Unable to correct dependencies, some packages cannot be installed
E: Unable to resolve some dependencies!
Some packages had unmet dependencies. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.

The following packages have unmet dependencies:
php4: Depends: libapache2-mod-php4 (>= 6:4.4.4-8+etch4) but it is not installable or
libapache-mod-php4 (>= 6:4.4.4-8+etch4) but it is not installable or
php4-cgi (>= 6:4.4.4-8+etch4) but it is not installable


and for dovecot I get:

The following packages have unmet dependencies:
dovecot-common: Depends: libc6 (>= 2.3.5-1) but 2.3.2.ds1-22sarge6 is installed.
Depends: libkrb53 (>= 1.4.2) but 1.3.6-2sarge4 is installed and it is kept back.
Depends: libpq4 but it is not installable
Depends: libssl0.9.8 (>= 0.9.8a-1) which is a virtual package.


I also tried various apt-get and aptitude commands to try and purge the package meta data for the problem packages, but that didn't seem to achieve anything.

Does anyone have any advice on how to fix this ? I have tried googling, but not come up with anything helpful.

I am wondering whether at this stage upgrading the machine to etch might be the way forward ?

This sort of problem is exactly the sort of thing that I expect to happen on Windows, not debian Ironically I used (and still use on an old server) rpm for years without anything like this happening.

All my apt config files and log files are available here http://www.norman.cx/download/vault/

Thanks
_________________________
Remind me to change my signature to something more interesting someday