Evidlo / remarkable_mouse

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

problem connecting to rm2 #64

Closed jave closed 2 years ago

jave commented 2 years ago

I'm trying to connect to the rm2, following the instructions in the readme.

I tried both with password flag, and using the flag to supply a key

both methods fail on authentication

[joakim@192 ~]$  .local/bin/remouse --debug --key ~/.ssh/remarkable --address 192.168.50.249 --evdev
Debugging enabled...
Connecting to input '192.168.50.249'
Traceback (most recent call last):
  File "/home/joakim/.local/bin/remouse", line 8, in <module>
    sys.exit(main())
  File "/home/joakim/.local/lib/python3.10/site-packages/remarkable_mouse/remarkable_mouse.py", line 131, in main
    rm_inputs = open_rm_inputs(
  File "/home/joakim/.local/lib/python3.10/site-packages/remarkable_mouse/remarkable_mouse.py", line 71, in open_rm_inputs
    client.connect(
  File "/home/joakim/.local/lib/python3.10/site-packages/paramiko/client.py", line 435, in connect
    self._auth(
  File "/home/joakim/.local/lib/python3.10/site-packages/paramiko/client.py", line 766, in _auth
    raise saved_exception
  File "/home/joakim/.local/lib/python3.10/site-packages/paramiko/client.py", line 702, in _auth
    self._transport.auth_publickey(username, key)
  File "/home/joakim/.local/lib/python3.10/site-packages/paramiko/transport.py", line 1634, in auth_publickey
    return self.auth_handler.wait_for_response(my_event)
  File "/home/joakim/.local/lib/python3.10/site-packages/paramiko/auth_handler.py", line 258, in wait_for_response
    raise e
paramiko.ssh_exception.AuthenticationException: Authentication failed.

when i try to ssh to rm2 with the key I produced according to the instructions, it also fails:

ssh -vvv -i ~/.ssh/remarkable root@192.168.50.249

debug1: send_pubkey_test: no mutual signature algorithm

ssh with password works well though.

jave commented 2 years ago
[joakim@192 ~]$ remouse --address 192.168.50.249
Traceback (most recent call last):
  File "/home/joakim/.local/bin/remouse", line 8, in <module>
    sys.exit(main())
  File "/home/joakim/.local/lib/python3.10/site-packages/remarkable_mouse/remarkable_mouse.py", line 131, in main
    rm_inputs = open_rm_inputs(
  File "/home/joakim/.local/lib/python3.10/site-packages/remarkable_mouse/remarkable_mouse.py", line 71, in open_rm_inputs
    client.connect(
  File "/home/joakim/.local/lib/python3.10/site-packages/paramiko/client.py", line 435, in connect
    self._auth(
  File "/home/joakim/.local/lib/python3.10/site-packages/paramiko/client.py", line 766, in _auth
    raise saved_exception
  File "/home/joakim/.local/lib/python3.10/site-packages/paramiko/client.py", line 702, in _auth
    self._transport.auth_publickey(username, key)
  File "/home/joakim/.local/lib/python3.10/site-packages/paramiko/transport.py", line 1634, in auth_publickey
    return self.auth_handler.wait_for_response(my_event)
  File "/home/joakim/.local/lib/python3.10/site-packages/paramiko/auth_handler.py", line 258, in wait_for_response
    raise e
paramiko.ssh_exception.AuthenticationException: Authentication failed.
reet- commented 2 years ago

Had the same issue with rm2, using the rm2 branch worked for me:

python -m pip install git+https://github.com/Evidlo/remarkable_mouse.git#rm2
Evidlo commented 2 years ago

I think this is fixed on 7.0.0. Let me know.

ubuntudroid commented 2 years ago

I'm having the same issue, but with a remarkable 1. I am on 7.0.0 - didn't try older versions. I'm on macOS 12.1.

ubuntudroid commented 2 years ago

Interestingly, when connecting directly via SSH and password I am getting this (not sure it is related):

sh: -c: line 0: syntax error near unexpected token `('
sh: -c: line 0: `exec -a bash bash --rcfile <(echo 'unset PS1; unset PS2; set -o vi; set +o vi; HISTCONTROL=ignorespace; printf '\''\u1b\u50\u24\u64{"hook": "InitShell", "value": {"shell": "bash"}}\u9c'\''')'
ubuntudroid commented 2 years ago

Okay, the SSH with password issue seems to be caused by using ZSH instead of bash.

bash -c "ssh root@10.11.99.1" works just fine.

However, that cannot be the root cause for the authentication issue, as running remouse in bash still fails.

bozzochet commented 2 years ago

I have (I think) the same problem:

bozzo@MacBook-Pro-3:Remarkable> ssh root@10.11.99.1
reMarkable
╺━┓┏━╸┏━┓┏━┓   ┏━┓╻ ╻┏━╸┏━┓┏━┓
┏━┛┣╸ ┣┳┛┃ ┃   ┗━┓┃ ┃┃╺┓┣━┫┣┳┛
┗━╸┗━╸╹┗╸┗━┛   ┗━┛┗━┛┗━┛╹ ╹╹┗╸
reMarkable: ~/ exit
logout
Connection to 10.11.99.1 closed.
bozzo@MacBook-Pro-3:Remarkable> remouse --debug --key ~/.ssh/id_rsa
Debugging enabled...
Connecting to input '10.11.99.1'
Traceback (most recent call last):
  File "/usr/local/bin/remouse", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.9/site-packages/remarkable_mouse/remarkable_mouse.py", line 131, in main
    rm_inputs = open_rm_inputs(
  File "/usr/local/lib/python3.9/site-packages/remarkable_mouse/remarkable_mouse.py", line 71, in open_rm_inputs
    client.connect(
  File "/usr/local/lib/python3.9/site-packages/paramiko/client.py", line 435, in connect
    self._auth(
  File "/usr/local/lib/python3.9/site-packages/paramiko/client.py", line 766, in _auth
    raise saved_exception
  File "/usr/local/lib/python3.9/site-packages/paramiko/client.py", line 666, in _auth
    self._transport.auth_publickey(username, pkey)
  File "/usr/local/lib/python3.9/site-packages/paramiko/transport.py", line 1634, in auth_publickey
    return self.auth_handler.wait_for_response(my_event)
  File "/usr/local/lib/python3.9/site-packages/paramiko/auth_handler.py", line 258, in wait_for_response
    raise e
paramiko.ssh_exception.AuthenticationException: Authentication failed.

this, with the RM2 USB-connected.

If I try via wifi:

bozzo@MacBook-Pro-3:Remarkable> ssh root@remarkable
reMarkable
╺━┓┏━╸┏━┓┏━┓   ┏━┓╻ ╻┏━╸┏━┓┏━┓
┏━┛┣╸ ┣┳┛┃ ┃   ┗━┓┃ ┃┃╺┓┣━┫┣┳┛
┗━╸┗━╸╹┗╸┗━┛   ┗━┛┗━┛┗━┛╹ ╹╹┗╸
reMarkable: ~/ exit
logout
Connection to 192.168.1.153 closed. 
bozzo@MacBook-Pro-3:Remarkable> remouse --address remarkable --debug --key ~/.ssh/id_rsa
Debugging enabled...
Connecting to input 'remarkable'
Traceback (most recent call last):
  File "/usr/local/bin/remouse", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.9/site-packages/remarkable_mouse/remarkable_mouse.py", line 131, in main
    rm_inputs = open_rm_inputs(
  File "/usr/local/lib/python3.9/site-packages/remarkable_mouse/remarkable_mouse.py", line 71, in open_rm_inputs
    client.connect(
  File "/usr/local/lib/python3.9/site-packages/paramiko/client.py", line 340, in connect
    to_try = list(self._families_and_addresses(hostname, port))
  File "/usr/local/lib/python3.9/site-packages/paramiko/client.py", line 203, in _families_and_addresses
    addrinfos = socket.getaddrinfo(
  File "/usr/local/Cellar/python@3.9/3.9.7/Frameworks/Python.framework/Versions/3.9/lib/python3.9/socket.py", line 954, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno 8] nodename nor servname provided, or not known
bozzochet commented 2 years ago

I tried also to unintall an re-install:

bozzo@MacBook-Pro-3:Remarkable> python3 -m pip uninstall remarkable-mouse
Found existing installation: remarkable-mouse 7.0.0
Uninstalling remarkable-mouse-7.0.0:
  Would remove:
    /usr/local/bin/remarkable-mouse
    /usr/local/bin/remouse
    /usr/local/lib/python3.9/site-packages/remarkable_mouse-7.0.0.dist-info/*
    /usr/local/lib/python3.9/site-packages/remarkable_mouse/*
Proceed (Y/n)? Y
  Successfully uninstalled remarkable-mouse-7.0.0
bozzo@MacBook-Pro-3:Remarkable> remouse --address remarkable --debug --key ~/.ssh/id_rsa
-bash: /usr/local/bin/remouse: No such file or directory
bozzo@MacBook-Pro-3:Remarkable> python3 -m pip install git+https://github.com/Evidlo/remarkable_mouse.git#rm2
DEPRECATION: Configuring installation scheme with distutils config files is deprecated and will no longer work in the near future. If you are using a Homebrew or Linuxbrew Python, please see discussion at https://github.com/Homebrew/homebrew-core/issues/76621
Collecting git+https://github.com/Evidlo/remarkable_mouse.git#rm2
  Cloning https://github.com/Evidlo/remarkable_mouse.git to /private/var/folders/z7/54kttw890k72q8xdymp05vx80000gp/T/pip-req-build-o9xps3jl
  Running command git clone --filter=blob:none -q https://github.com/Evidlo/remarkable_mouse.git /private/var/folders/z7/54kttw890k72q8xdymp05vx80000gp/T/pip-req-build-o9xps3jl
  Resolved https://github.com/Evidlo/remarkable_mouse.git to commit 9a5fff9227cade8a50375ee405c272f63c72bb91
  Preparing metadata (setup.py) ... done
Requirement already satisfied: paramiko in /usr/local/lib/python3.9/site-packages (from remarkable-mouse==7.0.0) (2.9.2)
Requirement already satisfied: libevdev in /usr/local/lib/python3.9/site-packages (from remarkable-mouse==7.0.0) (0.9)
Requirement already satisfied: pynput in /usr/local/lib/python3.9/site-packages (from remarkable-mouse==7.0.0) (1.7.6)
Requirement already satisfied: screeninfo in /usr/local/lib/python3.9/site-packages (from remarkable-mouse==7.0.0) (0.8)
Requirement already satisfied: bcrypt>=3.1.3 in /usr/local/lib/python3.9/site-packages (from paramiko->remarkable-mouse==7.0.0) (3.2.0)
Requirement already satisfied: pynacl>=1.0.1 in /usr/local/lib/python3.9/site-packages (from paramiko->remarkable-mouse==7.0.0) (1.5.0)
Requirement already satisfied: cryptography>=2.5 in /usr/local/lib/python3.9/site-packages (from paramiko->remarkable-mouse==7.0.0) (36.0.1)
Requirement already satisfied: pyobjc-framework-Quartz>=8.0 in /usr/local/lib/python3.9/site-packages (from pynput->remarkable-mouse==7.0.0) (8.1)
Requirement already satisfied: pyobjc-framework-ApplicationServices>=8.0 in /usr/local/lib/python3.9/site-packages (from pynput->remarkable-mouse==7.0.0) (8.1)
Requirement already satisfied: six in /usr/local/lib/python3.9/site-packages (from pynput->remarkable-mouse==7.0.0) (1.16.0)
Requirement already satisfied: Cython in /usr/local/lib/python3.9/site-packages (from screeninfo->remarkable-mouse==7.0.0) (0.29.26)
Requirement already satisfied: pyobjc-framework-Cocoa in /usr/local/lib/python3.9/site-packages (from screeninfo->remarkable-mouse==7.0.0) (8.1)
Requirement already satisfied: cffi>=1.1 in /usr/local/lib/python3.9/site-packages (from bcrypt>=3.1.3->paramiko->remarkable-mouse==7.0.0) (1.15.0)
Requirement already satisfied: pyobjc-core>=8.1 in /usr/local/lib/python3.9/site-packages (from pyobjc-framework-ApplicationServices>=8.0->pynput->remarkable-mouse==7.0.0) (8.1)
Requirement already satisfied: pycparser in /usr/local/lib/python3.9/site-packages (from cffi>=1.1->bcrypt>=3.1.3->paramiko->remarkable-mouse==7.0.0) (2.21)
Building wheels for collected packages: remarkable-mouse
  Building wheel for remarkable-mouse (setup.py) ... done
  Created wheel for remarkable-mouse: filename=remarkable_mouse-7.0.0-py3-none-any.whl size=21834 sha256=af030c84c2ee3a7bdf011a862f6d951c4f63e740426b3caa5f9f457ca5c4ad26
  Stored in directory: /private/var/folders/z7/54kttw890k72q8xdymp05vx80000gp/T/pip-ephem-wheel-cache-55ub2ivn/wheels/1d/ad/43/96f103a42cc3f973416c3cfabd49116ffd34dd88851f821966
Successfully built remarkable-mouse
Installing collected packages: remarkable-mouse
  DEPRECATION: Configuring installation scheme with distutils config files is deprecated and will no longer work in the near future. If you are using a Homebrew or Linuxbrew Python, please see discussion at https://github.com/Homebrew/homebrew-core/issues/76621
DEPRECATION: Configuring installation scheme with distutils config files is deprecated and will no longer work in the near future. If you are using a Homebrew or Linuxbrew Python, please see discussion at https://github.com/Homebrew/homebrew-core/issues/76621
Successfully installed remarkable-mouse-7.0.0
bozzo@MacBook-Pro-3:Remarkable> remouse --address remarkable --debug --key ~/.ssh/id_rsa
Debugging enabled...
Connecting to input 'remarkable'
Traceback (most recent call last):
  File "/usr/local/bin/remouse", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.9/site-packages/remarkable_mouse/remarkable_mouse.py", line 135, in main
    rm_inputs = open_rm_inputs(
  File "/usr/local/lib/python3.9/site-packages/remarkable_mouse/remarkable_mouse.py", line 70, in open_rm_inputs
    client.connect(
  File "/usr/local/lib/python3.9/site-packages/paramiko/client.py", line 340, in connect
    to_try = list(self._families_and_addresses(hostname, port))
  File "/usr/local/lib/python3.9/site-packages/paramiko/client.py", line 203, in _families_and_addresses
    addrinfos = socket.getaddrinfo(
  File "/usr/local/Cellar/python@3.9/3.9.7/Frameworks/Python.framework/Versions/3.9/lib/python3.9/socket.py", line 954, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno 8] nodename nor servname provided, or not known
bozzo@MacBook-Pro-3:Remarkable> remouse --key ~/.ssh/id_rsa
Connected to 10.11.99.1
Traceback (most recent call last):
  File "/usr/local/bin/remouse", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.9/site-packages/remarkable_mouse/remarkable_mouse.py", line 148, in main
    from remarkable_mouse.pynput import read_tablet
  File "/usr/local/lib/python3.9/site-packages/remarkable_mouse/pynput.py", line 4, in <module>
    import libevdev
  File "/usr/local/lib/python3.9/site-packages/libevdev/__init__.py", line 23, in <module>
    from .device import Device, InputAbsInfo
  File "/usr/local/lib/python3.9/site-packages/libevdev/device.py", line 29, in <module>
    from .event import InputEvent
  File "/usr/local/lib/python3.9/site-packages/libevdev/event.py", line 23, in <module>
    from .const import EventType, EventCode
  File "/usr/local/lib/python3.9/site-packages/libevdev/const.py", line 413, in <module>
    _load_consts()
  File "/usr/local/lib/python3.9/site-packages/libevdev/const.py", line 338, in _load_consts
    Libevdev()  # classmethods, need to make sure it's loaded at once
  File "/usr/local/lib/python3.9/site-packages/libevdev/_clib.py", line 395, in __init__
    super(Libevdev, self).__init__()
  File "/usr/local/lib/python3.9/site-packages/libevdev/_clib.py", line 76, in __init__
    self._load()
  File "/usr/local/lib/python3.9/site-packages/libevdev/_clib.py", line 83, in _load
    cls._lib = cls._cdll()
  File "/usr/local/lib/python3.9/site-packages/libevdev/_clib.py", line 123, in _cdll
    return ctypes.CDLL("libevdev.so.2", use_errno=True)
  File "/usr/local/Cellar/python@3.9/3.9.7/Frameworks/Python.framework/Versions/3.9/lib/python3.9/ctypes/__init__.py", line 374, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: dlopen(libevdev.so.2, 6): image not found

Maybe I have some mess with the Python installation? However:

bozzo@MacBook-Pro-3:Remarkable> python3 -m pip install libevdev
DEPRECATION: Configuring installation scheme with distutils config files is deprecated and will no longer work in the near future. If you are using a Homebrew or Linuxbrew Python, please see discussion at https://github.com/Homebrew/homebrew-core/issues/76621
Requirement already satisfied: libevdev in /usr/local/lib/python3.9/site-packages (0.9)

(I forgot: I'm on MacOs Catalina 10.15.7).

Thanks for the help!

deraffe commented 2 years ago

This is a paramiko issue caused by the SSH server of the reMarkable not supporting current algorithms. A workaround is to add the parameter

disabled_algorithms={'pubkeys': ['rsa-sha2-512', 'rsa-sha2-256']}

to the client.connect() call.

kubaraczkowski commented 2 years ago

Confirmed!

Evidlo commented 2 years ago

I've published this in 7.0.1. Don't know why it didn't show up in 7.0.0.