I am trying to send DBus messages via Ubuntu Touch C++ application. With configuring default template (no error with unconfined) for Apparmor file my application is getting following error as reply:

QDBusMessage(type=Error, service="", error name="org.freedesktop.DBus.Error.AccessDenied", error message="An AppArmor policy prevents this sender from sending this message to this recipient, 0 matched rules; type="method_call", sender=":1.278" (uid=32011 pid=28575 comm="/usr/lib/arm-linux-gnueabihf/qt5/bin/qmlscene $@ s") interface="org.bluez.Manager" member="DefaultAdapter" error name="(unset)" requested_reply="0" destination="org.bluez" (uid=0 pid=824 comm="/usr/sbin/bluetoothd ")", signature="", contents=([]) )

phablet@ubuntu-phablet:/etc/apparmor.d$ aa-easyprof  --policy-vendor=ubuntu --policy-version=1.2 --list-templates

My question: Do I have to configure Apparmor template with value unconfined even though the Ubuntu review will reject the upload package (and will do a manual review probably)? Or is there any way to create an own template for Ubuntu Touch click packages?

  • 1
    Just edit the *.apparmor in your project. Add rights that are needed.
    – Velkan
    Apr 25, 2015 at 6:48

1 Answer 1


Thanks for your answer. This is what I did. See manifest.json.in:

    "policy_groups": [
    "policy_version": 1.2,
    "template": "unconfined"

Thus following ways worked for me for muting BQ phone by any Ubuntu Touch application, but only by specifying the security template as unconfined.

  1. Launch pulse audio command:

    myProcess = new QProcess(this);
    connect (myProcess, SIGNAL(readyReadStandardOutput()), this, SLOT(printOutput()));
    connect (myProcess, SIGNAL(readyReadStandardError()), this, SLOT(printError()));
    QString cmd("/usr/bin/pactl");
    QStringList arguments;
    myProcess->start(QString(cmd), arguments);
  2. Send DBus message:

    QDBusInterface handlerPropertiesInterface("org.freedesktop.Accounts", "/org/freedesktop/Accounts/User32011", "org.freedesktop.DBus.Properties", QDBusConnection::systemBus());
    handlerPropertiesInterface.call("Set", "com.ubuntu.touch.AccountsService.Sound", "SilentMode", QVariant::fromValue(QDBusVariant(muted)));

To my mind it would be better to have a specific template for sending DBus messages (other than "wide" unconfined template), right? Or is it possible to define own security templates?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.