在ubuntu 14.04上安装postgres9.5时,以下命令会在出现错误时停止:postgresql apt-get install postgresql-9.5 pgadmin3
以下是错误消息:
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)是什么导致了这个错误?
发布于 2018-05-15 15:41:03
我今天遇到了同样的问题,我想它的发生是因为我不小心(递归地)改变了一个目录的所有权,这个目录太高了(这个错误很痛苦,很难修复)。
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]: postgresql@10-main.service: Can't open PID file /var/run/postgresql/10-main.pid (yet?) after start: No such file or directory
systemd[1]: postgresql@10-main.service: Failed with result 'protocol'.
systemd[1]: Failed to start PostgreSQL Cluster 10-main. 为了解决这个问题,我确保数据也归特殊用户postgres所有,如下所示:
cd /var/lib/
chown -R postgres postgresql/之后,(以root身份)启动主服务正常工作:
start postgresql@10-main
root@myhost:/var/lib/postgresql# systemctl status postgresql@10-main.service
● postgresql@10-main.service - PostgreSQL Cluster 10-main
Loaded: loaded (/lib/systemd/system/postgresql@.service; 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/postgresql@10-main.service
├─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发布于 2016-10-12 05:15:53
我发现的问题是/var上的权限意外地被更改为非根权限。在/var上运行chown -R之后,关于postgres的事情开始正常工作。
https://stackoverflow.com/questions/39983732
复制相似问题