New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
repository corrupted after prune from host where the rest-server is #1871
Comments
Hm, thanks for the report. I think this is a bug within restic, but I don't have any idea what's going on yet. Can you please rebuild restic and create a debug log (instructions) and attach it to the issue? Please make sure to replace any sensitive details included in there (authentication tokens, passwords etc) before posting it. Ideally, you would reproduce this (without a debug log) on a small repo, and once it happens, you switch on the debug log and only attach the run where it fails with the index errors. That'd be the most helpful. Thanks! |
Hey, I'm having trouble building from source, I'm on Fedora 29 and when I try and build from source with debug I get:
Any suggestions? I'm very new to go. |
I know what's going on: There are two different compilers (=implementations) for Go: The Go project's official compiler called For Fedora, the correct package should be |
Thanks, that got it to work! here's the debug log, my setup is local and testing only so far, so even If I've exposed some sensitive data - that's not a problem Before running the debug I cleaned the local .cache/restic/ folder just in case and restarted the rest-server backend. Then ran restic backup again, and after a few lines of not found - I Ctrl-C'ed it and that's the debug log. |
Hm, I think I found the issue (myself :) ). The rest-server is running with user: files and when I forget/prune I used root by default without thinking - but the indexes get recreated by root - so when I try to use the rest backend again I get "not found" which confused me, in reality it's "permission denied" but shown as not-found because it can't fetch it probably. After a good recursive chown to the user which rest runs as (files) it all works as expected now. |
Ah, hm. So the error message is wrong, hm. This is an issue in the rest-server then, it should have returned a different error code and logged the error... |
The rest server does read the OS error code (and logs "permission denied" to the console if --debug is specified), however it doesn't use the error code and always returns a HTTP StatusNotFound (404) status code. One option would be to map the OS error to a more specific HTTP status code (e.g. os.IsPermission() -> HTTP StatusForbidden (403)). |
Yes, I think we need to rework error handling in the REST server, badly :/ |
The changes needed to handle this specific issue are fairly minor. Do you have any thoughts for further improvements? |
I have in mind that the REST server code could use some cleanups, in terms of error handling and logging. It uses a custom log format at the moment (for debug log output I mean), and it does not contain enough information for my taste. I'd like to change it (eventually) to a format which prints one line per request, including the requested repo/path, the username, the action, and the result (similar to the common_log format for Apache/nginx). At the moment each log entry has multiple lines, making it hard to read. |
That makes sense, in addition to the log format, think would still need to pass status back to the client. Not familiar with the nginx log format, but sounds like a good starting point. |
I just ran into the same issue. Thanks to the hint with the wrong permissions I could resolve it pretty fast! |
I also just ran into this issue. Thanks to this thread I was able to resolve it quickly, but I feel that running prune as root should not change ownership of the repository. At the very least it should output a warning. And the documentation at https://restic.readthedocs.io/en/latest/060_forget.html should caution against running prune as root. |
Output of
restic version
restic 0.9.1 compiled with go1.10.2 on linux/amd64
How did you run restic exactly?
I'm making the backups via:
then I'm forgeting/prunging on the host where the rest-server is running (192.168.1.3) with:
I'm doing this locally because the rest-server is running in append only mode.
What backend/server/service did you use to store the repository?
rest-server 0.9.7
Expected behavior
After prune, I expect the repository to continue working properly.
Actual behavior
However, after prune I can no longer backup, I get the following when I run my original backup line from above:
If I try and work with the repository on the host where rest-server is running locally via
restic -r /path/to/repo
- then it all looks good, rebuild-index, check etc - all works and looks good.Steps to reproduce the behavior
Do you have any idea what may have caused this?
No idea.
Do you have an idea how to solve the issue?
No.
Did restic help you or made you happy in any way?
Yes, great software, quick and intuitive :)
The text was updated successfully, but these errors were encountered: