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