RClone sftp with local avahi hostname

What is the problem you are having with rclone?

I'm trying to set up rclone with an sftp server running on a raspberry pi (which I use as NAS) on my local network. I have avahi-daemon running on my Pi, and it has a hostname raspberrypi.local. When I do ssh pi@raspberrypi.local, I can ssh with no problems. But when I try to use sftp with it, I get the error pasted below because rclone seems to be unable to resolve the hostname.

Why is my rclone unable to resolve the local hostname? It looks like it's using some kind of public DNS to resolve the hostname? Oddly enough this wasn't a problem when I was running on the ubuntu-repo-default 1.50, but with the new version (which I installed to try and solve an unrelated issue) I get this.

BTW, yes I have tried replacing the hostname with the Pi's local IP (192.168.0.X) and it works, but that's very suboptimal since my router loves to change the local IP of my Pi.

Thanks for looking!

What is your rclone version (output from rclone version)

rclone v1.55.1

  • os/type: linux
  • os/arch: amd64
  • go/version: go1.16.3
  • go/linking: static
  • go/tags: none

Which OS you are using and how many bits (eg Windows 7, 64 bit)

Ubuntu x86_64

Which cloud storage system are you using? (eg Google Drive)

SFTP

The command you were trying to run (eg rclone copy /tmp remote:tmp)

rclone -vv ls rpi: 

The rclone config contents with secrets removed.

[gdrive]
type = drive
client_id = nope
client_secret = nope
scope = drive
token = nope

[stash]
type = crypt
remote = rpi:nope
filename_encryption = standard
directory_name_encryption = true
password = nope
password2 = nope

[rpi]
type = sftp
host = raspberrypi.local
user = pi
port = 22
pass = nope

A log from the command with the -vv flag

λ frank ~ → rclone -vv ls rpi:/media/external --max-depth=2 
<7>DEBUG : Using config file from "/home/dan/.config/rclone/rclone.conf"
<7>DEBUG : rclone: Version "v1.55.1" starting with parameters ["rclone" "-vv" "ls" "rpi:/media/external" "--max-depth=2"]
<7>DEBUG : rclone: systemd logging support activated
<7>DEBUG : Creating backend with remote "rpi:/media/external"
<7>DEBUG : pacer: low level retry 1/10 (error couldn't connect SSH: dial tcp: lookup raspberrypi.local on 10.0.254.2:53: no such host)
<7>DEBUG : pacer: Rate limited, increasing sleep to 200ms
<7>DEBUG : pacer: low level retry 2/10 (error couldn't connect SSH: dial tcp: lookup raspberrypi.local on 10.0.254.2:53: no such host)
<7>DEBUG : pacer: Rate limited, increasing sleep to 400ms
<7>DEBUG : pacer: low level retry 3/10 (error couldn't connect SSH: dial tcp: lookup raspberrypi.local on 10.0.254.2:53: no such host)
<7>DEBUG : pacer: Rate limited, increasing sleep to 800ms
<7>DEBUG : pacer: low level retry 4/10 (error couldn't connect SSH: dial tcp: lookup raspberrypi.local on 10.0.254.2:53: no such host)
<7>DEBUG : pacer: Rate limited, increasing sleep to 1.6s
<7>DEBUG : pacer: low level retry 5/10 (error couldn't connect SSH: dial tcp: lookup raspberrypi.local on 10.0.254.2:53: no such host)
<7>DEBUG : pacer: Rate limited, increasing sleep to 2s
<7>DEBUG : pacer: low level retry 6/10 (error couldn't connect SSH: dial tcp: lookup raspberrypi.local on 10.0.254.2:53: no such host)
<7>DEBUG : pacer: low level retry 7/10 (error couldn't connect SSH: dial tcp: lookup raspberrypi.local on 10.0.254.2:53: no such host)
<7>DEBUG : pacer: low level retry 8/10 (error couldn't connect SSH: dial tcp: lookup raspberrypi.local on 10.0.254.2:53: no such host)
<7>DEBUG : pacer: low level retry 9/10 (error couldn't connect SSH: dial tcp: lookup raspberrypi.local on 10.0.254.2:53: no such host)
<7>DEBUG : pacer: low level retry 10/10 (error couldn't connect SSH: dial tcp: lookup raspberrypi.local on 10.0.254.2:53: no such host)
Failed to create file system for "rpi:/media/external": NewFs: couldn't connect SSH: dial tcp: lookup raspberrypi.local on 10.0.254.2:53: no such host

hello and welcome to the forum,

so if you switch to v1.50, rclone works and if you swtich to v1.55.1 rclone does not work?

rclone will use whatever dns server is setup on the device running the ssh client.
seems like rclone cannot find the dns server on port 53?

not sure why you have that problem but as a workaround.
in the router, setup a static reservation for the pi, then the ip address will never change.

Hello and thanks for your reply! Yes when I was using 1.50 I was able to resolve the domain, which is why this is so bizarre.

And yes, the reserved IP thing is a reasonable solution. If there’s no solution to this, I’ll go with that. But it’s very strange, since as you said it uses the same dns as the standard ssh and I can do ssh pi@raspberrypi.local no problem.

but now, as a test, if you use v1.50, rclone does not error?
that would be very helpful to know.

both the ssh client and the the pi are on the same lan, but have different subnets?
does that have something to do with avahi?
Pi's local IP (192.168.0.X)
and the error from the rclone
lookup raspberrypi.local on 10.0.254.2

This might be to do with rclone using your system resolver or not.

Try compiling rclone from source - this will get you an rclone which uses your systems's resolver which might work better.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.