# dbus: Failed to authenticate



## JohnnySorocil (Oct 16, 2022)

I am building new libsignal + signal-cli from source.
signal-cli works but not in daemon mode (which uses dbus)

```
% echo $DBUS_SESSION_BUS_PID
28740

% echo $DBUS_SESSION_BUS_ADDRESS
unix:path=/tmp/dbus-uz9QtVF3Bh,guid=320c3c663b93e9ebe351dea7634bccd

% pgrep -U $(id -u) dbus-daemon
28740


% ~/bin/signal-cli daemon
INFO  DaemonCommand - Starting daemon in multi-account mode
INFO  TransportBuilder - Using transport dbus-java-transport-native-unixsocket to connect to unix:path=/tmp/dbus-uz9QtVF3Bh,guid=320c3c663b93e9ebe351dea7634bccda
Dbus command failed: Failed to connect to bus: Failed to authenticate

% ~/bin/signal-cli --verbose daemon
2022-10-16T16:05:18.902+0200 [main] DEBUG org.asamk.signal.util.IOUtils - XDG_RUNTIME_DIR not set, falling back to temp dir
2022-10-16T16:05:19.028+0200 [main] INFO  LibSignal - [libsignal]: rust/bridge/jni/src/logging.rs:156: Initializing libsignal version:0.20.0
2022-10-16T16:05:19.030+0200 [main] DEBUG org.asamk.signal.util.IOUtils - XDG_DATA_HOME not set, falling back to home dir
2022-10-16T16:05:19.415+0200 [main] INFO  com.zaxxer.hikari.HikariDataSource - HikariPool-1 - Starting...
2022-10-16T16:05:19.568+0200 [main] INFO  com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Added connection org.sqlite.jdbc4.JDBC4Connection@56303b57
2022-10-16T16:05:19.570+0200 [main] INFO  com.zaxxer.hikari.HikariDataSource - HikariPool-1 - Start completed.
2022-10-16T16:05:20.734+0200 [main] INFO  o.a.signal.commands.DaemonCommand - Starting daemon in multi-account mode
2022-10-16T16:05:20.739+0200 [receive-0] DEBUG o.asamk.signal.manager.ManagerImpl - Starting receiving messages
2022-10-16T16:05:20.746+0200 [main] DEBUG o.f.d.c.transports.TransportBuilder - Found provider 'NativeTransportProvider' named 'dbus-java-transport-native-unixsocket' providing bustype[1/966]
2022-10-16T16:05:20.762+0200 [main] INFO  o.f.d.c.transports.TransportBuilder - Using transport dbus-java-transport-native-unixsocket to connect to unix:path=/tmp/dbus-uz9QtVF3Bh,guid=320c3c663b93e9ebe351dea7634bccda
2022-10-16T16:05:20.765+0200 [receive-0] INFO  LibSignal - [WebSocketConnection]: [normal:693393474] connect()
2022-10-16T16:05:20.772+0200 [receive-0] INFO  LibSignal - [WebSocketConnection]: [unidentified:29768511] connect()
2022-10-16T16:05:20.776+0200 [receive-0] DEBUG o.a.s.manager.helper.ReceiveHelper - Handling message actions
2022-10-16T16:05:20.777+0200 [receive-0] DEBUG o.a.s.manager.helper.ReceiveHelper - Checking for new message from server
2022-10-16T16:05:20.782+0200 [main] DEBUG o.f.d.c.impl.DBusConnection - Error creating transport
org.freedesktop.dbus.exceptions.AuthenticationException: Failed to authenticate
        at org.freedesktop.dbus.connections.transports.AbstractTransport.authenticate(AbstractTransport.java:160)
        at org.freedesktop.dbus.connections.transports.AbstractTransport.connect(AbstractTransport.java:133)
        at org.freedesktop.dbus.connections.transports.TransportBuilder.build(TransportBuilder.java:335)
        at org.freedesktop.dbus.connections.AbstractConnection.<init>(AbstractConnection.java:150)
        at org.freedesktop.dbus.connections.impl.DBusConnection.<init>(DBusConnection.java:231)
        at org.freedesktop.dbus.connections.impl.DBusConnectionBuilder.build(DBusConnectionBuilder.java:195)
        at org.asamk.signal.commands.DaemonCommand.runDbus(DaemonCommand.java:353)
        at org.asamk.signal.commands.DaemonCommand.runDbusMultiAccount(DaemonCommand.java:306)
        at org.asamk.signal.commands.DaemonCommand.handleCommand(DaemonCommand.java:208)
        at org.asamk.signal.App.handleMultiLocalCommand(App.java:310)
        at org.asamk.signal.App.init(App.java:191)
        at org.asamk.signal.Main.main(Main.java:60)
2022-10-16T16:05:20.784+0200 [main] DEBUG o.f.d.c.impl.DBusConnection - Ignoring disconnect, already disconnected
2022-10-16T16:05:20.785+0200 [main] DEBUG o.asamk.signal.manager.ManagerImpl - Receive stop requested, interrupting read from server.
2022-10-16T16:05:20.785+0200 [receive-0] DEBUG o.a.s.manager.helper.ReceiveHelper - Handling message actions
2022-10-16T16:05:20.785+0200 [receive-0] INFO  LibSignal - [WebSocketConnection]: [normal:693393474] disconnect()
2022-10-16T16:05:20.786+0200 [receive-0] INFO  LibSignal - [WebSocketConnection]: [unidentified:29768511] disconnect()
2022-10-16T16:05:20.786+0200 [receive-0] DEBUG o.asamk.signal.manager.ManagerImpl - Finished receiving messages
2022-10-16T16:05:20.787+0200 [main] INFO  com.zaxxer.hikari.HikariDataSource - HikariPool-1 - Shutdown initiated...
2022-10-16T16:05:20.790+0200 [main] INFO  com.zaxxer.hikari.HikariDataSource - HikariPool-1 - Shutdown completed.
Dbus command failed: Failed to connect to bus: Failed to authenticate
org.freedesktop.dbus.exceptions.DBusException: Failed to connect to bus: Failed to authenticate
        at org.freedesktop.dbus.connections.AbstractConnection.<init>(AbstractConnection.java:156)
        at org.freedesktop.dbus.connections.impl.DBusConnection.<init>(DBusConnection.java:231)
        at org.freedesktop.dbus.connections.impl.DBusConnectionBuilder.build(DBusConnectionBuilder.java:195)
        at org.asamk.signal.commands.DaemonCommand.runDbus(DaemonCommand.java:353)
        at org.asamk.signal.commands.DaemonCommand.runDbusMultiAccount(DaemonCommand.java:306)
        at org.asamk.signal.commands.DaemonCommand.handleCommand(DaemonCommand.java:208)
        at org.asamk.signal.App.handleMultiLocalCommand(App.java:310)
        at org.asamk.signal.App.init(App.java:191)
        at org.asamk.signal.Main.main(Main.java:60)
Caused by: org.freedesktop.dbus.exceptions.AuthenticationException: Failed to authenticate
        at org.freedesktop.dbus.connections.transports.AbstractTransport.authenticate(AbstractTransport.java:160)
        at org.freedesktop.dbus.connections.transports.AbstractTransport.connect(AbstractTransport.java:133)
        at org.freedesktop.dbus.connections.transports.TransportBuilder.build(TransportBuilder.java:335)
        at org.freedesktop.dbus.connections.AbstractConnection.<init>(AbstractConnection.java:150)
        ... 8 more
```

Same steps works in Linux VM and worked with older version of signal-cli. They were many changes between version available in the port tree and the latest available version.
Using signal-cli without dbus works:

```
% ~/bin/signal-cli --version
signal-cli 0.11.3

% ~/bin/signal-cli listIdentities
<works>
```

What could be the issue? How to debug this?


----------



## sidetone (Oct 18, 2022)

net-im/signal-cli is in ports. net-im/scli uses that underneath and is more user friendly on the terminal. I tried one of these, and it puts the scancode up on the terminal, sometimes it's oversized, and it requires a phone to scan it to verify the code. There's a few libsignal ports available as well.

Is there a reason you're using the one from git?


----------



## JohnnySorocil (Oct 18, 2022)

sidetone said:


> net-im/signal-cli is in ports. net-im/scli uses that underneath and is more user friendly on the terminal. I tried one of these, and it puts the scancode up on the terminal, sometimes it's oversized, and it requires a phone to scan it to verify the code. There's a few libsignal ports available as well.


I was using that that combo for almost two years and it was working fantastic - until two weeks ago.



sidetone said:


> Is there a reason you're using the one from git?


Yes - Error 499


----------

