Chyba u postgresql-8.4 [Ubuntu 10.04]

postgresql1) postgresql nejde spustit:

Při snaze o spuštění postgresql obdržíme následující hlášení:
Insecure directory in $ENV{PATH} while running with -T switch at

Chyba je v oprávněních adresáře /bin
Po změně práv chmod 755 /bin by vše mělo fungovat správně.

2) postgresql nejde odinstalovat
Při snaze odinstalovat postgresql obdrtíme podobné chybové hlášení jako toto:

* Stopping PostgreSQL 8.4 database server
* Error: /var/lib/postgresql/8.4/main is not accessible or does not exist
…fail!
invoke-rc.d: initscript postgresql-8.4, action „stop“ failed.
dpkg: error processing postgresql-8.4 (–remove):
subprocess installed pre-removal script returned error exit status 1
* Starting PostgreSQL 8.4 database server
* Error: /var/lib/postgresql/8.4/main is not accessible or does not exist
…fail!
invoke-rc.d: initscript postgresql-8.4, action „start“ failed.
dpkg: error while cleaning up:
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
postgresql-8.4

Řešení:
Otevřeme soubor:
gedit /var/lib/dpkg/info/postgresql-8.4.prerm
A hned po první řádce
#/bin/sh -e
přidáme další řádku s
exit 0
a uložíme.

Poté již balíček lze odinstalovat bez problémů:

sudo dpkg -r postgresql-8.4
(Reading database … 137155 files and directories currently installed.)
Removing postgresql-8.4 …
Processing triggers for sreadahead …