When installing postgres9.5
on ubuntu 14.04
, the following command stops at an error:
$sudo apt-get install postgresql-9.5 pgadmin3
Here is the error message:
Preparing to unpack .../postgresql-9.5_9.5.4-1.pgdg14.04+2_amd64.deb ...
* Stopping PostgreSQL 9.5 database server * Error: Config owner (postgres:105) and data owner (ubuntu:1000) do not match, and config owner is not root
[fail]
invoke-rc.d: initscript postgresql, action "stop" failed.
dpkg: warning: subprocess old pre-removal script returned error exit status 1
dpkg: trying script from the new package instead ...
* Stopping PostgreSQL 9.5 database server * Error: Config owner (postgres:105) and data owner (ubuntu:1000) do not match, and config owner is not root
[fail]
invoke-rc.d: initscript postgresql, action "stop" failed.
dpkg: error processing archive /var/cache/apt/archives/postgresql-9.5_9.5.4-1.pgdg14.04+2_amd64.deb (--unpack):
subprocess new pre-removal script returned error exit status 1
Errors were encountered while processing:
/var/cache/apt/archives/postgresql-9.5_9.5.4-1.pgdg14.04+2_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
What causes the error?
I had this same problem today and I think it happened because I accidentally did a (recursive) change ownership one directory too high (painful mistake to fix).
systemd[1]: Starting PostgreSQL Cluster 10-main...
postgresql@10-main[3231]: Error: Config owner (postgres:111) and data owner (root:0) do not match, and config owner is not root
systemd[1]: [email protected]: Can't open PID file /var/run/postgresql/10-main.pid (yet?) after start: No such file or directory
systemd[1]: [email protected]: Failed with result 'protocol'.
systemd[1]: Failed to start PostgreSQL Cluster 10-main.
To solve this I made sure the data was also owned by the special user postgres
like so :
cd /var/lib/
chown -R postgres postgresql/
Afterwards, (as root) starting the main service worked correctly :
start postgresql@10-main
root@myhost:/var/lib/postgresql# systemctl status [email protected]
● [email protected] - PostgreSQL Cluster 10-main
Loaded: loaded (/lib/systemd/system/[email protected]; indirect; vendor preset: enabled)
Active: active (running) since Tue 2018-05-15 07:34:30 UTC; 4s ago
Process: 3333 ExecStart=/usr/bin/pg_ctlcluster --skip-systemctl-redirect 10-main start (code=exited, status=0/SUCCESS)
Main PID: 3347 (postgres)
Tasks: 7 (limit: 1112)
CGroup: /system.slice/system-postgresql.slice/[email protected]
├─3347 /usr/lib/postgresql/10/bin/postgres -D /var/lib/postgresql/10/main -c config_file=/etc/postgresql/10/main/postgresql.conf
├─3355 postgres: 10/main: checkpointer process
├─3356 postgres: 10/main: writer process
├─3357 postgres: 10/main: wal writer process
├─3358 postgres: 10/main: autovacuum launcher process
├─3359 postgres: 10/main: stats collector process
└─3360 postgres: 10/main: bgworker: logical replication launcher
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With