Even I had the same issue, related to the configuration of my pg_hba.conf file (located in /etc/postgresql/9.6/main). Kindly note that I am using version 9.6 in the Postgresql.
The error is related to some misconfiguration of Postgresql, which is causing the server to crash before it starts.
You can try these instructions:
Confirm that your Postgresql service is running, using sudo service PostgreSQL start
Run pg_lsclusters from your terminal
Check what is the cluster you are running, the output should be something like:
Version - Cluster Port Status Owner Data directory
9.6 ------- main -- 5432 online postgres /var/lib/postgresql/9.6/main
Disregard that '---' signs, as they are being used, only for alignment. The important information is the version and the cluster. You can also check whether the server is running or not in the status column.
Copy your info from the version siaplayed and the cluster, and use like so: pg_ctlcluster <version> <cluster> start, so in my case, using version 9.6 and cluster 'main', it would be pg_ctlcluster 9.6 main start
If something is wrong, then Postgresql will generate a log, that can be accessed on /var/log/postgresql/postgresql-<version>-main.log, so in my case, the full command would be
sudo nano /var/log/postgresql/postgresql-9.6-main.log.
The output should show what is the error.
2017-07-13 16:53:04 BRT [32176-1] LOG: invalid authentication method "all"
2017-07-13 16:53:04 BRT [32176-2] CONTEXT: line 90 of configuration file "/etc/postgresql/9.5/main/pg_hba.conf"
2017-07-13 16:53:04 BRT [32176-3] FATAL: could not load pg_hba.conf
- Fix the errors and restart your postgresql service through sudo service postgresql restart and it should be fine.
Come and join Linux training to gain great knowledge.