C.-F. Vintar
C.-F. Vintar

Reputation: 155

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.

Upvotes: 4

Views: 3164

Answers (2)

Jelen
Jelen

Reputation: 633

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

Upvotes: 0

Laurenz Albe
Laurenz Albe

Reputation: 246013

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

Upvotes: 4

Related Questions