en essayant de désinstaller postgresql avec
Sudo apt-get remove postgresql
J'ai reçu le message d'erreur suivant
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package 'postgresql' is not installed, so not removed
The following packages were automatically installed and are no longer required:
account-plugin-windows-live libupstart1
Use 'apt-get autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 17 not upgraded.
2 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up postgresql-common (154ubuntu1) ...
* Starting PostgreSQL 9.3 database server * The PostgreSQL server failed to start. Please check the log output:
2015-07-08 11:16:50 PDT FATAL: could not create lock file "/var/run/postgresql/.s.PGSQL.5432.lock": Permission denied
[fail]
invoke-rc.d: initscript postgresql, action "start" failed.
dpkg: error processing package postgresql-common (--configure):
subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of postgresql-9.3:
postgresql-9.3 depends on postgresql-common (>= 142~); however:
Package postgresql-common is not configured yet.
dpkg: error processing package postgresql-9.3 (--configure):
dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
Errors were encountered while processing:
postgresql-common
postgresql-9.3
E: Sub-process /usr/bin/dpkg returned an error code (1)
la même chose se produit lorsque j'essaie de purger le postgres, que se passe-t-il ici et comment puis-je enlever correctement le postgres?
invoke-rc.d: initscript postgresql, action "start" failed.
dpkg: error processing package postgresql-common (--configure):
subprocess installed post-installation script returned error exit status 1
le chemin court
Sudo rm /etc/init.d/postgresql
Sudo rm /etc/init/postgresql.conf
Sudo apt-get remove postgresql
ou le chemin long
Ouvrez le fichier /var/lib/dpkg/info/postgresql-common.postinst
Sudo nano /var/lib/dpkg/info/postgresql-common.postinst
Recherchez la ligne avec la commande de démarrage:
if [ -x "/etc/init.d/postgresql" ] || [ -e "/etc/init/postgresql.conf" ]; then
invoke-rc.d postgresql start || exit $?
fi
commenter le blocage
# if [ -x "/etc/init.d/postgresql" ] || [ -e "/etc/init/postgresql.conf" ]; then
# invoke-rc.d postgresql start || exit $?
# fi
Retirez le paquet à nouveau.
Sudo apt-get remove postgresql
Lors de la suppression de la postgresql
, le script postgresql-common.postinst
est appelé. Le script essaie de démarrer le service postgresql
et échouera invoke-rc.d postgresql start
(ne me demandez pas pourquoi).
Cela doit être évité. Soit en changeant les conditions dans lesquelles le code est exécuté. Ou par la suppression du code lui-même.