Postgres /root": Permission denied
There are three parts in the output:
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.
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.
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.
Related videos on Youtube
dcalixto
Updated on September 18, 2022Comments
-
dcalixto over 1 year
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
-
Craig Ringer over 8 yearsx-posted stackoverflow.com/q/32323090/398670
-
dcalixto over 8 yearsyeah, another guy recommended to post this type of question here
-
Craig Ringer over 8 yearsNo problem. I'm just cross-linking so if someone finds one they can see there might be more info at the other.
-