Postgresql database not starting- "ssl-cert-snakeoil.key" permission denied

rails
postgresql

#1

Hi,

I cloned my workspace and I’m not able to start the postgresql database.

When inputting the command: 'sudo service postgresql start', the following outcome pops up:

* Starting PostgreSQL 9.3 database server
* The PostgreSQL server failed to start. Please check the log output:
2017-08-22 15:32:28 UTC FATAL:  could not access private key file "/etc/ssl/private/ssl-cert-snakeoil.key": Permission denied

This error does not occur in my original workspace. None of the posted solutions on stack overflow work for me.

Setup: Rails 5.1.2, postgresql 9.3

Is anyone aware of how to fix this problem?


#2

Can you run sudo ls -al /etc/ssl/private and see the ownership of the key file? Is it the same as if you ran it on the original workspace?


#3

Hi there, thanks for the prompt reply:

Ownership of key file in cloned workspace:
michaelqz:~/workspace (master) $ sudo ls -al /etc/ssl/private
total 12
drwx–x— 2 postgres ssl-cert 4096 Aug 22 14:58 .
drwxr-xr-x 9 root root 4096 Aug 22 15:07 …
-rwxr----- 1 postgres postgres 1704 Aug 3 15:03 ssl-cert-snakeoil.key

Ownership of key file in original workspace:
michaelqz:~/workspace (improvements) $ sudo ls -al /etc/ssl/private
total 12
drwx–x— 2 root ssl-cert 4096 Nov 1 2016 .
drwxr-xr-x 7 root root 4096 Apr 4 11:50 …
-rw-r----- 1 root ssl-cert 1704 Nov 1 2016 ssl-cert-snakeoil.key

I then used the following command in my cloned workspace to ensure the ownership both match:
chown root:ssl-cert ssl-cert-snakeoil.key in sudo su mode

Unfortunately, postgresql still cannot be started, this is the output of sudo ls -al /etc/ssl/private in my cloned workspace (after ownership modification):
michaelqz:~/workspace (master) $ sudo ls -al /etc/ssl/private
total 12
drwx–x— 2 postgres ssl-cert 4096 Aug 22 14:58 .
drwxr-xr-x 9 root root 4096 Aug 22 15:07 …
-rwxr----- 1 root ssl-cert 1704 Aug 3 15:03 ssl-cert-snakeoil.key

The following is the output from command sudo service postgresql start in my cloned workspace :
* Starting PostgreSQL 9.3 database server
* The PostgreSQL server failed to start. Please check the log output:
2017-08-23 05:16:33 UTC FATAL: could not access private key file “/etc/ssl/private/ssl-cert-snakeoil.key”: Permission denied

Thanks for your assistance!


#4

hey @bryceito , any ideas how I can rectify this issue, thanks


#5

Could you try changing the folder’s permissions as well? That could potentially also affect accessing the file.