bordaigorl / remy

Remy, an online&offline manager for the reMarkable tablet
GNU General Public License v3.0
282 stars 13 forks source link

rsync: change_dir failed #32

Closed xade93 closed 2 years ago

xade93 commented 2 years ago

Hi all,

as the title describes, reMy refuse to connect. Terminal output:

% python3 remygui.py                                
[I] STARTING: Sun May  8 16:18:26 2022
[I] Configuration loaded from /home/pityhero/.config/remy/config.json.
[I] Using known hosts file: /home/pityhero/.config/remy/known_hosts
[I] Loaded known hosts from /home/pityhero/.config/remy/known_hosts
[I] Connecting...
[I] Connected to 192.168.12.234
[I] DATA STORED IN:
    /home/user/bin/remy/data2/documents
    /home/user/bin/remy/data2/templates
receiving file list ... 
rsync: change_dir "/home/root//'/usr/share/remarkable/templates" failed: No such file or directory (2)
done

sent 8 bytes  received 116 bytes  248.00 bytes/sec
total size is 0  speedup is 0.00
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1835) [Receiver=v3.2.4]
rsync: [Receiver] write error: Broken pipe (32)
[E] RETRY? [[Errno 2] No such file or directory: '/home/pityhero/bin/remy/data2/templates/templates.json']
[I] Waiting for stray threads
[I] Done waiting
[I] QUITTING: Sun May  8 16:18:30 2022

Config:

      "rM (makeAp)": {
        "name": "reMarkable (makeAp)",
        "type": "rsync",
        "data_dir": "/home/user/bin/remy/data2",
        "host": "192.168.12.234",
        "key": "/home/pityhero/.ssh/id_rsa",
        "username": "root",
        "timeout": 3,
        "use_banner": "remy-banner.png"
      }

I am able to ssh into remarkable normally with ssh root@192.168.12.234.

bordaigorl commented 2 years ago

Hi, sorry for the late response. Looks like the path /home/root//'/usr/share/remarkable/templates is wrong in that it contains a spurious ' but I'm not sure where that comes from... If you set "log_verbosity": "debug" in your configuration you'd be able to see the full rsync command issued, and that could give us some clue.

For more details you could add

    log.debug("RSYNC command: %s", ' '.join(cmd))

after line 475 in remy/remarkable/filesource.py

arieder commented 2 years ago

Hi, I have been encountering the same error for a couple of days. Changing the source type to ssh works fine, but if I try rsync I get the following output using your suggestions:

[I] Connected to 192.168.0.108
[I] DATA STORED IN:
        /home/alex/remarkable/documents
        /home/alex/remarkable/templates
[D] RSYNC: ['/usr/bin/rsync', '--info=NAME', '-e', '/usr/bin/ssh -o batchmode=yes -i "/home/alex/.ssh/id_rsa_rem" -o userknownhostsfile="/home/alex/.config/remy/known_hosts"']
[D] RSYNC command: /usr/bin/rsync --info=NAME -e /usr/bin/ssh -o batchmode=yes -i "/home/alex/.ssh/id_rsa_rem" -o userknownhostsfile="/home/alex/.config/remy/known_hosts" -vaz --prune-empty-dirs --delete root@192.168.0.108:'/usr/share/remarkable/templates/' /home/alex/remarkable/templates
illegal environment value for mesa_glthread: "0".  Ignoring.
receiving file list ... 
rsync: change_dir "/home/root//'/usr/share/remarkable/templates" failed: No such file or directory (2)
done

I hope that sheds some light on the issue.

arieder commented 2 years ago

just a quick additional remark: if I remove the quotes from remy/remarkable/filesource.py:462, i.e., make it
return "%s@%s:%s" % (self.username, self.host, path)

then everything works fine. (But I understand that things may break if there are spaces in the paths)

bordaigorl commented 2 years ago

@arieder thanks for the feedback! Indeed this seems to be an issue with quoting. The path is taken to be '/usr... which has the side-effect of making it a relative path, so it gets expanded to /home/root/'/usr... which is all sorts of wrong. Can you change line 462 with: return '%s@%s:"%s"' % (self.username, self.host, path) (note the switch of quotes). Does it work then?

arieder commented 2 years ago

Unfortunately it does not. (It no longer fails to connect completely, but that might be because now there is a valid templates folder from before). I get the following output:


[I] DATA STORED IN:
        /home/alex/remarkable/documents
        /home/alex/remarkable/templates
[D] RSYNC: ['/usr/bin/rsync', '--info=NAME', '-e', '/usr/bin/ssh -o batchmode=yes -i "/home/alex/.ssh/id_rsa_rem" -o userknownhostsfile="/home/alex/.config/remy/known_hosts"']
[D] RSYNC command: /usr/bin/rsync --info=NAME -e /usr/bin/ssh -o batchmode=yes -i "/home/alex/.ssh/id_rsa_rem" -o userknownhostsfile="/home/alex/.config/remy/known_hosts" -vaz --prune-empty-dirs --delete root@192.168.0.108:"/usr/share/remarkable/templates/" /home/alex/remarkable/templates
illegal environment value for mesa_glthread: "0".  Ignoring.
receiving file list ... 
rsync: change_dir "/home/root//"/usr/share/remarkable/templates" failed: No such file or directory (2)
done
bordaigorl commented 2 years ago

Ok. I guess that argument does not need quoting. It seems like a platform-specific issue though. What OS/Python/RSync versions are you using?

arieder commented 2 years ago

I am using:

Manjaro Linux with Python 3.10.4 rsync version v3.2.4 protocol version 31 (on my PC) rsync version 3.1.3 protocol version 31 (on my remarkable)

bordaigorl commented 2 years ago

Ok, I pushed a fix on devel I'll see if this is causing other platforms to fail.

arieder commented 2 years ago

thank you for the quick response. For me, it works now.