kmwoley / restic-windows-backup

Powershell scripts to run Restic backups on Windows
MIT License
330 stars 68 forks source link

"restic.exe : Fatal: unable to open config file: <config/> does not exist" #56

Closed hista closed 1 year ago

hista commented 2 years ago

Hi, I'm facing an error message when I try to run restic-windows-backup:

restic.exe : Fatal: unable to open config file: <config/> does not exist
Au caractère C:\restic\backup.ps1:80 : 14
+     $locks = & $ResticExe list locks --no-lock -q 3>&1 2>> $ErrorLog
+              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (Fatal: unable t... does not exist 
   :String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError

Is there a repository at the following location?
rclone:gdrive:Backup/Restic/VM

restic.exe : Fatal: unable to open config file: <config/> does not exist
Au caractère C:\restic\backup.ps1:255 : 13
+             & $ResticExe backup $folder_list $vss_option --tag "$tag" ...
+             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (Fatal: unable t... does not exist 
   :String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError

Is there a repository at the following location?
rclone:gdrive:Backup/Restic/VM

[[Backup]] Completed with errors
[[General]] Errors found. Log: C:\restic\logs\20211128T0031395545.err.txt

Here is my C:\restic\backup.ps1 file: https://bin.infini.fr/?3c520df3d3f15d51#KeS6oW2z8Uazqx6HhtM85K9Z7QjKya5MLJuoUg1aR9D Here is my C:\restic\config.ps1: https://bin.infini.fr/?cfa48f7d1da77fc3#EhgYY2nRF64H7EJkaTx7TmnJy4noR2j3e3cWhwGqUpju Here is my C:\restic\secrets.ps1: https://bin.infini.fr/?61b7796aaa362ce0#BA31eMZmUZUUMcqyctD5K7CAmpRNLHBAwDKvd5uH7etF

I'm confused because:

What am I missing?

Thanks a lot for your kind help :)

rawtaz commented 2 years ago

The most simple explanation would be that you simply haven't created your restic repository (or at least not where restic is looking). See the first point under https://github.com/kmwoley/restic-windows-backup#installation-instructions .

You can refer to https://restic.readthedocs.io/en/stable/030_preparing_a_new_repo.html for information on how to create the repository. Then point restic-windows-backup to it.

hista commented 2 years ago

Thanks for your anwer rawtaz.

There may be another explanation, because I did create this restic repository. And when I try to create the same, restic confirms there is already a config/repo there: C:\restic> .\restic.exe -r rclone:gdrive:Backup/Restic/VM init Fatal: create repository at rclone:gdrive:Backup/Restic/VM failed: Fatal: config file already exists

And restic-windows-backup seems to be linked to this repo:

# Template file for backup destination configuration and email passwords.
# Update this file to point to your restic repository and email service.
# Rename to `secrets.ps1`

# restic backup repository configuration
#$Env:AWS_ACCESS_KEY_ID='<KEY>'
#$Env:AWS_SECRET_ACCESS_KEY='<KEY>'
$Env:RESTIC_REPOSITORY='rclone:gdrive:Backup/Restic/VM'

Any other idea? :)

rawtaz commented 2 years ago

Well, simply try restic.exe -r rclone:gdrive:Backup/Restic/VM check and see if restic gives you an error?

hista commented 2 years ago

I tried to start from a new fresh repo.

The check works and shows an empty repo, with no errors:

PS C:\restic> .\restic.exe -r rclone:gdrive:Backup/Restic/VM check
using temporary cache in C:\Users\ADMINI~1\AppData\Local\Temp\restic-check-cache-330086319
repository a289570a opened successfully, password is correct
created new cache in C:\Users\ADMINI~1\AppData\Local\Temp\restic-check-cache-330086319
create exclusive lock for repository
load indexes
check all packs
check snapshots, trees and blobs
no errors were foundapshots
[0:02]          0 snapshots

But I still get an error in the logs when I run the restic task:


restic.exe : Fatal: unable to open config file: <config/> does not exist
Au caractère C:\restic\backup.ps1:80 : 14
+     $locks = & $ResticExe list locks --no-lock -q 3>&1 2>> $ErrorLog
+              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (Fatal: unable t... does not exist 
   :String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError

Is there a repository at the following location?
rclone:gdrive:Backup/Restic/VM

restic.exe : Fatal: unable to open config file: <config/> does not exist
Au caractère C:\restic\backup.ps1:255 : 13
+             & $ResticExe backup $folder_list $vss_option --tag "$tag" ...
+             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (Fatal: unable t... does not exist 
   :String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError

Is there a repository at the following location?
rclone:gdrive:Backup/Restic/VM

[[Backup]] Completed with errors

And yet, the config file already exists:

PS C:\restic> .\restic.exe -r rclone:gdrive:Backup/Restic/VM init
Fatal: create repository at rclone:gdrive:Backup/Restic/VM failed: Fatal: config file already exists

Therefore I'm a bit lost now :-/

rawtaz commented 2 years ago

I'm guessing this is a problem with this restic wrapper, so I'll let someone else answer that :) At least it's not restic itself that's doing something wrong, that's for sure.

hista commented 2 years ago

Yes maybe @kmwoley will have an idea. Maybe I can for the moment manually run a .\restic.exe -r rclone:gdrive:Backup/Restic/VM backup C:\ what do you think?

rawtaz commented 2 years ago

Absolutely. But you should probably make use of the --use-fs-snapshot option to the backup command (see restic help backup).

kmwoley commented 1 year ago

Hey folks - I'm going to close this issue due to it being open for a long time. If this didn't get sorted out, please re-open it. Thanks.