Evidlo / remarkable_mouse

use your reMarkable as a graphics tablet
GNU General Public License v3.0
514 stars 49 forks source link

Another connection issue #75

Open Dmarc opened 2 years ago

Dmarc commented 2 years ago

I fail using remouse, because (I guess) of some connection issue. The instruction remouse --address remarkable --debug yields:

rDebugging enabled... Connecting to input 'remarkable'

then, after a couple of minutes:

Traceback (most recent call last): File "/usr/bin/remouse", line 8, in <module> sys.exit(main())

File "/home/marc/.local/lib/python3.10/site-packages/remarkable_mouse/remarkable_mouse.py", line 138, in main rm_inputs = open_rm_inputs(

File "/home/marc/.local/lib/python3.10/site-packages/remarkable_mouse/remarkable_mouse.py", line 73, in open_rm_inputs client.connect(

File "/home/marc/.local/lib/python3.10/site-packages/paramiko/client.py", line 349, in connect retry_on_signal(lambda: sock.connect(addr))

File "/home/marc/.local/lib/python3.10/site-packages/paramiko/util.py", line 283, in retry_on_signal return function()

File "/home/marc/.local/lib/python3.10/site-packages/paramiko/client.py", line 349, in <lambda> retry_on_signal(lambda: sock.connect(addr))

TimeoutError: [Errno 110] Connection timed out

The remarkable config is: Host remarkable Hostname 10.11.99.1 User root Port 22 IdentityFile ~/.ssh/remarkable2 PubkeyAcceptedKeyTypes=+ssh-rsa HostKeyAlgorithms=+ssh-rsa

I checked that ssh remarkable works just fine, yet.

Evidlo commented 2 years ago

Does it work if you leave out --address? Can you ssh into 10.11.99.1?

Dmarc commented 2 years ago

No, it does not work. When doing ssh into 10.11.99.1, I have the message Unable to negotiate with 10.11.99.1 port 22: no matching host key type found. Their offer: ssh-rsa. This is because with openSSH 8.8 and later, ssh-rsa keys are disabled by default, as explained here. This is why I added the two lines PubkeyAcceptedKeyTypes +ssh-rsa HostKeyAlgorithms +ssh-rsa into the SSH config file.

Evidlo commented 2 years ago

That's a bit weird, as the exception from Paramiko is about timing out, whereas the issue in openssh-client is that that RSA isn't supported anymore.

Dmarc commented 2 years ago

Yep, since ssh remarkable works great (with remarkable defined in the SSH config file as shown above), I was expecting that remouse --address remarkable would have worked as well...

Dmarc commented 2 years ago

I forgot to mention I have a Remarkable 2.

Evidlo commented 2 years ago

Have you remouse with 10.11.99.1, so that it doesn't use your ssh config?

Dmarc commented 2 years ago

Here is the result of remouse --address 10.11.99.1:

/home/marc/.local/lib/python3.10/site-packages/paramiko/transport.py:236: CryptographyDeprecationWarning: Blowfish has been deprecated
  "class": algorithms.Blowfish,
Exception (client): key cannot be used for signing
Traceback (most recent call last):
  File "/home/marc/.local/lib/python3.10/site-packages/paramiko/transport.py", line 2163, in run
    handler(self.auth_handler, m)
  File "/home/marc/.local/lib/python3.10/site-packages/paramiko/auth_handler.py", line 375, in _parse_service_accept
    sig = self.private_key.sign_ssh_data(blob, algorithm)
  File "/home/marc/.local/lib/python3.10/site-packages/paramiko/agent.py", line 434, in sign_ssh_data
    raise SSHException("key cannot be used for signing")
paramiko.ssh_exception.SSHException: key cannot be used for signing

Traceback (most recent call last):
  File "/usr/bin/remouse", line 8, in <module>
    sys.exit(main())
  File "/home/marc/.local/lib/python3.10/site-packages/remarkable_mouse/remarkable_mouse.py", line 138, in main
    rm_inputs = open_rm_inputs(
  File "/home/marc/.local/lib/python3.10/site-packages/remarkable_mouse/remarkable_mouse.py", line 73, in open_rm_inputs
    client.connect(
  File "/home/marc/.local/lib/python3.10/site-packages/paramiko/client.py", line 435, in connect
    self._auth(
  File "/home/marc/.local/lib/python3.10/site-packages/paramiko/client.py", line 766, in _auth
    raise saved_exception
  File "/home/marc/.local/lib/python3.10/site-packages/paramiko/client.py", line 702, in _auth
    self._transport.auth_publickey(username, key)
  File "/home/marc/.local/lib/python3.10/site-packages/paramiko/transport.py", line 1624, in auth_publickey
    raise SSHException("No existing session")
paramiko.ssh_exception.SSHException: No existing session
Evidlo commented 2 years ago

Can you try with the --password option?

I think it doesn't like your default ssh key. You might also try generating an RSA ssh key and use the --key option.

Dmarc commented 2 years ago

Adding the --password option yields the exact same error message as above. I think these two lines generate an RSA ssh key, as you suggested:

ssh-keygen -m PEM -t rsa -f ~/.ssh/remarkable -N ''
ssh-copy-id -i ~/.ssh/remarkable.pub root@10.11.99.1

Though for having it working properly (i.e., without paramiko exception), I had to replace root@10.11.99.1 with remarkable. But then remouse --address 10.11.99.1 --key ~/.ssh/remarkable still returns the same error message.

Evidlo commented 2 years ago

Is this still an issue? I'm not sure why 10.11.99.1 isn't working for you. What does host remarkable return?