Postgresql can no longer start after reboot

Good afternoon,
I’ve been following the Fedora PostgreSQL guide and had successfully setup a test database where I’d connected and made changes to some test tables using python and beekeeper studio.

I restarted my computer, but now the service refuses to start and I can’t figure out why.

I’d only just started configuring it, so if it’s simpler to start again that’s not too much of a hassle.

When I attempt to start the service:

sudo systemctl start 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.

“systemctl status postgresql.service”

systemctl status postgresql.service
× postgresql.service - PostgreSQL database server
     Loaded: loaded (/usr/lib/systemd/system/postgresql.service; enabled; preset: disabled)
    Drop-In: /usr/lib/systemd/system/service.d
             └─10-timeout-abort.conf
     Active: failed (Result: exit-code) since Wed 2024-06-26 13:28:13 CDT; 8min ago
    Process: 9414 ExecStartPre=/usr/libexec/postgresql-check-db-dir postgresql (code=exited, status=0/SUCCESS)
    Process: 9417 ExecStart=/usr/bin/postgres -D ${PGDATA} (code=exited, status=1/FAILURE)
   Main PID: 9417 (code=exited, status=1/FAILURE)
        CPU: 40ms

Jun 26 13:28:13 padd systemd[1]: Starting postgresql.service - PostgreSQL database server...
Jun 26 13:28:13 padd postgres[9417]: 2024-06-26 13:28:13.259 CDT [9417] LOG:  redirecting log output to logging collector proce>
Jun 26 13:28:13 padd postgres[9417]: 2024-06-26 13:28:13.259 CDT [9417] HINT:  Future log output will appear in directory "log".
Jun 26 13:28:13 padd systemd[1]: postgresql.service: Main process exited, code=exited, status=1/FAILURE
Jun 26 13:28:13 padd systemd[1]: postgresql.service: Killing process 9418 (postgres) with signal SIGKILL.
Jun 26 13:28:13 padd systemd[1]: postgresql.service: Failed with result 'exit-code'.
Jun 26 13:28:13 padd systemd[1]: Failed to start postgresql.service - PostgreSQL database server.

“journalctl -xeu postgresql.service”

journalctl -xeu postgresql.service
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░ 
░░ A start job for unit postgresql.service has finished with a failure.
░░ 
░░ The job identifier is 5772 and the job result is failed.
Jun 26 13:37:38 padd systemd[1]: Starting postgresql.service - PostgreSQL database server...
░░ Subject: A start job for unit postgresql.service has begun execution
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░ 
░░ A start job for unit postgresql.service has begun execution.
░░ 
░░ The job identifier is 6160.
Jun 26 13:37:38 padd postgres[10413]: 2024-06-26 13:37:38.328 CDT [10413] LOG:  redirecting log output to logging collector pro>
Jun 26 13:37:38 padd postgres[10413]: 2024-06-26 13:37:38.328 CDT [10413] HINT:  Future log output will appear in directory "lo>
Jun 26 13:37:38 padd systemd[1]: postgresql.service: Main process exited, code=exited, status=1/FAILURE
░░ Subject: Unit process exited
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░ 
░░ An ExecStart= process belonging to unit postgresql.service has exited.
░░ 
░░ The process' exit code is 'exited' and its exit status is 1.
Jun 26 13:37:38 padd systemd[1]: postgresql.service: Killing process 10414 (postgres) with signal SIGKILL.
Jun 26 13:37:38 padd systemd[1]: postgresql.service: Failed with result 'exit-code'.
░░ Subject: Unit failed
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░ 
░░ The unit postgresql.service has entered the 'failed' state with result 'exit-code'.
Jun 26 13:37:38 padd systemd[1]: Failed to start postgresql.service - PostgreSQL database server.
░░ Subject: A start job for unit postgresql.service has failed
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░ 
░░ A start job for unit postgresql.service has finished with a failure.
░░ 
░░ The job identifier is 6160 and the job result is failed.

For reference, my pg_hba.conf file is using these configurations:

# TYPE  DATABASE        USER            ADDRESS                 METHOD

# "local" is for Unix domain socket connections only
local       all                 all                                     peer
# IPv4 local connections:
host       all                 all            127.0.0.1/32            peer
# IPv6 local connections:
host       all                 all             fe80::7a31:c1ff:0000:0000/96  md5
# Allow replication connections from localhost, by a user with the
# replication privilege.
local   replication     all                                     peer
host    replication    all             127.0.0.1/32            ident
host    replication    all             ::1/128                 ident
1 Like

Take a look at the logs located in /var/lib/pgsql/data/log

Using your configuration, I get

2024-06-26 23:46:20.640 CEST [1874] LOG:  peer authentication is only supported on local sockets
2024-06-26 23:46:20.640 CEST [1874] CONTEXT:  line 6 of configuration file "/var/lib/pgsql/data/pg_hba.conf"
2024-06-26 23:46:20.640 CEST [1874] FATAL:  could not load /var/lib/pgsql/data/pg_hba.conf

Using ident instead of peer on line 6, the service starts successfully

host   all   all   127.0.0.1/32   ident
1 Like

Thank you very much! Changing to ident allowed me to start the service again.

I still experienced logon issues due to ident however, but by using this thread I got everything to work again by using md5 instead.

Thank you!

2 Likes