calendarserver package broken

Bug #1600252 reported by HappyCamper
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
calendarserver (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

Hi

there are a number of things wrong with the current calendarserver package (7.0+dfsg-2) on Ubuntu 16.04 LTS server.

1. calendarserver can only work with a database backend, support for the files backend has been dropped upstream according to the docs. Yet, there is no dependency on any database, in particular postgresql.

2. The twisted framework seems to be missing gcc: "unable to execute 'x86_64-linux-gnu-gcc': No such file or directory" when starting caldavd. Not sure if fatal, may need python-dev to be installed as well.

3. There appears to be no method or script to create the required DB user and define the schema for the database. In past versions (<6.0) there was a calendarserver_bootstrap_database script. When you start caldavd now you will get an error in /var/log/caldavd/error.log:

" pg8000.core.ProgrammingError: (u'FATAL', u'3D000', u'database "caldav" does not exist', u'postinit.c', u'826', u'InitPostgres', u'', u'')"

I managed to modify Apple's original bootstrap_database script (attached) and use it to create a working calendar server. This is the original script:
https://svn.calendarserver.org/repository/calendarserver/CalendarServer/tags/release/CalendarServer-5.3/calendarserver/tools/bootstrapdatabase.py

Apart from the iOS paths there are a couple of things that need addressing for a port to Linux:
a. The database user should be "caldavd" not "caldav", to match the one in /etc/caldavd/caldavd.plist
b. The script assumes communication via UNIX sockets. With the default Postgresql config this means that the script must be run by the right user for authentication to succeed. Problem is that the script requires 2 different users.

    i. postgres to create the caldavd user and database
   ii. caldavd to set the database schema in the newly created database

So the createuser and createdb need to be run as postgres, and the PSQL commands as caldavd :-(

In my case I solved it by turning off exit-on-error and running the script as these two users.

Happy fixing.

Revision history for this message
HappyCamper (arno-cs) wrote :
Revision history for this message
Battant (mparchet) wrote :

Hello,

Here is my configuration
Ubuntu 16.04 64 bit
uname -r
4.4.0-22-generic

apt-cache policy calendarserver
calendarserver:
  Installed: 7.0+dfsg-2
  Candidate: 7.0+dfsg-2
  Version table:
 *** 7.0+dfsg-2 500
        500 http://ch.archive.ubuntu.com/ubuntu xenial/universe amd64 Packages
        100 /var/lib/dpkg/status

I have follow the README.debian file instruction

/usr/share/doc/calendarserver/README.Debian

and i have installed this package

sudo easy_install -U cffi (See this bug for details : https://bugs.launchpad.net/ubuntu/+source/python-pip/+bug/1512792

Problem :

When i try to start calendarserver with this command

"systemctl start calendarserver.service"

Calendarserver don't start

calendarserver.service - LSB: Calendar and Contacts Server
   Loaded: loaded (/etc/init.d/calendarserver; bad; vendor preset: enabled)
   Active: active (exited) since jeu. 2016-05-19 20:52:10 CEST; 35min ago
     Docs: man:systemd-sysv-generator(8)
    Tasks: 0 (limit: 512)

When I try to restart calendarserver with this command

" systemctl restart calendarserver.service"

Calendarserver is running

calendarserver.service - LSB: Calendar and Contacts Server
   Loaded: loaded (/etc/init.d/calendarserver; bad; vendor preset: enabled)
   Active: active (running) since jeu. 2016-05-19 21:32:16 CEST; 12s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 5317 ExecStop=/etc/init.d/calendarserver stop (code=exited, status=0/
  Process: 5327 ExecStart=/etc/init.d/calendarserver start (code=exited, status=
    Tasks: 8 (limit: 512)
   CGroup: /system.slice/calendarserver.service
           ├─5352 CalendarServer 7.0.a1+unknown [Combined]
           └─5354 memcached -U 0 -s /var/run/caldavd/memcache.sock -u caldavd

However about 5 minute later

Calendarserver exit without unexceptionally without message

● calendarserver.service - LSB: Calendar and Contacts Server
   Loaded: loaded (/etc/init.d/calendarserver; bad; vendor preset: enabled)
   Active: active (exited) since jeu. 2016-05-19 21:32:16 CEST; 11min ago
     Docs: man:systemd-sysv-generator(8)
  Process: 5317 ExecStop=/etc/init.d/calendarserver stop (code=exited, status=0/SUCCESS)
  Process: 5327 ExecStart=/etc/init.d/calendarserver start (code=exited, status=0/SUCCESS)

mai 19 21:32:15 mparchet-W240EU-W250EUQ-W270EUQ systemd[1]: Starting LSB: Calendar and Contacts Server...
mai 19 21:32:16 mparchet-W240EU-W250EUQ-W270EUQ systemd[1]: Started LSB: Calendar and Contacts Server.

In addition when I try to connect to this server with Evolution, I get the error message :

"Connection refused".

Could you help me please to solve both issues

Thanks in advance for your support

Best regards

Battant

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in calendarserver (Ubuntu):
status: New → Confirmed
Revision history for this message
Richard Johnson (rajid) wrote :

I used the bootstrapdatabase.py script provided by HappyCamper, changing SCHEMAFILE to:
  /usr/lib/python2.7/dist-packages/txdav/common/datastore/sql_schema/current.sql
and then ran it with:
  sudo -u caldavd /usr/bin/psql -h /var/run/postgresql -U caldavd -d caldav -f \
    /usr/lib/python2.7/dist-packages/txdav/common/datastore/sql_schema/current.sql
That worked just fine and I'm up and running!

Maybe the best course of action would be to make these changes, document how to run it, and include it into the next update. Having to search the net to find it here is quite ridiculous!

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.