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«
问题描述
我在Arch方面还是一个新手,在PostgreSQL中是一个初学者,所以这可能是一个非常基本的问题.
I am quite new in Arch and a total beginner in PostgreSQL, so this may be a very basic question.
我从Extra安装了postgresql 11.5-4,从AUR安装了pgadmin 4,它们似乎都运行良好.我使用以下命令创建了一个测试数据库:
I installed postgresql 11.5-4 from extra and pgadmin 4 from AUR, both seem to be running well. I created a test DB with the following command:
initdb -D /home/lg/test-db
我得到了答案:
You can start the db-server using:
pg_ctl -D /home/lg/test-db -l logdatei start
我尝试过并得到:
pg_ctl -D /home/lg/test-db -l logdatei start
waiting for serer to start.... stopped
pg_ctl: could not start the server
check the log.
日志仅显示无法创建锁文件»/run/postgresql/.s.PGSQL.5432.lock«,因为找不到该文件夹.在/run下没有名为"postgresql"的文件夹.我想postgresql无法创建此文件夹,因为它没有权限.但是,在线发布的一些帖子建议将数据库的用户/所有者更改为sudo.但是,PostgreSQL可以防止这种情况.当我尝试使用任何命令作为sudo时,postgresql告诉我该命令不能以root用户身份运行.我的想法一定有一些非常基本的错误,但是我已经3个小时没有解决了.
The log only says that the lockfile »/run/postgresql/.s.PGSQL.5432.lock« could not be created, because the folder could not be found. Under /run is no folder called "postgresql". I suppose postgresql can not create this folder, because it does not have the permission. Several posts online posts suggest to change the user/owner of the db to sudo, however. Postgresql prevents this, however. When I try any command as sudo, postgresql tells me that this command can't be run as root. There must be some very basic error in my thinking here, but I have not worked it out for 3 hours.
推荐答案
您必须从 postgresql.conf中的
unix_socket_directories
中删除/run/postgresql
在启动服务器之前.
You'll have to remove /run/postgresql
from unix_socket_directories
in postgresql.conf
before starting the server.
这篇关于PostgreSQL服务器无法在ArchLinux上启动:致命:无法创建锁文件»/run/postgresql/.s.PGSQL.5432.lock«的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!