-
-
Notifications
You must be signed in to change notification settings - Fork 96
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
Error removing file over SFTP but SSH permissions are OK #541
Comments
This is very hard to tell. SSH_FX_FAILURE seems to be a rather generic error code that can occur on different conditions. Googling shows me a few people seeing this error on disks that are full, but I doubt this is your problem as you just uploaded a new archive successfully. Your configuration is correct in any case. |
This could be related pkg/sftp#137 |
Yeah I'm not sure. Perhaps I can try to create a minimal go program loosely based on https://github.com/offen/docker-volume-backup/blob/main/internal/storage/ssh/ssh.go to reproduce the problem. |
I'd be interested in seeing what happens when you use a different sftp client and try to delete a file. |
Digging through the source code of the
Can you check if your remote supports this? |
@m90 I'm really not sure how to find out if that fsync extension is supported or not.
However my take on this is: I understand that the ability to force an |
I'm not sure such a fallback would really qualify as "simple" as it would require setting up yet another way of connecting to storage servers. In any case, I think this should not be solved here, but upstream in package |
I’m not really sure that One thing that could be happening is that P.S. |
Random question… you wouldn’t happen to be running this on Windows? (Why I ask, in |
I'm not entirely sure I understand yet. So the code in Then again a line like this
means that a path for use on the remote is being constructed, using the separator suitable for the client. Would it even be possible the remote is using Why do you think That being said, I don't think this problem is related to the issue itself as this would also make file creation fail, but it seems to work just fine. The SSH_FX_FAILURE is only being returned on calling |
Thanks for your thorough feedback on this by the way @puellanivis - that's much appreciated. |
From the SFTP spec:
Yeah, this kind of precludes the issue. It was a long shot anyways.
No. Everyone has settled on using |
Not sure if it helps but none of the systems involved with this issue are running Windows. They're all Linux-based. @puellanivis do you know if there is any SFTP client out there already available built using the sftp package so that I could check if that SFTP client is also reporting problems when trying to delete a file from my SFTP server ? |
Currently, filepath.Join is used to join path fragments that are supposed to be created on remote storage backends. This could theoretically cause problems when the separators used by the client and the remotes do not match. It's unlikely this causes problems right now, but it's definitely better to rectify it before it causes further confusion. This was raised in #541
Not off hand, no I don’t know any. 🤔 But you should be able to adapt any of the examples, like Another good idea would be to add the filename into the error text of
dev-v2 branch prototype for a v2 of the library actually switches to returning fs.PathError s that include the filenames, not just the status packet.)
|
…547) Currently, filepath.Join is used to join path fragments that are supposed to be created on remote storage backends. This could theoretically cause problems when the separators used by the client and the remotes do not match. It's unlikely this causes problems right now, but it's definitely better to rectify it before it causes further confusion. This was raised in #541
@f18m In case your setup allows you to use an image you build yourself, here's a branch https://github.com/offen/docker-volume-backup/tree/failure-filename that does:
Maybe this gives us an additional hint here? |
I also opened up a PR for |
I updated the code in https://github.com/offen/docker-volume-backup/tree/failure-filename to use the PR containing the backports. @f18m are you able to build the image from that branch and run it on your setup? |
Hi @puellanivis , @m90 , thank you so much for all the support. |
Thanks to the new logging I think the error is clear:
Indeed there is a "#recycle" folder inside the destination folder for the backups. I guess a folder like that cannot be deleted via SFTP because of its name? |
Indeed it seems I cannot delete the '#recycle' folder via SFTP:
(this is using the OpenSSH 'sftp' client) |
Interesting. I think I'd call the code trying to delete a directory a bug that needs to be fixed here. This behavior just wouldn't make sense in any scenario. In the meantime you should be able to work around this by setting a BACKUP_PRUNING_PREFIX in your configuration that matches your backups, e.g. Thanks for your help in debugging this. |
It seems like that '#recycle' folder is part of the (automatic) Samba configuration on my NAS:
(note that my NAS is enabling both SFTP and SAMBA access to the shares I define via some UI). Anyway reading the docs I see there is the possibility to specify a "BACKUP_PRUNING_PREFIX" option... going to try this one. |
Thanks @m90. Anyway using BACKUP_PRUNING_PREFIX=backup-, it now works fine!!
I do have one more question though: by looking at https://offen.github.io/docker-volume-backup/reference/ I was expecting "BACKUP_PRUNING_PREFIX=backup-" to be the default value. Last, as suggestion, I think it would be possible to automatically set the BACKUP_PRUNING_PREFIX to be the portion of the BACKUP_FILENAME string up to the first % sign... |
You should be able to add an An empty directory shouldn’t stop the pruning, because It would need to be either a protected directory, or a non-empty directory. |
That would make sense, yes, but it's also a breaking change in regards to the current behavior, so I can't just do it whenever. I'll put it on the list of things to consider for a v3 though. |
This is now fixed in v2.43.3 Thanks again @f18m and @puellanivis for your help in debugging this. |
Hi,
thanks for this great software!
I've set 7 days of retention for my backups over SSH/SFTP and the backups are correctly and regularly created. However docker-volume-backup is unable to erase old backups: here's a snippet of the log files (repeated many times):
The thing is: if I log via SSH using exactly
provided to docker-volume-backup, I can remove old backups without any issue with "rm"...
Any hint/idea?
The text was updated successfully, but these errors were encountered: