The snapshot functionality of cron fails when multiple clients connect to the server mode (UI/CLI)

Background: There are many Linux servers in the project that all need to be backed up. As the project grows and the amount of data to be backed up increases, I accidentally came across Kopia, which has features such as incremental backup, snapshot, and automatic policies like scheduled snapshots. So I started to study Kopia. I want to have one server connect to an S3 storage, and multiple clients connect to the server for configuration storage, and perform automatic snapshots according to the global cron policy.

Problem encountered: When multiple CLI clients connect to the server mode (UI/CLI), the cron - based snapshot function fails. I’ve noticed that Kopia itself has these features, but I haven’t been able to implement them successfully. I don’t know what I’m doing wrong. Although alternative solutions are available, such as using Ansible in combination with crontab to execute “kopia snapshot create ” for managing snapshots on multiple hosts. But in this way, the feature that “Kopia’s server mode makes it incredibly easy to centrally manage backups of multiple computers” is not utilized. This really confuses me.

Implementation process:
First, start the UI version using the docker - compose method.

The ui server at 10.10.1.57 was successfully launched. A local backup attempt was made and it was successful.

Since I’m testing cron, I use “* * * * *” to check the effect.

The cron snapshot was successful. Up to this point, there have been no issues with single - machine backups.

Try to switch scenarios and add multiple CLI clients.

It is stated that Kopia’s server mode exposes an API, which enables centralized management of backups for multiple computers and users responsible for backing up multiple machines. This API can be utilized to build client - side tools, facilitating functions such as triggering snapshots, obtaining client status, and accessing snapshotted data.

Adding users to the UI server

Since I couldn’t find the option to set user - related information in the UI interface, but I saw that it could be achieved through the CLI method. So I entered the UI container and used the CLI to create users.

Create a test in the container following the format of username@hostname

docker compose exec -it kopia kopia server user add test@test1

Creation was successful

kopia server user list
test@test1

The document indicates that the service needs to be restarted

Restart the service

docker compose up -d --force-recreate

Use the CLI command kopia repository connect server on the client computer to connect to the server

New client server 10.1.1.157

kopia repository connect server --url https://10.1.1.57:51514 --server-cert-fingerprint 8B9C6F54E23213123123CB42BAD5AD7A36EDB2E740811212121 --override-username=test --override-hostname=test1

Connected to repository API Server.

Try to create a snapshot and check if it’s successful

Generate a 20M file named test.file

dd if=/dev/zero of=test.file bs=20M count=1

Create a snapshot

kopia snapshot create test.file

Snapshotting test@test1:/tmp/test.file...
 * 0 hashing, 1 hashed (21 MB), 0 cached (0 B), uploaded 4.2 MB, estimating...
Created snapshot with root Ixee08052f46949a06c0bd5a4ccce54a69 and ID 43a3997e6d098f6d6afafb1fb24028d9 in 0s

Set the cron policy, using * * * * * for demonstration purposes

kopia policy set --snapshot-time-crontab “* * * * *” test@test1:/tmp/test.file

Returned to the UI but the snapshot was not displayed.

Restarted the server again, and then it was displayed on the UI.

docker compose up -d --force-recreate

There is no “policy” button, and the snapshot shows an “overdue” status.

The “policies” can be clicked to access the “edit” setting. Once inside, when setting the cron to “* * * * *”, it indicates that the setting was successful, and the expected time for the next snapshot is also shown correctly. However, the snapshot isn’t functioning as expected.

Attempt to view via command - line was unsuccessful

kopia snapshot list -
test@test1:/tmp/test.file
2025 - 01 - 08 17:47:50 CST Ixee08052f46949a06c0bd5a4ccce54a69 21 MB -rw-r–r-- (latest - 1,hourly - 1,daily - 1,weekly - 1,monthly - 1,annual - 1)

Attempt to add ACL, testing by allowing all users to view all snapshots in the system directly. Still failed

kopia server acl enable
kopia server acl add --user “@” --access READ --target type**=**snapshot

Using UI on the Server - side and CLI on the Client - side, with Failure. Attempting to Use CLI Everywhere

S3 Storage

Kopia Command - Line Interface

Create a Repository

Use the kopia repository create s3 command to create a repository.

kopia repository create s3
–bucket=“…”
–access-key=“…”
–secret-access-key=“…”
–prefix=“service-backup”
–region=“…”
–endpoint=“…”
–override-hostname=“…”
–description=“service-backup”

Start the Kopia Server from the CLI:

1. First startup, using an auto - generated certificate

kopia server start \
 --tls-generate-cert \
 --address https://10.1.1.57:5152 \
 --config-file=/root/.config/kopia/repository.config \
 --log-level=error \
 --file-log-level=error \
 --log-dir="/tmp/2025" \
 --tls-cert-file /root/kopia.cert --tls-key-file /root/kopia.key 
 
# 输出
SERVER CERT SHA256: d3f49ebf15adf6d4f4dsa4564905104664e0d2a7d64cc44c50db47dsab983123S
SERVER ADDRESS: https://10.1.1.57:5152

2. Subsequent startups after generating the certificate

 kopia server start \
 --address https://10.1.1.57:5152 \
 --config-file=/root/.config/kopia/repository.config \
 --log-level=error \
 --file-log-level=error \
 --log-dir="/tmp/2025" \
 --tls-cert-file /root/kopia.cert --tls-key-file /root/kopia.key 

3. Authorize users in the username@hostname format for testing

kopia server user add test@test1

Creation was successful

kopia server user list
test@test1

4. Connect the client to the server

kopia repository connect server --url https://10.1.1.57:5152 --server-cert-fingerprint d3f49ebf15adf6d4f4530db4564905104664e0d2a7d64cc44c50db472adb983123S --override-username=test --override-hostname=test1

5. Add a new snapshot and set the policy

Generate a 20M file named test.file

dd if=/dev/zero of=test.file bs=20M count=1

Create a Snapshot

kopia snapshot create test.file

Snapshotting test@test1:/tmp/test.file...
 * 0 hashing, 1 hashed (21 MB), 0 cached (0 B), uploaded 4.2 MB, estimating...
Created snapshot with root Ixee08052f46949a06c0bd5a4ccc32131a69 and ID 43a3997e6d098f6d6afafb1fb24028d9 in 0s

Set the Cron Policy, using * * * * * for demonstration purposes

kopia policy set --snapshot-time-crontab “* * * * *” test@test1:/tmp/test.file

The viewing still fails
kopia snapshot list