Painted-Fox / docker-postgresql

A dockerfile that produces a docker image that runs postgresql.
MIT License
72 stars 57 forks source link

PostgreSQL fails to start: [Errno 13] Permission denied setuser #25

Open jrjparks opened 10 years ago

jrjparks commented 10 years ago

Not sure if anyone else has this issue but, using the latest image, postgresql fails to start. Any help will be appreciated.

Note item two of the docker top output._

/usr/bin/runsvdir -P /etc/service log: : [Errno 13] Permission denied setuser: cannot execute /usr/lib/postgresql/9.3/bin/postgres: [Errno 13] Permission denied setuser: cannot execute /usr/lib/postgresql/9.3/bin/postgres: [Errno 13] Permission denied setuser: cannot execute /usr/lib/postgresql/9.3/bin/postgres: [Errno 13] Permission denied setuser: cannot execute /usr/lib/postgresql/9.3/bin/postgres: [Errno 13] Permission denied

docker run

$ docker run -d --name="postgresql" -p 127.0.0.1:5432:5432 -v /tmp/postgresql:/data -e USER="super" -e DB="database_name" -e PASS="$(pwgen -s -1 16)" paintedfox/postgresql

docker logs

$ docker logs postgresql

*** Running /etc/rc.local...
*** Booting runit daemon...
*** Runit started as PID 9
POSTGRES_USER=super
POSTGRES_PASS=nlMU71xfRsejnrbn
POSTGRES_DATA_DIR=/data
POSTGRES_DB=database_name
Starting PostgreSQL...
POSTGRES_USER=super
POSTGRES_PASS=nlMU71xfRsejnrbn
POSTGRES_DATA_DIR=/data
POSTGRES_DB=database_name
Starting PostgreSQL...
POSTGRES_USER=super
POSTGRES_PASS=nlMU71xfRsejnrbn
POSTGRES_DATA_DIR=/data
POSTGRES_DB=database_name
Starting PostgreSQL...
POSTGRES_USER=super
POSTGRES_PASS=nlMU71xfRsejnrbn
POSTGRES_DATA_DIR=/data
POSTGRES_DB=database_name
Starting PostgreSQL...

docker top

$ docker top postgresql

root                20549               19271               2                   15:46               ?                   00:00:00            /usr/bin/python3 -u /sbin/my_init
root                20578               20549               0                   15:46               ?                   00:00:00            /usr/bin/runsvdir -P /etc/service log: : [Errno 13] Permission denied setuser: cannot execute /usr/lib/postgresql/9.3/bin/postgres: [Errno 13] Permission denied setuser: cannot execute /usr/lib/postgresql/9.3/bin/postgres: [Errno 13] Permission denied setuser: cannot execute /usr/lib/postgresql/9.3/bin/postgres: [Errno 13] Permission denied setuser: cannot execute /usr/lib/postgresql/9.3/bin/postgres: [Errno 13] Permission denied
root                20579               20578               0                   15:46               ?                   00:00:00            runsv postgresql
root                20580               20578               0                   15:46               ?                   00:00:00            runsv syslog-ng
root                20581               20578               0                   15:46               ?                   00:00:00            runsv cron
root                20584               20581               0                   15:46               ?                   00:00:00            /usr/sbin/cron -f
root                20591               20549               0                   15:46               ?                   00:00:00            /bin/bash ./run
root                20593               20591               0                   15:46               ?                   00:00:00            inotifywait -q -e create /run/postgresql/
root                20594               20580               0                   15:46               ?                   00:00:00            syslog-ng -F -p /var/run/syslog-ng.pid --no-caps
root                20600               20549               0                   15:46               ?                   00:00:00            /bin/bash ./run
root                20602               20600               0                   15:46               ?                   00:00:00            inotifywait -q -e create /run/postgresql/
root                20607               20549               0                   15:46               ?                   00:00:00            /bin/bash ./run
root                20608               20607               0                   15:46               ?                   00:00:00            inotifywait -q -e create /run/postgresql/
root                20614               20549               0                   15:46               ?                   00:00:00            /bin/bash ./run
root                20616               20614               0                   15:46               ?                   00:00:00            inotifywait -q -e create /run/postgresql/
root                20621               20549               0                   15:46               ?                   00:00:00            /bin/bash ./run
root                20622               20621               0                   15:46               ?                   00:00:00            inotifywait -q -e create /run/postgresql/
root                20628               20549               0                   15:46               ?                   00:00:00            /bin/bash ./run
root                20630               20628               0                   15:46               ?                   00:00:00            inotifywait -q -e create /run/postgresql/
root                20641               20549               0                   15:46               ?                   00:00:00            /bin/bash ./run
root                20642               20641               0                   15:46               ?                   00:00:00            inotifywait -q -e create /run/postgresql/
root                20648               20549               0                   15:47               ?                   00:00:00            /bin/bash ./run
root                20649               20648               0                   15:47               ?                   00:00:00            inotifywait -q -e create /run/postgresql/
root                20655               20549               0                   15:47               ?                   00:00:00            /bin/bash ./run
root                20656               20655               0                   15:47               ?                   00:00:00            inotifywait -q -e create /run/postgresql/
jonmorehouse commented 10 years ago

I can't reproduce. Could you give us some context of your system?

jrjparks commented 10 years ago

clean install of ubuntu 14.04 with docker 1.0.0.

Edit for more clarification about hardware: VMware ESXi 5.0 VM v8 4 vCPU 6GB RAM 1x 80GB HDD Ubuntu 14.04 LTS Server x64 1x NIC

thall commented 10 years ago

I have the same problem. Im also running a freshly installed Ubuntu 14.04

richardgill commented 10 years ago

I have the same problem.

adonespitogo commented 10 years ago

I have the same problem using Ubuntu 14.04

ghost commented 10 years ago

Just wanted to add that I'm seeing the same thing. Host is OSX 10.9.

If I use a different box, the issue does not occur:

config.vm.box = "ubuntu/trusty64"
Angel0fDarkness commented 10 years ago

I am also facing this problem on a new Ubuntu 14.04 install. But when I change the setuser command back to what it was before (using su), everything works fine. So its either a problem of setuser, the usage of it or a problem in the baseimage..

For quick help, just change the one line in scripts/start.sh from setuser postgres /usr/lib/postgresql/9.3/bin/postgres -D /etc/postgresql/9.3/main back to su postgres -c '/usr/lib/postgresql/9.3/bin/postgres -D /etc/postgresql/9.3/main'

radyz commented 10 years ago

I had the same issue and following @Angel0fDarkness suggestion fixed it for me.