restic / restic

Fast, secure, efficient backup program
https://restic.net
BSD 2-Clause "Simplified" License
25.75k stars 1.54k forks source link

v 0.17.0 VSS error on Windows 2016 Server #4986

Closed Hoffenbar closed 2 weeks ago

Hoffenbar commented 1 month ago

Output of restic version

restic version 0.17.0 compiled with go1.22.5 on windows/amd64

What backend/service did you use to store the repository?

Filesystem

Problem description / Steps to reproduce

Do something like this on Windows Server 2022:

restic -r d:/backup-restic --verbose backup --use-fs-snapshot d:/programme/xyz it works as expected.

Do the same on Windows Server 2016:

At some state, the following error appears:

VSS error: The caller does not have sufficient backup privileges or is not an administrator: E_ACCESSDENIED (0x80070005)

There are no different rights in effect.

Expected behavior

Backup should work as with the previous restic version without an error. I noticed that there were some changes in VSS area between 0.16.5 and 0.17.0.

Actual behavior

Do you have any idea what may have caused this?

There must be some internal changes in the code regarding the VSS-API.

Did restic help you today? Did it make you happy in any way?

of course.

MichaelEischer commented 1 month ago

I noticed that there were some changes in VSS area between 0.16.5 and 0.17.0.

Does that mean that restic 0.16.5 works? Or is it an unrelated remark?

At some state, the following error appears:

That error happens when initializing the VSS components. There have been a few VSS related changes in restic 0.17.0, but neither of should be relevant up to this point. The error really looks like a permission problem on the server.

Hoffenbar commented 1 month ago

0 16.5 works under same conditions!-- Diese Nachricht wurde von meinem Android Mobiltelefon mit WEB.DE Mail gesendet.Am 10.08.24, 18:31 schrieb Michael Eischer @.***>:

I noticed that there were some changes in VSS area between 0.16.5 and 0.17.0.

Does that mean that restic 0.16.5 works? Or is it an unrelated remark?

At some state, the following error appears:

That error happens when initializing the VSS components. There have been a few VSS related changes in restic 0.17.0, but neither of should be relevant up to this point. The error really looks like a permission problem on the server. — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

Hoffenbar commented 3 weeks ago

To clarify, restic 0.16.5 works UNDER THE SAME CONDITIONS where 0.17 fails.

MichaelEischer commented 2 weeks ago

I've just taken another look and ended up with a question regarding the error message.

VSS error: The caller does not have sufficient backup privileges or is not an administrator: E_ACCESSDENIED (0x80070005)

Was that error printed without any prefix such as "failed to create snapshot for ..."? If yes, then restic probably exited immediately afterwards? If any of those answers are false, then please provide the full log output of a failing restic run (with redacted paths if relevant).

If both answers are yes, then the VSS permission check failed. However, there haven't been any changes to that code path that could in any way explain the different behavior. In that case, the only way forward would be to use git bisect between 0.16.5 and 0.17.0 and compile and test different restic versions, to find the change that introduced the problem.

Hoffenbar commented 2 weeks ago

The complete output is as follows:

D:\BMT\Tools>backupTEST.cmd
open repository
repository 42f52823 opened (version 2, compression level auto)
using parent snapshot 2659838f
load index files
[0:00] 100.00%  5 / 5 index files loaded
start scan on [d:/programme/projectile d:/Programme/Apache24/conf d:/bmt]
start backup on [d:/programme/projectile d:/Programme/Apache24/conf d:/bmt]
creating VSS snapshot for [d:\]
successfully created snapshot for [d:\]
scan finished in 5.820s: 0 files, 0 B
Fatal: unable to save snapshot: nodeFromFileInfo d:\Programme: get named security info failed with: Access is denied.

The same cmd with same user on same machine runs fine with the previous version of restic...

MichaelEischer commented 2 weeks ago

Fatal: unable to save snapshot: nodeFromFileInfo d:\Programme: get named security info failed with: Access is denied.

That error message is completely unrelated to the E_ACCESSDENIED error from the initial post. That looks rather like https://github.com/restic/restic/issues/5003 . Are you still able to reproduce the initial error or can we close this issue?

Hoffenbar commented 2 weeks ago

Yes I see that the flow is a little different in the last example. Just tested again on Windows 2022 Server - everything works fine. Tested again on 2016 - the Fatal: unable to save snapshot: nodeFromFileInfo d:\Programme: get named security info failed with: Access is denied. - Error happens (but not with 0.16.5!). Tested again on Win 2019 Server - works fine. Very mysterious. So, the errormessage is different from the first mentioned, but it remains true, that 0.17.0 does not work in Windows Server 2016 under the the very same conditions where 0.16.5 runs fine.

MichaelEischer commented 2 weeks ago

Yes I see that the flow is a little different in the last example.

The original error is related to creating a VSS snapshot. The last example is related to collecting metadata for a folder during the backup. Those errors don't have anything in common and have to be addressed in very different parts of restic.

https://github.com/restic/restic/issues/4953 fixes the problem of not creating a snapshot in that case. What's left is figuring out why the error message occurs and how to best filter it. However, that belongs into https://github.com/restic/restic/issues/5003 .

Does the error also occur when not creating a VSS snapshot? Is there anything special about the d:\Programme folder? Please add the response to #5003. I'll close this issue for now as the VSS error apparently doesn't reproduce, feel free to reopen it if the original error shows up again.