LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 06-18-2022, 01:26 PM   #1
Wed
Member
 
Registered: Sep 2005
Location: Sweden
Distribution: Slackware
Posts: 249

Rep: Reputation: 45
Root denied permission to change directory initialising postgresql


In a Virtualbox VM, pure 64 bit slackware 15 install, I have installed postgresql. According to the readme, it needs to be initialised thusly:
Code:
su postgres -c "initdb -D /var/lib/pgsql/14/data --locale=en_US.UTF-8 -A md5 -W"
Quote:
root@packages:~# su postgres -c "initdb -D /var/lib/pgsql/14/data --locale=sv_SE.UTF-8 -A md5 -W"
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.

The database cluster will be initialized with locale "sv_SE.UTF-8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "swedish".

Data page checksums are disabled.

Enter new superuser password:
(I did exchange en_US for sv_SE)

Is the bold statement merely an aesthetic nuisance, or could it be be a problem down the road? Can I fix it somehow?

Incidentally, if I abort with Ctrl-C, the characters stop showing as I type, and I have to reconnect to see the writings again.
 
Old 06-18-2022, 01:33 PM   #2
suramya
Member
 
Registered: Jan 2022
Location: Earth
Distribution: Debian
Posts: 249

Rep: Reputation: 102Reputation: 102
You are trying to run the postgreSQL server as postgres user from the /root directory. The user doesn't have access to the /root directory and thus gives you the error. You should try to run the following command instead:

Code:
su - postgres -c "initdb -D /var/lib/pgsql/14/data --locale=sv_SE.UTF-8 -A md5 -W"
This will use the user environment of the postgres user (including the home directory) so should run without errors/warnings.
 
Old 06-19-2022, 08:20 PM   #3
ljb643
Member
 
Registered: Nov 2003
Posts: 526

Rep: Reputation: Disabled
Quote:
Originally Posted by Wed View Post
...
Is the bold statement merely an aesthetic nuisance, or could it be be a problem down the road? Can I fix it somehow?
No, it's fine. You got this message because you did "su" while in root's home directory. When su changed to the postgres user, it could no longer read the current directory - because the postgres user has no permissions to root's home. The error is from su, but the initdb seems to have run OK and created the database. You can avoid the error message with "cd /tmp" before su, if you want.

The reason you got no characters after Ctrl+C is that initdb was prompting you for the database admin password, with echo off.
 
Old 06-20-2022, 04:04 PM   #4
Wed
Member
 
Registered: Sep 2005
Location: Sweden
Distribution: Slackware
Posts: 249

Original Poster
Rep: Reputation: 45
Many thanks for the explanations! It got my woes solved.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
cannot change directory to /home/user: Permission denied mahendrakumar Linux - Newbie 1 08-14-2018 01:07 AM
[SOLVED] Permission denied as root to a root-owned directory threevolve Ubuntu 3 06-06-2013 07:27 AM
mkdir throws Permission Denied error in a directoy even with root ownership and 777 permission surajchalukya Linux - Security 14 09-03-2012 08:34 AM
cannot change directory to /home/oracle: Permission denied nbeayni Linux - Newbie 14 11-08-2010 09:38 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 05:35 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration