norly

Q: permissions PostgreSQL/data

Hi.

I destryed one of my Wikis so I had to replace the:

Server/wiki/

Server/PostgreSQL/

 

folders with a backup..

 

Unfortunally I dont have the right permissions on the PostgreSQL/data/ folder. Can anyone help me with resetting those for the foldr, and the subfiles/folders.

 

As it is now the PostgreSQL.log gives me this fault

 

CETFATAL:  could not create lock file "postmaster.pid": Permission denied

 

The permissions are now:

 

$ sudo ls -al /Library/Server/PostgreSQL/

total 0

drwxrw-r-x@  5 _teamsserver  _teamsserver  170 23 Mar  2013 .

drwxr-xr-x  28 root          wheel         952 18 Mar 22:09 ..

drwxr-xr-x@  3 _postgres     _postgres     102 19 Mar 00:04 Config

drwx------+ 19 _postgres     _postgres     646 19 Mar 10:17 Data

 

 

$ sudo ls -al /Library/Server/PostgreSQL/Data/

total 80

drwx------+ 19 _postgres     _postgres       646 19 Mar 10:17 .

drwxrw-r-x@  5 _teamsserver  _teamsserver    170 23 Mar  2013 ..

-rwx------+  1 _postgres     _postgres         4 19 Mar 10:19 PG_VERSION

drwx------+  6 _postgres     _postgres       204 23 Mar  2013 base

drwx------+ 45 _postgres     _postgres      1530 23 Mar  2013 global

drwx------+  4 _postgres     _postgres       136 23 Mar  2013 pg_clog

-rwx------+  1 _postgres     _postgres      4479 19 Mar 10:19 pg_hba.conf

-rwx------+  1 _postgres     _postgres      1636 19 Mar 10:19 pg_ident.conf

drwx------+  4 _postgres     _postgres       136 23 Mar  2013 pg_multixact

drwx------+  3 _postgres     _postgres       102 23 Mar  2013 pg_notify

drwx------+  2 _postgres     _postgres        68 23 Mar  2013 pg_serial

drwx------+  2 _postgres     _postgres        68 23 Mar  2013 pg_snapshots

drwx------+  2 _postgres     _postgres        68 23 Mar  2013 pg_stat_tmp

drwx------+  3 _postgres     _postgres       102 23 Mar  2013 pg_subtrans

drwx------+  2 _postgres     _postgres        68 23 Mar  2013 pg_tblspc

drwx------+  2 _postgres     _postgres        68 23 Mar  2013 pg_twophase

drwx------+  4 _postgres     _postgres       136 23 Mar  2013 pg_xlog

-rwx------   1 _postgres     _postgres     19596 19 Mar 10:19 postgresql.conf

-rwx------+  1 _postgres     _postgres       481 19 Mar 10:19 postmaster.opts

 

 

I dont know what the original permissions should be exect that The Data/ folder should have 700. Can anyone have a look at there servers and chack what kind of attribs the folder/files has?

 

 

Since the PostgreSQL dont work I cant start my wiki...

 

collabd[700]: [CSConnectionPool.m:196 77fa000 +0ms] Could not open a connection to Postgres. Please make sure it is running and has the correct access.

collabd[700]: [CSXCWorkSchedulerService.m:196 77fa000 +0ms] Failed to open DB connection, retrying in 10s: [CSDatabaseError] Connection to DB failed

com.apple.launchd[1]: (org.postgresql.postgres[51647]) Exited with code: 1

com.apple.launchd[1]: (org.postgresql.postgres) Throttling respawn: Will start in 10 seconds

 

It to late to do a complete reset form timemaschine since people has been working on the server for a few days. So all I want is a  chmod  and a chmod +acommand for the _postgres account...

 


Mac mini, OS X Server, Maveriks server

Posted on Mar 19, 2014 4:22 AM

Close

Q: permissions PostgreSQL/data

  • All replies
  • Helpful answers

  • by Linc Davis,Helpful

    Linc Davis Linc Davis Mar 19, 2014 3:43 PM in response to norly
    Level 10 (207,963 points)
    Applications
    Mar 19, 2014 3:43 PM in response to norly

    sudo chmod 755 /Library/Server/PostgreSQL; sudo chown 216:216 $_

  • by norly,

    norly norly Mar 19, 2014 11:54 PM in response to Linc Davis
    Level 1 (0 points)
    Mar 19, 2014 11:54 PM in response to Linc Davis

    Thanks. But the the Data folder must be 700 i Think... No mather what i found a CC backup and just did the

     

    sudo cp -pRv /Volumes/OSX\ server\ 1/Library/Server/PostgreSQL/ /Library/Server/PostgreSQL/


    sudo cp -pRv /Volumes/OSX\ server\ 1/Library/Server/Wiki/ /Library/Server/Wiki/

     

    So now the permissions are correct. And the postSQL is running quite fine.

     

    sudo serveradmin fullstatus postgres

    postgres:dataDirHasBeenInitialized = yes

    postgres:PG_VERSION = "9.2.4"

    postgres:dataDir = "/Library/Server/PostgreSQL/Data"

    postgres:postgresIsResponding = yes

    postgres:dataDirIsDirectory = yes

    postgres:PGserverVersion = 90204

    postgres:dataDirExists = yes

    postgres:setStateVersion = 1

    postgres:state = "RUNNING"

     

    But I am getting the classic error and a failure to acces any webbased server (exept the normal 443 website), it gives a:

    (Caught exception "Connection to DB failed" [CSDatabaseError] executing route, in Safari/IE).

     

    All.log

    collabd[345]:  Could not open a connection to Postgres. Please make sure it is running and has the correct access.

    collabd[345]: Failed to open DB connection, retrying in 10s: [CSDatabaseError] Connection to DB failed

     

    The latest logs in the postSQL.log

     

    17:59:11 CETFATAL:  the database system is starting up

    17:59:14 CETLOG:  database system is ready to accept connections

    17:59:14 CETLOG:  autovacuum launcher started

    18:00:22 CETLOG:  connection received: host=127.0.0.1 port=49638

    18:00:22 CETLOG:  connection authorized: user=_postgres database=postgres

    23:24:06 CETLOG:  connection received: host=127.0.0.1 port=55180

    23:24:06 CETLOG:  connection authorized: user=_postgres database=postgres

    23:29:30 CETLOG:  connection received: host=[local]

    23:29:30 CETLOG:  connection authorized: user=collab database=collab

    23:29:30 CETFATAL:  role "collab" does not exist

    07:42:49 CETLOG:  connection received: host=127.0.0.1 port=64038

    07:42:49 CETLOG:  connection authorized: user=_postgres database=postgres

     

    Ive looked around but havent found anything that works. How do I make sure its connecting to the right adress? Could you help me with this?

  • by norly,

    norly norly Mar 20, 2014 12:45 AM in response to norly
    Level 1 (0 points)
    Mar 20, 2014 12:45 AM in response to norly

    collabd[345]: Caught exception "Connection to DB failed" [CSDatabaseError] executing [http]Request{AuthService.enterMagicalAuthRealm()}:

    (

              0   CoreFoundation                      0x00007fff91e1425c __exceptionPreprocess + 172

              1   libobjc.A.dylib                     0x00007fff863fbe75 objc_exception_throw + 43

              2   CSService                           0x00000001070a7efd -[CSConnectionPool openConnection] + 3309

              3   CSService                           0x00000001070a88ca -[CSConnectionPool currentConnection] + 98

              4   CSService                           0x0000000107137b09 -[CSAuthService unauthenticatedSession] + 82

              5   CSService                           0x00000001071380e3 -[CSAuthService currentOrNewSession] + 154

              6   CSService                           0x000000010713af61 -[CSAuthService enterMagicalAuthRealm] + 51

              7   CoreFoundation                      0x00007fff91cffbec __invoking___ + 140

              8   CoreFoundation                      0x00007fff91cffa54 -[NSInvocation invoke] + 308

              9   CSService                           0x00000001070a30a0 -[CSServiceDispatcher executeRequest:asPartOfBatch:usingServiceImpl:] + 4589

              10  CSService                           0x00000001070a3557 -[CSServiceDispatcher executeRequest:] + 120

              11  CSService                           0x0000000107126fdf +[CSServiceDispatchHTTPRouter routeServiceRequest:response:] + 1214

              12  CSService                           0x00000001070aa25f __21-[CSServiceBase init]_block_invoke_6 + 48

              13  CSService                           0x0000000107123fda __53-[CSRoutingHTTPConnection httpResponseForMethod:URI:]_block_invoke + 95

              14  CSService                           0x000000010712757b -[CSHTTPBackgroundResponse bounce:] + 286

              15  Foundation                          0x00007fff876b776b __NSThread__main__ + 1318

              16  libsystem_pthread.dylib             0x00007fff85e37899 _pthread_body + 138

              17  libsystem_pthread.dylib             0x00007fff85e3772a _pthread_struct_init + 0

              18  libsystem_pthread.dylib             0x00007fff85e3bfc9 thread_start + 13

    )

     

     

    /Library/Server/PostgreSQL/Config/org.postgresql.postgres.plist

    <?xml version="1.0" encoding="UTF-8"?>

    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">

    <plist version="1.0">

    <dict>

     

            <key>ProgramArguments</key>

            <array>

                    <string>-D</string>

                    <string>/Library/Server/PostgreSQL/Data</string>

                    <string>-c</string>

                    <string>listen_addresses=127.0.0.1,::1</string>

                    <string>-c</string>

                    <string>log_connections=on</string>

                    <string>-c</string>

                    <string>log_directory=/Library/Logs/PostgreSQL</string>

                    <string>-c</string>

                    <string>log_filename=PostgreSQL.log</string>

                    <string>-c</string>

                    <string>log_line_prefix=%t </string>

                    <string>-c</string>

                    <string>log_lock_waits=on</string>

                    <string>-c</string>

                    <string>log_statement=ddl</string>

                    <string>-c</string>

                    <string>logging_collector=on</string>

                    <string>-c</string>

                    <string>unix_socket_directory=/private/var/pgsql_socket</string>

                    <string>-c</string>

                    <string>unix_socket_group=_postgres</string>

                    <string>-c</string>

                    <string>unix_socket_permissions=0770</string>

            </array>

    </dict>

    </plist>

     


  • by Linc Davis,

    Linc Davis Linc Davis Mar 20, 2014 8:11 AM in response to norly
    Level 10 (207,963 points)
    Applications
    Mar 20, 2014 8:11 AM in response to norly

    CETFATAL:  role "collab" does not exist

    sudo /Applications/Server.app/Contents/ServerRoot/System/Library/ServerSetup/CommonExtras/CoreCollaborationCommonExtra.py
  • by norly,

    norly norly Mar 20, 2014 8:23 AM in response to Linc Davis
    Level 1 (0 points)
    Mar 20, 2014 8:23 AM in response to Linc Davis

    createuser: could not connect to database postgres: could not connect to server: Connection refused

              Is the server running locally and accepting

              connections on Unix domain socket "/Library/Server/Wiki/PostgresSocket/.s.PGSQL.5432"?

    createdb: could not connect to database template1: could not connect to server: Connection refused

              Is the server running locally and accepting

              connections on Unix domain socket "/Library/Server/Wiki/PostgresSocket/.s.PGSQL.5432"?

    wikiadmin[71613] <Info>: [SchemaMigrator.m:142 75437310 +0ms] Updating schema to latest schema version (166)

    wikiadmin[71613] <Info>: [SchemaMigrator.m:148 75437310 +0ms] Bumping schema to version (166)

    wikiadmin[71613] <Info>: [CSConfig.m:55 75437310 +4ms] Reading plist at /Library/Server/Wiki/Config/collabd.plist

    wikiadmin[71613] <Debug>: [CSConnectionPool.m:141 75437310 +0ms] Opening DB connection

    wikiadmin[71613] <Debug>: [PGCConnection.m:63 75437310 +0ms] -[PGCConnection connect] with [host='/Library/Server/Wiki/PostgresSocket' dbname=collab client_encoding=utf-8 options='-c bytea_output=escape' user=collab]

    wikiadmin[71613] <Debug>: [PGCConnection.m:619 75437310 +0ms] -[PGCConnection close]

    wikiadmin[71613] <Error>: [CSConnectionPool.m:196 75437310 +0ms] Could not open a connection to Postgres. Please make sure it is running and has the correct access.

    wikiadmin[71613] <Error>: [main.m:452 75437310 +0ms] Caught top-level exception: [CSDatabaseError] Connection to DB failed, exiting

    collabd:state = "STOPPED"


    2014-03-20 16:15:39.019 xcs_preflight[71629:c07] Deleted identity for com.apple.server.collabd

    2014-03-20 16:15:39.795 xcs_preflight[71629:c07] Created new identity com.apple.server.collabd for /Applications/Server.app/Contents/ServerRoot/usr/sbin/collabd

    2014-03-20 16:15:39.875 xcs_preflight[71629:c07] Deleted identity for com.apple.server.xcsbuildd

    2014-03-20 16:15:40.481 xcs_preflight[71629:c07] Created new identity com.apple.server.xcsbuildd for /Applications/Server.app/Contents/ServerRoot/usr/libexec/xcsbuildd

    2014-03-20 16:15:40.552 xcs_preflight[71629:c07] Registered certificate com.apple.server.xcsbuildd with credential server

    2014-03-20 16:15:40.620 xcs_preflight[71629:c07] Deleted identity for com.apple.server.servermgr_xcode

    2014-03-20 16:15:41.331 xcs_preflight[71629:c07] Created new identity com.apple.server.servermgr_xcode for /Applications/Server.app/Contents/ServerRoot/System/Library/CoreServices/Server ManagerDaemon.bundle

    2014-03-20 16:15:41.353 xcs_preflight[71629:c07] Deleted identity for com.apple.server.scm_poller

    2014-03-20 16:15:42.112 xcs_preflight[71629:c07] Created new identity com.apple.server.scm_poller for /Applications/Server.app/Contents/ServerRoot/usr/sbin/scm_poller

    2014-03-20 16:15:42.150 xcs_preflight[71629:c07] Registered certificate com.apple.server.scm_poller with credential server

    collabd:state = "RUNNING"

     

    Restarted the server but are still geting the same errors

     

    2014-03-20 16:18:19,747 collabd[71674]: [CSConnectionPool.m:196 61fa000 +0ms] Could not open a connection to Postgres. Please make sure it is running and has the correct access.

    2014-03-20 16:18:19,748 collabd[71674]: [CSXCWorkSchedulerService.m:196 61fa000 +0ms] Failed to open DB connection, retrying in 10s: [CSDatabaseError] Connection to DB failed


  • by Linc Davis,Solvedanswer

    Linc Davis Linc Davis Mar 20, 2014 10:07 AM in response to norly
    Level 10 (207,963 points)
    Applications
    Mar 20, 2014 10:07 AM in response to norly
  • by norly,

    norly norly Mar 24, 2014 7:41 AM in response to Linc Davis
    Level 1 (0 points)
    Mar 24, 2014 7:41 AM in response to Linc Davis

    Followed the instuctions but I did not do any differense... It is the datbase that is broken?

  • by norly,

    norly norly Mar 24, 2014 10:38 AM in response to norly
    Level 1 (0 points)
    Mar 24, 2014 10:38 AM in response to norly

    Ok.. Did it the proper way via Recover HD. And it worked. Apparantly its not enought to just stop the post service from running.

     

    Enter TM

     

    1. Ctrl click the wiki folder in TM drive.

    2. Recover to a folder in OSX HD

    3. Restart to recovery, run terminal

    4. rm -r /volumes/osx/library/server/wiki

    5. cp -pRv /volumes/osx/Wikibackup/Wiki /volumes/osx/library/server/wiki

     

    Restart and it worked... What dosent work is to try it without booting to recovery disk.

     

    Thanks Linc Davis. I owe you one. If you ever come to zurich Ill buy you a beer