[英]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.我是 Arch 的新手,也是 PostgreSQL 的初学者,所以这可能是一个非常基本的问题。
I installed postgresql 11.5-4 from extra and pgadmin 4 from AUR, both seem to be running well.我安装了来自 extra 的 postgresql 11.5-4 和来自 AUR 的 pgadmin 4,两者似乎都运行良好。 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.日志只说无法创建锁文件»/run/postgresql/.s.PGSQL.5432.lock«,因为找不到文件夹。 Under /run is no folder called "postgresql". /run 下没有名为“postgresql”的文件夹。 I suppose postgresql can not create this folder, because it does not have the permission.我想 postgresql 不能创建这个文件夹,因为它没有权限。 Several posts online posts suggest to change the user/owner of the db to sudo, however.但是,一些在线帖子建议将数据库的用户/所有者更改为 sudo。 Postgresql prevents this, however.但是,Postgresql 阻止了这种情况。 When I try any command as sudo, postgresql tells me that this command can't be run as root.当我以 sudo 身份尝试任何命令时,postgresql 告诉我该命令不能以 root 身份运行。 There must be some very basic error in my thinking here, but I have not worked it out for 3 hours.我这里的想法一定有一些非常基本的错误,但我已经3个小时没有解决了。
你必须删除/run/postgresql
从unix_socket_directories
在postgresql.conf
启动服务器之前。
Probably You have /var/run symlinked to /run and run is on tmpfs.可能你有 /var/run 符号链接到 /run 并且 run 在 tmpfs 上。 You should add something like d /run/postgresql 0755 postgres postgres -
into /usr/lib/tmpfiles.d/postgresql.conf您应该将d /run/postgresql 0755 postgres postgres -
到 /usr/lib/tmpfiles.d/postgresql.conf
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.