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

Copying of data from hard drive permissioning problem #479

Open
anneCarlson opened this issue Nov 8, 2018 · 10 comments
Open

Copying of data from hard drive permissioning problem #479

anneCarlson opened this issue Nov 8, 2018 · 10 comments

Comments

@anneCarlson
Copy link

anneCarlson commented Nov 8, 2018

I recently got a new computer, and coppied the application postgres and the Library/Application\ Support/Postgres/var-10/ directory to my new computer. When I try to start the server I get
bin/sh: /Users/annecarlson/Library/Application Support/Postgres/var-10/postgresql.log: Permission denied pg_ctl: could not start server
even after I chmodded the entire directory to 777 permissions. How do I fix this error?

@jakob
Copy link
Member

jakob commented Nov 8, 2018

What's the result of the following command:

ls -l /Users/annecarlson/Library/Application Support/Postgres/var-10

@anneCarlson
Copy link
Author

-rwx------@ 1 annecarlson _postgres 6148 Feb 27 2018 .DS_Store
-rwx------@ 1 annecarlson _postgres 3 Nov 8 2017 PG_VERSION
drwx------@ 10 annecarlson _postgres 340 Sep 25 17:25 base
drwx------@ 62 annecarlson _postgres 2108 Oct 4 13:52 global
drwx------@ 2 annecarlson _postgres 68 Nov 8 2017 pg_commit_ts
drwx------@ 2 annecarlson _postgres 68 Nov 8 2017 pg_dynshmem
-rwx------@ 1 annecarlson _postgres 4513 Nov 8 2017 pg_hba.conf
-rwx------@ 1 annecarlson _postgres 1636 Nov 8 2017 pg_ident.conf
drwx------@ 5 annecarlson _postgres 170 Oct 4 17:19 pg_logical
drwx------@ 4 annecarlson _postgres 136 Nov 8 2017 pg_multixact
drwx------@ 3 annecarlson _postgres 102 Oct 4 13:51 pg_notify
drwx------@ 2 annecarlson _postgres 68 Nov 8 2017 pg_replslot
drwx------@ 2 annecarlson _postgres 68 Nov 8 2017 pg_serial
drwx------@ 2 annecarlson _postgres 68 Nov 8 2017 pg_snapshots
drwx------@ 2 annecarlson _postgres 68 Oct 4 13:51 pg_stat
drwx------@ 6 annecarlson _postgres 204 Oct 5 08:16 pg_stat_tmp
drwx------@ 3 annecarlson _postgres 102 Sep 27 19:33 pg_subtrans
drwx------@ 2 annecarlson _postgres 68 Nov 8 2017 pg_tblspc
drwx------@ 2 annecarlson _postgres 68 Nov 8 2017 pg_twophase
drwx------@ 8 annecarlson _postgres 272 Oct 4 17:04 pg_wal
drwx------@ 16 annecarlson _postgres 544 Sep 27 19:32 pg_xact
-rwx------@ 1 annecarlson _postgres 88 Nov 8 2017 postgresql.auto.conf
-rwx------@ 1 annecarlson _postgres 22770 Nov 8 2017 postgresql.conf
-rwx------@ 1 annecarlson _postgres 837 Nov 8 15:47 postgresql.log
-rwx------@ 1 annecarlson _postgres 144 Oct 4 13:51 postmaster.opts

@jakob
Copy link
Member

jakob commented Nov 8, 2018

What about var-10 directory itself?

ls -l "/Users/annecarlson/Library/Application Support/Postgres"

Where is that _postgres group coming from?

Are you using the Postgres.app GUI?

@anneCarlson
Copy link
Author

drwx------@ 27 _postgres _postgres 918 Nov 8 15:46 var-10
Yes, I am using the postgres.app GUI
screen shot 2018-11-08 at 3 53 58 pm

@jakob
Copy link
Member

jakob commented Nov 8, 2018

Looks like you need to chown that dir itself

chown -R annecarlson  "/Users/annecarlson/Library/Application Support/Postgres"

@jakob
Copy link
Member

jakob commented Nov 8, 2018

(probably need to prefix that with sudo)

@jakob
Copy link
Member

jakob commented Nov 8, 2018

(Postgres.app runs as your user, it doesn't use the _postgres system user.)

@anneCarlson
Copy link
Author

Interesting. Now I get the following log error when I click start
2018-11-08 15:57:10.744 EST [11906] FATAL: could not create lock file "postmaster.pid": Permission denied

@anneCarlson
Copy link
Author

I assume my permissions are still messed up? I'm the group "_postgres" is incorrect?

@jakob
Copy link
Member

jakob commented Nov 9, 2018

The group shouldn't matter. Postgres.app runs under your user, which I assume is "annecarlson". You can type whoami at the command line to see your user name.

Some other PostgreSQL installations may create a "postgresql" user, and run the server using that user, but we don't do that because it causes lots of headaches.

PostgreSQL needs to be allowed to create a file named "postmaster.pid" inside the data directory. Here's what permissions look like on my Mac:

$ whoami
jakob
$ ls -l ~/Library/Application\ Support/Postgres
drwx------  26 jakob  staff   832 Sep 20 16:27 var-11

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants