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

Lennart Poettering lennart at poettering.net
Thu Apr 10 18:01:23 PDT 2014


On Wed, 02.04.14 15:53, Alex Hunsaker (badalex at gmail.com) wrote:

> 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:
> PAMname=systemd-login
> 
> 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.

Yuck, I figure we need to ignore RemoveIPC for all system users, not
just for root. We probably need to add some infrastructure to classify
users into system users and normal users, which we currently
lack. Tradditionally on Linux this is done via login.defs, but I am
really not convinced this should be runtime configurable. I'd prefer to
detect the minimal normal UID at compile time, and then use that to
distuingish normal from system users.

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list