[systemd-devel] Systemd 212 RemoveIPC=yes breaks postgresql

Alex Hunsaker badalex at gmail.com
Wed Apr 2 14:53:16 PDT 2014

Systemd 212 defaults to remove all IPC (including SYSV memory) when a
user "fully" logs out.

Because the postgresql service does not count as a login, if you ssh
in as postgres (I'm rsycing wal files) and then logout. Systemd
removes the postgres SYSV memory bringing down postgres with fun
errors like:
FATAL:  semop(id=92307463) failed: Invalid argument
CONTEXT:  xlog redo insert: rel 1663/16414/112697213; tid 1319269/129
LOG:  background writer process (PID 24589) exited with exit code 1
LOG:  terminating any other active server processes
LOG:  all server processes terminated; reinitializing
LOG:  semctl(119406593, 0, IPC_RMID, ...) failed: Invalid argument

I was thinking the simple fix would be to add the below to postgresql.service:

But that does not work for two reasons:
1) it does not seem to register with logind (I dont get logs about
Started User Manager for UID 88, like i do when I ssh in)
2) as soon as pg_ctl exits, the session gets closed. (pg_ctl starts
postgres in the background)

Is there some other systemd.service knob I can turn? Or, for any
machine running postgres is the recommendation to disable RemoveIPC ?

Find attached the postgresql.service file.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: postgresql.service
Type: application/octet-stream
Size: 668 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20140402/7c9793ea/attachment-0001.obj>

More information about the systemd-devel mailing list