rustic-rs / rustic

rustic - fast, encrypted, and deduplicated backups powered by Rust
https://rustic.cli.rs
Apache License 2.0
1.67k stars 63 forks source link

`error: data decryption failed` - Can't List Snapshots #1154

Open ossie-git opened 2 months ago

ossie-git commented 2 months ago

Hi,

I have a repository that suddenly won't allow me to list snapshots. It was working fine before today. This is what I see when I run a snapshots command:

$ rustic -P aws snapshots
[INFO] using config /home/o/.config/rustic/aws.toml
[INFO] repository local:/mnt/hard/O/Backups/Rustic/AWS: password is correct.
[INFO] using no cache
error: data decryption failed

Other commands such as find also don't work (I'm using the nightly builds):

$ rustic -P aws find --iglob "*.pdf"
[INFO] using config /home/o/.config/rustic/aws.toml
[INFO] repository local:/mnt/hard/O/Backups/Rustic/AWS: password is correct.
[INFO] using no cache
[00:00:00] reading index...               ████████████████████████████████████████         22/22        [00:00:00] getting snapshots...           ████████████████████████████████████████          0
error: data decryption failed

At the same time, some commands such as backup do work:

$ rustic -P aws backup
[INFO] using config /home/o/.config/rustic/aws.toml
[INFO] repository local:/mnt/hard/O/Backups/Rustic/AWS: password is correct.
[INFO] using no cache
[00:00:00] reading index...               ████████████████████████████████████████         22/22        [INFO] using all backup sources from config file.
[INFO] merging source="/home/o/Downloads/AWS" section from config file
[INFO] using no parent
[INFO] starting to backup "/home/o/Downloads/AWS"...
[00:00:01] backing up...                  ████████████████████████████████████████ 187.70 MiB/187.70 MiB 159.86 MiB/s (ETA -)Files:       9 new, 0 changed, 0 unchanged
Dirs:        5 new, 0 changed, 0 unchanged
Added to the repo: 0 B (raw: 0 B)
processed 9 files, 187.7 MiB
snapshot 38151dc1 successfully saved.
[INFO] backup of "/home/o/Downloads/AWS" done.

and:

$ rustic -P aws repoinfo
[INFO] using config /home/o/.config/rustic/aws.toml
[00:00:02] scanning files...                                                                          [INFO] repository local:/mnt/hard/O/Backups/Rustic/AWS: password is correct.
[INFO] using no cache
[00:00:00] scanning index...              ████████████████████████████████████████         22/22        repository files

| File type | Count | Total Size |
|-----------|-------|------------|
| Key       |     1 |      363 B |
| Snapshot  |    47 |   24.2 kiB |
| Index     |    22 |   18.1 kiB |
| Pack      |    47 |  121.0 MiB |
| Total     |   117 |  121.0 MiB |

| Blob type | Count | Total Size | Total Size in Packs |
|-----------|-------|------------|---------------------|
| Tree      |   110 |  358.4 kiB |           134.3 kiB |
| Data      |   155 |  152.0 MiB |           120.8 MiB |
| Total     |   265 |  152.3 MiB |           121.0 MiB |

| Blob type  | Pack Count | Minimum Size | Maximum Size |
|------------|------------|--------------|--------------|
| Tree packs |         22 |      6.3 kiB |      6.4 kiB |
| Data packs |         25 |     69.8 kiB |     34.3 MiB |

I'm currently using the following (as I want the find command):

$ rustic --version
rustic v0.7.0-45-gfc8e3c5-nightly

I also downloaded and tried it on the stable version and have the same problem:

$ ./rustic --version
rustic v0.7.0

My configuration is very simple (I have another repo with the exact same configuration options which is still working fine):

[repository]
repository = "/mnt/hard/O/Backups/Rustic/AWS"
password = "password"
no-cache = true # no cache needed for local repository

[forget]
keep-hourly = 24
keep-daily = 14
keep-weekly = 8
keep-monthly = 24
keep-yearly = 10

[backup]
#exclude-if-present = [".nobackup", "CACHEDIR.TAG"]
#glob-file = ["/root/rustic-local.glob"]
one-file-system = true

[[backup.sources]]
source = "/home/o/Downloads/AWS"
git-ignore = true

Any ideas? Thanks

ossie-git commented 2 months ago

Restic appears to be able to run snapshots on the repository:

$ restic -r /mnt/hard/O/Backups/Rustic/AWS/ snapshots
enter password for repository:
repository 9fd2c6f9 opened (version 2, compression level auto)
created new cache in /home/o/.cache/restic
Ignoring "7f008c6609065eb9a03134440168bebe280b4b0b6f56c6f6b0c6876f2e175915": failed to load snapshot 7f008c66: invalid data returned
ID        Time                 Host        Tags        Paths
----------------------------------------------------------------------------
5f7097a5  2024-05-14 16:20:59  dell                    /home/o/Downloads/AWS
c6fa2e44  2024-05-14 16:21:03  dell                    /home/o/Downloads/AWS
fbf9571d  2024-05-14 17:40:01  dell                    /home/o/Downloads/AWS
...
aawsome commented 2 months ago

Seems like the snapshot file 7f008c6609065eb9a03134440168bebe280b4b0b6f56c6f6b0c6876f2e175915 is defect.

So yes, the error message should be improved such that you can see where data decryption failed. Also we could ignore defect snapshot files like restic does. These are IMO good UX improvements.

@ossie-git Can you please post the output of rustic check? There at least some useful information should be given, it not this is a UX bug, IMO.

ossie-git commented 2 months ago
$ rustic -P aws check
[INFO] using config /home/o/.config/rustic/aws.toml
[INFO] repository local:/mnt/hard/O/Backups/Rustic/AWS: password is correct.
[INFO] using no cache
[00:00:00] reading index...               ████████████████████████████████████████         24/24        [00:00:00] listing packs...               ⠁
[00:00:00] listing packs...
error: data decryption failed
aawsome commented 2 months ago

@ossie-git Thanks. This is not how it should be :wink:

ossie-git commented 2 months ago

Do you have any idea why the backup might have become corrupted. I'm just guessing but it might have been right as I was suspending my PC