Upgrading to 3.14
Note
This guide assumes that you are familiar and comfortable with administration of a Cyrus installation, and system administration in general.
It assumes you are installing from source or tarball. If you want to install from package, use the upgrade instructions from the package provider.
1. Preparation
Things to consider before you begin:
Versions to upgrade from
Before upgrading to 3.14, your deployment should be running 3.12.0 (or later)
If your existing deployment is older than this, you should first upgrade to 3.12, let it run for a while, resolve any issues that come up, and only then upgrade to 3.14.
Configuration that 3.14 will not start with
Check these settings before starting 3.14. Make the changes while still running 3.12 where possible.
Invalid configdirectory
configdirectory must be an absolute path other than /.
Overlapping partitions
master(8) will refuse to start if multiple partitions appear to be identical or overlap. (Issue #5573) If you are configured this way, this is already probably unsafe, and you should correct your configuration before attempting to upgrade.
Removed event parameter
Remove vnd.fastmail.counters from event_extra_params. An
unknown value there is a fatal configuration error. If your push consumers
need the per-type states, add vnd.fastmail.jmapStates, which reports the
same information as a map of JMAP data type to state string.
Removed httpd modules
Remove ischedule, domainkey, rss and cgi from
httpmodules, including service-specific overrides and any
alternate configuration files used by httpd. iSchedule is now used only
between the backends of a Cyrus Murder, where it needs no configuration beyond
proxyservers.
Removed services
NNTP and fud have been removed. Remove any SERVICES entries in
cyrus.conf(5) that run fud or nntpd. Master refuses to
start if a configured service executable is missing.
Other configuration updates
Remove scheduled fetchnews jobs from the EVENTS section of
cyrus.conf(5). A stale entry fails when the event runs.
Values stored in the /vendor/cmu/cyrus-imapd/news2mail annotation are
ignored. If you want to remove them, do so under 3.12 with
cyradm> mboxconfig <mailbox> news2mail "".
Objectstore
In the very unlikely event that you're using objectstore, you'll need to stop. That probably means replicating to a new Cyrus install without objectstore configured. Our view is that this is so unlikely that we are not preparing detailed instructions. If you are in this situation, contact us on the mailing list.
Deprecated options and changed defaults
Run cyr_info conf-lint (see step 5) to find options that are now
deprecated. The release notes list them.
None of them stops Cyrus from starting, but all of them are now ignored.
There's a new default tls_eccurve list. If you've got this
setting naming a single curve, you may wish to clear the setting and get the
list. If you enable http_allow_0rtt,
tls_session_timeout must not be 0, and you may want
tls_sessions_db: twom, or tls_sessions_db_path on a tmpfs.
URLAUTH has been removed. Users' mboxkey databases can be deleted.
If you set replicaonly on a server, clients that could previously
make local changes there (which then diverged from the master) now get errors
instead.
Logging
Audit logging is now always on. Sites that did not previously enable
auditlog will see event=auditlog.* entries in syslog, many at "info".
Your logging volume will increase. Make sure your logging setup is ready for
it, and consider limiting which syslog priorities are kept.
Cyrus now writes all of its syslog output as logfmt: each line is an
event= name followed by key=value pairs. Every log line has changed,
so anything that parses Cyrus logs will need updating.
Structured logging with logfmt describes the format, and doc/logfmt-keys in the
source lists the keys.
The first start
The first time ctl_cyrusdb(8) -r runs under 3.14, which is
normally in the START section of cyrus.conf(5), it scans
mailboxes.db and opens local mailboxes whose entries lack a unique id or
JMAP mailbox id. For each mailbox that needs a new JMAP id, it updates the
header and index as well as the database entry.
No 3.12 mailbox has a JMAP mailbox id, so on an upgrade from 3.12 this is every local mailbox on the server. You should expect that:
The first start takes time in proportion to the number of mailboxes. When run as a
STARTcommand, the work finishes before services start. Later starts are as quick as before.Creating a JMAP id raises the mailbox's modseq, so clients will see every mailbox as changed, and replication will pick up a change to every mailbox.
Each new id is logged as
ctl_cyrusdb.mailboxid.created.
If you would rather watch this happen than wait on your init system, run
ctl_cyrusdb -r by hand, as the cyrus user, before starting Cyrus.
If you replicate, upgrade the replica first and let it start before upgrading the source server. Recovery skips replica-only mailboxes. They receive their ids through replication after the source server creates them.
Compact ids
Nothing is required when upgrading. But the new compact_ids
option has a setting, always, which will be the only behavior in the next
major release, so now is a good time to migrate. For every user:
Upgrade all of their mailboxes to index version 20, with
reconstruct -V max -u <userid>.Upgrade their conversations database, with
ctl_conversationsdb -U <userid>.Enable compact ids, with
ctl_conversationsdb -I on <userid>.
Only when every user has been migrated, set compact_ids: always. After
that, compact ids cannot be turned off for any user. Set it identically on
all servers that replicate to one another or that participate in the same
Murder.
Turning on compact ids changes a user's JMAP ids, so JMAP clients will need to fetch their data again.
Search indexes
Existing Xapian indexes keep working. You should consider rebuilding them with squatter(8) if any of these matter to you:
Calendar events are now indexed under search parts of their own. Events already indexed are indexed that way only once the index is rebuilt.
squatter(8) now records the highest createdmodseq it has indexed, which JMAP
Email/queryChangesrelies on. An index that was fully built once and has been kept up to date by a rolling squatter needs nothing. Other indexes may give inconsistentEmail/queryChangesresults until they are rebuilt.The "category" comparator of
Email/queryneeds an index of version 17 or later to group bymessageId,referencesorinReplyTo. 3.12 wrote version 17, so this concerns only indexes last built by an older version. See also JMAP Email/query filter conditions.
Time zone data
Cyrus now builds and installs its own time zone data. An existing
zoneinfo_dir setting still wins, and existing time zone data
keeps working. The TZDist chapter of the CalDAV installation guide describes
how to switch to the data Cyrus installs.
Packagers: vzic is now a build-time dependency for the time zone data. See
the same chapter of the installation guide, or configure with
--without-vzic to keep shipping time zone data separately.
Replication
If you use sync_cache_db_path, a replica may be silently missing
users whose folders are all tombstoned in its mailboxes.db. Any whole-user
sync repairs such a user: run sync_client -u <user> or sync_client -A.
Replication no longer deletes the wrong mailbox when a mailbox name has been reused, but only once both ends have been upgraded.
The new /vendor/cmu/cyrus-imapd/accountid annotation is kept in
mailboxes.db and replicated with the INBOX. An older replica doesn't
store it, so upgrade replicas before setting it.
Tools and scripts
reconstruct(8) no longer re-injects message files that are missing from the index but have a UID the mailbox has already handed out. Scripts that rely on that must add
-k.If you access users' mailboxes as an admin and set
admins_get_internal_seen, useEXAMINEor fetch message content withBODY.PEEKorBINARY.PEEKto preserve the owner's\Seenflags.If you act on AclChange events, you will start seeing them for sharing changes made over JMAP and DAV. Their "user" field is empty.
If you relied on an annotator callout processing appends to non-email mailboxes, you will need to find another solution.
If you used
XSTATS, use the Prometheus metrics instead.installsieveis gone. Use sieveshell(1).
Client-visible changes
Review these changes for clients and integrations before upgrading the server.
IMAP and SASL:
On TLS 1.3, the channel binding for -PLUS SASL mechanisms is now
tls-exporter(RFC 9266). Clients that sendtls-uniqueover TLS 1.3 will fail to authenticate with those mechanisms. Clients that don't use channel binding are unaffected.Non-admin users must log in as
user+davto see or operate on calendars, address books and other non-email mailboxes over IMAP, including with theVENDOR.CMU-DAVLIST selection option.FETCH THREADIDreturnsTHREADID NILfor a message with no conversation, as RFC 8474 requires. It used to returnTHREADID (NIL).Cyrus advertises IMAP PREVIEW and accepts
FETCH PREVIEWonly whenjmap_preview_annotis set and begins with/shared/.Cyrus advertises SEARCH=FUZZY only when
search_engineisxapian. With other engines, Cyrus accepts and ignores the FUZZY search key, andsearch_fuzzy_alwayshas no effect.URLAUTH has been removed.
JMAP, all types:
Every method call but
Core/echomust carry anaccountId./queryand/queryChangesreturntotalonly when the request setscalculateTotal. These methods andSearchSnippet/getno longer echo the request's arguments, so a result reference to/filterno longer resolves./setrejects an update that changes an immutable or server-set property withinvalidProperties. Sending such a property with its current value is still allowed.Duplicate JSON member names are
notJSON; overlapping patch paths areinvalidPatch; a missingsinceStateisinvalidArguments; and/copyreportsfromAccountNotFoundfor an unusablefromAccountId.Clients must stop sending the
https://cyrusimap.org/ns/jmap/admincapability.UserCounters/getis gone. UseUserState/get.The
urn:ietf:params:jmap:blobcapability reportsmaxSizeBlobSetin octets, not kilobytes, andmaxDataSourcesis spelled that way.Blob/lookupreturnsunknownDataTypefor a type whose capability is not inusing.
JMAP Mail:
shareWithon a Mailbox needs theurn:ietf:params:jmap:mail:sharecapability, and its values are MailboxRights objects. ThemayRead,mayWriteandmayAdminrights are gone, andmyRightsno longer includesmayAdmin.Setting
shareWithon a Mailbox requires administrative access to it, or to its parent when creating one.The
imageSizeandisDeletedbody properties, and SearchSnippet attachments, needhttps://cyrusimap.org/ns/jmap/mailinusing.Email/querykeyword filters apply to the Email as a whole: "notKeyword" matches only if no copy of the Email has the keyword, and "hasKeyword" combined with "inMailbox" matches an Email whose flagged copy is in another mailbox.Email/queryadvertised a sort by "emailstate" that never worked. It is spelled "emailState", and now works.A Mailbox created without a
sortOrdergets 0, not 10.JMAP rejects mailbox names that Cyrus cannot represent. Cyrus also validates domains and user IDs in mailbox names more strictly.
An email can be moved into or out of the scheduled mailbox only by its EmailSubmission. Other attempts are
forbidden.EmailSubmission/setreturnsinvalidPropertiesfor an unknownemailId, andnoRecipientsfor an emptyrcptTo.MDN/sendrequiresidentityIdand anonSuccessUpdateEmailargument that sets$mdnsent, as RFC 9007 requires.The fallback identity for a user without a domain now uses
userid@defaultdomainwhendefaultdomainis set.MDN/sendandSieveScript/testuse the same address and now preferdefaultdomaintoservername.
JMAP Calendars and Contacts:
JMAP for Calendars accepts only JSCalendar 2.0 names. For example, on Calendar, use
maySharerather thanmayAdmin; on CalendarEvent, useiCalendarrather thancyrusimap.org:iCalProps.CalendarEvent/queryno longer acceptsinCalendars; use one or moreinCalendarconditions, combined with an "OR" operator.CalendarEvent/getcomputesutcStartandutcEndof floating events in Etc/UTC unless its newtimeZoneargument names another zone. It used the calendar's time zone.CalendarEvent/setrejects arecurrenceOverridespatch on a property that an override may not change, such asuidorrecurrenceRule. These were ignored.Calendar/setandAddressBook/setreject an empty name.ContactCard/setrejects a photo that is not an image, and members on a card whose kind is not "group". Editing an existing card whose photo is not an image fails until the photo is replaced.ContactCard/setfiles a new card with noaddressBookIdsin the address book markedisDefault. dblookup uses that address book when the request does not name a mailbox.The legacy
Contact/*andContactGroup/*methods are gone. UseContactCard/*.JMAP vCard blobIds issued by earlier versions are no longer accepted.
CalDAV and CardDAV:
A scheduling CalDAV PUT no longer returns an ETag.
xCal, the PATCH method, and the
application/event+jsonmedia type are no longer supported.CalDAV ignores the
Schedule-Sender-AddressandSchedule-Sender-Namerequest headers.A login as
user+defaultshows the user's default calendar or address book, rather than the collection named "Default", if those differ.DELETE and MOVE need both the
tanderights.CardDAV refuses to delete the address book marked
isDefault.DAV rejects collection names that Cyrus cannot represent.
How are you planning on upgrading?
Ideally, you will do a sandboxed test installation of 3.14 using a snapshot of your existing data before you switch off your existing installation.
Other possibilities are upgrading by replication, or upgrading in place.
The rest of the instructions are written assuming a sandboxed 3.14 installation, but you should read and understand them regardless of how you intend to perform the upgrade.
Upgrade by replicating
If you're familiar with replication, you can set up your existing installation to replicate data to a new 3.14 installation and failover to the new installation when you're ready. The replication protocol has been kept mostly backwards compatible.
Upgrade in place
If you are upgrading in place, you will need to shut down Cyrus entirely while you install the new package. You should probably also block logins or firewall off internet access until you're completely finished so that you aren't surprised by users reconnecting before the upgraded server is ready for them.
Run Cyrus maintenance commands as the cyrus user. For example, run
sudo -u cyrus cyr_info conf-lint -C /etc/imapd.conf -M /etc/cyrus.conf.
2. Install new 3.14 Cyrus
Download the release 3.14 package tarball.
Cyrus 3.14 needs newer versions of some libraries than 3.12 did, and some that were optional are now required:
OpenSSL 3.0 or later
libical 4.0.0 or later (or a compatible development snapshot reporting at least 3.99.99), libxml2, SQLite3 and
xxd, since HTTP and DAV support are now part of every build. Drop the--enable-httpand--enable-calalarmdconfigure options from build scripts.For Xapian search, Xapian 2.0.0 or later, or a recent 1.5.x snapshot, and a C++17 compiler. configure rejects older versions.
perl 5.28.0 or later, with the
MooandApp::Cmdmodulesgperfvzic, to build the time zone data (see Time zone data)
Your platform may not package versions this recent, in which case you will need to build them yourself.
See Compiling for the dependency list and Debian package names.
If you're on another platform and can provide the list of dependencies, please let us know via a GitHub issue or documentation pull request, or send mail to the developer list.
Follow the general install instructions.
Note
It's best to ensure your new Cyrus will not start up automatically if your server restarts in the middle of the upgrade.
How this is best achieved will depend upon your OS and distro, but may
involve something like systemctl disable cyrus-imapd or
update-rc.d cyrus-imapd disable
3. Shut down existing Cyrus
Shut down your existing Cyrus installation with its init script or whatever method you normally use.
This is necessary to guarantee a clean data snapshot.
4. Backup and Copy existing data
We recommend backing up all your data before continuing.
Sieve scripts
Config files
Mail spool
Copy all of this to the new instance, using rsync or similar tools.
Note
Cyrus keeps its data and databases in various locations, some of which may be tailored by your configuration. Please consult File & Directory Locations for guidance on where data lives in your current installation.
For example, to copy from an existing Debian or Ubuntu installation using their standard locations, you might execute this series of commands on the new server (where "oldimap" is the name of the old server):
rsync -aHv oldimap:/var/lib/cyrus/. /var/lib/cyrus/.
rsync -aHv oldimap:/var/spool/cyrus/. /var/spool/cyrus/.
You don't need to copy the following databases as Cyrus 3.14 will recreate these for you automatically:
duplicate delivery (deliver.db),
TLS cache (tls_sessions.db),
PTS cache (ptscache.db),
STATUS cache (statuscache.db).
Note
You may wish to consider relocating these four databases to ephemeral
storage, such as /run/cyrus (Debian/Ubuntu) or /var/run/cyrus
or whatever suitable tmpfs is provided on your distro. It will place
less IO load on your disks and run faster.
5. Copy config files and update
Again, check the locations on your specific installation. For example,
on FreeBSD systems, the configuration files imapd.conf(5)
and cyrus.conf(5) are in /usr/local/etc, rather than
/etc/. Run this command on the old server:
scp /etc/cyrus.conf /etc/imapd.conf newimap:/etc/
Using the cyr_info(8) command, check to see if your imapd.conf file contains any deprecated options. Run this command on the new server:
cyr_info conf-lint -C <path to imapd.conf> -M <path to cyrus.conf>
You need to provide both imapd.conf and cyrus.conf so that conf-lint knows the names of all your services and can check service-specific overrides.
To check your entire system's configuration you can use the conf-all action. This command takes all the system defaults, along with anything you have provided overrides for in your config files:
cyr_info conf-all -C <path to imapd.conf> -M <path to cyrus.conf>
Add -s 3.12.0 to highlight the options that are new, or whose behavior
has changed, since 3.12.
6. Upgrade specific items
If you have not already done so, check your configuration against Configuration that 3.14 will not start with and make the changes that apply to your site.
7. Start new 3.14 Cyrus and verify
Start Cyrus using your regular service manager or init script. Allow time for The first start, then check the service logs for errors and verify that Cyrus 3.14 can access the migrated data before allowing client traffic.
If something has gone wrong, contact us on the mailing list. You can revert to backups and keep processing mail using your old version until you're able to finish your 3.14 installation.
Note
If you've disabled your system startup scripts, as recommended in
step 2, remember to re-enable them. Use something like systemctl
enable cyrus-imapd or update-rc.d cyrus-imapd enable
8. Reconstruct databases and cache
The following steps can each take a long time, so we recommend running them one at a time (to reduce locking contention and high I/O load).
To upgrade all the mailboxes to the latest version, which is 20 in Cyrus 3.14. This will take hours, possibly days. Once a mailbox has been upgraded, 3.12 can no longer read it, so do this only when you are sure you won't be going back.
reconstruct -V max
maxheaderlines now counts headers rather than header lines.
Under 3.12, a message with a header folded over very many lines could have
the headers after it left out of its cache record. Such messages keep their
incomplete cache records until reparsed. To fix them, run this on the
affected mailboxes:
reconstruct -G
To upgrade a user's conversations database to the latest version:
ctl_conversationsdb -U <userid>
or, for every user:
ctl_conversationsdb -U -r
DAV databases from 3.12 are migrated automatically when opened.
Use dav_reconstruct if you need to repair a DAV database from its mailbox
data.
If you suspect incorrect quota usage, recalculate it with:
quota -f
If you use reverseacls and see stale or missing entries for shared
mailboxes, you can rebuild the reverse-ACL data in mailboxes.db.
ctl_cyrusdb -r performs this work when the setting changes. To force a
rebuild:
Shut down Cyrus
Change
reverseaclsto 0Run ctl_cyrusdb(8) with the -r switch (or just start Cyrus, assuming your cyrus.conf(5) contains a ctl_cyrusdb -r entry in the START section). The old RACL entries will be removed
(If you started Cyrus, shut it down again)
Change reverseacls back to 1
Start up Cyrus (or run ctl_cyrusdb -r). The RACL entries will be rebuilt
There are fixes and improvements to search indexing in 3.14. See Search indexes for whether to rebuild your search indexes with squatter(8). This will probably take a long time.
9. Enable optional features
See the 3.14 release notes for the full list of new features.
To use the
twomdatabase backend, set the backend for each database type you want to convert. Withcyrusdb_autoconvert, databases are converted as they are opened; otherwise convert them by hand. No default has changed.To send metadata and annotation change events to notifyd, add
metadatatoevent_groups. The IMAP notifications of those changes need idled.To have master(8) wait for idled before starting services, add
wait=yto the idled entry in theDAEMONsection of cyrus.conf(5).To allow WebDAV locks longer than five minutes, raise
dav_writelock_max_timeout.To accept SMTPUTF8 in lmtpd, disable both
munge8bitandreject8bit.
Special note for Murder configurations
If you upgrade murder frontends before you upgrade all the backends, they may advertise features to clients which the backends don't support, which will cause the commands to fail when they are proxied to the backend.
Generally accepted wisdom when upgrading a Murder configuration is to upgrade all your back end servers first. This can be done one at a time.
Upgrade your mupdate master and front ends last.
When a 3.12 backend uses XFER to move mailboxes to a 3.14 backend that
advertises replication, it transfers mailbox data through replication. The
3.14 backend creates the destination indexes and can inherit an older index
version from an existing parent mailbox. When XFER falls back to the legacy
dump and undump path, a 3.12 source recognises a 3.14 destination as supporting
version 19 and can transfer version 19 indexes directly. To convert any
remaining older indexes, run reconstruct -V max on the destination when
ready to adopt version 20.
Earlier upgrades
These notes concern upgrades to versions before 3.14. They are kept here because the release notes of those versions refer to them.
JMAP Email/query filter conditions
3.12 added the JMAP Email/query filter conditions messageId,
references, and inReplyTo.
It is recommended to rebuild the Xapian index with squatter(8) to make use of these filter conditions. Otherwise, email queries having these filters fall back to reading the MIME headers from disk, resulting in slower search.
PCRE2 support
Since 3.10, Cyrus prefers PCRE2 over PCRE if both are installed. If you have
both installed and wish to use PCRE rather than PCRE2, run configure with
--disable-pcre2.
If you haven't specifically installed libpcre2-dev (or whatever your system's
equivalent is), you might still have parts of pcre2 installed due to other
packages on your system depending on it. This can confuse configure into
thinking you have a usable PCRE2 when you don't. Either properly install
libpcre2-dev so Cyrus can use it, or configure Cyrus with --disable-pcre2
so that it ignores the partial installation.
Please note that on Debian-based systems, PCRE (the old one, no longer maintained) is called "pcre3". Yes, this is confusing.