# pg_ctl: could not start server



## imamkusuma (Nov 10, 2022)

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:

```
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


----------



## Alain De Vos (Nov 10, 2022)

Have a look at /var/log/messages ?


----------



## SirDice (Nov 10, 2022)

Is this an entirely new install? Did you do `service postgresql initdb` first?


----------



## imamkusuma (Nov 11, 2022)

Alain De Vos said:


> 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
> ...


----------



## imamkusuma (Nov 11, 2022)

SirDice said:


> 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.


----------



## imamkusuma (Nov 11, 2022)

Hi all i think problem is solved by using 


> chmod 1777 /tmp



Thank you for the response!!


----------



## SirDice (Nov 11, 2022)

imamkusuma said:


> 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.


----------



## piercedwater (Nov 26, 2022)

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.


----------

