![](/img/trans.png)
[英]Postgresql FATAL: could not create lock file "/var/run/postgresql/.s.PGSQL.5432.lock": Permission denied
[英]PostgreSQL server failed to start, could not create lock file: permission denied
每當我使用安裝它時,我都試圖安裝和運行 postgreSQL 服務器
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/postgresql
的所有者並將其設置為postgres
:
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
。
你能檢查/var/run的文件權限嗎?
ls -l /var/run
如果缺少“寫”權限,請嘗試
sudo chmod o+w /var/run
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.