# Kopia repository can't connect SFTP - error loading indexes: unable to open pack index

**URL:** https://kopia.discourse.group/t/kopia-repository-cant-connect-sftp-error-loading-indexes-unable-to-open-pack-index/2945
**Category:** Support
**Created:** [May 28, 2024, 11:40am UTC](https://kopia.discourse.group/t/kopia-repository-cant-connect-sftp-error-loading-indexes-unable-to-open-pack-index/2945 "2024-05-28T11:40:48Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![tecwar](https://avatars.discourse-cdn.com/v4/letter/t/ba9def/32.png) [@tecwar](https://kopia.discourse.group/u/tecwar)
#### Post date: [May 28, 2024, 11:40am UTC](https://kopia.discourse.group/t/kopia-repository-cant-connect-sftp-error-loading-indexes-unable-to-open-pack-index/2945/1 "2024-05-28T11:40:48Z")

</div>

Hi,

I am trying to use Kopia 0.17 for 4 weeks now. It work’s for ~2 weeks. Kopia is in a system with BTRFS RAID 1 2x12TB HDD, and was created with:

````kopia
    --path= ... \
    --ecc=REED-SOLOMON-CRC32 \
    --ecc-overhead-percent=1 \
    --cache-directory= ... \
    --config-file= ...

kopia cache set --content-cache-size-mb=512 <- tried with higher values too```

The client's (10 client) is in the same, **local network** as the main kopia repository.
I use it to backup ~550 directories (deduplicated size is ~600GB overall, gameservers mostly) in each hour, using kopia built-in cron, it works perfectly for ~2 weeks.
I have an another repository, where I backup a smaller amount of directories with ~200GB overall adata, and with a daily snapshot, it works perfectly.

Connect command:
```kopia cache clear

kopia repository connect sftp \
--enable-actions \
--cache-directory= ... \
--config-file= ... \
--content-cache-size-mb 512 \ <- tried with higher values too
--metadata-cache-size-mb 256 \ <- tried with higher values too
--username ... \
--host ... \
--path ... \```

Then suddenly I got this type of error, randomly after a service restart. (Service restart means, that I am using kopia with systemd service. When service restart's, it's clearing the cache directory on the client, and then attemtps to connect to kopia repository with the above command.)

While running:
`kopia snapshot fix invalid-files --commit`
```WARN unable to create memory-mapped segment: unable to create memory-mapped file: open : no such file or directory```

`kopia repository connect sftp `
```ERROR failed to open repository: unable to create shared content manager: error loading indexes: unable to open pack index "xn0_412b7db76e150d24778ca42787a3cf75-se3d6e3bc1fdf70d4129-c1": mmap error: cannot allocate memory
ERROR open repository: unable to open repository: unable to create shared content manager: error loading indexes: unable to open pack index "xn0_412b7db76e150d24778ca42787a3cf75-se3d6e3bc1fdf70d4129-c1": mmap error: cannot allocate memory
ERROR failed to open repository: unable to create shared content manager: error loading indexes: unable to open pack index "xn0_45da350025d2074f30db3f5c6505dac7-s40cc36a20df536d9129-c1": mmap error: cannot allocate memory```

`kopia maintenance info `
```Object Lock Extension: disabled
Recent Maintenance Runs:
  cleanup-epoch-markers:
    2024-05-28 11:30:22 CEST (0s) SUCCESS
    2024-05-28 10:09:49 CEST (0s) SUCCESS
    2024-05-21 18:52:42 CEST (0s) SUCCESS
  full-rewrite-contents:
    2024-05-28 10:46:42 CEST (43m38s) SUCCESS
    2024-05-21 18:52:42 CEST (0s) SUCCESS
  generate-epoch-range-index:
    2024-05-28 11:30:22 CEST (0s) SUCCESS
    2024-05-28 10:09:49 CEST (0s) SUCCESS
    2024-05-21 18:52:42 CEST (0s) SUCCESS
  advance-epoch:
    2024-05-28 11:30:22 CEST (0s) SUCCESS
    2024-05-28 10:09:49 CEST (0s) SUCCESS
    2024-05-21 18:52:42 CEST (0s) SUCCESS
  cleanup-logs:
    2024-05-28 11:30:23 CEST (0s) SUCCESS
    2024-05-28 10:09:49 CEST (0s) SUCCESS
    2024-05-21 18:52:42 CEST (0s) SUCCESS
  compact-single-epoch:
    2024-05-28 11:30:22 CEST (0s) SUCCESS
    2024-05-28 10:09:49 CEST (0s) SUCCESS
    2024-05-21 18:52:42 CEST (0s) SUCCESS
  delete-superseded-epoch-indexes:
    2024-05-28 11:30:22 CEST (0s) SUCCESS
    2024-05-28 10:09:49 CEST (0s) SUCCESS
    2024-05-21 18:52:42 CEST (0s) SUCCESS
  full-delete-blobs:
    2024-05-28 10:09:26 CEST (22s) SUCCESS
  full-drop-deleted-content:
    2024-05-28 11:30:20 CEST (2s) SUCCESS
    2024-05-28 10:09:24 CEST (2s) SUCCESS
  snapshot-gc:
    2024-05-28 10:29:03 CEST (17m39s) SUCCESS
    2024-05-28 09:43:40 CEST (25m44s) SUCCESS
    2024-05-21 18:52:42 CEST (0s) SUCCESS```

kopia repository status
```Description: Repository in Filesystem: ...
Hostname: ...
Username: ...
Read-only: false
Format blob cache: 15m0s

Storage type: filesystem
Storage capacity: 12 TB
Storage available: 10.9 TB
Storage config: {
                       "path": "...",
                       "fileMode": 384,
                       "dirMode": 448,
                       "dirShards": null
                     }

Unique ID: ...
Hash: BLAKE2B-256-128
Encryption: AES256-GCM-HMAC-SHA256
Splitter: DYNAMIC-4M-BUZHASH
Format version: 3
Content compression: true
Password changes: true
Max pack length: 21 MB
Index Format: v2

Epoch Manager: enabled
Current Epoch: 1

Epoch refresh frequency: 20m0s
Epoch advance on: 20 blobs or 10.5 MB, minimum 24h0m0s
Epoch cleanup margin: 4h0m0s
Epoch checkpoint every: 7 epochs```

**I can connect to it in local, with `kopia repository connect filesystem`**

Please **let me know if I am missing something** , and I would really appreciate the help. :pleading_face:
````
