Stalwart-migrate with rootless Podman?

Your question

The migration guide says:

For a server running in Docker, run the tool from its image instead, as a Compose service that shares the volumes, network and environment of the Stalwart service. Every stalwart-migrate command below then becomes docker compose run --rm migrate . Such commands need neither sudo nor --owner, because the container runs as the same user as the Stalwart container.

Here, Stalwart runs a rootless Podman Quadlet. The UID it uses is 101999. How do I have to use stalwart-migrate in this case? How can I make sure that there are no permission issues?

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

Short version: the docs don’t cover rootless Podman specifically, but the ownership rules they describe let you work out the setup. This is my own inference from those rules, not a documented procedure.

What the docs say

  • The migrate image runs as the stalwart user (uid/gid 2000) inside the container. The files it creates then belong to whichever user the 1.0 container runs as, as long as both containers run with the same user.
  • --owner UID:GID sets the owner of the files and directories the tool creates for the target. It matters when the tool runs as root and the 1.0 server runs as another user.
  • Without --owner, a run as root produces a warning before any target file is created, and the 1.0 server may be unable to open those files.

What this means for your Quadlet setup

  1. Run the migrate container the same way as your Stalwart Quadlet, as a .container unit or a one-off podman run. Use the same User=/UserNS= settings and the same Network=, EnvironmentFile= and Volume= entries.
  2. Mount the volumes at the paths from the docs:
    • /etc/stalwart:ro and /var/lib/stalwart for 0.16.
    • /etc/stalwart-v1 and /var/lib/stalwart-v1 for the new store.
    • /var/lib/stalwart-migrate for the state directory.
  3. Mount the new data volume in the 1.0 container at the path the target config names. That is /var/lib/stalwart-v1 in the docs’ examples. Alternatively, use --target-path-map.
  4. Check ownership as seen from inside the containers. With rootless Podman, container uid 2000 maps to a host subuid, which is probably where your 101999 comes from. Container uid 2000 would be host uid 100000 + 1999 = 101999 if your subuid range starts at 100000. That is consistent with the image’s uid 2000 and the same user mapping. If the migrate container uses the same user namespace as Stalwart, the files it creates will already have the right owner, and you need neither --owner nor sudo.
  5. If you run the tool as root inside the container (or without a matching user namespace), pass --owner with the uid:gid as the 1.0 container sees it, for example --owner 2000:2000. Don’t pass the host-side 101999 from inside the container. You can also run podman unshare chown -R 2000:2000 <dir> on the host data directory afterwards.
  6. Test before the final run. ls -ln the new data directory from inside both containers, and run prepare first (it needs a terminal, so use -it). If the files show uid 2000 in the 1.0 container, the 1.0 server can open them.

Docs: Installation | Stalwart (sections “Running the Docker image” and “Paths and file ownership”).

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

Thanks, permissions are ok. After step 5 (Copy the data while 0.16 runs) I see one error:

2026-10-26T17:59:02.149824Z ERROR migrate::orchestrator: run finished with objects that could not be copied; see the report errors=1
$ podman run --rm -it -v /srv/podvols/stalwart-state/:/var/lib/stalwart-migrate ghcr.io/stalwartlabs/stalwart-migrate report --state /var/lib/stalwart-migrate --severity errorrun    severity category   account    object               id                   message
1      error    skipped    -          x:SpamTrainingSample 328762709843335680   blob f204814b9b0f2f4359461f99c4ca6883cc4d5ccb7f5ef5cd5fb822cbe9ee9296 is missing in the source; the object was not copied
1 rows

This seems to apply only to a spam sample, right? Can I ignore that and proceed?

Hmm, I tried to proceed, but:

2026-10-26T18:28:09.162489Z  WARN hickory_net::dnssec: response does not contain NSEC or NSEC3 records. Query: Query { name: Name("."), query_type: DNSKEY, query_class: IN } response: DnsResponse { message: Message { metadata: Metadata { id: 12548, message_type: Response, op_code: Query, authoritative: false, truncation: false, recursion_desired: false, recursion_available: false, authentic_data: false, checking_disabled: false, response_code: NXDomain }, queries: [Query { name: Name("."), query_type: DNSKEY, query_class: IN }], answers: [], authorities: [], additionals: [], signature: None, edns: None }, buffer: [49, 4, 128, 3, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 48, 0, 1] }
2026-10-26T18:28:09.417364Z  INFO migrate::orchestrator::account: account pass started accounts=9 removed=0
2026-10-26T18:28:09.660367Z  INFO migrate::orchestrator::finalize: finalizing target accounts=9
2026-10-26T18:28:09.664586Z  INFO migrate::orchestrator: run finished run_id=6 status=ok stats={"accounts_delta":0,"accounts_failed":0,"accounts_full":0,"accounts_removed":0,"accounts_unchanged":9,"accounts_wiped":0,"blob_bytes":0,"blobs_copied":0,"bytes_written":0,"emails_written":0,"errors":0,"global_deleted":0,"global_records":0,"issues":35,"log_rows":0,"objects_deleted":0,"objects_skipped":0,"objects_written":0,"registry_deleted":0,"registry_dropped":0,"registry_written":0}
2026-10-26T18:28:38.983954Z  INFO migrate::orchestrator::verify: verify finished run_id=7 status=failed accounts_checked=9 mismatches=5 unexplained=4
2026-10-26T18:28:38.984020Z ERROR migrate::orchestrator: finalize completed but verification failed: the final run is not marked done; fix the reported mismatches and repeat the command (run --final, or rollback with the same --state)
run 6: ok ({"accounts_delta":0,"accounts_failed":0,"accounts_full":0,"accounts_removed":0,"accounts_unchanged":9,"accounts_wiped":0,"blob_bytes":0,"blobs_copied":0,"bytes_written":0,"emails_written":0,"errors":0,"global_deleted":0,"global_records":0,"issues":35,"log_rows":0,"objects_deleted":0,"objects_skipped":0,"objects_written":0,"registry_deleted":0,"registry_dropped":0,"registry_written":0})
verify: 9 accounts checked, 5 mismatches, 4 not explained by earlier reports (failed)
finalize completed but verification failed: the final run is not marked done. Fix the reported mismatches (stalwart-migrate report --severity verify) and run --final again.

And there are some more errors:

run    severity category   account    object               id                   message
5      verify   mismatch   -          x:SpamTrainingSample 328762709843335680   the converted source object is missing in the target
5      verify   mismatch   31         email                44518                differs in the target: keywords
5      verify   mismatch   31         email                58658                differs in the target: keywords
5      verify   mismatch   31         email                70616                differs in the target: keywords
5      verify   mismatch   31         email                70894                differs in the target: keywords

Back to v0.16 for now.

I’m seeing the same error: differs in the target: keywords. How to proceed?

@mdecimus Might this be fixed with 1.0.1, too? And should I start over with a fresh v1-DB (PostgreSQL in my case) or can I just re-run stalwart-migrate?

Yes, both of you are hitting something 1.0.1 fixes. Stalwart 1.0 sets $hasattachment or $hasnoattachment on every message itself, based on its content, and 1.0.0 compared those with the keywords 0.16 had stored, so any message where the two disagreed showed up as a keyword mismatch. Nothing you or your clients set on those messages was lost. 1.0.1 leaves both keywords out of the copy and out of the comparison.

The spam training sample is safe to ignore. Its blob was already missing in 0.16, so that sample was unusable there as well; accept it with --allow-errors on the final run.

The tool could carry on from your existing state directory, but the emails already in the PostgreSQL target were written by 1.0.0, which may have stored those two keywords as ordinary ones. Since you’re back on 0.16 and nothing is using the 1.0 database yet, I’d drop it, create a new empty one and start again with 1.0.1 and a new state directory. With 9 accounts the full copy won’t take long.

@Kevarti, same answer for you: update to 1.0.1 and repeat the migration into a new, empty target.

Thanks a lot, with v1.0.1 I was able to migrate to v1.

One last question, what is the meaning of the folloring warning - what can I do about it?

WARN hickory_net::dnssec: response does not contain NSEC or NSEC3 records. Query: Query { name: Name(“.”), query_type: DNSKEY, query_class: IN } response: DnsResponse { message: Message { metadata: Metadata { id: 40465, message_type: Response, op_code: Query, authoritative: false, truncation: false, recursion_desired: false, recursion_available: false, authentic_data: false, checking_disabled: false, response_code: NXDomain }, queries: [Query { name: Name(“.”), query_type: DNSKEY, query_class: IN }], answers: , authorities: , additionals: , signature: None, edns: None }, buffer: [158, 17, 128, 3, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 48, 0, 1] }