Details
-
Bug
-
Resolution: Fixed
-
Not Evaluated
-
None
-
5.15.2, 6.4.0
-
None
-
Linux Mint 20, gcc 10.3.0, clang 14.0.0, Qt 5.15.2 and 6.4.0
Description
I'm trying to inspect and control netplan via QtDBus. I've taken listnames project as an example and am trying to reach io.netplan.Netplan. A minimal example looks like this:
auto activatable = QDBusConnection::sessionBus() .interface() ->activatableServiceNames() .value(); std::sort(activatable.begin(), activatable.end()); for (auto &service : activatable) qDebug() << service; QDBusInterface iface("io.netplan.Netplan", "/io/netplan/Netplan", "io.netplan.Netplan"); if (iface.isValid()) { QDBusReply<QString> reply = iface.call("Info", argc > 1 ? argv[1] : ""); if (reply.isValid()) { printf("Reply was: %s\n", qPrintable(reply.value())); return 0; } fprintf(stderr, "Call failed: %s\n", qPrintable(reply.error().message())); return 1; } fprintf(stderr, "%s\n", qPrintable(QDBusConnection::sessionBus().lastError().message())); return 1;
I get the list of service names, but it doesn't contain
io.netplan.Netplan
(or any other name for netplan service). And an attempt to make a call yields an error message
"The name io.netplan.Netplan was not provided by any .service files".
Yet when I try to see the list of activatable service names via
busctl list --activatable
or introspect it via
busctl introspect io.netplan.Netplan /io/netplan/Netplan
I can access netplan service and it's interfaces and methods. An attempt to find netplan via
QDBusConnection::sessionBus().interface()->registeredServiceNames()
also fails.
I can also find io.netplan.Netplan.service in /usr/share/dbus-1/system-services. So most probably QtDBus looks for services somewhere else.