Calendarserver running, but not working

Hi All,


we are running the calendar service on Mac 10.11.6 with Server App 5.2.

Without updating or something like that the calendar isn’t working anymore.


In Console i get this massages:

08/05/18 16:46:27,248 com.apple.xpc.launchd[1]: (org.calendarserver.agent[80072]) Service exited with abnormal code: 1

08/05/18 16:46:27,248 com.apple.xpc.launchd[1]: (org.calendarserver.agent) Service only ran for 0 seconds. Pushing respawn out by 10 seconds.

08/05/18 16:46:27,393 com.apple.xpc.launchd[1]: (org.calendarserver.calendarserver[80080]) Service exited with abnormal code: 1

08/05/18 16:46:27,393 com.apple.xpc.launchd[1]: (org.calendarserver.calendarserver) Service only ran for 0 seconds. Pushing respawn out by 60 seconds.

I figured out that calenderserver can’t connect to the database and the problem was that the expected socket file/directory “/var/run/caldavd/PostgresSocket/.s.PGSQL.5432” doesn’t exists.

So i created them again:

cd /var/run

mkdir caldavd

mkdir caldavd/PostgresSocket

chown -R _calendar caldavd/

Than i tried to start Postgre again with:

sudo -u _calendar /Applications/Server.app/Contents/ServerRoot/usr/bin/postgres_real "-c" "listen_addresses=" "-c" "unix_socket_directories=/var/run/caldavd/PostgresSocket" "-c" "shared_buffers=165" "-c" "max_connections=110" "-c" "standard_conforming_strings=on" "-c" "unix_socket_permissions=0770" "-c" "log_lock_waits=TRUE" "-c" "deadlock_timeout=10" "-c" "log_line_prefix=%m [%p] " "-c" "log_directory=/Library/Server/Calendar and Contacts/Logs" "-c" "log_truncate_on_rotation=on" "-c" "log_filename=postgresql_%w.log" "-c" "log_rotation_age=1440" "-c" "logging_collector=on" "-c" "log_line_prefix=%t" -D /Library/Server/Calendar\ and\ Contacts/Data/Database.xpg/cluster.pg/


Now Postgre is running but the calendar server is still not working.


Here is the output of calendarserver_diagnose:

OS Build: 15G1004

Server Build: 16S1195


/Library/Server/Preferences/Calendar.plist exists and can be parsed

Prefs plist says ServerRoot directory is: /Library/Server/Calendar and Contacts

ServerRoot volume ok

/Library/Server/Calendar and Contacts/Config/caldavd-system.plist exists and can be parsed

/Library/Server/Calendar and Contacts/Config/caldavd-user.plist does not exist


Configuration:


Calendar and Contacts service processes:

USER PID %CPU %MEM RSS ELAPSED STARTED COMMAND

root 12867 0.0 0.3 29128 23:34:34 Mon May 7 16:56:57 2018 servermgr_calendar

_calendar 20886 0.0 0.0 696 14-01:22:39 Tue Apr 24 15:08:52 2018 /System/Library/Frameworks/CoreServices.framework/Frameworks/Metadata.framework /Versions/A/Support/mdflagwriter

_calendar 78345 0.0 0.0 520 05:39 Tue May 8 16:25:52 2018 postgres: logger process

_calendar 78347 0.0 0.0 1068 05:39 Tue May 8 16:25:52 2018 postgres: checkpointer process

_calendar 78348 0.0 0.0 828 05:39 Tue May 8 16:25:52 2018 postgres: writer process

_calendar 78349 0.0 0.0 748 05:39 Tue May 8 16:25:52 2018 postgres: wal writer process

_calendar 78350 0.0 0.0 1772 05:39 Tue May 8 16:25:52 2018 postgres: autovacuum launcher process

_calendar 78351 0.0 0.0 552 05:39 Tue May 8 16:25:52 2018 postgres: archiver process

_calendar 78352 0.0 0.0 852 05:39 Tue May 8 16:25:52 2018 postgres: stats collector process

root 78343 0.0 0.0 3072 05:39 Tue May 8 16:25:52 2018 sudo -u _calendar /Applications/Server.app/Contents/ServerRoot/usr/bin/postgres_real -c listen_addresses= -c unix_socket_directories=/var/run/caldavd/PostgresSocket -c shared_buffers=165 -c max_connections=110 -c standard_conforming_strings=on -c unix_socket_permissions=0770 -c log_lock_waits=TRUE -c deadlock_timeout=10 -c log_line_prefix=%m [%p] -c log_directory=/Library/Server/Calendar and Contacts/Logs -c log_truncate_on_rotation=on -c log_filename=postgresql_%w.log -c log_rotation_age=1440 -c logging_collector=on -c log_line_prefix=%t -D /Library/Server/Calendar and Contacts/Data/Database.xpg/cluster.pg/

_calendar 78344 0.0 0.1 7956 05:39 Tue May 8 16:25:52 2018 /Applications/Server.app/Contents/ServerRoot/usr/bin/postgres_real -c listen_addresses= -c unix_socket_directories=/var/run/caldavd/PostgresSocket -c shared_buffers=165 -c max_connections=110 -c standard_conforming_strings=on -c unix_socket_permissions=0770 -c log_lock_waits=TRUE -c deadlock_timeout=10 -c log_line_prefix=%m [%p] -c log_directory=/Library/Server/Calendar and Contacts/Logs -c log_truncate_on_rotation=on -c log_filename=postgresql_%w.log -c log_rotation_age=1440 -c logging_collector=on -c log_line_prefix=%t -D /Library/Server/Calendar and Contacts/Data/Database.xpg/cluster.pg/


Serverd status:

org.calendarserver.agent is enabled

org.calendarserver.calendarserver is enabled

org.calendarserver.relocate is enabled


Disk space on boot volume:

Filesystem Size Used Avail Capacity iused ifree %iused Mounted on

/dev/disk0s2 149G 79G 70G 54% 19378948 17117412 53% /


Disk space on service data volume:

Filesystem Size Used Avail Capacity iused ifree %iused Mounted on

/dev/disk0s2 149G 79G 70G 54% 19378948 17117412 53% /


Disk space used by Calendar and Contacts service:

4.0K /Library/Server/Calendar and Contacts/Config

704M /Library/Server/Calendar and Contacts/Data

56M /Library/Server/Calendar and Contacts/Logs



Postgres status for cluster /Library/Server/Calendar and Contacts/Data/Database.xpg/cluster.pg:

pg_ctl: server is running (PID: 78344)

/Applications/Server.app/Contents/ServerRoot/usr/bin/postgres_real "-c" "listen_addresses=" "-c" "unix_socket_directories=/var/run/caldavd/PostgresSocket" "-c" "shared_buffers=165" "-c" "max_connections=110" "-c" "standard_conforming_strings=on" "-c" "unix_socket_permissions=0770" "-c" "log_lock_waits=TRUE" "-c" "deadlock_timeout=10" "-c" "log_line_prefix=%m [%p] " "-c" "log_directory=/Library/Server/Calendar and Contacts/Logs" "-c" "log_truncate_on_rotation=on" "-c" "log_filename=postgresql_%w.log" "-c" "log_rotation_age=1440" "-c" "logging_collector=on" "-c" "log_line_prefix=%t" "-D" "/Library/Server/Calendar and Contacts/Data/Database.xpg/cluster.pg/"



Postgres content:


List of databases

Name | Owner | Encoding | Collate | Ctype | Access privileges

-----------+--------+----------+---------+-------+-------------------

caldav | caldav | UTF8 | C | C |

postgres | caldav | UTF8 | C | C |

template0 | caldav | UTF8 | C | C | =c/caldav +

| | | | | caldav=CTc/caldav

template1 | caldav | UTF8 | C | C | =c/caldav +

| | | | | caldav=CTc/caldav

(4 rows)



'calendarserver' table...

name | value

--------------------------+-------

VERSION | 63

CALENDAR-DATAVERSION | 6

ADDRESSBOOK-DATAVERSION | 2

NOTIFICATION-DATAVERSION | 1

MANAGED-ATTACHMENTS | 1

MIN-VALID-REVISION | 1378

(6 rows)



Number of calendar homes: 8

Number of calendar events: 318

Number of contacts homes: 0

Number of contacts cards: 0

Number of non-group delegate assignments: 2

Number of group delegate assignments: 0

'job' table...

job_id | work_type | priority | weight | not_before | assigned | overdue | failed | pause

--------+------------------------------+----------+--------+-------------------- --------+----------+---------+--------+-------

502993 | GROUP_CACHER_POLLING_WORK | 0 | 5 | 2018-04-07 01:33:03.841934 | | | 0 | 0

501649 | APN_PURGING_WORK | 0 | 5 | 2018-04-07 03:03:47.193065 | | | 0 | 0

503003 | IMIP_POLLING_WORK | 0 | 5 | 2018-04-07 01:33:19.137223 | | | 0 | 0

498512 | FIND_MIN_VALID_REVISION_WORK | 0 | 5 | 2018-04-07 15:01:47.274809 | | | 0 | 0

498514 | INBOX_CLEANUP_WORK | 0 | 5 | 2018-04-07 15:01:47.279631 | | | 0 | 0

501642 | PRINCIPAL_PURGE_POLLING_WORK | 0 | 5 | 2018-04-13 15:01:10.751866 | | | 0 | 0

(6 rows)




Agent:

Attempting to send a request to the agent...

Can't connect to agent: <urlopen error [Errno 61] Connection refused>


Server connection:

Traceback (most recent call last):

File "/Applications/Server.app/Contents/ServerRoot/usr/sbin/calendarserver_diagnose" , line 12, in <module>

load_entry_point('CalendarServer==9.0a1.dev0+62917155216af396d70d6b441b470e941c 919c47.head', 'console_scripts', 'calendarserver_diagnose')()

File "/Applications/Server.app/Contents/ServerRoot/Library/CalendarServer/lib/python 2.7/site-packages/calendarserver/tools/diagnose.py", line 150, in main

connectToCaldavd(keys)

File "/Applications/Server.app/Contents/ServerRoot/Library/CalendarServer/lib/python 2.7/site-packages/calendarserver/tools/diagnose.py", line 604, in connectToCaldavd

url = "https://{host}/principals/".format(host=keys["ServerHostName"])

KeyError: 'ServerHostName'


So, i’m now even more confused. ;-)

How can the socket dir disappear? Did i restart the database correctly? I didn’t found a start script, where is it?

If anybody have any ideas what’s going on, or have any tips for me.

I would be very grateful.


Cheers,

Marcus

iMac, OS X Server

Posted on May 8, 2018 8:31 AM

Reply

Similar questions

5 replies

May 29, 2018 8:16 AM in response to jepping

Hi Jeffrey,


i solved this problem. :-)

For the records:

Not with reinstall the server app, i found the mistake!

(As mentioned) i'm new to mac server and even more the newer server app version.

i trapped into the deeps architecture of this sand-boxed server system.

As i remember correctly i wasn't happy with the calendar web front end and missed some possibilities for adjustments.

So i installed some python modules(pytz,pycalendar).

This was the mistake! Don't mix up included services with your own.

After deinstallation everything works again.


I have some kind of diary of the server and here i saw that i installed something(which i actually can't remember).


Cheers

Marcus

May 14, 2018 8:51 AM in response to MarcusFromBamberg

Hi Marcus,


Stop the calendar server, export all user calendars on every local mac if possible.

Are there any more services running on this server? If not, I would do the following:

- export settings from the server.app or make screendumps of dns, export open directory and settings

- stop calendar server

- drag server.app to the trash

You will get a message that services have been stopped

- Go to /Library/Server and move Server folder to your Desktop.

- Download the latest version from the Mac AppStore

- Open the server.app and start fresh, setup a fixed IP address, dns and then import users, groups.

- Start the Calendar server and locally import all calendars into their new accounts.


This will take less time and provide a better starting point, then trying to fix everything that got broken. Those postgres sockets are really specific when it comes to settings and which instance to run...

If you have an older clone when the server was running, you could restore that copy.

Consider running this server as a virtual server inside vmware fusion or esxi to have more control and restore snapshots when things brake. Some day services will break for no apparent reason and being prepared will help.

Goodluck


Jeffrey

May 14, 2018 10:41 PM in response to MarcusFromBamberg

Hi Marcus,


You're welcome.

Well you already seem to have made some modifications to the default setup, so when dragging the server.app to the trash and letting /Library/Server reside might work when reinstalling the server.app. At least an import of that data will start again and it might get you to a working calendar server... might.

But this would be a lot of if's and might not work dependable later on.

Exporting ics files and importing them, will be a more certain way of controlling the data, but you would need delegate once again.

After all this, transferring the server to a virtual environment will give you more control.

Goodluck


Jeffrey

May 14, 2018 9:14 AM in response to jepping

Hi Jeffrey,


thanks for your adivce. :-)

I've read about the reinstallation proccess of the Server.app as a default step if the server is doing strange things.

I'm new to mac server, i'm used to linux systems. Sounds to be nearly the same, but with a fancy gui.

unfortunately it develops a life of its own.


OK, now the plan is to reinstall the server. A further question: If i let /Library/Server where it is, do the services(after reinstallation) automatically use the data there. Right now, the most important is the calendar data.

If i import the ics backups into the calendar, i have to invite all the users to the calendars again.


Consider running this server as a virtual server inside vmware fusion or esxi to have more control and restore snapshots when things brake. Some day services will break for no apparent reason and being prepared will help

This is a really good idea. We are planning to move to a new server and this goes into a virtual server for sure.


Cheers,

Marcus

May 30, 2018 4:49 AM in response to MarcusFromBamberg

Hi Marcus,


Glad to see you were able to fix it. Adding certain features to macOS server might get you some unwanted results.

You could build a virtual machine and test those extensions for calendar in a virtual environment and when it works and checks out, deploy towards a working environment.

With every new Apple update, any addons might get broken or stop working at all. When you just need a working calendar server consider the costs and the effort it requires to get it to work and to keep it working.

Goodluck


Jeffrey

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Calendarserver running, but not working

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.