Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

DBus, failed to obtain systemwide name

Tags:

glib

dbus

I'm using gio, and this DBus implementation to register some internal object of a daemon. I did all my test with a SESSION wide Dbus and everythings worked fine, but I tried to use the systemwide registration, and since my name registration failed.

I'm using g_bus_own_name to acquire the name, and my error case respond the the bus_acquired_handler then name_lost_handler scenario.

any ideas, how can I solve this issue, or how can I get more information about the error ?

GIO : https://developer.gnome.org/gio/2.38/gio-Owning-Bus-Names.html#g-bus-own-name

This is the dbus-monitor trace :

signal sender=org.freedesktop.DBus -> dest=:1.96 serial=2 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=NameAcquired
string ":1.96"


signal sender=:1.95 -> dest=(null destination) serial=3 path=/org/ast/AstCore; interface=org.freedesktop.DBus.Properties; member=PropertiesChanged
string "org.ast.AstCore"
array [
dict entry(
string "state"
variant int32 3
)
]
array [
]


signal sender=:1.95 -> dest=(null destination) serial=5 path=/org/ast/AstCore; interface=org.freedesktop.DBus.Properties; member=PropertiesChanged
string "org.ast.AstCore"
array [
dict entry(
string "state"
variant int32 4
)
]
array [
]


signal sender=org.freedesktop.DBus -> dest=(null destination) serial=173 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=NameOwnerChanged
string ":1.95"
string ":1.95"
string ""


signal sender=org.freedesktop.DBus -> dest=(null destination) serial=174 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=NameOwnerChanged
string ":1.97"
string ""
string ":1.97"


like image 956
user179663 Avatar asked Jan 18 '26 19:01

user179663


1 Answers

As mentioned in /etc/dbus-1/system.conf

<!-- Holes must be punched in service configuration files for
     name ownership and sending method calls -->
<deny own="*"/>
...

Add your own configuration file (e.g astcore.conf) in /etc/dbus-1/system.d/ to allow your app to own the specific bus name.

like image 134
corro Avatar answered Jan 21 '26 08:01

corro