Symlinks are causing issues when restoring to a temp location

I’m trying to restore my snapshot to temp space so i can verify it. every time i try to run my restore job, though, it successfully restores several snapshots, and then it errors out on this snapshot.

rm -r /tmp/restic
mkdir -p /tmp/restic/local/restore
restic restore $snapshot_id -r $RESTIC_LOCAL_REPO --target /tmp/restic/local/restore
...
restoring <Snapshot dc5b491c of [/home/user/appdata/jellyfin] at 2023-12-29 11:49:41.73668273 -0500 EST by user@home-server> to /tmp/restic/local/restore
restoring <Snapshot 3f1948db of [/home/user/appdata/jellyseerr] at 2023-12-29 11:55:50.456831427 -0500 EST by user@home-server> to /tmp/restic/local/restore
ignoring error for /home/user/appdata/jellyseerr/config/logs/.machinelogs.json: Symlink: symlink .machinelogs-2023-12-29.json /tmp/restic/local/restore/home/user/appdata/jellyseerr/config/logs/.machinelogs.json: file exists
ignoring error for /home/user/appdata/jellyseerr/config/logs/overseerr.log: Symlink: symlink overseerr-2023-12-29.log /tmp/restic/local/restore/home/user/appdata/jellyseerr/config/logs/overseerr.log: file exists
Fatal: There were 2 errors

here are the contents of the directory

using ls -a results in:
user@home-server:/tmp/restic/local/restore/home/user/appdata/jellyseerr/config/logs$ ls -a
.  ..  .20136e5b8544ec13f7fc29ce3d35150d597108bb-audit.json  .d2109f103a9d757bc28894d508ee5579a3284e75-audit.json  .machinelogs-2023-12-29.json  .machinelogs.json  overseerr-2023-12-29.log  overseerr.logz

Which restic version are you using?

restic 0.14.0 compiled with go1.19.8 on linux/amd64

My guess would be that your specific problem is fixed in 0.15.0 (via Restore of a existing symlink(with same content) fails · Issue #2578 · restic/restic · GitHub ).

However, it looks like you’re running restore twice for the same location without deleting the target folder in the meantime. At least that would explain the error message.

thank you! let me see if i understand your second point correctly.

lets say i have two snapshots, abc and 123. these contain /home/user/abc and /home/user/123. you’re saying that i can’t restore both snapshots to /tmp/restic at the same time for a result of /tmp/restic/home/user/abc and /tmp/restic/home/user/123? i need to restore just one, then delete/create /tmp/restic, then restore the next, etc?

Oh, I’ve missed the part that both snapshots contain different folders. In that case, there shouldn’t be a problem. But that symlink error also only occurs if the symlink already existed, which only happens if something previously created that symlink…

1 Like

based on your insistence of the accuracy of the error message, i went through my logs again and found the issue. my job is restoring all my stuff twice for some reason. it just wasn’t a problem for my other snapshots. this particular one just throws the error as soon as it tries for the second time because of the symlinks.

thank you so much for taking the time to help me out! i also updated my version. too bad the default apt package is so out of date :frowning:

1 Like