Strange permission errors in new PostgreSQL installation

Posted by Bart van Heukelom on Server Fault See other posts from Server Fault or by Bart van Heukelom
Published on 2012-06-14T12:51:45Z Indexed on 2012/06/19 15:18 UTC
Read the original article Hit count: 1314

Filed under:

A freshly installed PostgreSQL (with configuration overwritten) won't start:

$ sudo service postgresql start
 * Starting PostgreSQL 9.1 database server
 * Error: could not read /etc/postgresql/9.1/main/postgresql.conf: Permission denied

Looks like it should be able to read it though:

$ ls -l postgresql.conf 
-rw------- 1 postgres postgres 19450 2012-06-14 10:07 postgresql.conf

But fine, I'll add chmod +r it to test if that works.

$ sudo chmod +r postgresql.conf 
$ sudo service postgresql start
 * Starting PostgreSQL 9.1 database server
 * The PostgreSQL server failed to start. Please check the log output:
Error: Could not open log file /var/log/postgresql/postgresql-9.1-main.log


$ ls -l /var/log/postgresql/
total 4
-rw-r----- 1 postgres adm 827 2012-06-14 10:07 postgresql-9.1-main.log

I don't get it. What can be wrong here? This used to work before.

Can I maybe monitor what process attempts to open the file?

It's Ubuntu 11.10 on EC2, using Chef. For completeness, here's the recipe:

# Install PostgreSQL
package "postgresql-9.1"

# Stop server
service "postgresql" do
    action :stop

# Overwrite configuration (setting data dir)
template "/etc/postgresql/9.1/main/postgresql.conf" do
    source "postgresql-conf.erb"
    owner "postgres"
    group "postgres"

# Start server
service "postgresql" do
    action :start

© Server Fault or respective owner

Related posts about linux

Related posts about ubuntu