Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When recovering the Postgresql database from a hacked Ubuntu 12.04 server, I copied the data directory to another location, reinstalled the OS and PostgreSQL, stopped PostgreSQL service, removed the contents in the data directory and copied back the contents from the previous installation.

Problem: PostgreSQL will not start now, showing the errors below. Why is this happening, and how can we fix the problem?

service postgresql restart
* Restarting PostgreSQL 9.1 database server                                     

* Error: could not exec /usr/lib/postgresql/9.1/bin/pg_ctl /usr/lib/postgresql/9.1/bin/pg_ctl start -D /var/lib/postgresql/9.1/main -l /var/log/postgresql/postgresql-9.1-main.log -s -o -c config_file="/etc/postgresql/9.1/main/postgresql.conf" :


Restarting PostgreSQL service now gives the error:

* Restarting PostgreSQL 9.1 database server                                     
* The PostgreSQL server failed to start. Please check the log output:
2013-04-16 01:52:10 EDT PANIC:  could not open control file "global/pg_control": Permission denied
share|improve this question
"Permission denied". Have you checked the obvious? – Colin 't Hart Apr 16 '13 at 7:22
Setting the permissions solved it :) – Nyxynyx Apr 16 '13 at 7:24
up vote 0 down vote accepted

There are some preconditions which should be met in order to get this working. I see your case basically the same as a physical backup and restore, which is covered well in the documentation. The main points are:

  • you have to take a consistent snapshot (PostgreSQL should be stoped first)
  • you have to copy the whole cluster (looks like this is done by your part)
  • you have to copy the commit log files in pg_clog/

And for me it looks like that your error message has at least one following line, which probably tells what the problem is.

share|improve this answer

I ran into the same problem. To clarify what Nyxynyx hints towards in his comment, the resolution was to give permissions to access the db cluster dir (the path that follows -D in the error):

chown -R postgres:postgres /var/lib/postgresql/9.1/main
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.