Unable to connect to postgresql

I’m not able to connect to my postgresql server and I don’t know why. I’m on Linux Ubuntu Deskop 24.04

Here is the error I get when I run sudo systemctl restart postgresql

Job for postgresql.service failed because the control process exited with error code.
See "systemctl status postgresql.service" and "journalctl -xeu postgresql.service" for details.

Here is the status sudo systemctl status postgresql

● postgresql.service - PostgreSQL RDBMS
     Loaded: loaded (/usr/lib/systemd/system/postgresql.service; enabled; preset: e>
     Active: activating (auto-restart-queued) (Result: exit-code) since Tue 2025-04>
 Invocation: d18633e047cf4d1ebbdee8806f995ec8
    Process: 93915 ExecStart=/usr/lib/postgresql/16/bin/pg_ctl start -D /var/lib/po>
   Mem peak: 2.8M
        CPU: 49ms

Apr 15 22:36:49 corey-james-HP-Laptop-14-dq0xxx systemd[1]: postgresql.service: Sch>
lines 1-9/9 (END)

Please let me know if you need additional information, I hope I don’t have to uninstall & re-install postgresql

I think I’m just gonna uninstall & reinstall postgresql

Start with checking the PostgreSQL logs themselves. (/var/log/postgresql/postgresql-*.log), that’s going to give you all the available information.

If you have modified your PostgreSQL configuration, this may not make a difference.

When you say modified, are you referring to editing the pg_hba.conf file? If so I can always change that again if it will fix this error

I am referring to any of the PostgreSQL configuration files. This includes postgresql.conf, any files in conf.d, or any of the pg_*.conf files.

The PostgreSQL logs should tell you which (if any) files have errors.

Okay I’ll check right now

So I opened the logs file via Ubuntu Desktop terminal, it’s way too damn long to paste here.

But the only problem it shows regarding files, is this

2025-04-14 14:44:37.849 MDT [19451] LOG:  could not open file "postmaster.pid": No 

There are other readings in the file such as 2025-04-14 14:44:40.609 MDT [19483] LOG: received smart shutdown request and 2025-04-14 14:45:13.855 MDT [19900] LOG: database system was shut down at 2025-04->

Try to restart PostgreSQL, then look for the log messages in the time period from when you tried to start it until you see a shutdown message.

The errors may not make a reference to a specific file - it may show a reference to a specific setting instead. In that case, it’s up to you to locate the file containing that setting.

I’ll try and figure this out myself. Thanks anyway

I got it fixed, thank god