Different behavior between restic 0.9.6 and 0.11.0 on backup errors?

I’ve been using 0.9.6 for several months now. Backups were looking goods.
I upgraded yesterday to 0.11.0. And now, one of my backups keeps on failing: the restic backup command returns error code 3.

I looked into more details in the various logs, and I noticed that, erratically, a few files to be backed up error out during the ‘restic backup’ with error : permission denied (which is weird, I’m running restic backup as sudo…). This triggers a final result code ‘3’ for the ‘restic backup’ command.

So I went into past days backup logs, and I noticed that I had failed to see that the same errors actually occurred before. But restic 0.9.6 result code was apparently 0 in such cases. Now, restic 0.11.0 reports a result code of 3.

2 questions :
1- Am I correct in assuming that ‘restic backup’ result code changed between 0.9.6 and 0.11.0 in such circumstances?

2- What is the consequence of this in terms of snapshot consistency?
The ‘restic check’ returns no error. So I would tend to say that this only means that not all files were backed up, but over all, the backup terminated properly nevertheless.
As a consequence, if I need to restore these backups, I would ‘simply’ not have those files which caused the ‘permission denied’ issue. But all other files would be restored properly.
Am I right?

Thanks

That’s an intentional change introduced in 0.10.0, see #2546 and #2526. You are encouraged to read the CHANGELOG file. We’re trying very hard to make it user readable so you get a quick information what has changed without having to follow the activity on GitHub in detail. :slight_smile:

Here’s the relevant entry:

Change #2546: Return exit code 3 when failing to backup all source data

The backup command used to return a zero exit code as long as a snapshot could be created successfully, even if some of the source files could not be read (in which case the snapshot would contain the rest of the files).

This made it hard for automation/scripts to detect failures/incomplete backups by looking at the exit code. Restic now returns the following exit codes for the backup command:

0 when the command was successful - 1 when there was a fatal error (no snapshot created) - 3 when some source data could not be read (incomplete snapshot created)

You’ll get an incomplete snapshot which misses some files. The others you will be able to restore without any issues.

We decided to change the behavior so users were notified that restic was unable to save some files. Apparently it worked very well for you :slight_smile:

Yep, exactly.

1 Like

Point taken, I should have read the changelog notes indeed. :flushed:

Thanks a lot!

2 Likes