YunoHost-Apps / mautrix_signal_ynh

Matrix signal package for YunoHost
GNU Affero General Public License v3.0
4 stars 10 forks source link

Linking the bridge as a secondary device is not working #5

Closed Thatoo closed 2 years ago

Thatoo commented 3 years ago

Describe the bug

Linking the bridge as a secondary device is not working. !sg link is not working

Context

Steps to reproduce

In the "SIgnal bridge bot" room, I get an answer to the command !sg help but when I launch !sg link or !sg link Matrix, it fails with the following error :

Unhandled error while handling command:

Traceback (most recent call last):
  File "/opt/yunohost/mautrix_signal/lib/python3.7/site-packages/mautrix/bridge/commands/handler.py", line 405, in handle
    await self._run_handler(handler, evt)
  File "/opt/yunohost/mautrix_signal/lib/python3.7/site-packages/mautrix/bridge/commands/handler.py", line 290, in __call__
    return await self._handler(evt)
  File "/opt/yunohost/mautrix_signal/lib/python3.7/site-packages/mautrix_signal/commands/auth.py", line 62, in link
    sess = await evt.bridge.signal.start_link()
  File "/opt/yunohost/mautrix_signal/lib/python3.7/site-packages/mausignald/signald.py", line 112, in start_link
    return LinkSession.deserialize(await self.request_v1("generate_linking_uri"))
  File "/opt/yunohost/mautrix_signal/lib/python3.7/site-packages/mausignald/rpc.py", line 210, in request_v1
    return await self.request(command, expected_response=command, version="v1", **data)
  File "/opt/yunohost/mautrix_signal/lib/python3.7/site-packages/mausignald/rpc.py", line 204, in request
    resp_type, resp_data = await self._raw_request(command, **data)
  File "/opt/yunohost/mautrix_signal/lib/python3.7/site-packages/mausignald/rpc.py", line 200, in _raw_request
    await self._send_request(data)
  File "/opt/yunohost/mautrix_signal/lib/python3.7/site-packages/mausignald/rpc.py", line 190, in _send_request
    raise NotConnected("Not connected to signald")
mausignald.errors.NotConnected: Not connected to signald

Expected behavior

Getting a QR code in order to link the bridge as a secondary device with the help of the Signal app

Logs

Gredin67 commented 3 years ago

I have the same issue. I think it is related to some signald user data remaining from a previous install, see https://gitlab.com/signald/signald/-/issues/187 Did you install for the first time or did you remove a previous signal installation beforehand? Could you try to:

Thatoo commented 3 years ago

I have indeed tried to install as explained here https://github.com/YunoHost-Apps/mautrix_signal_ynh/issues/4 but it has failed. Ok, I'll try to remove it and do what you said. To do "erase signald user, group, and all related user data in debian", could you give me the command I should launch?

Thatoo commented 3 years ago

My question is about "all related user data in debian" mostly...

Thatoo commented 3 years ago

I also need to delete the signalbot user in synapse I guess. How can I do that?

Thatoo commented 3 years ago

Should I do, with the ACCES_TOKEN of an admin curl --insecure -XPOST -H "Authorization: Bearer ACCES_TOKEN" -H "Content-Type: application/json" -d '{"erase": true}' "https://localhost:8448/_synapse/admin/v1/deactivate/users/@signalbot:domain.com" ? or curl --insecure -XPOST -H "Authorization: Bearer ACCES_TOKEN" -H "Content-Type: application/json" -d '{}' "https://localhost:8448/_synapse/admin/v1/deactivate/users/@signalbot:domain.com" before reinstalling?

Thatoo commented 3 years ago

For now, I did

sudo yunohost app remove mautrix_signal
sudo deluser signald

but I guess it would have been better to do: sudo deluser --remove-all-files signald

Then I did

sudo groupdel signald
sudo rm -R /var/lib/signald

but I got the following error :

rm: impossible to delete '/var/lib/signald': no file or folder

sudo find / -name signald doesn't return any result!

Now, before attempting a new install of this signal bridge, as it's on my prod server (I don't have test server...), I'd like to know what I should do with the @signalbot:domain.com user of my synapse server? Will the installation take care of that, and be able to reuse this user or shoudl I do something about it?

centralscrutinizer21 commented 3 years ago

I think the debian package is placing stuff in the wrong place, or the bridge is looking in the wrong place. I installed signlad from source and start it from the command line and the bridge works again, of course when closing the terminal the magic vanishes. If I try to move or soft link the program i get the same error again

rosbeef commented 3 years ago

the only way i could connect mautrix to signald were to change access to signald folder with : chmod 777 /var/run/signald

source : https://github.com/tulir/mautrix-signal/issues/45

centralscrutinizer21 commented 3 years ago

I see...but I don't even have that folder

centralscrutinizer21 commented 3 years ago

When I try to run signald from terminal (the one installed from debian repo) i get this error: Error: Could not find or load main class io.finn.signald.Main Caused by: java.lang.ClassNotFoundException: io.finn.signald.Main

rosbeef commented 3 years ago

Is your instalation works well ? Did you try as described in #8 ? yunohost app remove mautrix_signal --debug pip3 install --upgrade setuptools yunohost app install mautrix_signal --debug then chmod 777 /var/run/signald

centralscrutinizer21 commented 3 years ago

yes installation goes well with the exeption of a few warnings: 213101 WARNING Failed building wheel for mautrix-signal 298022 WARNING ERROR: column "signalbot" does not exist 298023 WARNING LINE 1: UPDATE users SET admin = 1 WHERE name = signalbot; 298023 WARNING pip3 install etc gives me Requirement already up-to-date: setuptools in /usr/local/lib/python3.7/dist-packages (57.4.0) but at the end no /var/run/signald folder is created

rosbeef commented 3 years ago

Last chance ... after that i'm not capable to help you :-1: could try before installing mautrix_signal pip3 install --upgrade wheel

so :

yunohost app remove mautrix_signal --debug pip3 install --upgrade setuptools pip3 install --upgrade wheel yunohost app install mautrix_signal --debug then chmod 777 /var/run/signald

rosbeef commented 3 years ago

sorry wheel

centralscrutinizer21 commented 3 years ago

yes I realized the command was missing the h after I posted my response. But no that is not the problem, wheel upgraded but at installation I still get: 204712 DEBUG error: invalid command 'bdist_wheel' 204712 DEBUG 204713 DEBUG ---------------------------------------- 204713 WARNING Failed building wheel for mautrix-signal

centralscrutinizer21 commented 3 years ago

But the installation goes fine in the end, but when sending the bot the command link I get this error: Unhandled error while handling command:

Traceback (most recent call last):
  File "/opt/yunohost/mautrix_signal/lib/python3.7/site-packages/mautrix/bridge/commands/handler.py", line 405, in handle
    await self._run_handler(handler, evt)
  File "/opt/yunohost/mautrix_signal/lib/python3.7/site-packages/mautrix/bridge/commands/handler.py", line 290, in __call__
    return await self._handler(evt)
  File "/opt/yunohost/mautrix_signal/lib/python3.7/site-packages/mautrix_signal/commands/auth.py", line 62, in link
    sess = await evt.bridge.signal.start_link()
  File "/opt/yunohost/mautrix_signal/lib/python3.7/site-packages/mausignald/signald.py", line 112, in start_link
    return LinkSession.deserialize(await self.request_v1("generate_linking_uri"))
  File "/opt/yunohost/mautrix_signal/lib/python3.7/site-packages/mausignald/rpc.py", line 210, in request_v1
    return await self.request(command, expected_response=command, version="v1", **data)
  File "/opt/yunohost/mautrix_signal/lib/python3.7/site-packages/mausignald/rpc.py", line 204, in request
    resp_type, resp_data = await self._raw_request(command, **data)
  File "/opt/yunohost/mautrix_signal/lib/python3.7/site-packages/mausignald/rpc.py", line 200, in _raw_request
    await self._send_request(data)
  File "/opt/yunohost/mautrix_signal/lib/python3.7/site-packages/mausignald/rpc.py", line 190, in _send_request
    raise NotConnected("Not connected to signald")
mausignald.errors.NotConnected: Not connected to signald

And it is definitely related to the bridge not able to connect to signald

rosbeef commented 3 years ago

yes it show me this error but install is working for me. and after chmod 777 /var/run/signald !sg link works

damne i'm sorry i can not help more. i'm just a noob in debunging :P

centralscrutinizer21 commented 3 years ago

Thanks anyway. Maybe it's because I am running yunohost on a raspberry Pi 4 so armhf arch. Dunno

rosbeef commented 3 years ago

i'm on a Odroid hc1 so armhf too and inside a lxd/lxc container so it should not be that.

centralscrutinizer21 commented 3 years ago

Just to understand, what's in your /var/run/synapse folder?

rosbeef commented 3 years ago

/var/run/synapse does not exist

$ ls /var/run/**signald**
signald.sock
$ cat /var/run/signald/signald.sock 
cat: /var/run/signald/signald.sock: No such device or address

It seems to be the communication socket to signald

Adding more information "link" is working (it returns me a QRCode) but "register" not. not already impremented : ROADMAP

Gredin67 commented 2 years ago

reading this issue and discussion I feel like we have to implement what I describe in issue #9 to solve #5 and #8 If Someone wants to give it a try, feel free to open a new PR (from the testing branch)

Gredin67 commented 2 years ago

17 solved