Mender-connect dbus errors that "AuthenticationManager was not provided"

Hey,
I just upgraded mender to the latest dunfell release to test mender-connect. I configured the bare minimum which is setting the client user to a non-root user.
The last two log messages are:

Jan 27 20:23:53 CI-570A7 mender-connect[261]: time="2021-01-27T20:23:53Z" level=warning msg="call to GetJWTToken on the Mender D-Bus API failed: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name io.mender.AuthenticationManager was not provided by any .service files"
Jan 27 20:23:53 CI-570A7 mender-connect[261]: time="2021-01-27T20:23:53Z" level=info msg="waiting for JWT token (waitForJWTToken)"

Any ideas what the error message indicates?

I’ve not seen anything like that myself. @kacf any ideas?

Do you mean that you modified the mender-client.service file to run the mender client under a different UID, or that you set the User field in the mender-connect.conf to a different user?

If it was the former, then I think DBus communication will not work out of the box, because you need root permissions to query the endpoint (mender-connect is querying mender-client for authentication information). Something along these lines in a mender-client_%.bbappend file should fix it:

do_install_append() {
    sed -i -e 's/<policy user="root">/<policy user="myuser">/' ${D}/${datadir}/dbus-1/system.d/io.mender.AuthenticationManager.conf
}

I didn’t test that, but hopefully you get the idea.

Also note that mender-connect will need to be run under the same UID.

Thanks for the hint. I tried using a non-root user but dropped back to root as the mender-connect user to avoid permission issues. Still, the error persists.

This is my mender-connect_%.bbappend:

FILESEXTRAPATHS_prepend := "${THISDIR}/files:"

SRC_URI_append = " \
    file://mender-connect.conf \
"

do_install_append() {
    install -m 600 ${WORKDIR}/mender-connect.conf ${D}${sysconfdir}/mender/mender-connect.conf
}

where mender-connect.conf is:

{
    "ClientProtocol": "https",
    "ServerURL": "https://hosted.mender.io",
    "User": "root",
    "Terminal": {
        "Height": 24,
        "Width": 128
    },
    "Sessions": {
      "StopExpired": false,
      "ExpireAfter": 255,
      "ExpireAfterIdle": 16,
      "MaxPerUser": 4
    }
}

mender-client works fine.
The error stated above is followed by:

Jan 01 01:41:07 6D86AA69 mender-connect[251]: time="1970-01-01T01:41:07Z" level=info msg="waiting for JWT token (waitForJWTToken)"

which sounds to me like the client is working. Still, the remote terminal is not available at hosted.mender. Am I missing something?

I noticed that the year in your log message is 1970. Is the time not set correctly on the device? The client will not be able to connect if the clock is wrong, because the certificate is only valid within a given time period.

I just revisited the problem. Turned out that I had pending client authentications. After I dismissed older ones the remote client worked using the exact configuration and recipe above.