Segmentation fault in stalwart-migrate

Issue Description

Migrating to 1.0 gets a segmentation fault during copying of one old account.

$ sudo stalwart-migrate run   --source /opt/mail/stalwart/v0.16.26/etc/config.json   --target /etc/stalwart-v1/config.json   --state /var/lib/stalwart-migrate   --owner "$(id -u stalwart-mail):$(id -g stalwart-mail)" --log-level trace
[…]

2026-10-27T11:14:14.454329Z DEBUG rustls::webpki::anchors: add_parsable_certificates processed 118 valid and 0 invalid certs
2026-10-27T11:14:14.454389Z DEBUG rustls_platform_verifier::verification::others: Loaded 118 CA root certificates from the system
2026-10-27T11:14:14.522357Z DEBUG rustls::webpki::anchors: add_parsable_certificates processed 118 valid and 0 invalid certs
2026-10-27T11:14:14.522422Z DEBUG rustls_platform_verifier::verification::others: Loaded 118 CA root certificates from the system
2026-10-27T11:14:14.523463Z  INFO migrate::orchestrator::account: account pass started accounts=6 removed=0
2026-10-27T11:14:14.523921Z DEBUG migrate::orchestrator::job: full copy account_id=62 full_target=52193
2026-10-27T11:14:14.524022Z DEBUG migrate::orchestrator::job: full copy account_id=91 full_target=2094
2026-10-27T11:14:14.524078Z DEBUG migrate::orchestrator::job: full copy account_id=43 full_target=4809
2026-10-27T11:14:14.524111Z DEBUG migrate::orchestrator::job: full copy account_id=55 full_target=1097
2026-10-27T11:14:14.525286Z DEBUG migrate::orchestrator::job: full copy account_id=25 full_target=633
2026-10-27T11:14:14.525302Z DEBUG migrate::orchestrator::job: full copy account_id=93 full_target=3
Segmentation fault         sudo stalwart-migrate run --source /opt/mail/stalwart/v0.16.26/etc/config.json --target /etc/stalwart-v1/config.json --state /var/lib/stalwart-migrate --owner "$(id -u stalwart-mail):$(id -g stalwart-mail)" --log-level trace

Expected Behavior

I’d expect stalwart-migrate to complete the migration run - or at least report an error if something is off.

Actual Behavior

Segmentation fault see above

Reproduction Steps

Following the migration guide at: Quick migration guide | Stalwart
during step 5 copy data while v0.16 runs (slight adjustments due to my settings see commands above)

Relevant Log Output

2026-10-27T11:26:22.227376Z DEBUG rustls::webpki::anchors: add_parsable_certificates processed 118 valid and 0 invalid certs
2026-10-27T11:26:22.227437Z DEBUG rustls_platform_verifier::verification::others: Loaded 118 CA root certificates from the system
2026-10-27T11:26:22.296985Z DEBUG rustls::webpki::anchors: add_parsable_certificates processed 118 valid and 0 invalid certs
2026-10-27T11:26:22.297052Z DEBUG rustls_platform_verifier::verification::others: Loaded 118 CA root certificates from the system
2026-10-27T11:26:22.298248Z  INFO migrate::orchestrator::account: account pass started accounts=6 removed=0
2026-10-27T11:26:22.299168Z DEBUG migrate::orchestrator::job: full copy account_id=91 full_target=2094
2026-10-27T11:26:22.299173Z DEBUG migrate::orchestrator::job: full copy account_id=55 full_target=1097
2026-10-27T11:26:22.299197Z DEBUG migrate::orchestrator::job: full copy account_id=43 full_target=4809
2026-10-27T11:26:22.299289Z DEBUG migrate::orchestrator::job: full copy account_id=93 full_target=3
2026-10-27T11:26:22.299854Z DEBUG migrate::orchestrator::job: full copy account_id=62 full_target=52193
2026-10-27T11:26:22.300454Z DEBUG migrate::orchestrator::job: full copy account_id=25 full_target=633
2026-10-27T11:26:22.315068Z  INFO migrate::orchestrator::job: account done account_id=93 checkpoint=3
Segmentation fault         sudo stalwart-migrate run --final --source /opt/mail/stalwart/v0.16.26/etc/config.json --target /etc/stalwart-v1/config.json --state /var/lib/stalwart-migrate --owner "$(id -u stalwart-mail):$(id -g stalwart-mail)" --log-level trace

Stalwart Version

v1.x

Installation Method

Binary (Linux)

Database Backend

RocksDB

Blob Storage

RocksDB

Search Engine

Internal

Directory Backend

Internal

I have reviewed the documentation and FAQ and confirm that my issue is NOT addressed there.

on

I have searched this support forum (open and closed topics) and confirm this is not a duplicate.

on

I understand that topics in this category are triaged by a bot first but a human reply will follow up. If I’d prefer a human-only reply, I’ll add the no-ai tag to my topic.

on

Your source is on v0.16.26, but the migration docs require the source to be 0.16.27. That is the only documented requirement your logs contradict, and it may or may not be what causes the crash.

The requirements page says: “The source runs Stalwart 0.16.27. Earlier 0.16 releases are upgraded to 0.16.27 first.” Your source path is /opt/mail/stalwart/v0.16.26/..., so I’d upgrade the source to 0.16.27 and then re-run stalwart-migrate run. The run can be resumed by repeating the same command.

I found nothing in the docs about a segmentation fault in stalwart-migrate, so I can’t say the version mismatch is the cause. A segfault instead of an error message looks like a bug in the tool. If it still crashes on 0.16.27, a human will need to look at it. These details would help them:

  • The exact stalwart-migrate version.
  • Whether the crash always happens right after account 93 finishes.
  • Whether the target directory was empty before the first run. The target must be a new, empty store, and a failed first run may have left a partial one behind.
  • Whether dmesg or journalctl shows more about the crash.

Docs: Overview | Stalwart

This is an automated reply from the Stalwart Help Bot. Other community members may follow up if this answer is incomplete or wrong.

Thanks for pointing the version out. My bad I thought I had the most recent one but must have missed the 0.16.27 unfortunately upgrading to v 0.16.27 did not help though.

I just restarted the migration script with the new version `v0.16.27` , a new config and a new empty store the problem persists:

[root@webserver stalwart]# sudo stalwart-migrate run   --source /opt/mail/stalwart/v0.16.26/etc/config.json   --target /etc/stalwart-v1/config.json   --state /var/lib/stalwart-migrate-v1   --owner "$(id -u stalwart-mail):$(id -g stalwart-mail)"
2026-10-27T11:46:07.582666Z  INFO migrate::commands::run: run state=/var/lib/stalwart-migrate-v1/state.sqlite source=/opt/mail/stalwart/v0.16.26/etc/config.json target=/etc/stalwart-v1/config.json categories=settings,principals,mail,calendars,contacts,files,sieve,identities,push_subscriptions,spam_samples,reports,archive,spam_model,queue,tasks,telemetry blob_mode=Copy edition="enterprise" concurrency=16
2026-10-27T11:46:08.096814Z  INFO migrate::orchestrator::account: account pass started accounts=6 removed=0
Segmentation fault         sudo stalwart-migrate run --source /opt/mail/stalwart/v0.16.26/etc/config.json --target /etc/stalwart-v1/config.json --state /var/lib/stalwart-migrate-v1 --owner "$(id -u stalwart-mail):$(id -g stalwart-mail)"
[root@webserver stalwart]# stalwart-migrate --version
stalwart-migrate 1.0.1
[root@webserver stalwart]#

I do not see anything usefull in dmesg or journal.

I am on arm64 too as the other issue opened at the same time: Stalwart-migrate 1.0.1 segfault on aarch64 - #3 by enaut

Hi @enaut, this one is on our side. It’s the same arm64 crash as in the other topic, and it has nothing to do with your config or the 0.16 version you migrate from, so the upgrade to 0.16.27 couldn’t have helped.

The cause is how our aarch64 release binaries were compiled: RocksDB’s write queue uses an atomic operation that, in this build, can fail spuriously under concurrent writes, and RocksDB then dereferences a NULL pointer. That’s why it dies a few seconds into the account pass with nothing in the log.

It’s fixed for the next weekly Stalwart release and the next stalwart-migrate release. Your state in /var/lib/stalwart-migrate-v1 stays valid, so rerunning the same command with the new binary continues from there. If you don’t want to wait, a stalwart-migrate built from source on the server itself doesn’t have the problem; see Building from source (keep the default enterprise feature, since your status shows the enterprise edition).