I am running postgres 9.6 cluster on ubuntu 20.

All installation and starting the database is fine, however, I am experiencing a weird behavior.

In the pg_hba.conf file, I am trusting any connection from any user from the local host and it is working just fine when I start the cluster using the "pg_ctl start" utility.

enter image description here

However, when I start it from the systemd, systemctl start [email protected], it fails with the following error

enter image description here

Anyone has proper explanation for this difference in behaviour ?

1 Answer 1


Figured it why; When you use pg_ctl to stop/start your cluster, you define your data directory with -D argument.

However, when you start postgres with systemd 'systemctl stop/start <>', it fetch the configuration (postgresql.conf and pg_hba.conf) from /etc/postgresql/.... according to what is defined in the service definition in systemd.

That is what caused the difference in behaviour.

  • 1
    You should remove the configuration file that is wrong. That way, you will notice automatically if you try to start the server in the wrong way. Commented Sep 1, 2022 at 15:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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