5

postgresql.service contents is

# systemd service for managing all PostgreSQL clusters on the system. This
# service is actually a systemd target, but we are using a service since
# targets cannot be reloaded.

[Unit]
Description=PostgreSQL RDBMS
[Service]
Type=oneshot
ExecStart=/bin/true
ExecReload=/bin/true
RemainAfterExit=on

[Install]
WantedBy=multi-user.target

I tried to start PostrgeSQL by service postgresql start and was surprised by postgresql.service contents, because it starts /bin/true

uname -a output:

Linux debian 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt25-2+deb8u3 (2016-07-02) x86_64 GNU/Linux

So my questions is: WTF?! Why it happens, and how to fix it?

1

As indicated on the thread by @termcap, postgresql@{version}-main.service is the new service name.

So use systemctl {start|enable} postgresql@9.6-main.service.

Sensibly the postgresql.service should contain a friendly migration warning rather than /bin/true (work it out yourself).

  • Note that the postgresql.service unit also functions as an enable/disable switch for all clusters. If you disable it then all clusters will be disabled, and if you enable any cluster then it will be enabled. – Stop Harming Monica Jan 16 at 10:30
-1

I confirm the issue, OS - xenial, Postgres version - 10 (latest from official repo). frustrating as hell.

Correct file:

[Unit]
Description=PostgreSQL database server
Documentation=man:postgres(1)

[Service]
Type=notify
User=postgres
ExecStart=/usr/lib/postgresql/10/bin/postgres -D /var/lib/postgresql/10/main -c config_file=/etc/postgresql/10/main/postgresql.conf
ExecReload=/bin/kill -HUP $MAINPID
KillMode=mixed
KillSignal=SIGINT
TimeoutSec=0

[Install]
WantedBy=multi-user.target

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.