# Permissions denied errors after migration

**URL:** https://support.stalw.art/t/permissions-denied-errors-after-migration/2075
**Category:** Questions
**Created:** [October 27, 2026, 10:45pm UTC](https://support.stalw.art/t/permissions-denied-errors-after-migration/2075 "2026-10-27T22:45:06Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![madsmh](https://support.stalw.art/user_avatar/support.stalw.art/madsmh/32/57_2.png) [@madsmh](https://support.stalw.art/u/madsmh)
#### Post date: [October 27, 2026, 10:45pm UTC](https://support.stalw.art/t/permissions-denied-errors-after-migration/2075/1 "2026-10-27T22:45:06Z")

</div>

### Your question

I ran

```auto
docker compose run --rm migrate run \
  --final \   
  --source /etc/stalwart/config.json \  
  --target /etc/stalwart-v1/config.json \  
  --state /var/lib/stalwart-migrate \
  --target-path-map /var/lib/stalwart=/var/lib/stalwart-v1 \
  --owner 2000:2000

```

and there were no errors, but when I started v1, I got

```auto
stalwart-v1 | ⚠️ Startup failed: Failed to create database directory /var/lib/stalwart-v1/: Os { code: 13, kind: PermissionDenied, message: "Permission denied" }

```

Both Stalwarts (the old and new) run in docker

with Stalwart V1 having the compose file:

```yml
networks:
  ip6net:
    enable_ipv6: true
    ipam:
      config:
        - subnet: fd00::/8
services:
  stalwart-v1:
      image: stalwartlabs/stalwart:v1
      container_name: stalwart-v1
      init: true
      restart: unless-stopped
      env_file: "stalwart.env"
      ports:
        - "25:25"
        - "465:465"
        - "993:993"
       # - "995:995"
        - "4190:4190"
       # - "443:443"
        - "127.0.0.1:8081:8080"
      volumes:
        - stalwart-v1-etc:/etc/stalwart
        - stalwart-v1-data:/var/lib/stalwart

```

### 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

---

<div class="post-metadata">

### Author: ![helpbot](https://support.stalw.art/user_avatar/support.stalw.art/helpbot/32/13_2.png) [@helpbot](https://support.stalw.art/u/helpbot)
#### Post date: [October 27, 2026, 10:45pm UTC](https://support.stalw.art/t/permissions-denied-errors-after-migration/2075/2 "2026-10-27T22:45:18Z")

</div>

The 1.0 container is probably failing because the data volume is mounted at a different path from the one the migrated configuration names.

The error says the server tried to create `/var/lib/stalwart-v1/`. That means the target `config.json` names `/var/lib/stalwart-v1` as the data path. Your v1 compose file mounts the data volume at `/var/lib/stalwart`, so `/var/lib/stalwart-v1` doesn’t exist inside the container. The server runs as uid 2000, which can’t create a directory under `/var/lib`, hence the permission denied. Your `--owner 2000:2000` is correct and is probably not the problem.

The docs describe two ways to line the paths up. The first is to mount the data volume at the path the target configuration names:

```yaml
    volumes:
      - stalwart-v1-etc:/etc/stalwart
      - stalwart-v1-data:/var/lib/stalwart-v1

```

The second is to keep the mount at `/var/lib/stalwart`. In that case the target configuration has to name `/var/lib/stalwart`, and you run the tool with `--target-path-map /var/lib/stalwart=/var/lib/stalwart-v1`. That is what you passed, so check what `/etc/stalwart-v1/config.json` actually contains. If it still says `/var/lib/stalwart-v1`, either edit the path in it or use the first option.

The first option is the simpler fix. After changing the mount, `docker compose up -d stalwart-v1` should be enough. You shouldn’t need to re-run the migration.

Docs: [Installation | Stalwart](https://stalw.art/docs/migration/upgrade-0-16/installation) (see “Mounting the new store in the 1.0 container” 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._

---

<div class="post-metadata">

### Author: ![stalwart](https://support.stalw.art/user_avatar/support.stalw.art/stalwart/32/12_2.png) [@stalwart](https://support.stalw.art/u/stalwart)
#### Post date: [October 28, 2026, 6:57am UTC](https://support.stalw.art/t/permissions-denied-errors-after-migration/2075/3 "2026-10-28T06:57:48Z")

</div>

The path map isn’t doing anything here. `--target-path-map /var/lib/stalwart=/var/lib/stalwart-v1` only rewrites paths that start with `/var/lib/stalwart` in the target config, and the error shows that your `/etc/stalwart-v1/config.json` names `/var/lib/stalwart-v1`. So the tool wrote the store to `/var/lib/stalwart-v1`, v1 reads the same config and looks there, but your v1 container mounts the data volume at `/var/lib/stalwart`. Inside that container `/var/lib/stalwart-v1` doesn’t exist, and the stalwart user isn’t allowed to create it.

Mounting the volume where the config points fixes it:

```yml
      volumes:
        - stalwart-v1-etc:/etc/stalwart
        - stalwart-v1-data:/var/lib/stalwart-v1

```

Make sure it’s the same Docker volume the migrate service wrote into. Compose prefixes volume names with the project name, so if v1 lives in a separate compose project, `docker volume ls` will show two different `stalwart-v1-data` volumes and you’ll want to declare the one with your data as `external`.

The other layout (data at `/var/lib/stalwart` in the v1 container, with the path map) is described here: [Installation | Stalwart](https://stalw.art/docs/migration/upgrade-0-16/installation#mounting-the-new-store-in-the-10-container)
