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

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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