Error restoring single file in latest snapshot

Hello, and first of all thank you for restic so much.

I am trying to restore a single file from the latest snapshot with the command:
restore latest --target /data/home/upback/restic/tmp --include “/data/nas3data/Downloads/Complete/All of Ben Liebrand on Radio Veronica Broadcast/Ben Liebrand - In The Mix Radio Show 2018 (radio 10)/#561 Ben Liebrand R10 - in the mix full hour format 2018-08-04_2100-2200 hours \[streamrip no re-encode\].mp3”

Note that the [ and ] characters are escaped, and that the filename has spaces in it so it is put between quotes.

The result of this is:
Fatal: more than one snapshot ID specified: [latest of Ben Liebrand on Radio Veronica Broadcast/Ben Liebrand - In The Mix Radio Show 2018 (radio 10)/#561 Ben Liebrand R10 - in the mix full hour format 2018-08-04_2100-2200 hours \[streamrip no re-encode\].mp3"]

And I can’t figure out why this specifies more than one snapshot?

If I do a find instead of restore:
find “/data/nas3data/Downloads/Complete/All of Ben Liebrand on Radio Veronica Broadcast/Ben Liebrand - In The Mix Radio Show 2018 (radio 10)/#561 Ben Liebrand R10 - in the mix full hour format 2018-08-04_2100-2200 hours \[streamrip no re-encode\].mp3” --long --snapshot latest

I would expect the result to be one single file, but instead a rather long list of files is returned with totally different files, p.e.:
dgrwxr-xr-x 100 100 0 2017-04-02 06:47:31 /data/nas3data/Apps/Traktor/Trainspotter2.3/configuration/org.eclipse.osgi/bundles/142/1/.cp/icons/full/dlcl16

The only reason I can think of is because of the word “full” in the filename requested, and the word “full” in the path of the unrelated file, but I am not sure.

How can I restore just the latest version of this one file?

Thank you!

The syntax is restic restore [flags] snapshotID. The snapshotID should be last.

I haven’t tested it myself and I’m not sure on this one but it might aswell be caused by wrong option order. The syntax should be restic find [flags] PATTERN.

Thank you, will try that of course.

But please note that the examples @ Restoring from backup — restic 0.12.0 documentation

do not specify the snapshotID as last.

You are correct, the order you were using is in the documentation and is working (just tested it). It looks like the # character is what is causing you problems. Maybe restic is interpreting the rest of the filename as comment?

Can you try this?
restic restore latest --target /data/home/upback/restic/tmp --include "/data/nas3data/Downloads/Complete/All of Ben Liebrand on Radio Veronica Broadcast/Ben Liebrand - In The Mix Radio Show 2018 (radio 10)*"

Thank you, will try that.
Currently waiting for a rather larger check read-data, because of Http2 stream closed / connection reset / context canceled - #4 by mdl

But I will get back with the results.
Thank you!

Note that you should not escape [ and ] when they appear in a quoted string. In that case the backslashes are taken literally.

$ echo "[foo]"
[foo]
$ echo "\[foo\]"
\[foo\]

Generally, using single quotes is a pretty safe way to escape everything, except for other single quotes. Prefer them when possible.

hello @cdhowie
Thank you for your answer.
Restic wants brackets to be escaped, see earlier discussion: Restore fails but no error is shown

1 Like

Ah, my bad. I forgot that restic interprets the brackets itself.

Hello @764287, thank you for your reply.
I just tested the command you suggested but unfortunately, the same error occurs:
2021-04-07 12:05:58 Restic command restore latest --target /data/home/upback/restic/tmp --include '/data/nas3data/Downloads/Complete/All of Ben Liebrand on Radio Veronica Broadcast/Ben Liebrand - In The Mix Radio Show 2018 (radio 10)*' 2021-04-07 12:05:58 Starting restic restore, output follows Fatal: more than one snapshot ID specified: [latest of Ben Liebrand on Radio Veronica Broadcast/Ben Liebrand - In The Mix Radio Show 2018 (radio 10)*']

I also tried a find:
find '/data/nas3data/Downloads/Complete/All of Ben Liebrand on Radio Veronica Broadcast/Ben Liebrand - In The Mix Radio Show 2018 (radio 10)*' --long --snapshot latest

Which also returns files that I would not expect, like, p.e.:
Found matching entries in snapshot 50257878 from 2021-04-05 03:03:02 -rw-r--r-- 100 100 18193 2018-10-01 17:31:07 /data/nas3data/Iedereen/2018/BTW/1809.ods

How can I correct this?
Thank you so much.

Hi guys,
Besides a lot of joy restic gives me, I keep having this little issue. Today I ran into another file that can not be restored:
Restic version:
restic 0.12.0 compiled with go1.15.8 on linux/arm

I expect that this find command returns just one file:
find ‘/data/nas3data/Downloads/Complete/RARE FLAC/Unreleleased and rare tracks/Another Suitcase In Another Hall (Tv Radio Edit).Ape’ --long --snapshot latest

But it returns several files:

Found matching entries in snapshot ab52a9a9 from 2021-04-13 17:24:03
drwxr-xr-x 100 100 0 2020-10-28 21:16:07 /data/nas3data/Apps/Audio Plugins/Analogobsession/rare
-rwxr–r-- 100 100 14951147 2019-04-15 13:30:55 /data/nas3data/Apps/Audio Plugins/Analogobsession/rare/RARE_AU_MAC.zip
-rwxr–r-- 100 100 14983182 2019-10-24 10:12:02 /data/nas3data/Apps/Audio Plugins/Analogobsession/rare/Rare_2.0_AU_MAC.zip
-rwxr–r-- 100 100 148 2019-06-12 15:52:11 /data/nas3data/Apps/Audio Plugins/Analogobsession/rare/description

And a restore fails:
restore latest --target /data/home/upback/restic/tmp --include ‘/data/nas3data/Downloads/Complete/RARE FLAC/Unreleleased and rare tracks/Another Suitcase In Another Hall (Tv Radio Edit).Ape’

Fatal: more than one snapshot ID specified: [latest FLAC/Unreleleased and rare tracks/Another Suitcase In Another Hall (Tv Radio Edit).Ape’]

Any help really appreciated. Thank you.

For find, please see restic help find and notice that you’re supposed to provide the flags before the pattern you are searching for: restic find [flags] PATTERN.... Also make sure your quotes aren’t some funky ones, but plain single (') or double (") ones. Try e.g.:

find --long --snapshot latest '/data/nas3data/Downloads/Complete/RARE FLAC/Unreleleased and rare tracks/Another Suitcase In Another Hall (Tv Radio Edit).Ape'

For restore, please see restic help restore and notice that you’re supposed to provide the flags before the snapshot you want to restore from: restic restore [flags] snapshotID. Also make sure your quotes aren’t some funky ones, but plain single (') or double (") ones. Try e.g.:

restore --target /data/home/upback/restic/tmp --include '/data/nas3data/Downloads/Complete/RARE FLAC/Unreleleased and rare tracks/Another Suitcase In Another Hall (Tv Radio Edit).Ape' latest

I don’t remember off the top of my head if find accepts latest as a snapshot ID, but I guess you’ll see :slight_smile:

Hello @rawtaz thank you for your time and reply.

I tried your suggestions, but unfortunately no luck:

find --long --snapshot latest “/data/nas3data/Downloads/Complete/RARE FLAC/Unreleleased and rare tracks/Another Suitcase In Another Hall (Tv Radio Edit).Ape”

Found matching entries in snapshot ab52a9a9 from 2021-04-13 17:24:03
drwxr-xr-x 100 100 0 2020-10-28 21:16:07 /data/nas3data/Apps/Audio Plugins/Analogobsession/rare
-rwxr–r-- 100 100 14951147 2019-04-15 13:30:55 /data/nas3data/Apps/Audio Plugins/Analogobsession/rare/RARE_AU_MAC.zip
-rwxr–r-- 100 100 14983182 2019-10-24 10:12:02 /data/nas3data/Apps/Audio Plugins/Analogobsession/rare/Rare_2.0_AU_MAC.zip
-rwxr–r-- 100 100 148 2019-06-12 15:52:11 /data/nas3data/Apps/Audio Plugins/Analogobsession/rare/description

And a restore:

restore --target /data/home/upback/restic/tmp --include “/data/nas3data/Downloads/Complete/RARE FLAC/Unreleleased and rare tracks/Another Suitcase In Another Hall (Tv Radio Edit).Ape” latest

Fatal: more than one snapshot ID specified: [FLAC/Unreleleased and rare tracks/Another Suitcase In Another Hall (Tv Radio Edit).Ape" latest]

I tried single quotes (’) and double quotes ("), behavior is the same.

Please note that the examples at Restoring from backup — restic 0.12.0 documentation do specify the syntax I used previously.

You’re indeed right about the documentation there!

Reading the command and the output of your restore attempt, it appears that restic parsed "/data/nas3data/Downloads/Complete/RARE (including the starting ") as the value for the --include option, and either FLAC/Unreleleased and rare tracks/Another Suitcase In Another Hall (Tv Radio Edit).Ape" (including the ending ") or each space-separated word of that as a snapshot ID (besides the latest one at the end). I’d guess it splits into all words.

I tried it here and it works fine to both find a file with spaces in it:

$ RESTIC_PASSWORD=apaapa ./restic -r apa find --long --snapshot latest "Another Suitcase In Another Hall (Tv Radio Edit).Ape"
repository ba330420 opened successfully, password is correct
Found matching entries in snapshot 844a6ba8 from 2021-04-13 19:20:18
-rw-r--r--   502    20      7 2021-04-13 19:19:15 /foo/rare/RARE FLAC/Unreleased and rare tracks/Another Suitcase In Another Hall (Tv Radio Edit).Ape

as well as restoring a file with spaces in it:

$ RESTIC_PASSWORD=apaapa ./restic -r apa restore --target tmp --include "/foo/rare/RARE FLAC/Unreleased and rare tracks/Another Suitcase In Another Hall (Tv Radio Edit).Ape" latest
repository ba330420 opened successfully, password is correct
restoring <Snapshot 844a6ba8 of [/Users/rawtaz/go/src/github.com/restic/restic/foo] at 2021-04-13 19:20:18.436019 +0200 CEST by rawtaz@bleh.local> to tmp

$ find tmp
tmp
tmp/foo
tmp/foo/rare
tmp/foo/rare/RARE FLAC
tmp/foo/rare/RARE FLAC/Unreleased and rare tracks
tmp/foo/rare/RARE FLAC/Unreleased and rare tracks/Another Suitcase In Another Hall (Tv Radio Edit).Ape

My best guess right now is that you still have mangled characters in the command/path, for example I think that your spaces are not regular spaces. Please run the restore command again after editing it so that you replace each and every space in the command with a regular space (that is, delete each space and replace it with a regular new space).

Thank you, found it.

Please accept my apologies because it was totally my own error. Somewhere in my script, quotes didn’t make it completely to the restic command that was issued by the script.

This is part of the problem. When you debug something, you should take all unnecessary potential culpruits out of the factor, and e.g. try the commands suggested manually. I presume that in this case you tested the things I suggested inside your script, which still contains the potential of error in the script. Better to try the commands all by yourself to make sure that they work as intended, then you can focus on the script being the problem.

Glad it works now!

1 Like