6

I recently updated my Mac Mini Server to Yosemite and the Server app 4.0. When I tried to verify that Postgres is available by executing sudo serveradmin fullstatus postgres I get the following error:

postgres:error = <62706c69 73743030 d4010203 04050618 19582476 65727369 6f6e5824 6f626a65 63747359 24617263 68697665 72542474 6f701200 0186a0a4 07081112 55246e75 6c6cd409 0a0b0c0d 0e0f1056 4e53436f 64655a4e 53557365 72496e66 6f584e53 446f6d61 696e5624 636c6173 73100180 00800280 035f1014 636f6d2e 6170706c 652e7365 72766572 6d677264 d2131415 165a2463 6c617373 6e616d65 5824636c 61737365 73574e53 4572726f 72a21517 584e534f 626a6563 745f100f 4e534b65 79656441 72636869 766572d1 1a1b5472 6f6f7480 0108111a 232d3237 3c424b52 5d666d6f 7173758c 919ca5ad b0b9cbce d3000000 00000001 01000000 00000000 1c000000 00000000 00000000 00000000 d5>
postgres:errorDescription = "The operation couldn’t be completed. (com.apple.servermgrd error 1.)"
postgres:errorCode = 1

When I attempted to execute sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.servermgrd.plist I got the following error:

/System/Library/LaunchDaemons/com.apple.servermgrd.plist: No such file or directory

I tried doing the same in /Library/Preferences/com.apple.servermgrd.plist and got the following error:

/Library/Preferences/com.apple.servermgrd.plist: Invalid or missing service identifier

My guess is that the first file is the one it's trying to access which is missing. I'm not sure what deleted the file. How can I create this file? I have websites using the Web Service that are down.

I guess if I cannot figure it out I will restore to the backup right before I upgraded to Yosemite on both my servers. Oh well.

  • What do you need PostGreSQL for? – klanomath Nov 7 '14 at 19:46
  • I'm using PostgreSQL databases in my Ruby on Rails applications. I just restored both my servers back to the last backup using Mavericks. I have since found that there is another problem with Yosemite deleting or not converting PostgreSQL databases. I'm sticking with Maverick on my servers for now until I am successful in using postgres.app or another way to install another installation of PostgreSQL. Glad I only had one record that was not updated before I did my restore. – Pamela Cook - LightBe Corp Nov 8 '14 at 0:27
8

"Invalid or missing service identifier" seems to mean that your plist file has not got or has misspelled a section like

<key>Label</key>
<string>com.foo.bar</string>

Note "Label" must start with upper case L.

1

Starting with OS X Server version 4.0 it seems like Apple doesn't want us to use the built-in PostgreSQL:

The Postgres database used by OS X Server is only intended for use with service data used by the system. Avoid adding custom content to this database. If you’d like to run Postgres on your OS X Server, you should download and install your own instance.

But there is still a way to use it. Use the following commands in Terminal:

sudo mkdir -p /Library/Server/PostgreSQL/Config
sudo chown -R _postgres:_postgres /Library/Server/PostgreSQL
sudo -u _postgres vim /Library/Server/PostgreSQL/Config/org.postgresql.postgres.plist

then copy, paste and save this:

<?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_directories=/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>

Also edit

sudo vim /System/Library/LaunchDaemons/org.postgresql.postgres.plist

then copy and paste this:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Disabled</key>
    <true/>
    <key>Label</key>
    <string>org.postgresql.postgres</string>
    <key>UserName</key>
    <string>_postgres</string>
    <key>GroupName</key>
    <string>_postgres</string>
    <key>ProgramArguments</key>
    <array>
        <string>/Applications/Server.app/Contents/ServerRoot/usr/bin/postgres</string>
        <string>--apple-configuration</string>
        <string>/Library/Server/PostgreSQL/Config/org.postgresql.postgres.plist</string>
    </array>
    <key>OnDemand</key>
    <false/>
    <key>StandardErrorPath</key>
    <string>/Library/Logs/PostgreSQL/PostgreSQL.log</string>
    <key>StandardOutPath</key>
    <string>/Library/Logs/PostgreSQL/PostgreSQL.log</string>
</dict>
</plist>

To install do

sudo launchctl load -w /System/Library/LaunchDaemons/org.postgresql.postgres.plist
sudo -u _postgres psql postgres

and Postgres will greet you with

psql (9.3.5)
Type "help" for help.
postgres=# 
  • I went back to Mavericks because I had way more problems with Yosemite. Thankfully I did not lost many updates. I will see if I need to use the Server app for anything. The one thing I need to figure out is how to host a plain html5 website without using the Web Server in the Server app. If I can figure that out I will not use it and install Postgres.app. Since it looks like a lot of work to use the built in postgreSQL when I upgrade to Yosemite I will not use it. I have saved this link just in case I change my mind. Thanks for the info. – Pamela Cook - LightBe Corp Jan 26 '15 at 16:31
0

In the more recent versions of Mac OS X Server (really anything running out of Server.app), the launchd plist file for the server backend daemon lives inside of the Server.app bundle itself and is no longer directly managed by launchctl. If you have a file at the old path, it will be left over from an earlier system and no longer functional.

Likewise with the com.apple.servermgrd.plist file in the preferences, it is not a launchd job plist and cannot be loaded by launchctl.

The bulk of the config files in Server 4.0 and later live in /Library/Server

  • I started using Postgres.app for my databases not too long after I posted this question to avoid problems like this in the future. It took five minutes to set up. I use LaunchD Task Scheduler to create regular backups using pg_dump/pg_dumpall. – Pamela Cook - LightBe Corp Feb 13 '16 at 15:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .