Beginner Wasabi backup script failing

Hey, very new restic user here.

I am a bit panicked because my backup failed yesterday and I am not sure why. Please bear with me, I am only beginning to get into Unix and a more terminal-centric usage of my computer.

I am on EndeavourOS running restic 0.12.1-2 from the Arch community repo.

I have a directory (size ~1.5 TB) which I have already successfully backed up to an external HDD with restic. Now I wanted to back up said directory to an online provider as well. I chose Wasabi and followed the instructions in the restic documentation. I created a little script and then left my computer (was gone for a week since I expected it to take some time) to do the backup.

Script:

#!/bin/bash

export AWS_ACCESS_KEY_ID=...
export AWS_SECRET_ACCESS_KEY=...
export WASABI_SERVICE_URL=s3.eu-central-1.wasabisys.com
export WASABI_BUCKET_NAME=...

#echo $AWS_ACCESS_KEY_ID

# Init repository - Not needed anymore!
#restic -r s3:https://s3.eu-central-1.wasabisys.com/<...> init

# Create new snapshot
echo 'INFO: Creating new snapshot!'
restic -r s3:https://s3.eu-central-1.wasabisys.com/<...> backup ~/work
retVal=$?
echo $retVal
if [ $retVal -ne 0 ]; then
    echo "ERROR!"
fi
echo 'INFO: Done!'
echo 'Hibernating in 10s...'
sleep 10
systemctl hibernate

Unfortunately, I have not saved the terminal output. But I remember that there were several “ConnWaitError” errors and restic finished with exit code 1.

So I have several questions:

  • Just a quick sanity check, no data on my drive was modified by restic. Only a snapshot was written to the wasabi bucket but that snapshot failed?
  • Has anyone else experienced such an error? Did not find anything, except this lorentzkim Profile - gitmemory , leads me to believe this is an error that is not on my end.
  • Is there anything I can do to avoid this error? Can I improve my script or how should I go from here?

Thanks a lot in advance!

1 Like

Is this a statement or really a question? If you see a new restic snapshot over at Wasabi, then the backup completed. It would be good to see the output from the backup, but since you don’t have that we can only presume that the backup did complete. It might just be that there were some unreadable files during the backup process, and some connectivity issues as well.

This doesn’t have to mean there was a big problem, it’s more important to look at what the end result was, so I wouldn’t worry too much about it.

Restic should finish with exit code 1 if there was a fatal error preventing a snapshot to be saved in the end. But since you say that you have a snapshot, I’m asking, is it possible that restic exited with exit code 3 (rather than 1)? What makes you think/say that the exit code was 1?


I never used Wasabi myself so I can’t comment on the other questions. But what I’d do in your place now is to simply verify the integrity of the repository. You can either run the check command which verifies that the structure of the repository is intact, or you can run the check --read-data command+option which will do the aforementioned but also verify that all the data in your repository is intact. If you do the latter, you can rest assured that everything is fine.

Another thing you can do, but this won’t verify the integrity of the data, is to simply to another backup run. Restic will then report how much new data it added to the repository (which assuming that the previous/initial backup completed should be about as much as you changed since then), as well as let you know if there’s any files it cannot read during the process.

Since it won’t hurt to run the backup again, and it’s likely that it will only add a little data (assuming you haven’t changed much since last snapshot), this should be fine to try before the check I guess :slight_smile:

Thank you for your reply.

My questions were probably worded confusingly. Restic did finish with exit code 1, that was printed out by my script. I also can not see any snapshots in the repository right now. What I wanted to know was whether or not I put something wrong in the script (which I do not believe…just as a sanity check).

Okay, so I understand that after an aborted backup I can just run another backup again and restic will sort things out by itself, correct? I was worried that the repository might have some bad data in it or something like that.

Then I will just start another run and run the check command after.

Some years ago I was also a beginner. Not to Linux but to wasabi and restic.

My way to get into things was to do them more by hand and not use scripts. In fact I still don’t use scripts at all. I just call restic directly using cron or by hand when i want to.

I would recommend the following

Create a textfile like “restic-config” with the following contents

export RESTIC_REPOSITORY=“s3:https://WASABI-URL/YOUR-BUCKET-NAME”
export AWS_ACCESS_KEY_ID=“YOUR-ACCESS_KEY”
export AWS_SECRET_ACCESS_KEY=“YOUR-SECRET”
export RESTIC_PASSWORD=“PASSWORD-OF-YOUR-RESTIC-REPOSITORY”

Now do a “source restic-config” and you have your variables set and you can use restic in a nice short way.

If you create a new repo you would now do a “restic init”. But since it looks like you already have one, do a “restic snapshots” and look at your already finished snapshots.

You can also play around with “restic list” and “restic stats” just to get to know everything a bit better.

Do a backup with verbosity. Like “restic backup -vvv /your-data-source” and watch how things are going. Take a look at “restic snapshot” when it’s done.

Just some ideas.

2 Likes

Very much so. You explicitly wrote “a snapshot was written to the wasabi bucket”, and now you say that is not what you meant. That’s not exactly helping us spend time writing the right replies, quite the opposite.

Yes, just re-run your backup. It’s fine to do so.

Thanks for the advice. Again, didnt mean to waste anyone’s time.

1 Like

No worries. Please let us know how it goes so we can rest assured that you’re on track with working backups!

The snapshot was now successfully created. Everything looks good.

Thanks for all of the advice!

1 Like