AsamK / signal-cli

signal-cli provides an unofficial commandline, JSON-RPC and dbus interface for the Signal messenger.
GNU General Public License v3.0
3.17k stars 299 forks source link

How to properly install/configure as system dbus and not user dbus #1538

Closed loldebyte closed 4 months ago

loldebyte commented 4 months ago

Hello,

My goal is to use signal without a smartphone. In order to achieve this, it seems much preferable to use a system dbus installation of signal-cli because it supports more options (eg isRegistered which seems necessary to add new contacts) and is (seems ? I'm obviously no sysadmin) easier to configure to autostart on boot.

I have followed the following instructions in the README :

export VERSION=0.13.3
wget https://github.com/AsamK/signal-cli/releases/download/v"${VERSION}"/signal-cli-"${VERSION}".tar.gz
sudo tar xf signal-cli-"${VERSION}".tar.gz -C /opt
sudo ln -sf /opt/signal-cli-"${VERSION}"/bin/signal-cli /usr/local/bin/

and then followed up with the instructions on DBus-service in the wiki :

cp data/org.asamk.Signal.conf /etc/dbus-1/system.d/
cp data/org.asamk.Signal.service /usr/share/dbus-1/system-services/
cp data/signal-cli.service /etc/systemd/system/
sed -i -e "s|%dir%|/opt/signal-cli-0.13.3/bin|" /etc/systemd/system/signal-cli.service
systemctl daemon-reload
systemctl enable signal-cli.service
systemctl reload dbus.service

Then, I created both a group and a user named signal-cli. Afterwards, I gathered (from issue #45) that registering could be done the good ol' way so I registered as my regular user.

Launching the daemon as user session dbus (/opt/signal-cli-0.13.3/bin/signal-cli -a +[REDACTED] daemon --dbus works perfectly.

But attempting to start the system dbus with sudo systemctl start signal-cli.service fails with the following error messages in journalctl :

june 01 15:21:05 [redacted] signal-cli[15309]: Failed to read local accounts list
june 01 15:21:05 [redacted] systemd[1]: signal-cli.service: Main process exited, code=exited, status=3/NOTIMPLEMENTED
░░ Subject: Unit process exited
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░ 
░░ An ExecStart= process belonging to unit signal-cli.service has exited.
The process' exit code is 'exited' and its exit status is 3.

(rest of the logs omitted for readability)

Where tf did I go wrong ? What am I missing ? I assume it must be something evident to those more familiar with these kinda issues but alas...

I'd also like to ask an extra question, just to make sure : are messages sent while signal-cli was down lost ? (ie should signal-cli be always running at the risk of missing messages ?)

Thanks for the work !

m-ueberall commented 4 months ago

If you followed the instructions in the wiki, this means that signal-cli.service should expect the configuration in /var/lib/signal-cli (see the note directly under the systemctl reload dbus.service statement on said wiki page).

loldebyte commented 4 months ago

Yes, it does, and ... And indeed that's not where signal-cli data is... I had thought about it on another computer but not here, damnit.I know how to change the expected config using --conf but not how to prevent/change registering from creating confs in ~/.local/share/signal-cli/ apparently.

Would copying (or cutting I guess) the configuration work or should I re-register in another manner ? Using root ?

Thanks for the answer

m-ueberall commented 4 months ago

Simply moving the configuration should work (if the user account in question differs, you'd need to execute a chown beforehand, of course). By the way, Signal buffers undelivered messages (see the relevant section in the r/signal FAQ).

loldebyte commented 4 months ago

Thanks a bunch ! After doing so and rebooting, the service is active and running ! :tada: