Packaging help with DBus for Intune

I am trying to package Intune (Microsoft Intune Portal · Issue #196237 · NixOS/nixpkgs · GitHub). It consists of 3 packages:

Unfortunately, I’m stuck at the first one: microsoft-identity-broker. The base exception is:

org.freedesktop.dbus.exceptions.DBusException: Failed to connect to bus: Failed to auth

But the package does contain configuration for DBus authentication. You can see my packaging attempt here: https://github.com/JamieMagee/nix-config/compare/main...intune
and the full logs + some configuration files here: microsoft-identity-broker package · GitHub

I’m not an expert at all but after a quick search you might be missing some packages : for instance signal-cli used to add dbus-java to the java path https://github.com/r-ryantm/nixpkgs/blob/39da9b721d971f33dc72454c6e0380e502844327/pkgs/applications/networking/instant-messengers/signal-cli/default.nix (see also the PR that enabled dbus signal-cli: enable dbus functionality by erictapen · Pull Request #72829 · NixOS/nixpkgs · GitHub) which is also mentionned here https://youtrack.jetbrains.com/issue/TBX-7550, and this post mentions jffi-native Unable to connect to the D-Bus system bus on FreeBSD · Issue #287 · AsamK/signal-cli · GitHub.

I found https://youtrack.jetbrains.com/issue/TBX-7550/Toolbox-fails-to-connect-to-DBus-1.14#focus=Comments-27-5941022.0-0, which points to

https://github.com/freedesktop/dbus/blob/2fb2491ad0e2d9eae85be646c3314dfe45a8e6f1/NEWS#L965-L972

1 Like

I tried the same approach, adding libmatthew_java, dbus_java and dbus, but I am still seeing the same error message

Error message
Exception in thread "main" [0.249s][info][class,load] java.lang.Throwable$PrintStreamOrWriter source: jrt:/java.base
[0.249s][info][class,load] java.lang.Throwable$WrappedPrintStream source: jrt:/java.base
java.lang.ExceptionInInitializerError
        at com.microsoft.identity.broker.dbus.DBusCallerInfo.getInstance(DBusCallerInfo.java:85)
        at com.microsoft.identity.broker.dbus.services.impl.DeviceBrokerDBusV1Impl.<clinit>(DeviceBrokerDBusV1Impl.java:81)
        at com.microsoft.identity.broker.dbus.services.DeviceBrokerDBusV1Service.<init>(DeviceBrokerDBusV1Service.java:41)
        at com.microsoft.identity.broker.service.DeviceBrokerService.main(DeviceBrokerService.java:48)
Caused by: java.lang.RuntimeException: org.freedesktop.dbus.exceptions.DBusException: Failed to connect to bus: Failed to auth
        at com.microsoft.identity.broker.dbus.DBusCallerInfo$LazyHolder.<clinit>(DBusCallerInfo.java:96)
        ... 4 more
[0.250s][info][class,load] com.microsoft.identity.common.java.util.ThrowableUtil source: file:/nix/store/q8imqnwz0zrf6wrkf42i2l82vkxqkk8s-microsoft-identity-broker-1.4.1/lib/microsoft-identity-broker/common4j-4.0.0.jar
Caused by: org.freedesktop.dbus.exceptions.DBusException: Failed to connect to bus: Failed to auth
        at org.freedesktop.dbus.connections.AbstractConnection.<init>(AbstractConnection.java:154)
        at org.freedesktop.dbus.connections.impl.DBusConnection.<init>(DBusConnection.java:322)
        at org.freedesktop.dbus.connections.impl.DBusConnection.getConnection(DBusConnection.java:134)
        at org.freedesktop.dbus.connections.impl.DBusConnection.getConnection(DBusConnection.java:193)
        at org.freedesktop.dbus.connections.impl.DBusConnection.getConnection(DBusConnection.java:158)
        at com.microsoft.identity.broker.dbus.DbusServiceManager.getDbusServiceInterface(DbusServiceManager.java:98)
        at com.microsoft.identity.broker.dbus.DbusServiceManager.bindToService(DbusServiceManager.java:85)
        at com.microsoft.identity.broker.dbus.DbusServiceManager.bindToService(DbusServiceManager.java:79)
        at com.microsoft.identity.broker.dbus.DBusCallerInfo.<init>(DBusCallerInfo.java:46)
[0.250s][info][class,load] java.io.PrintWriter source: jrt:/java.base
        at com.microsoft.identity.broker.dbus.DBusCallerInfo.<init>(DBusCallerInfo.java:39)
        at com.microsoft.identity.broker.dbus.DBusCallerInfo$LazyHolder.<clinit>(DBusCallerInfo.java:93)
        ... 4 more
[0.250s][info][class,load] java.lang.Throwable$WrappedPrintWriter source: jrt:/java.base
Caused by: java.io.IOException: Failed to auth
        at org.freedesktop.dbus.connections.transports.AbstractTransport.authenticate(AbstractTransport.java:114)
        at org.freedesktop.dbus.connections.transports.UnixSocketTransport.connect(UnixSocketTransport.java:68)
        at org.freedesktop.dbus.connections.transports.TransportFactory.createTransport(TransportFactory.java:44)
        at org.freedesktop.dbus.connections.AbstractConnection.<init>(AbstractConnection.java:149)
        ... 14 more
[0.250s][info][class,load] java.util.IdentityHashMap$KeyIterator source: jrt:/java.base
E/DBusCallerInfo: [2023-01-12 05:06:43 - thread_name: main, correlation_id: UNSET - ] Unable to init DBusCallerInfo
org.freedesktop.dbus.exceptions.DBusException: Failed to connect to bus: Failed to auth
        at org.freedesktop.dbus.connections.AbstractConnection.<init>(AbstractConnection.java:154)
        at org.freedesktop.dbus.connections.impl.DBusConnection.<init>(DBusConnection.java:322)
        at org.freedesktop.dbus.connections.impl.DBusConnection.getConnection(DBusConnection.java:134)
        at org.freedesktop.dbus.connections.impl.DBusConnection.getConnection(DBusConnection.java:193)
        at org.freedesktop.dbus.connections.impl.DBusConnection.getConnection(DBusConnection.java:158)
        at com.microsoft.identity.broker.dbus.DbusServiceManager.getDbusServiceInterface(DbusServiceManager.java:98)
        at com.microsoft.identity.broker.dbus.DbusServiceManager.bindToService(DbusServiceManager.java:85)
        at com.microsoft.identity.broker.dbus.DbusServiceManager.bindToService(DbusServiceManager.java:79)
        at com.microsoft.identity.broker.dbus.DBusCallerInfo.<init>(DBusCallerInfo.java:46)
        at com.microsoft.identity.broker.dbus.DBusCallerInfo.<init>(DBusCallerInfo.java:39)
        at com.microsoft.identity.broker.dbus.DBusCallerInfo$LazyHolder.<clinit>(DBusCallerInfo.java:93)
        at com.microsoft.identity.broker.dbus.DBusCallerInfo.getInstance(DBusCallerInfo.java:85)
        at com.microsoft.identity.broker.dbus.services.impl.DeviceBrokerDBusV1Impl.<clinit>(DeviceBrokerDBusV1Impl.java:81)
        at com.microsoft.identity.broker.dbus.services.DeviceBrokerDBusV1Service.<init>(DeviceBrokerDBusV1Service.java:41)
        at com.microsoft.identity.broker.service.DeviceBrokerService.main(DeviceBrokerService.java:48)
Caused by: java.io.IOException: Failed to auth
        at org.freedesktop.dbus.connections.transports.AbstractTransport.authenticate(AbstractTransport.java:114)
        at org.freedesktop.dbus.connections.transports.UnixSocketTransport.connect(UnixSocketTransport.java:68)
        at org.freedesktop.dbus.connections.transports.TransportFactory.createTransport(TransportFactory.java:44)
        at org.freedesktop.dbus.connections.AbstractConnection.<init>(AbstractConnection.java:149)
        ... 14 more

Same result with adding jffi

I should also add, that a colleague has gotten intune working here, but it depends on half the universe, and this is my attempt to contribute her work upstream to nixpkgs. I thought starting with a single package would be easy :sweat_smile:

If anyone is still interested, this is currently in PR: Microsoft Intune by rhysmdnz · Pull Request #221628 · NixOS/nixpkgs · GitHub

2 Likes

Hi, anyone here with a working solution or implementation? I am new to NixOS. I have tried the following solution: https://github.com/astatide/nixos-intune
but it has a lot of bugs. After fixing them (renaming some aliases etc.) I still have a problem with the libQt dependencies:

    libQt6Widgets.so.6 -> not found!
    libQt6Gui.so.6 -> not found!
    libQt6Core.so.6 -> not found!

@zvalo there is another PR that is further along

https://github.com/NixOS/nixpkgs/pull/221628

Sorry for the late reply, I was away for two months. How can I use it? I added this line to my flake.nix:
intune.url = "github:rhysmdnz/nixpkgs/intune";
and enabled it in “outputs”.

Then I tried to enable intune in my dot file like this:

{...}: {
  services.intune = {
    enable = true;
  };
}

But it ends with this error:
error: The "services.intune" option does not exist.

What am I doing wrong?