7 Replies Latest reply: Feb 4, 2013 8:20 PM by trilogy1000
loup.bell Level 1 Level 1 (5 points)

Hello everyone,

 

I did something dumb. REALLY dumb. I deleted /Library/Server on my Mac Pro running Mac OS 10.8 ML Server

 

Of course, no backup.

 

When I realised that Server.app was displaying tons of errors, I installed a fresh copy of ML Server in a VM. I then copied /Library/Server back in my main machine, deleted Server.app and reinstalled it through the mac app store.

 

Now everything works fine except the profile manager and the wiki that both display "Error reading settings". I tried to run wipeDB (http://support.apple.com/kb/HT5349) as root but here what comes out of this:

 

server:~ Loup$ sudo /Applications/Server.app/Contents/ServerRoot/usr/share/devicemgr/backend/wipeDB .sh

devicemgr:state = "STOPPED"

postgres_server:error = "CANNOT_START_SERVICE_TIMEOUT_ERR"

(in /Applications/Server.app/Contents/ServerRoot/usr/share/devicemgr/backend)

Couldn't drop device_management : #<PGError: could not connect to server: No such file or directory

          Is the server running locally and accepting

          connections on Unix domain socket "/Library/Server/PostgreSQL For Server Services/Socket/.s.PGSQL.5432"?

>

(in /Applications/Server.app/Contents/ServerRoot/usr/share/devicemgr/backend)

could not connect to server: No such file or directory

          Is the server running locally and accepting

          connections on Unix domain socket "/Library/Server/PostgreSQL For Server Services/Socket/.s.PGSQL.5432"?

/Applications/Server.app/Contents/ServerRoot/usr/share/devicemgr/backend/vendor/ rails/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb:9 41:in `initialize'

/Applications/Server.app/Contents/ServerRoot/usr/share/devicemgr/backend/vendor/ rails/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb:9 41:in `connect'

/Applications/Server.app/Contents/ServerRoot/usr/share/devicemgr/backend/vendor/ rails/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb:9 41:in `connect'

/Applications/Server.app/Contents/ServerRoot/usr/share/devicemgr/backend/vendor/ rails/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb:2 17:in `initialize'

/Applications/Server.app/Contents/ServerRoot/usr/share/devicemgr/backend/vendor/ rails/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb:3 7:in `new'

/Applications/Server.app/Contents/ServerRoot/usr/share/devicemgr/backend/vendor/ rails/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb:3 7:in `postgresql_connection'

/Applications/Server.app/Contents/ServerRoot/usr/share/devicemgr/backend/vendor/ rails/activerecord/lib/active_record/connection_adapters/abstract/connection_poo l.rb:223:in `send'

/Applications/Server.app/Contents/ServerRoot/usr/share/devicemgr/backend/vendor/ rails/activerecord/lib/active_record/connection_adapters/abstract/connection_poo l.rb:223:in `new_connection'

/Applications/Server.app/Contents/ServerRoot/usr/share/devicemgr/backend/vendor/ rails/activerecord/lib/active_record/connection_adapters/abstract/connection_poo l.rb:245:in `checkout_new_connection'

/Applications/Server.app/Contents/ServerRoot/usr/share/devicemgr/backend/vendor/ rails/activerecord/lib/active_record/connection_adapters/abstract/connection_poo l.rb:188:in `checkout'

/Applications/Server.app/Contents/ServerRoot/usr/share/devicemgr/backend/vendor/ rails/activerecord/lib/active_record/connection_adapters/abstract/connection_poo l.rb:184:in `loop'

/Applications/Server.app/Contents/ServerRoot/usr/share/devicemgr/backend/vendor/ rails/activerecord/lib/active_record/connection_adapters/abstract/connection_poo l.rb:184:in `checkout'

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/monitor. rb:242:in `synchronize'

/Applications/Server.app/Contents/ServerRoot/usr/share/devicemgr/backend/vendor/ rails/activerecord/lib/active_record/connection_adapters/abstract/connection_poo l.rb:183:in `checkout'

/Applications/Server.app/Contents/ServerRoot/usr/share/devicemgr/backend/vendor/ rails/activerecord/lib/active_record/connection_adapters/abstract/connection_poo l.rb:98:in `connection'

/Applications/Server.app/Contents/ServerRoot/usr/share/devicemgr/backend/vendor/ rails/activerecord/lib/active_record/connection_adapters/abstract/connection_poo l.rb:326:in `retrieve_connection'

/Applications/Server.app/Contents/ServerRoot/usr/share/devicemgr/backend/vendor/ rails/activerecord/lib/active_record/connection_adapters/abstract/connection_spe cification.rb:123:in `retrieve_connection'

/Applications/Server.app/Contents/ServerRoot/usr/share/devicemgr/backend/vendor/ rails/activerecord/lib/active_record/connection_adapters/abstract/connection_spe cification.rb:115:in `connection'

/Applications/Server.app/Contents/ServerRoot/usr/share/devicemgr/backend/vendor/ rails/railties/lib/tasks/databases.rake:70:in `create_database'

/Applications/Server.app/Contents/ServerRoot/usr/share/devicemgr/backend/vendor/ rails/railties/lib/tasks/databases.rake:31

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rake.rb: 636:in `call'

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rake.rb: 636:in `execute'

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rake.rb: 631:in `each'

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rake.rb: 631:in `execute'

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rake.rb: 597:in `invoke_with_call_chain'

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/monitor. rb:242:in `synchronize'

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rake.rb: 590:in `invoke_with_call_chain'

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rake.rb: 583:in `invoke'

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rake.rb: 2051:in `invoke_task'

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rake.rb: 2029:in `top_level'

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rake.rb: 2029:in `each'

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rake.rb: 2029:in `top_level'

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rake.rb: 2068:in `standard_exception_handling'

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rake.rb: 2023:in `top_level'

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rake.rb: 2001:in `run'

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rake.rb: 2068:in `standard_exception_handling'

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rake.rb: 1998:in `run'

/usr/bin/rake:31

Couldn't create database for {"adapter"=>"postgresql", "host"=>"/Library/Server/PostgreSQL For Server Services/Socket", "pool"=>5, "database"=>"device_management", "username"=>"_devicemgr", "encoding"=>"UTF8"}

devicemgr:state = "STARTING"

server:~ Loup$

 

 

I think that I will have to wipe my Macintosh HD and reinstall the OS again. the problem is that I have "software-based RAID" and I'm affraid that it won't mount the drives correctly if I wipe my Macintosh HD and reinstall ML server again.

 

Help please !

 

Thanks!

  • 1. Re: Profile manager and wiki read error
    UptimeJeff Level 4 Level 4 (3,390 points)

    did you start postgres?

    sudo serveradmin start postgres

  • 2. Re: Profile manager and wiki read error
    loup.bell Level 1 Level 1 (5 points)

    Hello UptimeJeff,

     

    First of all, thank you for helping me

     

    Here is the outcome of the command you gave me.

     

    server:~ Loup$ sudo serveradmin start postgres

    Password:

    postgres:error = "CANNOT_START_SERVICE_TIMEOUT_ERR"

     

    Looks like postgres is not doing it's job.... I don't even know what it is Any idea?

     

     

    Thanks again!

  • 3. Re: Profile manager and wiki read error
    UptimeJeff Level 4 Level 4 (3,390 points)

    Look at your postgres logs using the Console app

         /Library/Logs/PostgreSQL

    post any results

     

    post output of

    sudo serveradmin settings postgres

     

    Look at the output of above and note the path for "postgres:data"

    Run this command if it matches your path:

    sudo chown -R _postgres:_postgres /Library/Server/PostgreSQL/Data

     

    Try starting postgres again and post anything interesting

  • 4. Re: Profile manager and wiki read error
    loup.bell Level 1 Level 1 (5 points)

    With the last command you gave me (chown), I was able to get postgres up and running

     

    Here is what I executed:

     

     

    sudo chown -R _postgres:_postgres "/Library/Server/PostgreSQL For Server Services"

    sudo chown -R _postgres:_postgres /Library/Server/PostgreSQL/Data

    Then, I ran the wipeDB command...

     

     

    sudo /Applications/Server.app/Contents/ServerRoot/usr/share/devicemgr/backend/wipeDB .sh

    devicemgr:state = "RUNNING"

    (in /Applications/Server.app/Contents/ServerRoot/usr/share/devicemgr/backend)

    (in /Applications/Server.app/Contents/ServerRoot/usr/share/devicemgr/backend)

    devicemgr:state = "STARTING"

    One quick reboot.

    then, a little check-up at postgres

     

     

    server:~ Loup$ sudo serveradmin fullstatus postgres

    Password:

    postgres:dataDirHasBeenInitialized = yes

    postgres:PG_VERSION = "9.2.1"

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

    postgres:postgresIsResponding = yes

    postgres:dataDirIsDirectory = yes

    postgres:PGserverVersion = 90201

    postgres:dataDirExists = yes

    postgres:setStateVersion = 1

    postgres:state = "RUNNING"

     

    Since then, the wiki section in the Server.app does not display an error message and seems to work fine. My problem is 50% solved You're just awesome UptimeJeff. All errors about postgres in Console.app have dissapered.

     

    But the profile manager still displays an error in Server.app (error reading settings)

     

    I will post the lines that appears in Console.app that seems suspicious to me.

     

     

    2013-01-25 17:54:59,758 ProfileManager[1491]: devicemgrd: Terminating on unhandled exception Permission denied - /var/devicemgr/ServiceData/Data/migration at /Applications/Server.app/Contents/ServerRoot/usr/share/devicemgr/webserver/devi cemgrd:238:in `initialize'

    /Applications/Server.app/Contents/ServerRoot/usr/share/devicemgr/webserver/devic emgrd:238:in `new'

    /Applications/Server.app/Contents/ServerRoot/usr/share/devicemgr/webserver/devic emgrd:238:in `SetupRails'

    /Applications/Server.app/Contents/ServerRoot/usr/share/devicemgr/webserver/devic emgrd:158:in `Run'

    /Applications/Server.app/Contents/ServerRoot/usr/share/devicemgr/webserver/devic emgrd:851

    2013-01-25 17:54:59,761 com.apple.launchd[1]: (com.apple.devicemanager[1491]) Exited with code: 1

    2013-01-25 17:54:59,761 com.apple.launchd[1]: (com.apple.devicemanager) Throttling respawn: Will start in 8 seconds

    2013-01-25 17:55:01,101 ProfileManager[1519]: devicemgrd: Terminating on unhandled exception No such file or directory - /var/devicemgr/ServiceData/Data/migration at /Applications/Server.app/Contents/ServerRoot/usr/share/devicemgr/webserver/devi cemgrd:238:in `initialize'

    /Applications/Server.app/Contents/ServerRoot/usr/share/devicemgr/webserver/devic emgrd:238:in `new'

    /Applications/Server.app/Contents/ServerRoot/usr/share/devicemgr/webserver/devic emgrd:238:in `SetupRails'

    /Applications/Server.app/Contents/ServerRoot/usr/share/devicemgr/webserver/devic emgrd:158:in `Run'

    /Applications/Server.app/Contents/ServerRoot/usr/share/devicemgr/webserver/devic emgrd:851

    2013-01-25 17:55:01,148 servermgrd[203]: servermgr_devicemgr: PrepareDatabase: 'devicemgrd -migrate' status = 1

    2013-01-25 17:55:01,828 sudo[1569]:     root : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/Applications/Server.app/Contents/ServerRoot/usr/bin/psql -h /Library/Server/PostgreSQL For Server Services/Socket -U webauth -d webauth -c SELECT max(version) FROM schema_migrations

    2013-01-25 17:55:01,872 Server[671]: error reading data stores for servermgr_devicemgr = Error Domain=servermgr_devicemgr Code=1 "PrepareDatabase: 'devicemgrd -migrate' status = 1" UserInfo=0x7ff49bc912e0 {NSLocalizedDescription=PrepareDatabase: 'devicemgrd -migrate' status = 1}

    2013-01-25 17:55:01,873 Server[671]: Error: The server '127.0.0.1' reported an error while processing a command of type: 'readSettings' in plug-in: 'servermgr_devicemgr'. Error: Error Domain=servermgr_devicemgr Code=1 "PrepareDatabase: 'devicemgrd -migrate' status = 1" UserInfo=0x7ff49bc912e0 {NSLocalizedDescription=PrepareDatabase: 'devicemgrd -migrate' status = 1}

    2013-01-25 17:55:07,846 ProfileManager[1573]: Failed to delete '/var/devicemgr/ServiceData/Data/tmp'. Permission denied - /var/devicemgr/ServiceData/Data/tmp

     

     

    For references purposes, here is the output of sudo serveradmin settings postgres

     

     

    sudo serveradmin settings postgres

    Password:

    postgres:log_connections = "on"

    postgres:log_directory = "/Library/Logs/PostgreSQL"

    postgres:listen_addresses = "127.0.0.1,::1"

    postgres:unix_socket_group = "_postgres"

    postgres:log_statement = "ddl"

    postgres:log_line_prefix = "%t "

    postgres:unix_socket_permissions = "0770"

    postgres:log_lock_waits = "on"

    postgres:logging_collector = "on"

    postgres:log_filename = "PostgreSQL.log"

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

    postgres:unix_socket_directory = "/private/var/pgsql_socket"

     

     

     

    Again, a HUGE thanks. You already helped me A LOT.

  • 5. Re: Profile manager and wiki read error
    UptimeJeff Level 4 Level 4 (3,390 points)

    Glad you are on the way to sorting this out.

     

    I can't be much help on device manager, I've never used it.

     

    Looking at the first line you provided, it lists a permission issue at

       /var/devicemgr/ServiceData/Data/migration

     

    Check your permissions there with

         ls -al /var/devicemgr/ServiceData/Data/*

     

    Everything there should be owned by user=_devicemgr and group=_devicemgr

    If its not, you can fix with

         sudo chown -R _devicemgr:_devicemgr /var/devicemgr/ServiceData/Data

     


    Hope that gets you closer..

     

    Jeff

     


  • 6. Re: Profile manager and wiki read error
    loup.bell Level 1 Level 1 (5 points)

    First of all, you deserve a HUGE thank you. My problem is now solved, and you definitely contributed to the repair process. You are simply awesome, THANKS

     

    Here's what I did....

     

    I checked the permissions like you suggested me... that led me to discover that /var/devicemgr/ServiceData is not a directory.... it's a shortcut. Initially, the shortcut was pointing at itself (infinite loop)

     

    I continued to google my problem, and found that there's a gold mine hidden in Mountain Lion Server at /Applications/Server.app/Contents/ServerRoot/System/Library/ServerSetup/CommonE xtras

     

    I simply deleted the shortcut in /var/devicemgr/ServiceData and ran /Applications/Server.app/Contents/ServerRoot/System/Library/ServerSetup/CommonE xtras/80-devicemgrcommon.sh as root (sudo -s) to recreate all devicemgr files.

     

    Now everything is up and running.... but prior to doing this, it is very important to fix postgreSQL folders permissions like you suggested to me. with sudo chown -R _postgres:_postgres /Library/Server/PostgreSQL/Data

     

    hope this can help anyone else with the same problem!

  • 7. Re: Profile manager and wiki read error
    trilogy1000 Level 1 Level 1 (45 points)

    Kudos to loup.bell!!

     

    This solved it for me. After trying any number of other options this was the only thing that worked.  I had no idea there was anything in /var/ and I'm sure this is where the problem was. Anyway, a huge thank you, we're happily running without the anoying read settings errors.