2

I cannot "service postgresql start" by root:

Startup Log: /usr/bin/postmaster: error while loading shared libraries: libz.so.1: failed to map segment from shared object: Permission denied

I cannot "service postgresql start" by postgres:

Startup Log:runuser: cannot set groups: Operation not permitted

But I can start it by postgres user with command:

postmaster -D /usr/local/pgsql/data

Why?

When I installed, I used

initdb -D /usr/local/pgsql/data

not

service postgresql initdb

So I afterwards changed init.d/postgresql script with the new path. Is this causing problem?

4
  • Sounds like a permission problem on the data directory. Did you check if the postgres (operating system) user has full access to /usr/local/pgsql/data and all sub-directories? Commented May 31, 2012 at 10:52
  • 1
    @a_horse_with_no_name Looks to me like zlib has the wrong permissions or SELinux label, m'self. Commented May 31, 2012 at 13:01
  • 1
    OP: what OS and version are you on? What version of PostgreSQL? How did you install PostgreSQL and from where? If it's CentOS or Fedora, are there any SELinux messages in the system log or dmesg? Commented May 31, 2012 at 13:02
  • 1
    CentOS5.6 PostgreSQL8.1.23 I installed by yum. Nothing in dmesg. What permission should zlib has? It's now owned by root. I chown postgres:postgres /usr/local/pgsql Commented May 31, 2012 at 14:44

2 Answers 2

2

Caused for me by creating the DB with

/etc/init.d/postgresql-9.3 initdb 

Recreating with

service postgresql-9.3 initdb

solved the issue.

Sign up to request clarification or add additional context in comments.

3 Comments

What should I do when i don't have "service" available?
@KaiThomasWerther and pg_createcluster?
Running the Scripts on init.d solved it. CentOs is weird when you are used to Windows ;)
0

As Craig said this is either a file permission issue or a selinux issue. If it is a file permissions issu, that is easy enough to fix (give read/execute perms).

If it is an selinux issue your best option is to run audit2allow to identify the problem and ensure that selinux is configured to allow the correct access.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.