apple / ccs-calendarserver

The Calendar and Contacts Server.
https://www.calendarserver.org
Apache License 2.0
483 stars 137 forks source link

Not able to start server #532

Open hemantlinux opened 5 years ago

hemantlinux commented 5 years ago

calendar server is not starting up. Error msg is below :-

Starting server... Reading configuration from file: /root/ccs-calendarserver-CalendarServer-9.0/conf/caldavd-dev.plist Removing stale pidfile /root/ccs-calendarserver-CalendarServer-9.0/data/Logs/state/caldavd.pid 2019-03-25T02:51:40-0400 [-] Log opened. 2019-03-25T02:51:40-0400 [-] twistd 15.4.0 (/root/ccs-calendarserver-CalendarServer-9.0/.develop/virtualenv/bin/python 2.7.10) starting up. 2019-03-25T02:51:40-0400 [-] reactor class: twisted.internet.epollreactor.EPollReactor. 2019-03-25T02:51:40-0400 [-] AMPPushNotifierFactory starting on 62311 2019-03-25T02:51:40-0400 [-] ControlSocket starting on './data/Logs/state/caldavd.sock' 2019-03-25T02:51:40-0400 [txdav.base.datastore.subpostgres#info] Running initdb for /root/ccs-calendarserver-CalendarServer-9.0/data/Data/Database/cluster 2019-03-25T02:51:40-0400 [memcached-Default] can't run as root without the -u switch 2019-03-25T02:51:40-0400 [txdav.base.datastore.subpostgres#info] Requesting postgres start via: ['/root/ccs-calendarserver-CalendarServer-9.0/.develop/roots/PostgreSQL/bin/pg_ctl', 'start', '--log=/root/ccs-calendarserver-CalendarServer-9.0/data/Logs/postgres.log', '--timeout=86400', '-w', '-o', "-c listen_addresses='' -c unix_socket_directories=/tmp/ccs_postgres_2d3c45f8111867257a9fcaeeeb0cd115 -c shared_buffers=49 -c max_connections=33 -c standard_conforming_strings=on -c unix_socket_permissions=0770 -c log_line_prefix=%t"] 2019-03-25T02:51:40-0400 [txdav.base.datastore.subpostgres.PostgresMonitor#info] 2019-03-25T02:51:40-0400 [twisted.logger._global#warn] /root/ccs-calendarserver-CalendarServer-9.0/.develop/virtualenv/lib/python2.7/site-packages/twisted/python/util.py:765: exceptions.UserWarning: tried to drop privileges and setuid 0 but uid is already 0; should we be root? Continuing. 2019-03-25T02:51:40-0400 [txdav.base.datastore.subpostgres.PostgresMonitor#error] pg_ctl: cannot be run as root 2019-03-25T02:51:40-0400 [txdav.base.datastore.subpostgres.PostgresMonitor#error] Please log in (using, e.g., "su") as the (unprivileged) user that will 2019-03-25T02:51:40-0400 [txdav.base.datastore.subpostgres.PostgresMonitor#error] own the server process. 2019-03-25T02:51:40-0400 [txdav.base.datastore.subpostgres.PostgresMonitor#info] pg_ctl process ended with status=256 2019-03-25T02:51:40-0400 [txdav.base.datastore.subpostgres.PostgresMonitor#error] Could not start postgres; see postgres.log 2019-03-25T02:51:40-0400 [txdav.base.datastore.subpostgres#critical] Can't start or connect to postgres: No such socket file: /tmp/ccs_postgres_2d3c45f8111867257a9fcaeeeb0cd115/.s.PGSQL.5432 2019-03-25T02:51:40-0400 [-] (UNIX Port ./data/Logs/state/caldavd.sock Closed) 2019-03-25T02:51:40-0400 [-] (TCP Port 62311 Closed)

dreness commented 5 years ago

In this particular case, it looks like Postgres is trying to start as root, which it doesn't like to do. The general guidance is to use a non-root account as the owner and executor of CalendarServer and related services (postgres, memcached). See caldavd-apple.plist for an example - note the places where the "_calendar" user is referenced. To see a generic plist of all possible options (plus comments), check out caldavd-stdconfig.plist.