After the UPdate, there is an error message about postgresql during boot (could not read it completely due to time) and after log-in, it’s impossible to start the connection:
Connection to localhost:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.
Postgresql 15.2.1 is installed, I used version 15 before.
$ systemctl status postgresql
× postgresql.service - PostgreSQL database server
Loaded: loaded (/usr/lib/systemd/system/postgresql.service; enabled; preset: disabled)
Active: failed (Result: exit-code) since Mon 2023-04-03 12:16:27 CEST; 31min ago
Process: 834 ExecStartPre=/usr/bin/postgresql-check-db-dir ${PGROOT}/data (code=exited, status=1/FAILURE)
CPU: 30ms
Apr 03 12:16:27 machine systemd[1]: Starting PostgreSQL database server...
Apr 03 12:16:27 machine postgres[834]: An old version of the database format was found.
Apr 03 12:16:27 machine postgres[834]: See https://wiki.archlinux.org/index.php/PostgreSQL#Upgrading_PostgreSQL
Apr 03 12:16:27 machine systemd[1]: postgresql.service: Control process exited, code=exited, status=1/FAILURE
Apr 03 12:16:27 machine systemd[1]: postgresql.service: Failed with result 'exit-code'.
Apr 03 12:16:27 machine systemd[1]: Failed to start PostgreSQL database server.
Never edit files installed by a package manager. They get overridden with every update. Only few files in /etc/ will get a pacnew ending.
Either create an override file, ( sudo systemctl edit postgresql.service ) or copy the complete file to /etc/systemd/system and make your necessary changes. After copy and edit do a systemctl daemon-reload .
An alternative would be to do sudo systemctl edit -all postgresql.service (only one dash in front of all) , make the changes and save. Wich is basically the same as to copy the file in /etc/systemd/system and make changes.
Just for my understanding (Sorry, never heard about that way before): The command sudo systemctl edit postgresql.service copies the file, each line marked as comment with initial #? Now I edit the change uncomment that line and save the file. And the system will care about the override by its own?
Just edit (without -all) will not copy anything. The comments are just for you and will not be in the override file. Don’t forget to also specify the correct section. This needs to be in override file as well.
The created override file will be shown in the status output as used in combination with the system service file.