PostgreSQL server启动失败,无法创建锁定文件:权限被拒绝
每当我使用安装postgreSQL server时,我都会尝试安装并运行它PostgreSQL server启动失败,无法创建锁定文件:权限被拒绝,postgresql,ubuntu,ubuntu-13.10,Postgresql,Ubuntu,Ubuntu 13.10,每当我使用安装postgreSQL server时,我都会尝试安装并运行它 sudo apt-get install postgresql 我得到以下错误: * Starting PostgreSQL 9.1 database server * The PostgreSQL server failed to start. Please check the log output: 2014-04-03 17:18:16
sudo apt-get install postgresql
我得到以下错误:
* Starting PostgreSQL 9.1 database server
* The PostgreSQL server failed to start. Please check the log output:
2014-04-03 17:18:16 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 postgresql-common (--configure):
subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of postgresql-9.1:
postgresql-9.1 depends on postgresql-common (>= 115~); however:
Package postgresql-common is not configured yet.
dpkg: error processing postgresql-9.1 (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of postgresql:
postgresql depends on postgresql-9.1; however:
Package postgresql-9.1 is not configured yet.
dpkg: error processing postgresql (--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.1
postgresql
E: Sub-process /usr/bin/dpkg returned an error code (1)
我猜这是一个权限问题;我该如何着手解决它?
我正在运行Ubuntu 13.10,你能检查一下/var/run的文件权限吗
ls -l /var/run
如果缺少“写入”权限,请重试
sudo chmod o+w /var/run
更改
/var/run/postgresql
的所有者并将其设置为postgres
:
chown -R postgres:postgres /var/run/postgresql
sudo chown-R postgres:postgres/var/run/postgresql
如果您运行的用户没有sudo权限,则
su -
/var/run/postgresql
的所有权更改为用户postgres
和组postgres
:
chown -R postgres:postgres /var/run/postgresql
在Ubuntu 14.04上安装
postgres
并更改所有权时,我也遇到了同样的问题。锁文件以/var/run
结束。为了修复这个目录的权限,我需要运行sudo chmod a+w/var/run/postgresql
当我输入我得到的时,lrwxrwxrwx 1 root 4 april 1 17:46/var/run->/run
我然后执行sudo chmod o+w/var/run
,然后运行postgresql服务器,同样的问题。你能试试“sudo apt get update”吗然后“sudo apt get install postgresql”?这是一个符号链接。在/run
上的烫发是什么ls-ld/run
这里有解决方案。我认为这应该对你有所帮助。我试过了,但这是被退回的;你好,道森迪亚兹,谢谢你的截图。您必须先更改为root。你错过了chown命令之前的“sudo”。如果dawson用户没有sudo权限,那么1)通过“su-”更改为root,2)“chown-R postgres:postgres/var/run/postgresql”这对我也有效,但我已经安装了postgres 9.3。Synaptic Package Manager想要发布更新,在更新运行之后,Postgres无法重新启动,原因与您问题中详述的相同。手动修复权限问题使我能够重新启动本地postgres服务器。这也是Linux Mint上的解决方案。在fedora上,将所有者更改为postgres:postgres
对我无效,但是将它更改为我的当前用户工作了sudo chown-R$user:$user/var/run/postgresql
我以不同于postgres的用户身份运行postgresql,它不允许我在/var/run/postgresql
处创建锁文件。IMHO允许全局读/写是不好的,我刚刚将我的用户添加到postgres
组。