I deleted my repository.config while KopiaUI runnig

Hello all!

I am happy user of KopiaUI, but suddenly I decide to play with kopia.exe CLI.

While KopiaUI running in background as usual, I created new repository with

kopia repository create filesystem --path=C:\kopia_test

Then i take a look at %USERPROFILE%\AppData\Roaming\kopia\ to see what changes in repository.config. I suppose that the new section will be added to it, or new config file will be created. But I found that my old repository.config file was overwritten with new one. Panicked, I disconnected from the new repository:

kopia repository disconnect

then repository.config file disappear.

Now I have KopiaUI running, still connected to my main repository, and in Repository tab of KopiaUI indicated repository.config that actually is absent. Next snapshot scheduled in 3 hours.

Is it OK? Did I do something wrong (except for not backing up huh)? Will KopiaUI continue to work? What will happens after restarting computer?

If there no other repository.config exists (e.g all repositories are disconnected), Kopia create a new repository.config. If repository.config exists Kopia creates repository-XXX.config. For multiple repositories, you can create a “dummy” repository.config (e.g, non used, empty repository) and then connect another ones, which each gets its own repository-XXX.config.

You can delete repository.config file and connect again to the repository. Kopia just create a new config file.

I was hoping for this since the documentation says

For each repository connection, Kopia maintains a configuration file…

But this is not happen in my case. The repository.config existed, but the program created a new one with the same name, overwriting the old one. Is this a bug?

1 Like

Hm. If repository.config existed, Kopia should created a new xxx one. But, if your repository was disconnected, then Kopia overwrite the existed one. New ones (repository-xxx.config) are created in situation of connected repositories.

When using both UI and cmd with multiple repos good practice is to explicitly specify which config file you want to use with every kopia cmd command, e.g.:

kopia repository create filesystem --path=/path/to/repo --config-file %USERPROFILE%\AppData\Roaming\kopia\repository_local_testing.config

This way you will never have surprises.

I sure that repository.config existed and repository was connected, because KopiaUI was runnig and showing my main repository detais on all tabs.

I did the test with copia CLI only. This wrong behavior confirmed:

(notice the repository.config.mlock file still exists after first incident)

CLI log
PS C:\Users\Andrey\AppData\Roaming\kopia> dir


    Каталог: C:\Users\Andrey\AppData\Roaming\kopia


Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a----         7/23/2023   3:45 AM              0 repository.config.mlock
-a----         7/23/2023  12:00 AM             57 ui-preferences.json


PS C:\Users\Andrey\AppData\Roaming\kopia> kopia repository create filesystem --path=C:\kopia\repo1
Enter password to create new repository:
Re-enter password for verification:
Initializing repository with:
  block hash:          BLAKE2B-256-128
  encryption:          AES256-GCM-HMAC-SHA256
Connected to repository.

NOTICE: Kopia will check for updates on GitHub every 7 days, starting 24 hours after first use.
To disable this behavior, set environment variable KOPIA_CHECK_FOR_UPDATES=false
Alternatively you can remove the file "C:\Users\Andrey\AppData\Roaming\kopia\repository.config.update-info.json".

Retention:
  Annual snapshots:                 3   (defined for this target)
  Monthly snapshots:               24   (defined for this target)
  Weekly snapshots:                 4   (defined for this target)
  Daily snapshots:                  7   (defined for this target)
  Hourly snapshots:                48   (defined for this target)
  Latest snapshots:                10   (defined for this target)
Compression disabled.

To find more information about default policy run 'kopia policy get'.
To change the policy use 'kopia policy set' command.

NOTE: Kopia will perform quick maintenance of the repository automatically every 1h0m0s
and full maintenance every 24h0m0s when running as Andrey@desktop-49rbbuq.

See https://kopia.io/docs/advanced/maintenance/ for more information.

NOTE: To validate that your provider is compatible with Kopia, please run:

$ kopia repository validate-provider

PS C:\Users\Andrey\AppData\Roaming\kopia> dir


    Каталог: C:\Users\Andrey\AppData\Roaming\kopia


Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a----         7/23/2023   3:45 AM              0 repository.config.mlock
-a----         7/23/2023   2:57 PM            139 repository.config.update-info.json
-a----         7/23/2023  12:00 AM             57 ui-preferences.json


PS C:\Users\Andrey\AppData\Roaming\kopia> type .\repository.config
{
  "storage": {
    "type": "filesystem",
    "config": {
      "path": "C:\\kopia\\repo1",
      "fileMode": 384,
      "dirMode": 448,
      "dirShards": null
    }
  },
  "caching": {
    "cacheDirectory": "..\\..\\Local\\kopia\\fc52e8fb826eabc2",
    "maxCacheSize": 5242880000,
    "maxMetadataCacheSize": 5242880000,
    "maxListCacheDuration": 30
  },
  "hostname": "desktop-49rbbuq",
  "username": "Andrey",
  "description": "Repository in Filesystem: C:\\kopia\\repo1",
  "enableActions": false,
  "formatBlobCacheDuration": 900000000000
}
PS C:\Users\Andrey\AppData\Roaming\kopia> kopia repository create filesystem --path=C:\kopia\repo2
Enter password to create new repository:
Re-enter password for verification:
Initializing repository with:
  block hash:          BLAKE2B-256-128
  encryption:          AES256-GCM-HMAC-SHA256
Connected to repository.

NOTICE: Kopia will check for updates on GitHub every 7 days, starting 24 hours after first use.
To disable this behavior, set environment variable KOPIA_CHECK_FOR_UPDATES=false
Alternatively you can remove the file "C:\Users\Andrey\AppData\Roaming\kopia\repository.config.update-info.json".

Retention:
  Annual snapshots:                 3   (defined for this target)
  Monthly snapshots:               24   (defined for this target)
  Weekly snapshots:                 4   (defined for this target)
  Daily snapshots:                  7   (defined for this target)
  Hourly snapshots:                48   (defined for this target)
  Latest snapshots:                10   (defined for this target)
Compression disabled.

To find more information about default policy run 'kopia policy get'.
To change the policy use 'kopia policy set' command.

NOTE: Kopia will perform quick maintenance of the repository automatically every 1h0m0s
and full maintenance every 24h0m0s when running as Andrey@desktop-49rbbuq.

See https://kopia.io/docs/advanced/maintenance/ for more information.

NOTE: To validate that your provider is compatible with Kopia, please run:

$ kopia repository validate-provider

PS C:\Users\Andrey\AppData\Roaming\kopia> dir


    Каталог: C:\Users\Andrey\AppData\Roaming\kopia


Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a----         7/23/2023   3:45 AM              0 repository.config.mlock
-a----         7/23/2023   3:02 PM            139 repository.config.update-info.json
-a----         7/23/2023  12:00 AM             57 ui-preferences.json


PS C:\Users\Andrey\AppData\Roaming\kopia> type .\repository.config
{
  "storage": {
    "type": "filesystem",
    "config": {
      "path": "C:\\kopia\\repo2",
      "fileMode": 384,
      "dirMode": 448,
      "dirShards": null
    }
  },
  "caching": {
    "cacheDirectory": "..\\..\\Local\\kopia\\1d3beccdd5e99fe1",
    "maxCacheSize": 5242880000,
    "maxMetadataCacheSize": 5242880000,
    "maxListCacheDuration": 30
  },
  "hostname": "desktop-49rbbuq",
  "username": "Andrey",
  "description": "Repository in Filesystem: C:\\kopia\\repo2",
  "enableActions": false,
  "formatBlobCacheDuration": 900000000000
}
PS C:\Users\Andrey\AppData\Roaming\kopia> kopia repository disconnect
deleted repository password for C:\Users\Andrey\AppData\Roaming\kopia\repository.config.
PS C:\Users\Andrey\AppData\Roaming\kopia> dir


    Каталог: C:\Users\Andrey\AppData\Roaming\kopia


Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a----         7/23/2023  12:00 AM             57 ui-preferences.json


PS C:\Users\Andrey\AppData\Roaming\kopia> kopia --version
0.13.0 build: 7f69502bddd6650e7cb7a132291bc54920e58988 from: kopia/kopia

As i show in my previous message, in my experience, when repository disconnecting, Kopia deletes repository.config. Hence, if repository was disconnected, then nothing exists to overwrite.

It is not “wrong behaviour”. Simply cmd always uses repository.config file unless you specify otherwise using --config-file flag.

When you use UI only then it does it for you, when you use cmd it is your responsibility.

I see, thanks!

But maybe then this documentation statement

For each repository connection, Kopia maintains a configuration file…

should be changed to something like

For each repository connection, user maintains a configuration file…

:smiley:

Agree. You can update documentation and post PR. It is never ending work in progress like most open source projects.

I understand and approve of the open source movement, but to my shame the git is rocket-science for me. :frowning_face:

And thanks again for the replies.