简体   繁体   中英

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

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.

你必须删除/run/postgresqlunix_socket_directoriespostgresql.conf启动服务器之前。

Probably You have /var/run symlinked to /run and run is on tmpfs. You should add something like d /run/postgresql 0755 postgres postgres - into /usr/lib/tmpfiles.d/postgresql.conf

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM