简体   繁体   English

PostgreSQL 服务器启动失败,无法创建锁定文件:权限被拒绝

[英]PostgreSQL server failed to start, could not create lock file: permission denied

I am attempting to install and run a postgreSQL server, whenever I install it using每当我使用安装它时,我都试图安装和运行 postgreSQL 服务器

sudo apt-get install postgresql

I get the following error:我收到以下错误:

* 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)

I am guessing it's a permissions issue;我猜这是一个权限问题; how do I go about solving it?我该如何解决? I am running Ubuntu 13.10我正在运行 Ubuntu 13.10

Change the owner of /var/run/postgresql and set it to postgres :更改/var/run/postgresql的所有者并将其设置为postgres

sudo chown -R postgres:postgres /var/run/postgresql

If the user you are running as does not have sudo privilege, then如果您运行的用户没有 sudo 权限,则

  1. Change to root:更改为根:

     su -
  2. Change ownership of /var/run/postgresql to user postgres and group postgres :/var/run/postgresql所有权更改为用户postgres和组postgres

     chown -R postgres:postgres /var/run/postgresql

I had the same problem when installing postgres on Ubuntu 14.04 and changing the ownership fixed the problem for me.我在 Ubuntu 14.04 上安装postgres时遇到了同样的问题,更改所有权为我解决了这个问题。

The lock file ends up in /var/run .锁定文件最终在/var/run To fix the permissions of this dir, I needed to run sudo chmod a+w /var/run/postgresql .为了修复这个目录的权限,我需要运行sudo chmod a+w /var/run/postgresql

Could you check the file permissions of /var/run?你能检查/var/run的文件权限吗?

ls -l /var/run

If 'write' permission is missing, try如果缺少“写”权限,请尝试

sudo chmod o+w /var/run

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Postgresql 致命:无法创建锁定文件“/var/run/postgresql/.s.PGSQL.5432.lock”:权限被拒绝 - Postgresql FATAL: could not create lock file "/var/run/postgresql/.s.PGSQL.5432.lock": Permission denied 致命:无法创建锁定文件“postmaster.pid”:权限被拒绝 - FATAL: could not create lock file “postmaster.pid”: Permission denied 由于锁定文件的权限被拒绝,无法启动 Postgres 服务器 - Unable to start Postgres Server because of permission denied on lock file PostgreSQL 服务器无法在 ArchLinux 上启动:致命:无法创建锁文件 »/run/postgresql/.s.PGSQL.5432.lock« - PostgreSQL server fails to start on ArchLinux: FATAL: could not create lockfile »/run/postgresql/.s.PGSQL.5432.lock« 无法连接到 PostgreSQL 服务器:无法连接到服务器:权限被拒绝 - Unable to connect to PostgreSQL server: could not connect to server: Permission denied initdb:错误:无法创建目录“./PostgreSQL”:权限被拒绝 - initdb: error: could not create directory “./PostgreSQL”: Permission denied PostgreSQL - '无法截断文件“global/21607”:权限被拒绝' - PostgreSQL - 'could not truncate file "global/21607": permission denied' 无法启动 PostgreSQL 服务器 - Could not start PostgreSQL server ROR 无法连接 PostgreSQL 无法连接到服务器:权限被拒绝; 而控制台可以连接 - ROR is unable to connect PostgreSQL could not connect to server: Permission denied; while console can connect PostgreSQL:无法打开文件进行读取。 没有权限。 SQL 状态:42501 - PostgreSQL: Could not open file for reading. Permission denied. SQL state: 42501
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM