Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Failed to start PostgreSQL Cluster 10-main when booting

when I try to boot Ubuntu, it never finishes the boot process because it appears the message "Failed to start PostgreSQL Cluster 10-main." I also get the same message with 9.5-main. But lets focus on 10.

When I execute:

systemctl status [email protected]

I get the following message:

[email protected] - PostgreSQL Cluster 10-main
  Loaded: loaded (/lib/systemd/system/[email protected]; indirect; vendor preset: enabled)
  Active: failed (Result: protocol) since Wed 2020-02-19 17:57:22 CET; 30 min ago
 Process: 1602 ExecStart=/usr/bin/pg_ctlcluster --skip-systemctl-redirect 10-main start (code_exited, status=1/FAILURE)
PC_info systemd[1]: Starting PostgreSQL Cluster 10-main...
PC_info postgresql@10-main[1602]: Error: /usr/lib/postgresql/10/bin/pg_ctl /usr/lib/postgresql/10/bin/pg_ctl start -D /var/lib/postgresql/10/main -l /var/log/postgresql/postgresql-19-main.log -s -o -c config_file="/etc/postgresql/10/main/postgresql.conf" exit with status 1:
PC_info systemd[1]: [email protected]: Can't open PID file /var/run/postgresql/10-main.pid (yet?) after start: No such file or directory
PC_info systemd[1]: [email protected]: Failed with result 'protocol'.
PC_info systemd[1]: Failed to start PostgreSQL Cluster 10-main.

PC_info is information about my computer (user, date..) not relevant

I got this error from one day to an other without touching anything related to Database Servers. I tried to fix it by my self but nothing worked

Writing the command

service postgresql@10-main start

I get

Job for [email protected] failed because the service did not take the steps required by its unit configuration
See "systemctl status [email protected]" and "journalctl -xe"  for details.

Running this two command I get the message from the beginning.

Anyone has an idea of what is happening? How I can fix it?

like image 790
Ignasi Avatar asked Feb 03 '23 15:02

Ignasi


1 Answers

I had same issue, I followed below steps,

Error status :

  • pg_lsclusters

Ver Cluster Port Status Owner Data directory Log file

10 main 5432 down postgres /var/lib/postgresql/10/main /var/log/postgresql/postgresql-10-main.log

Applied Solution :

  • sudo chmod 700 -R /var/lib/postgresql/10/main
  • sudo -i -u postgres
  • postgres@abc:~$ /usr/lib/postgresql/10/bin/pg_ctl restart -D /var/lib/postgresql/10/main

After Solution status :

  • pg_lsclusters

Ver Cluster Port Status Owner Data directory Log file

10 main 5432 online postgres /var/lib/postgresql/10/main /var/log/postgresql/postgresql-10-main.log

like image 163
Omkar Avatar answered Feb 06 '23 05:02

Omkar