PostgresSql not starting somthing permission error


(Pallav Ladekar) #1

i had running discourse application but by mistakenly i changed permission of /var/discourse/ and i also revert back all permission as it is…still getting error
“Expected to find it in the directory “/shared/postgres_data”,
but could not open file “/shared/postgres_data/global/pg_control”: Permission denied
postmaster: could not find the database system”

thats way it is not starting postgresql and i’m not able to access discourse application.

any suggestion please.


#2

I only have one test instance to look at right now, but here are the user and group IDs for that one:

root@disco:/var/discourse/shared/standalone# ls -aln
total 44
drwxr-xr-x 11    0   0 4096 May 15 21:25 .
drwxr-xr-x  3    0   0 4096 Oct 10  2017 ..
drwxr-xr-x  3 1000  33 4096 Oct 10  2017 backups
drwxr-xr-x  4    0   0 4096 Oct 10  2017 log
drwxr-xr-x  2  107 112 4096 Oct 10  2017 postgres_backup
drwx------ 19  107 112 4096 May 21 08:13 postgres_data
drwx------ 20  107 112 4096 May 15 21:25 postgres_data_old
drwxrwxr-x  4  107 112 4096 May 21 08:13 postgres_run
drwxr-xr-x  2  110 114 4096 May 22 07:48 redis_data
drwxr-xr-x  4    0   0 4096 Oct 10  2017 state
drwxr-xr-x  4 1000  33 4096 Dec  6 18:47 uploads

Assuming that the uid and guid set by the app container are always the same, you should be able to go through these directories and do commands like chown -R 107:112 postgres_data and so on. Not sure if rebuilding the app also fixes permissions, did you try that already?


(Pallav Ladekar) #3

ya… i tried to rebuild app but due to wrong permission postgres not started and thats way rebuild not successful.

parallely i installed another one and checked all ownership and permissions and i done as it to my older one…all working fine but it is the only problem with permission
“could not open file “/shared/postgres_data/global/pg_control”: Permission denied”

rwxr-xr-x  3 ubuntu     www-data 4096 May  5 07:20 backups
drwxr-xr-x  4 root       root     4096 May  5 06:19 log
drwxr-xr-x  2 messagebus uuidd    4096 May  5 06:19 postgres_backup
drwx------ 19 messagebus uuidd    4096 May 21 10:23 postgres_data
drwxrwsr-x  3 messagebus uuidd    4096 May 21 11:12 postgres_run
drwxr-xr-x  2 sshd       mlocate  4096 May 21 13:52 redis_data
drwxr-xr-x  4 root       root     4096 May  5 06:26 state
drwxr-xr-x  3 ubuntu     www-data 4096 May  5 06:21 uploads

#4

I don’t know then, maybe check that it isn’t being held open by a frozen postgres process or something? After the containers are stopped, do a ‘ps -ef |grep postgres’ and see what you get.

I did a google search for pg_control access denied and from the results it seems like that file can get corrupt and make postgres throw that error even when the permissions are correct.

If you’re stuck you should be able to restore one of the automatic backups into the new instance you created, and after you verify that the restore is good you could move the old data directories out of the way and do the same thing on your main discourse after you redeploy it.


(Pallav Ladekar) #5

thanks for response bro…Problem solved.
i just took backup and remove setup and install new one . After installing i restored backup through discourse UI.