Data directory "/shared/postgres_data" has group or world access

When I try to ./laucher bootstrap app discourse it fetches the docker image from the registry and quickly fails afer on

LOG:  skipping missing configuration file "/shared/postgres_data/postgresql.auto.conf"
2016-08-10 18:21:43 UTC [53-2] FATAL:  data directory "/shared/postgres_data" has group or world access
2016-08-10 18:21:43 UTC [53-3] DETAIL:  Permissions should be u=rwx (0700).

My volume configuration is as such:

## The Docker container is stateless; all data is stored in /shared
volumes:
  - volume:
      host: /data/discourse/shared/standalone
      guest: /shared
  - volume:
      host: /data/discourse/shared/standalone/log/var-log
      guest: /var/log

/data is a partition on a second disk (formatted as ext4) but that never proved to be an issue with docker for me before, I run my private docker registry the same way. /data/discourse doesn’t exist prior to ./launcher bootstrap app, it is created by by the launcher so I presume it could give it the permissions it wants.

And here’s my docker info:

docker info
Containers: 0
 Running: 0
 Paused: 0
 Stopped: 0
Images: 1
Server Version: 1.12.0
Storage Driver: aufs
 Root Dir: /var/lib/docker/aufs
 Backing Filesystem: extfs
 Dirs: 8
 Dirperm1 Supported: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: overlay host bridge null
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Security Options:
Kernel Version: 3.16.0-4-amd64
Operating System: Debian GNU/Linux 8 (jessie)
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 3.865 GiB
Name: ICL2-LVCORPO-11
ID: TZE6:YZCD:3EFK:IKLN:5RVI:BGA4:M3GS:4CI2:P3TW:TFZY:J2IY:CDFT
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
WARNING: No memory limit support
WARNING: No swap limit support
WARNING: No kernel memory limit support
WARNING: No oom kill disable support
WARNING: No cpu cfs quota support
WARNING: No cpu cfs period support
Insecure Registries:
 127.0.0.0/8

Any clue?

What is your LANG setting?

The last time I got this error was because I used something other than LANG: en_US.UTF-8.

See:

https://meta.discourse.org/t/cant-upgrade-to-latest-version-psql-9-3-to-9-5/47375

2 Likes

fr_FR.UTF-8

I changed it so the initial welcome and everything would be in French.

I see from your linked topic that I only have to set DISCOURSE_DEFAULT_LOCALE: fr. Maybe LANG shouldn’t be configurable if it’s unnecessary and broken.

I’ll try to make the fix first thing in the morning when I get to the office.

Thanks a lot!

I have the same problem, you reset the LANG variable in the app.yml file with this value: en_US.UTF-8.
I have recompile the locales inside the docker contenainer but that’s not work.

J’ai le même problème, qui se resout en remettant dans le fichier app.yml la valeur
en_US.UTF-8 pour la variable LANG.
j’ai pourtant reconfigurer les locales du conteneur docker mais j’ai eu la même erreur
Bizarre que l’on ne puisse pas compiler en français

Is it OK @zogstrip ?

3 Likes

Hey guys, hope you can help me as I am stuck…

I have the same problem, but I have never modified the LANG variable.
Recently upgraded to beta10, all seemed to work, but trying to install the babble plugin, and then I have this error when trying to rebuild:

cd /pups && git pull && /pups/bin/pups --stdin
Already up-to-date.
I, [2017-04-18T09:37:50.558079 #13]  INFO -- : Loading --stdin
I, [2017-04-18T09:37:50.563428 #13]  INFO -- : > mkdir -p /shared/postgres_run
I, [2017-04-18T09:37:50.566192 #13]  INFO -- :
I, [2017-04-18T09:37:50.566713 #13]  INFO -- : > chown postgres:postgres /shared/postgres_run
I, [2017-04-18T09:37:50.568389 #13]  INFO -- :
I, [2017-04-18T09:37:50.568780 #13]  INFO -- : > chmod 775 /shared/postgres_run
I, [2017-04-18T09:37:50.569973 #13]  INFO -- :
I, [2017-04-18T09:37:50.570292 #13]  INFO -- : > rm -fr /var/run/postgresql
I, [2017-04-18T09:37:50.571553 #13]  INFO -- :
I, [2017-04-18T09:37:50.571868 #13]  INFO -- : > ln -s /shared/postgres_run /var/run/postgresql
I, [2017-04-18T09:37:50.573027 #13]  INFO -- :
I, [2017-04-18T09:37:50.573329 #13]  INFO -- : > socat /dev/null UNIX-CONNECT:/shared/postgres_run/.s.PGSQL.5432 || exit 0 && echo postgres already running stop container ; exit 1
2017/04/18 09:37:50 socat[21] E connect(6, AF=1 "/shared/postgres_run/.s.PGSQL.5432", 36): No such file or directory
I, [2017-04-18T09:37:50.577462 #13]  INFO -- :
I, [2017-04-18T09:37:50.577738 #13]  INFO -- : > rm -fr /shared/postgres_run/.s*
I, [2017-04-18T09:37:50.579469 #13]  INFO -- :
I, [2017-04-18T09:37:50.579732 #13]  INFO -- : > rm -fr /shared/postgres_run/*.pid
I, [2017-04-18T09:37:50.581248 #13]  INFO -- :
I, [2017-04-18T09:37:50.581514 #13]  INFO -- : > mkdir -p /shared/postgres_run/9.5-main.pg_stat_tmp
I, [2017-04-18T09:37:50.582744 #13]  INFO -- :
I, [2017-04-18T09:37:50.583072 #13]  INFO -- : > chown postgres:postgres /shared/postgres_run/9.5-main.pg_stat_tmp
I, [2017-04-18T09:37:50.584369 #13]  INFO -- :
I, [2017-04-18T09:37:50.586947 #13]  INFO -- : File > /etc/service/postgres/run  chmod: +x
I, [2017-04-18T09:37:50.589453 #13]  INFO -- : File > /etc/runit/3.d/99-postgres  chmod: +x
I, [2017-04-18T09:37:50.591778 #13]  INFO -- : File > /root/upgrade_postgres  chmod: +x
I, [2017-04-18T09:37:50.592182 #13]  INFO -- : > chown -R root /var/lib/postgresql/9.5/main
I, [2017-04-18T09:37:50.597974 #13]  INFO -- :
I, [2017-04-18T09:37:50.598349 #13]  INFO -- : > [ ! -e /shared/postgres_data ] && install -d -m 0755 -o postgres -g postgres /shared/postgres_data && sudo -E -u postgres /usr/lib/postgresql/9.5/bin/initdb -D /shared/postgres_data || exit 0
I, [2017-04-18T09:37:50.599840 #13]  INFO -- :
I, [2017-04-18T09:37:50.599937 #13]  INFO -- : > chown -R postgres:postgres /shared/postgres_data
I, [2017-04-18T09:37:50.607311 #13]  INFO -- :
I, [2017-04-18T09:37:50.607762 #13]  INFO -- : > chown -R postgres:postgres /var/run/postgresql
I, [2017-04-18T09:37:50.609445 #13]  INFO -- :
I, [2017-04-18T09:37:50.609862 #13]  INFO -- : > /root/upgrade_postgres
I, [2017-04-18T09:37:50.612924 #13]  INFO -- :
I, [2017-04-18T09:37:50.613222 #13]  INFO -- : > rm /root/upgrade_postgres
I, [2017-04-18T09:37:50.614448 #13]  INFO -- :
I, [2017-04-18T09:37:50.614901 #13]  INFO -- : Replacing data_directory = '/var/lib/postgresql/9.5/main' with data_directory = '/shared/postgres_data' in /etc/postgresql/9.5/main/postgresql.conf
I, [2017-04-18T09:37:50.615836 #13]  INFO -- : Replacing (?-mix:#?listen_addresses *=.*) with listen_addresses = '*' in /etc/postgresql/9.5/main/postgresql.conf
I, [2017-04-18T09:37:50.616302 #13]  INFO -- : Replacing (?-mix:#?synchronous_commit *=.*) with synchronous_commit = $db_synchronous_commit in /etc/postgresql/9.5/main/postgresql.conf
I, [2017-04-18T09:37:50.616727 #13]  INFO -- : Replacing (?-mix:#?shared_buffers *=.*) with shared_buffers = $db_shared_buffers in /etc/postgresql/9.5/main/postgresql.conf
I, [2017-04-18T09:37:50.617107 #13]  INFO -- : Replacing (?-mix:#?work_mem *=.*) with work_mem = $db_work_mem in /etc/postgresql/9.5/main/postgresql.conf
I, [2017-04-18T09:37:50.617589 #13]  INFO -- : Replacing (?-mix:#?default_text_search_config *=.*) with default_text_search_config = '$db_default_text_search_config' in /etc/postgresql/9.5/main/postgresql.conf
I, [2017-04-18T09:37:50.618044 #13]  INFO -- : > install -d -m 0755 -o postgres -g postgres /shared/postgres_backup
I, [2017-04-18T09:37:50.620055 #13]  INFO -- :
I, [2017-04-18T09:37:50.620479 #13]  INFO -- : Replacing (?-mix:#?max_wal_senders *=.*) with max_wal_senders = $db_max_wal_senders in /etc/postgresql/9.5/main/postgresql.conf
I, [2017-04-18T09:37:50.620942 #13]  INFO -- : Replacing (?-mix:#?wal_level *=.*) with wal_level = $db_wal_level in /etc/postgresql/9.5/main/postgresql.conf
I, [2017-04-18T09:37:50.621331 #13]  INFO -- : Replacing (?-mix:#?checkpoint_segments *=.*) with checkpoint_segments = $db_checkpoint_segments in /etc/postgresql/9.5/main/postgresql.conf
I, [2017-04-18T09:37:50.621738 #13]  INFO -- : Replacing (?-mix:#?logging_collector *=.*) with logging_collector = $db_logging_collector in /etc/postgresql/9.5/main/postgresql.conf
I, [2017-04-18T09:37:50.622114 #13]  INFO -- : Replacing (?-mix:#?log_min_duration_statement *=.*) with log_min_duration_statement = $db_log_min_duration_statement in /etc/postgresql/9.5/main/postgresql.conf
I, [2017-04-18T09:37:50.622542 #13]  INFO -- : Replacing (?-mix:^#local +replication +postgres +peer$) with local replication postgres  peer in /etc/postgresql/9.5/main/pg_hba.conf
I, [2017-04-18T09:37:50.622880 #13]  INFO -- : Replacing (?-mix:^host.*all.*all.*127.*$) with host all all 0.0.0.0/0 md5 in /etc/postgresql/9.5/main/pg_hba.conf
I, [2017-04-18T09:37:50.623205 #13]  INFO -- : > HOME=/var/lib/postgresql USER=postgres exec chpst -u postgres:postgres:ssl-cert -U postgres:postgres:ssl-cert /usr/lib/postgresql/9.5/bin/postmaster -D /etc/postgresql/9.5/main
I, [2017-04-18T09:37:50.624160 #13]  INFO -- : > sleep 5
2017-04-18 09:37:50 UTC [42-1] FATAL:  data directory "/shared/postgres_data" has group or world access
2017-04-18 09:37:50 UTC [42-2] DETAIL:  Permissions should be u=rwx (0700).
I, [2017-04-18T09:37:55.628964 #13]  INFO -- :
I, [2017-04-18T09:37:55.629678 #13]  INFO -- : > su postgres -c 'createdb discourse' || true
createdb: could not connect to database template1: could not connect to server: No such file or directory
        Is the server running locally and accepting
        connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
I, [2017-04-18T09:37:55.693427 #13]  INFO -- :
I, [2017-04-18T09:37:55.693982 #13]  INFO -- : > su postgres -c 'psql discourse -c "create user discourse;"' || true
psql: could not connect to server: No such file or directory
        Is the server running locally and accepting
        connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
I, [2017-04-18T09:37:55.764180 #13]  INFO -- :
I, [2017-04-18T09:37:55.764816 #13]  INFO -- : > su postgres -c 'psql discourse -c "grant all privileges on database discourse to discourse;"' || true
psql: could not connect to server: No such file or directory
        Is the server running locally and accepting
        connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
I, [2017-04-18T09:37:55.831153 #13]  INFO -- :
I, [2017-04-18T09:37:55.831718 #13]  INFO -- : > su postgres -c 'psql discourse -c "alter schema public owner to discourse;"'
psql: could not connect to server: No such file or directory
        Is the server running locally and accepting
        connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
I, [2017-04-18T09:37:55.900120 #13]  INFO -- :
I, [2017-04-18T09:37:55.900896 #13]  INFO -- : Terminating async processes


FAILED
--------------------
Pups::ExecError: su postgres -c 'psql discourse -c "alter schema public owner to discourse;"' failed with return #<Process::Status: pid 68 exit 2>
Location of failure: /pups/lib/pups/exec_command.rb:108:in `spawn'
exec failed with the params "su postgres -c 'psql $db_name -c \"alter schema public owner to $db_user;\"'"
07126760455e9058c145e69358c01234e7c54a84ba20857afa4efda7111bf471
** FAILED TO BOOTSTRAP ** please scroll up and look for earlier error messages, there may be more than one