解决 PostgreSQL `could not open shared memory segment` 错误
解决 PostgreSQL could not open shared memory segment 错误。
打开 journalctl -u postgresql.service 可以看到:
Jun 15 11:55:52 fanyang-legion postgres[322924]: 2025-06-15 11:55:52.856 CST [322924] ERROR: could not open shared memory segment "/PostgreSQL.2816709408": No such file or directory Jun 15 11:56:52 fanyang-legion postgres[322973]: 2025-06-15 11:56:52.914 CST [322973] ERROR: could not open shared memory segment "/PostgreSQL.2816709408": No such file or directory Jun 15 11:57:52 fanyang-legion postgres[323026]: 2025-06-15 11:57:52.975 CST [323026] ERROR: could not open shared memory segment "/PostgreSQL.2816709408": No such file or directory Jun 15 11:58:53 fanyang-legion postgres[323076]: 2025-06-15 11:58:53.034 CST [323076] ERROR: could not open shared memory segment "/PostgreSQL.2816709408": No such file or directory Jun 15 11:59:53 fanyang-legion postgres[323127]: 2025-06-15 11:59:53.042 CST [323127] ERROR: could not open shared memory segment "/PostgreSQL.2816709408": No such file or directory Jun 15 12:00:53 fanyang-legion postgres[323181]: 2025-06-15 12:00:53.099 CST [323181] ERROR: could not open shared memory segment "/PostgreSQL.2816709408": No such file or directory Jun 15 12:01:53 fanyang-legion postgres[323229]: 2025-06-15 12:01:53.155 CST [323229] ERROR: could not open shared memory segment "/PostgreSQL.2816709408": No such file or directory Jun 15 12:02:53 fanyang-legion postgres[323286]: 2025-06-15 12:02:53.193 CST [323286] ERROR: could not open shared memory segment "/PostgreSQL.2816709408": No such file or directory Jun 15 12:03:53 fanyang-legion postgres[323334]: 2025-06-15 12:03:53.219 CST [323334] ERROR: could not open shared memory segment "/PostgreSQL.2816709408": No such file or directory Jun 15 12:04:53 fanyang-legion postgres[323385]: 2025-06-15 12:04:53.232 CST [323385] ERROR: could not open shared memory segment "/PostgreSQL.2816709408": No such file or directory Jun 15 12:05:04 fanyang-legion postgres[323386]: 2025-06-15 12:05:04.501 CST [323386] FATAL: could not open shared memory segment "/PostgreSQL.2816709408": No such file or directory
解决方法:
# sudo vim /etc/systemd/logind.conf RemoveIPC=no
systemctl restart systemd-logind.service