Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve error handling and display to user when opening a repository #958

Closed
huetremy opened this issue Nov 30, 2023 · 5 comments · Fixed by #963
Closed

Improve error handling and display to user when opening a repository #958

huetremy opened this issue Nov 30, 2023 · 5 comments · Fixed by #963
Labels
A-errors Area: error handling needs improvement A-ui-ux Area: Related to user interfaces and user experience C-enhancement Category: New feature or request

Comments

@huetremy
Copy link

huetremy commented Nov 30, 2023

Hi ! Thank you for this awesome tool !

I have a problem using rustic with S3 backend.

Steps

  • I have an empty S3 bucket (using garage) to store my backup, with the corresponding keys
  • I used rclone and setup a backend with this S3 bucket
  • Init the repository with rustic -r rclone:backend:bucket init, and set a password. The command returns that it successfully created the repo

I checked the content of the bucket with Minio client, and I can see the config file and keys folder, meaning that rustic indeed wrote to this repository.

However, whenever I try to access it (with a check, a snapshots, a backup...) it always returns me that the provided password is not good (of course, I tried with very simple passwords to be sure).

Am I doing something wrong ?

Thank you again !

@github-actions github-actions bot added the S-triage Status: Waiting for a maintainer to triage this issue/PR label Nov 30, 2023
@huetremy huetremy changed the title Wrong Password after init on S3 backent Wrong Password after init on S3 backend Nov 30, 2023
@huetremy
Copy link
Author

I forgot to precise that I use rustic 0.6.1, that I installed using cargo install rustic-rs on Fedora 39.

I also tried using a very simple config file ~/.config/rustic/rustic.toml

[repository]
repository = "rclone:garage:my_bucket"
password = "aaaa"

I can run rustic init which creates the repository, but I cannot access it

~ rustic init
using config /home/huetremy/.config/rustic/rustic.toml
[INFO] key 6e461227 successfully added.
[INFO] repository 93747363 successfully created.
[INFO] using cache at /home/huetremy/.cache/rustic/93747363a72599de2b71c32f8bcf45d4f597917dc3a0eadb205d8da2a7dfd700~ rustic check
using config /home/huetremy/.config/rustic/rustic.toml
error: incorrect password!

@aawsome
Copy link
Member

aawsome commented Dec 2, 2023

@huetremy Thanks for opening this issue! Can you reproduce it on the local backend? If not, can you try to copy the repo to some local dir and try to access it using a local repo path? Or do it the other way: Initialize a local one and manually copy it to the S3 backend, is rustic able to access that as a remote repo?

@simonsan simonsan added C-question Category: Further information is requested and removed S-triage Status: Waiting for a maintainer to triage this issue/PR labels Dec 2, 2023
@huetremy
Copy link
Author

huetremy commented Dec 3, 2023

Hi !
Thanks for your quick response !

Here are the tests you suggested :

  • Local repo : OK
~ rustic -r /tmp/test_local init
using no config file, none of these exist: /home/huetremy/.config/rustic/rustic.toml, /etc/rustic/rustic.toml, ./rustic.toml
enter password for new key: [hidden]
[INFO] key 94cbe721 successfully added.
[INFO] repository 266a680d successfully created.
[INFO] using cache at /home/huetremy/.cache/rustic/266a680dc3762f84a94941236b3a329beaf64d37ec6baafd8bb624ebde36036e~ rustic -r /tmp/test_local check
using no config file, none of these exist: /home/huetremy/.config/rustic/rustic.toml, /etc/rustic/rustic.toml, ./rustic.toml
enter repository password: [hidden]
[INFO] repository local:/tmp/test_local: password is correct.
[INFO] using cache at /home/huetremy/.cache/rustic/266a680dc3762f84a94941236b3a329beaf64d37ec6baafd8bb624ebde36036e
[00:00:00] reading index...               ████████████████████████████████████████          0/0                                              [00:00:00] listing packs...                                                                                                                  [00:00:00] cleaning up packs from cache...                                                                                                   [00:00:00] reading snapshots...           ████████████████████████████████████████          0/0                                              [00:00:00] checking trees...              ████████████████████████████████████████          0/0
  • Create local repo and put it in S3 : not OK
~ rclone sync /tmp/test_local garage:remy-pc-backups~ rclone lsl garage:remy-pc-backups                 
      155 2023-12-03 10:22:29.690803934 config
      363 2023-12-03 10:22:29.690803934 keys/513d6a52a432137c45b74cb5172b48350f7c86b258608f44c651be4482aa3563~ rustic -r rclone:garage:remy-pc-backups check
using no config file, none of these exist: /home/huetremy/.config/rustic/rustic.toml, /etc/rustic/rustic.toml, ./rustic.toml
enter repository password: [hidden]
enter repository password: [hidden]
enter repository password: [hidden]
enter repository password: [hidden]
enter repository password: [hidden]
error: incorrect password

I tried then to create a repo on the backend, and copying it with rclone gave me the following error :

  ~ rclone copy garage:remy-pc-backups /tmp/test       
2023/12/03 09:45:50 ERROR : config: Failed to copy: failed to open source object: AccessDenied: Forbidden: Invalid signature
	status code: 403, request id: , host id: 
2023/12/03 09:45:50 ERROR : keys/c61e0e8042e31aa25e14913d686e01c1cf39a6baabbf613be211747d6e9e3a43: Failed to copy: failed to open source object: AccessDenied: Forbidden: Invalid signature
	status code: 403, request id: , host id:

Il clearly seems that I missconfigured my rclone backend (while I did it well with Minio client...) and that it is not a problem from rustic. I will investigate that and tell you if everything is ok

@aawsome
Copy link
Member

aawsome commented Dec 3, 2023

I agree that this seems to be a backend problem. Anyway, I think rustic must improve the error message here, so that users can identify more easily where the problem is.
IIRC the repository opening currently displays "wrong password" if any error occurs while trying to open the repo. We should distinguish between a real "wrong password" and other errors like not being able to access the key file etc...

@simonsan simonsan added C-enhancement Category: New feature or request A-errors Area: error handling needs improvement A-ui-ux Area: Related to user interfaces and user experience and removed C-question Category: Further information is requested labels Dec 3, 2023
@simonsan simonsan changed the title Wrong Password after init on S3 backend Improve error handling and display to user when opening a repository Dec 3, 2023
@aawsome
Copy link
Member

aawsome commented Dec 10, 2023

Just wanted to add that this messed-up error handling only takes place if you don't specify your password anywhere (config file, password file, password command), but rely on really typing your password into the password prompt.

A workaround - until this is fixed - is to use one of the above password options. This will give you correct error information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-errors Area: error handling needs improvement A-ui-ux Area: Related to user interfaces and user experience C-enhancement Category: New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants