Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've got a server with zoneminder, mysql, ffserver and some ffmpeg instances running on it, but for some reason everything seems to be tied to PostgreSQL. I noticed an error when loading the zoneminder viewer, saying it couldn't connect to mysql. I checked mysql and found it didn't create the socket, using sudo start mysql yields a service could not start error and absolutely nothing in the logs (even when manually specifying a log file to use). I tried to reinstall mysql with sudo apt-get remove mysql-server and got an error saying it couldn't start PostgreSQL server (nothing in the log for that either). Tried to uninstall postgresql with sudo apt-get remove postgresql and got the same error.

So my question is, why does everything seem to be tied to PostgreSQL on the machine, and why can't I remove it? I'm trying to get MySQL Server up and running but apt-get fails every commend I give it trying to access PostgreSQL.

$ sudo apt-get purge postgresql
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:
  libmime-types-perl libyaml-syck-perl unzip php5 libavfilter2 libarchive-zip-perl libmime-tools-perl libdate-manip-perl
  libavdevice53 linux-headers-3.5.0-25-generic libsys-mmap-perl linux-headers-3.5.0-23-generic linux-headers-3.5.0-23
  linux-headers-3.5.0-25 libraw1394-11 libphp-serialization-perl libemail-date-format-perl libdc1394-22 zip
  libdevice-serialport-perl libconvert-binhex-perl libmime-lite-perl libjs-mootools
Use 'apt-get autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 18 not upgraded.
2 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up postgresql-9.1 (9.1.9-0ubuntu12.04) ...
 * Starting PostgreSQL 9.1 database server
 * The PostgreSQL server failed to start. Please check the log output.
invoke-rc.d: initscript postgresql, action "start" failed.
dpkg: error processing postgresql-9.1 (--configure):
 subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of postgresql-contrib-9.1:
 postgresql-contrib-9.1 depends on postgresql-9.1 (= 9.1.9-0ubuntu12.04); however:
  Package postgresql-9.1 is not configured yet.
dpkg: error processing postgresql-contrib-9.1 (--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:
E: Sub-process /usr/bin/dpkg returned an error code (1)

Edit: I found the issue: Zoneminder was filling up all 8TB of disk space. Still curious why apt-get needs postgresql though if anyone knows.

share|improve this question
I have this issue when I've enabled auditd as per the example, just installing auditd doesn't cause the failure, but enabling auditctl -a task,always reproduces the invoke-rc.d: initscript postgresql, action "start" failed. notice – ThorSummoner Oct 4 '14 at 4:10
up vote 2 down vote accepted

You have an incomplete PostgreSQL install or uninstall. apt will try to finish any incomplete installs/uninstalls before performing the task you requested, and will fail if it can't finish the interrupted task.

You will observe that apt-get -f install also tries to do something with Pg. It's because you have an incomplete or damaged Pg install that apt is trying to get into a proper state so it can get on to other tasks.

You'll need to fix the PostgreSQL package. In this case I suggest looking at the PostgreSQL logs, or (if you're not using it) just attempting to unintall Pg.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .