0

why on ubuntu 14.10 every time that i try to start the postgres on:

sudo -p 'sudo password: ' -u postgres /usr/lib/postgresql/9.4/bin/initdb -D /mnt/postgresql/9.4/data

show this:

could not change directory to "/root": Permission denied The files belonging to this database system will be owned by user "postgres". This user must also own the server process.

initdb: invalid locale settings; check LANG and LC_* environment variables

3

2 Answers 2

1

There are three parts in the output:

  1. could not change directory to "/root": Permission denied: your 'sudo' succeeds but your postgres user fails to access the home of root. You may check for the setting of homedirectory for postgres in /etc/passwd.

  2. The files belonging to this database system will be owned by user "postgres". This user must also own the server process. : This is the normal permissions reminder from initdb. So you know initdb started regardles of failed directory change.

  3. initdb: invalid locale settings; check LANG and LC_* environment variables: here initdb fails for real due to missing locale settings.

I think You need to check your sudo configuration and make sure your postgres user has a proper environment before calling initdb.

0

Step 1

stat -c "%G" .

Step 2

sudo usermod -aG <the output from the step 1> postgres

df.tips/t/2063/2

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .