(RESOLVED) Duplicati can't connect via SSH, every other device can

Hi all,

I’ve been using Duplicati successfully for quite some time. One of my destinations is a Netgear NAS - no issues at all.

Yesterday I replaced that NAS with a Synology Diskstation and am trying to modify the backup destination to the new NAS. Duplicati, when testing the connection, says:

“Failed to connect: Session operation has timed out”

All other permitted devices on the network can connect to the Synology NAS without issue. Only Duplicati can’t. Duplicati on this laptop has not changed. The IP address of the NAS is the same as the last one. I have removed all keys from ~/.ssh/known_hosts as well as “ssh-fingerprint” from the backup configuration.

Credentials have not changed and I’m not using key authentication - just username/password for now.

After I delete the “ssh-fingerprint” setting and use “Test connection” again, Duplicati does ask if I want to trust the host certificate. This suggests that connectivity is there, although something goes wrong after that point.

I’ve checked the Synology NAS and have tried high, medium and low security settings (the various levels specify which ciphers etc are accepted).

Any ideas what could be causing this?

Thanks!

Edit: Here’s the log entry related to the failure:

Renci.SshNet.Common.SshOperationTimeoutException: Session operation has timed out
  at Renci.SshNet.Session.WaitOnHandle (System.Threading.WaitHandle waitHandle, System.TimeSpan timeout) [0x00065] in <1fab08b1278e43dabeb31c481785219b>:0 
  at Renci.SshNet.Session.Renci.SshNet.ISession.WaitOnHandle (System.Threading.WaitHandle waitHandle) [0x0000d] in <1fab08b1278e43dabeb31c481785219b>:0 
  at Renci.SshNet.Channels.Channel.WaitOnHandle (System.Threading.WaitHandle waitHandle) [0x00000] in <1fab08b1278e43dabeb31c481785219b>:0 
  at Renci.SshNet.Channels.Channel.GetDataLengthThatCanBeSentInMessage (System.Int32 messageLength) [0x00059] in <1fab08b1278e43dabeb31c481785219b>:0 
  at Renci.SshNet.Channels.Channel.SendData (System.Byte[] data, System.Int32 offset, System.Int32 size) [0x0000d] in <1fab08b1278e43dabeb31c481785219b>:0 
  at Renci.SshNet.Channels.Channel.SendData (System.Byte[] data) [0x00000] in <1fab08b1278e43dabeb31c481785219b>:0 
  at Renci.SshNet.SubsystemSession.SendData (System.Byte[] data) [0x0000c] in <1fab08b1278e43dabeb31c481785219b>:0 
  at Renci.SshNet.Sftp.SftpSession.SendMessage (Renci.SshNet.Sftp.SftpMessage sftpMessage) [0x00007] in <1fab08b1278e43dabeb31c481785219b>:0 
  at Renci.SshNet.Sftp.SftpSession.OnChannelOpen () [0x00007] in <1fab08b1278e43dabeb31c481785219b>:0 
  at Renci.SshNet.SubsystemSession.Connect () [0x000ea] in <1fab08b1278e43dabeb31c481785219b>:0 
  at Renci.SshNet.SftpClient.OnConnected () [0x0002e] in <1fab08b1278e43dabeb31c481785219b>:0 
  at Renci.SshNet.BaseClient.Connect () [0x00082] in <1fab08b1278e43dabeb31c481785219b>:0 
  at Duplicati.Library.Backend.SSHv2.CreateConnection () [0x000cc] in <cd4d7a20547f42cf8eac75b90eb5491d>:0 
  at Duplicati.Library.Backend.SSHv2.List () [0x0000c] in <cd4d7a20547f42cf8eac75b90eb5491d>:0 
  at Duplicati.Library.Backend.SSHv2.Test () [0x00000] in <cd4d7a20547f42cf8eac75b90eb5491d>:0 
  at Duplicati.Server.WebServer.RESTMethods.RemoteOperation.TestConnection (System.String url, Duplicati.Server.WebServer.RESTMethods.RequestInfo info) [0x000b7] in <a6c0c2089b9a44ec9be5057a44f12116>:0 
  at Duplicati.Server.WebServer.RESTMethods.RemoteOperation.POST (System.String key, Duplicati.Server.WebServer.RESTMethods.RequestInfo info) [0x00091] in <a6c0c2089b9a44ec9be5057a44f12116>:0 
  at Duplicati.Server.WebServer.RESTHandler.DoProcess (Duplicati.Server.WebServer.RESTMethods.RequestInfo info, System.String method, System.String module, System.String key) [0x0026e] in <a6c0c2089b9a44ec9be5057a44f12116>:0

Welcome to the forum, @digitalformula2017!

Just for testing purposes, what happens if you create a new backup far enough to get to the destination test for the NEW NAS?

Hi @JonMikelV, and thanks. :slight_smile:

Your suggestion is already as far as I’ve managed to get, unfortunately.

I’ve configured all parameters up until the “Backup Destination” screen. It’s then, when I enter the IP address and credentials, that I hit the “Test connection” button and receive the error.

I should clarify, sorry - I’m not editing the old configuration. I’m starting a new backup configuration from scratch.

I didn’t notice before but I’m also seeing this at the same time as the session timeout errors:

System.ObjectDisposedException: Cannot write to a closed TextWriter.
  at System.IO.StreamWriter.Flush (System.Boolean flushStream, System.Boolean flushEncoder) [0x00008] in <ac812cae460544af83bd6cf54c5eee87>:0 
  at System.IO.StreamWriter.Flush () [0x00006] in <ac812cae460544af83bd6cf54c5eee87>:0 
  at Duplicati.Server.WebServer.RESTHandler.DoProcess (Duplicati.Server.WebServer.RESTMethods.RequestInfo info, System.String method, System.String module, System.String key) [0x003aa] in <a6c0c2089b9a44ec9be5057a44f12116>:0 ~~~

Try saving the job, then going back and testing. I find that tends to work better for testing.
If that doesn’t work, set a log file and set it to profile level, and then post that output. (both on the 5th screen)

Thanks @davegold. The errors are the same:

System.ObjectDisposedException: Cannot write to a closed TextWriter.
  at System.IO.__Error.WriterClosed()
  at System.IO.StreamWriter.Flush(Boolean flushStream, Boolean flushEncoder)
  at Duplicati.Server.WebServer.RESTHandler.DoProcess(RequestInfo info, String method, String module, String key)

Followed by:

Renci.SshNet.Common.SshOperationTimeoutException: Session operation has timed out
   at Renci.SshNet.Session.WaitOnHandle(WaitHandle waitHandle, TimeSpan timeout)
   at Renci.SshNet.Channels.Channel.GetDataLengthThatCanBeSentInMessage(Int32 messageLength)
   at Renci.SshNet.Channels.Channel.SendData(Byte[] data, Int32 offset, Int32 size)
   at Renci.SshNet.Sftp.SftpSession.OnChannelOpen()
   at Duplicati.Library.Backend.SSHv2.CreateConnection()
   at Duplicati.Library.Backend.SSHv2.List()
   at Duplicati.Server.WebServer.RESTMethods.RemoteOperation.TestConnection(String url, RequestInfo info)
   at Duplicati.Server.WebServer.RESTHandler.DoProcess(RequestInfo info, String method, String module, String key)

Sorry everyone. This turned out to be an issue with the stupid Synology NAS, not with Duplicati.

There’s a bug of some sort in the Synology DSM software that means connections on port 22 simply don’t work, even if they’re enabled and configured correct.

I had to change the SSH and SFTP ports to a different port number. Duplicati could then connect.

Apologies for wasting everyone’s time! :frowning:

1 Like

No need to apologize - I don’t recall reading of this DSM bug elsewhere so at least now we have it documented!

(I hope you don’t mind, I went ahead and flagged your post as the solution…)

Nope, I don’t mind at all. Even though it’s a messy solution, it is the solution. Synology seemed surprised that I told them, despite others having the exact same issue with this sort of connection (outside of Duplicati).

Thanks again! :slight_smile: