PostgreSQL server fails to start on ArchLinux: FATAL: could not create lockfile »/run/postgresql/.s.PGSQL.5432.lock«

送分小仙女□ 提交于 2021-02-10 09:20:51

问题


I am quite new in Arch and a total beginner in PostgreSQL, so this may be a very basic question.

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

I got the answer:

You can start the db-server using:
pg_ctl -D /home/lg/test-db -l logdatei start

I tried that and got:

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.

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.


回答1:


You'll have to remove /run/postgresql from unix_socket_directories in postgresql.conf before starting the server.



来源:https://stackoverflow.com/questions/59040764/postgresql-server-fails-to-start-on-archlinux-fatal-could-not-create-lockfile

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!