c – D-Bus: No property can be created: sd_bus_add_object_vtable fails

I am trying to create a property on the system bus with a complex signature and two signed integers in my example. The source file test.c:


#define DATA_INTERFACE "com.myexample.myproject"
#define DATA_PATH "/com/myexample/myproject"
#define DATA_PROPERTY "data"
#define DATA_SIGNATURE "ii"

static int get_property_cb(sd_bus*_bus,         
                const char* path,
                const char* interface,
                const char* property,
                sd_bus_message* reply,
                void* userdata,
                sd_bus_error* ret_error)
    int ret = 1;
    sd_bus_message_open_container(reply, 'r', DATA_SIGNATURE);
    sd_bus_message_append(reply, "i", 111);
    sd_bus_message_append(reply, "i", 222);
    return ret;

static const sd_bus_vtable prop_spec(3) = {

int main ()
    sd_bus* _bus = NULL;
    sd_bus_slot* _slot = NULL;
    int ret = 0;
    ret = sd_bus_open_system(&_bus);
    if(ret < 0) {
        fprintf(stderr, "Error: sd_bus_open ret %dn", ret);
        return -1;
    ret = sd_bus_request_name(_bus, DATA_INTERFACE, 0);
    if(ret < 0) {
        fprintf(stderr, "Error: sd_bus_request_name ret %dn", ret);
        return -1;
    ret = sd_bus_add_object_vtable(_bus, &_slot, DATA_PATH, DATA_INTERFACE, prop_spec, NULL);
    if(ret < 0) {
        fprintf(stderr, "Error: sd_bus_add_object_vtable ret %dn", ret);
        return -1;
    return 0;

I also created the file /usr/share/dbus-1/system.d/com.myexample.myproject.conf
(also tried setting it to /etc/dbus-1/system.d/)


the interface file /usr/share/dbus-1/interfaces/com.myexample.myproject.xml


and /usr/share/dbus-1/services/com.myexample.myproject.service

(D-BUS Service)

I run it as root:

sudo ./test

and break my brain why sd_bus_add_object_vtable returns -22 (-EINVAL)

Does anyone know what's going on?

Error while establishing D-Bus connection: No operating permit

I'm using a Centos 7 operating system
I moved houses / var / run / dbus / system_bus_socket after accidentally removing the / var / run folder.
Now if I try to use systemctl Command I get the above error.
Note that I connect to this computer via SSH.
So I have two questions:

  1. Is there a way to recover the deleted files and especially those? system_bus_socket?
  2. When the computer restarts, the files are restored. (Because I'm worried that the system will not be able to start the services after the reboot or I can not connect to SSH)?

Apparmor: How to enable Apparmor's Dbus feature (# Dbus-Mediation) in the Linux kernel?

I would like to use Apparmor to restrict the specific Dbus communication in my system. The following line, however, appears in my Syslog:

December 28 09:36:21 Top caught[1127]: Status of AppArmor: Apparmor is enabled, but some features are missing: dbus, network

Have tested with the following Apparmor profile. Unfortunately, it does not limit the DBUS: _ (

# Last modified: Fri 28 Dec 09:20:30 2018

/ usr / bin / budgie-panel {

  # Allow all rules
enable *,

# Then deny binding access for the program / usr / bin / budgie-panel.
# on any bus (either the user's session bus or the system-wide bus),
# to prevent registration of the dbus endpoint address "org.freedesktop.Notifications"
# This is to keep the address free for other notification daemons
# (like # haze or # 39; mako #, which provide support for multiple screens)
# This also means that Budgerigar can not receive notifications (Raven sidebar and applets).
deny dbus bind name = org.freedesktop.Notifications,


Well, there should be a kernel flag? To see if this feature is enabled in the kernel, there should be a folder under / sys / kernel / security / apparmor / features / dbuscontaining a file with the name mask, However, this folder is missing on my system.

Maybe that's because I switched to update_ubuntu_kernel.sh. Which one will be .deb Kernel packages from https://kernel.ubuntu.com/. They are not the typical Ubuntu kernel. According to ubuntu's own documentation, the dbus function should be present in apparmor since ubuntu 13.10.

$ uname -a
Linux apex 4.20.0-042000-lowlatency # 201812232030 SMP submission from Mon Dec 24 01:42:05 UTC 2018 x86_64 x86_64 x86_64 GNU / Linux

So then! … wants to know how to enable kernel boot flags. Or load a module (modprobe). Or other steps to get this feature working in these newer Linux kernels. Not sure what to look for!

Dbus daemon crash after boot

Not always, but often I find this error at startup, but with nothing that crashes. For the moment I ignore it because I repeat it, it does not scratch anything on the screen, but is there a solution? Details can be found in this picture -> http://tinyimg.io/i/RaXqsym.jpg