openbravo: postgresql won't start after lights out.

 

I Made some changes on the Server Rack setup and by mistake disconnected the power to the server, upon restart got the following error:

* Starting PostgreSQL 9.1 database server * 
The PostgreSQL server failed to start. Please check the log output: 
2015-05-26 03:27:20 UTC [331-1] LOG: database system was interrupted; last known up at 2015-05-21 19:56:58 UTC 
2015-05-26 03:27:20 UTC [331-2] FATAL: could not open file "/etc/ssl/certs/ssl-cert-snakeoil.pem": Permission denied 
2015-05-26 03:27:20 UTC [330-1] LOG: startup process (PID 331) exited with exit code 1 
2015-05-26 03:27:20 UTC [330-2] LOG: aborting startup due to startup process failure

 

Found the solution here: https://wiki.postgresql.org/wiki/May_2015_Fsync_Permissions_Bug

Which is the following:

(as root)
# go to PGDATA directory
cd /var/lib/postgresql/9.1/main 
ls -l server.crt server.key

# confirm both of those files are symbolic links
# to files in /etc/ssl before going further

# remove symlinks to SSL certs
rm server.crt
rm server.key 

# copy the SSL certs to the local directory
cp /etc/ssl/certs/ssl-cert-snakeoil.pem server.crt
cp /etc/ssl/private/ssl-cert-snakeoil.key server.key

# set permissions on ssl certs
# and postgres ownership on everything else
# just in case
chown postgres *
chmod 640 server.crt server.key

service postgresql start

 

Note that this solution is for a Standard PostgreSQL installation, but remember has its own "application" PostgreSQL database, so you should reproduce this steps under correct path. To do this. just do a search (Example: Locate server.key) and there you'll get the correct path to make the changes. In mi case the correct path was "/opt/OpenbravoERP-3.0/postgresql"

Leave a Reply

Your email address will not be published. Required fields are marked *