Re: Problems with remote repository access via sftp

Denis Corbin <[email protected]> Sat, 1 Oct 2022 20:43:23 +0200
Newsgroups gmane.comp.sysutils.backup.dar.support
Organization http://dar.linux.free.fr/
Message-ID <[email protected]>
On 30/09/2022 22:00, Martin Michel wrote:
> Hi Denis,

Hi Martin,

>   
>> OK, I would amend my previous writing with this:
>>
>> 	dar -va -t sftp://xxxx@host//home/xxx/archive/server4you/first
>>
>> can you try this?
> 
> I tried it, any many other combination how the path could be specified.
> Unfortunately, it did not help.

Yes I answered too quickly, I could have guessed this was not the 
problem, else you could not have been able to create the backup through 
sftp.

> 
> Concerning your other guides:
> 
>> would advise for now to test with the dar_static I provide at
>> https://dar.edrusb.org/dar.linux.free.fr/Releases/ if you don't mind.
> 
> Yes, I downloaded and use for all tests dar_static_2.7.7_x86_64_GNU_Linux

Good, this is just for the troubleshooting phase here, right.

> 
>[...]
 >

I did some investigations, commenting below based on that:

> Additionally, I tried to access my cloud storage via curl directly, this worked.
> Given this command, I could get a file listing of the directory where my archive is stored:
> 
> curl -k sftp://xxxx@host/archives/server4you/
> 
> My curl version is:
> 
> $ curl --version
> curl 7.84.0 (x86_64-unknown-linux-gnu) libcurl/7.84.0 OpenSSL/1.1.1q zlib/1.2.12 zstd/1.5.2 libssh2/1.10.0 nghttp2/1.49.0
> Release-Date: 2022-06-27
> Protocols: dict file ftp ftps gopher gophers http https imap imaps mqtt pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp
> Features: alt-svc AsynchDNS HSTS HTTP2 HTTPS-proxy IPv6 Largefile libz NTLM NTLM_WB SSL threadsafe TLS-SRP UnixSockets zstd
> 
> 
> Actually, and this is strange, for creation of the archive with dar -c, exactly the same path worked.
> See here the difference copied from my terminal:
> 
> [~]$ dar_static -l sftp://xxxx-1vLc8hIqMXM6W2CmMRYvJckow22SKM/[email protected]/archives/server4you/first
> Parse error: Error opening directory: archives/server4you : Datei oder Verzeichnis nicht gefunden
> [~]$ dar_static -c sftp://xxxx-1vLc8hIqMXM6W2CmMRYvJckow22SKM/[email protected]/archives/server4you/first
> Please provide the password for login xxxx at host xxxx.your-storagebox.de:
> <aborted with ^C>
> 

OK, this is a bug in dar, it is now fixed in git/branch_2.7.x and is 
available in Release Candidate 2 for 2.7.8 (aka 2.7.8.RC2):
https://dar.edrusb.org/dar.linux.free.fr/Interim_releases/

> 
> Okay, I just tried something else.
> Things are getting more mysterious.
> I moved the dar archive into the root directory of my user (~).
> 
> Now this happens when I run from my desktop GNU/Linux:
> 
> $ dar_static -l sftp://xxxx-1vLc8hIqMXM6W2CmMRYvJckow22SKM/[email protected]/first
> Please provide the password for login xxxx at host xxxx.your-storagebox.de:
> Segmentation fault

the segmentation fault occurs inside the libcurl call 
'curl_easy_perform()' but only with the static linking... (I did several 
builds to test that) maybe something was wrong with the libcurl 
statically linked library I was using here and am also using to build 
the dar_static binaries. I have thus upgraded libcurl (and librsync by 
the way) to a more recent versions and the problem vanished...

By the way too, I have added the option -avc to surface the verbose 
libcurl messages to dar output (it was only available when dar was 
compiled with debug option, but it sound interesting for dar's users too).

I've setup a dar_static version with the upgraded static builds of 
libcurl and librsync, but as I have not run a lot of testing on it, this 
dar_static binary will be left available only for testing, waiting for 
official 2.7.8 release. You can fetch it at:

https://dar.edrusb.org/dar.linux.free.fr/Specific_builds/

> 
> 
> I have also a VPS, running the same on that with the same dar_static:
> 
> $ ./dar_static_2.7.7_x86_64_GNU_Linux -j 3 -l sftp://xxxx-1vLc8hIqMXM6W2CmMRYvJckow22SKM/[email protected]/first
> Please provide the password for login xxxx at host xxxx.your-storagebox.de:
> No backup file is present in sftp://xxxx.your-storagebox.de// for archive first, please provide the last file of the set. [return = YES | Esc = NO]
> Escaping...
> Final memory cleanup...
> Aborting program. User refused to continue while asking: No backup file is present in sftp://xxxx.your-storagebox.de// for archive first, please provide the last file of the set.
> 
> Note that dar has append a trailing slash in the output.
> Strange though that it segfaults on my local PC but not on the VPS.

yes, even stranger is that it didn't segfaulted when run from within gdb 
(the debugging tool), but it did alone. So I could only trace the place 
of the root cause by adding extra temporary output, recompiling and 
retrying, which lead to the libcurl curl_easy_perform() call as 
mentioned above.

> 
> Let me know how I can help debug this further.
> I might be offline (from this mail) for some days after the weekend though.

Thank you for your patience, I was traveling this week and it had not 
the possibility to try reproducing it until today.

> 
> Best regards,
> Martin
> 
>