pg_ctl: could not start server

Hi all, I have problem with PostgreSQL in my FreeBSD, previously it's working fine but now I can't start the PostgreSQL services. I'm using PostgreSQL version 13.8. When I try to run sudo service postgresql start, the result is:
Code:
022-11-10 13:51:36.604 WIB [32618] LOG:  ending log output to stderr
2022-11-10 13:51:36.604 WIB [32618] HINT:  Future log output will go to log destination "syslog"
pg_ctl: could not start server
Examine the log output.
I've tried to update postgresql with different version, I even tried to delete the pkg and then installing it again.
Is there any tips for this problem? Thanks
 
Is this an entirely new install? Did you do service postgresql initdb first?
 
Have a look at /var/log/messages ?
Hi Alain De Vos, here is the result of the messages
Nov 11 03:01:02 lima sendmail[7309]: NOQUEUE: SYSERR(root): can not chdir(/var/spool/clientmqueue/): No such file or directory
Nov 11 03:04:18 lima sendmail[7550]: NOQUEUE: SYSERR(root): can not chdir(/var/spool/clientmqueue/): No such file or directory
Nov 11 03:04:18 lima sendmail[7598]: NOQUEUE: SYSERR(root): can not chdir(/var/spool/clientmqueue/): No such file or directory
Nov 11 03:04:19 lima sendmail[7641]: NOQUEUE: SYSERR(root): can not chdir(/var/spool/clientmqueue/): No such file or directory
Nov 11 03:04:19 lima sendmail[7644]: NOQUEUE: SYSERR(root): can not chdir(/var/spool/clientmqueue/): No such file or directory
Nov 11 08:26:02 lima postgres[9964]: [5-1] 2022-11-11 08:26:02.254 WIB [9964] FATAL: could not create lock file "/tmp/.s.PGSQL.5432.lock": Permission denied
 
Is this an entirely new install? Did you do service postgresql initdb first?
Hi SirDice, no this is not new install. Previously it is working fine, but then yeah i try reinstalling with different version of postgresql, and I have done the initdb. The problem is just i cannot start the services.
 
i try reinstalling with different version of postgresql
Keep in mind that different versions use different data directories. PostgreSQL 12 uses /var/db/postgres/data12, 13 uses /var/db/postgres/data13, etc. Just randomly installing different versions isn't going to work if you don't migrate the databases themselves.
 
I had a similar issue and running the following command as postgres user worked:

pg_ctl -D /var/db/postgres/data13 start

where "data13" is the data directory for your postgres version as SirDice explained.
 
Back
Top