OK , it seems some times when installing packages, the installation scripts get a bit confused, and can't seem to handle initscript errors.
This results in said package being half installed, but marked as failed, On occasion running apt-get -f install or dpkg --configure -a, once you have solved the problem will get things into working order again.
These commands don't allways work however, and your left with a package stuck like this:
user@server:~$ sudo dpkg -l lighttpd
iF lighttpd 1.4.25-2 A fast webserver with minimal memory footpri
(iF meaning installation Failed)
In order to resolve this, if it still refuses to install properly (even after fixing the problem that caused the error in the first place), it is neccessary to force remove the package (unfortunately dpkg --purge or --remove on its own will not work).
Typing the following (replacing lighttpd with your package name), should get the system back into working order again.
CODE:
sudo dpkg --force-remove-reinstreq --purge lighttpd
Then if you try running apt-get -f install, it should bring your system back into the correct state again.
There are other ways around this problem (I think manually installing the .dpkg archive via dpkg -i may work, but i havent tried it), but i think this is the easiest.
Anyways Tara for now!.
Keith