Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

data directory "/var/lib/postgresql/data" has wrong ownership #56

Closed
jralfonsog opened this issue Jul 26, 2020 · 12 comments · Fixed by #57
Closed

data directory "/var/lib/postgresql/data" has wrong ownership #56

jralfonsog opened this issue Jul 26, 2020 · 12 comments · Fixed by #57
Labels
Bug Something isn't working

Comments

@jralfonsog
Copy link

jralfonsog commented Jul 26, 2020

One-line summary (optional)
When building, postgresql container gives the error: data directory "/var/lib/postgresql/data" has wrong ownership

Steps to Reproduce
Run make or make all

** Include specs (OS, Python version, code commit hash or release version), if useful **
Linux Mint 19.3, Python 3.7.7

Outcome

postgres_1  | The files belonging to this database system will be owned by user "postgres".
postgres_1  | This user must also own the server process.
postgres_1  | 
postgres_1  | The database cluster will be initialized with locale "en_US.utf8".
postgres_1  | The default database encoding has accordingly been set to "UTF8".
postgres_1  | The default text search configuration will be set to "english".
postgres_1  | 
postgres_1  | Data page checksums are disabled.
postgres_1  | 
postgres_1  | fixing permissions on existing directory /var/lib/postgresql/data ... ok
postgres_1  | creating subdirectories ... ok
postgres_1  | selecting dynamic shared memory implementation ... posix
postgres_1  | selecting default max_connections ... 20
postgres_1  | selecting default shared_buffers ... 400kB
postgres_1  | selecting default time zone ... Etc/UTC
postgres_1  | creating configuration files ... ok
postgres_1  | running bootstrap script ... 2020-07-25 18:03:19.812 UTC [74] FATAL:  data directory "/var/lib/postgresql/data" has wrong ownership
postgres_1  | 2020-07-25 18:03:19.812 UTC [74] HINT:  The server must be started by the user that owns the data directory.
postgres_1  | child process exited with exit code 1
postgres_1  | initdb: removing contents of data directory "/var/lib/postgresql/data"
@jralfonsog jralfonsog added the Bug Something isn't working label Jul 26, 2020
@sertansenturk
Copy link
Owner

Thank you @jralfonsog for reporting this bug.

This is a project I work on my free time, so I am sure there are problems like this one which I fixed in Ubuntu but does not work universally.

I will take a look at it this weekend, and try to understand the problem. In the meantime, can you tell me the user and group id of the username you ran the docker-compose stack, e.g. by running id on the terminal?

@jralfonsog
Copy link
Author

jralfonsog commented Jul 29, 2020 via email

@jralfonsog
Copy link
Author

Hi again, Sertan.

Quick update. I found where the problem was, I was testing it on a NTFS mapped folder... It works perfectly if I use an Ext4.

Thanks anyway! :)

@sertansenturk
Copy link
Owner

Ohh, I see! It is good to know. I can open a known issues section in the README and include the NTFS problem. Or if you'd like to contribute directly, you can also open a PR too :)

Either way, I will close the issue, once the issue is documented in the README file.

Thank you for your compliments and your help! Let's see where the repo will take itself.

@jralfonsog
Copy link
Author

Oh, go ahead and open the section. I'll probably play some more, so I'll let you know/do a PR if I see anything else :)

@sertansenturk
Copy link
Owner

sertansenturk commented Aug 7, 2020

I created a PR, which documents the issue: #57

@jralfonsog can you take a look at the PR, whenever you have time? I can add you repo's contributors, in case you would like to give proper approval, or make modifications by yourself.

PS: I have also added your name in the documentation (link). If you want to modify the text or if you want me to remove your name, please let me know.

@jralfonsog
Copy link
Author

I created a PR, which documents the issue: #57

@jralfonsog can you take a look at the PR, whenever you have time? I can add you repo's contributors, in case you would like to give proper approval, or make modifications by yourself.

PS: I have also added your name in the documentation (link). If you want to modify the text or if you want me to remove your name, please let me know.

It's perfect this way, thanks! I think I've given approval properly, but I keep seeing the "Review required" message.

@sertansenturk
Copy link
Owner

I think it's about having writer permissions. I can still merge, it's not a problem.

The issue is closed. Thanks for your report and help!

@cn00
Copy link

cn00 commented Sep 15, 2022

The problem is still exist on pg14, but I find an unusual solution on docker-compose, and test for pg11 and pg14:

  • add user: 999:999 # postgres user in docker-compose.yml
  • run docker-compose run postgres bash
  • run docker-compose up -d

but I don't know why it works😅

@UgurGumushan
Copy link

Disabling VirtioFS on docker resolved the issue for me.
MacOS, M1

@realies
Copy link

realies commented Oct 28, 2022

Thanks, @UgurGumushan, this took me a while to narrow down.

@jsifantu
Copy link

jsifantu commented Nov 8, 2022

Yes, thank you @UgurGumusha for the suggestion!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants