I was excited to see this post as my contacts server has stopped working since I upgraded my server on Sunday to Server 3.2.2. I found this post after looking in the error log and seeing something about postgres not getting started. I'm definitely no expert, but I kind of understand what's happening in the suggested list of actions above, so I decided it couldn't hurt to try. To emphasize, it is CONTACTS that aren't working for me. Perhaps Calendars are in the same boat, but I don't use them so don't know.
I have already tried throwing the server app in the trash and restoring it - that did not fix anything and when doing the server setup it gave me the error message about configuration having failed.
I followed the steps through to "# Finish the upgrade job that never completed..." but when I ran the pg_upgrade command I got an error:
Database.xpg root# sudo -u _calendar /Applications/Server.app/Contents/ServerRoot/usr/bin/pg_upgrade -b /Applications/Server.app/Contents/ServerRoot/usr/libexec/postgresql9.2 -B /Applications/Server.app/Contents/ServerRoot/usr/bin -d /Library/Server/Calendar\ and\ Contacts/Data/Database.xpg/cluster.pg.original_for_upgrade/ -D /Library/Server/Calendar\ and\ Contacts/Data/Database.xpg/cluster.pg
Performing Consistency Checks
-----------------------------
Checking cluster versions ok
*failure*
Consult the last few lines of "pg_upgrade_server.log" for
the probable cause of the failure.
connection to database failed: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/Library/Server/Calendar and Contacts/Data/Database.xpg/.s.PGSQL.50432"?
could not connect to old postmaster started with the command:
"/Applications/Server.app/Contents/ServerRoot/usr/libexec/postgresql9.2/pg_ctl" -w -l "pg_upgrade_server.log" -D "/Library/Server/Calendar and Contacts/Data/Database.xpg/cluster.pg.original_for_upgrade/" -o "-p 50432 -b -c listen_addresses='' -c unix_socket_permissions=0700 -c unix_socket_directory='/Library/Server/Calendar and Contacts/Data/Database.xpg'" start
Failure, exiting
Taking a look at the last few lines of "pg_upgrade_server.log" I saw this:
-----------------------------------------------------------------
pg_upgrade run on Fri Apr 22 14:27:33 2016
-----------------------------------------------------------------
command: "/Applications/Server.app/Contents/ServerRoot/usr/libexec/postgresql9.2/pg_ctl" -w -l "pg_upgrade_server.log" -D "/Library/Server/Calendar and Contacts/Data/Database.xpg/cluster.pg.original_for_upgrade/" -o "-p 50432 -b -c listen_addresses='' -c unix_socket_permissions=0700 -c unix_socket_directory='/Library/Server/Calendar and Contacts/Data/Database.xpg'" start >> "pg_upgrade_server.log" 2>&1
waiting for server to start....LOG: database system was interrupted; last known up at 2013-11-26 15:11:55 PST
LOG: starting archive recovery
cp: ../backup/000000010000000000000002: No such file or directory
LOG: could not open file "pg_xlog/000000010000000000000002" (log file 0, segment 2): No such file or directory
LOG: invalid checkpoint record
FATAL: could not locate required checkpoint record
HINT: If you are not restoring from a backup, try removing the file "/Library/Server/Calendar and Contacts/Data/Database.xpg/cluster.pg.original_for_upgrade/backup_label".
LOG: startup process (PID 37871) exited with exit code 1
LOG: aborting startup due to startup process failure
........................................................... stopped waiting
pg_ctl: could not start server
Examine the log output.
I renamed the file "/Library/Server/Calendar and Contacts/Data/Database.xpg/cluster.pg.original_for_upgrade/backup_label" and tried running the pg_upgrade command again, but got the same error message. This time, the last few lines of "pg_upgrade_server.log" are:
-----------------------------------------------------------------
pg_upgrade run on Fri Apr 22 14:14:06 2016
-----------------------------------------------------------------
command: "/Applications/Server.app/Contents/ServerRoot/usr/libexec/postgresql9.2/pg_ctl" -w -l "pg_upgrade_server.log" -D "/Library/Server/Calendar and Contacts/Data/Database.xpg/cluster.pg.original_for_upgrade/" -o "-p 50432 -b -c listen_addresses='' -c unix_socket_permissions=0700 -c unix_socket_directory='/Library/Server/Calendar and Contacts/Data/Database.xpg'" start >> "pg_upgrade_server.log" 2>&1
waiting for server to start....LOG: database system was interrupted; last known up at 2013-11-26 15:11:55 PST
LOG: starting archive recovery
LOG: could not open file "pg_xlog/000000010000000000000002" (log file 0, segment 2): No such file or directory
LOG: invalid primary checkpoint record
LOG: could not open file "pg_xlog/000000010000000000000002" (log file 0, segment 2): No such file or directory
LOG: invalid secondary checkpoint record
PANIC: could not locate a valid checkpoint record
LOG: startup process (PID 37753) was terminated by signal 6: Abort trap
LOG: aborting startup due to startup process failure
........................................................... stopped waiting
pg_ctl: could not start server
Examine the log output.
Is there any easy solution for this? Am I doing the right steps for resolving the issue with cardav not working as opposed to caldav? We really need our contacts back!
What do I need to do to triage having run the first few commands and not being able to finish? My guess would be that I can just work backwards, but I don't want to make anything worse!
I will be so grateful for any help with this 🙂
Addendum:
Database.xpg root# ls backup
000000010000000000000002.00000028.backup 000000010000000000000005 00000001000000000000006D
000000010000000000000003 000000010000000000000006 base_backup
000000010000000000000004 00000001000000000000006B
000000010000000000000004.00000028.backup 00000001000000000000006C