LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 08-11-2019, 10:35 AM   #1
arcctgx
Member
 
Registered: Mar 2006
Location: EU
Distribution: Slackware, Gentoo
Posts: 58

Rep: Reputation: 23
Can't start blueman-applet as a regular user in Slackware64-14.2 - permissions issue?


Hi,

First of all, I'm new to Bluetooth in general, so please be patient. I want to use my Bluetooth headset with my PC. I have a USB BT dongle, which seems to be working:
Code:
# lsusb | grep -i bluetooth
Bus 001 Device 004: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)

# hciconfig
hci0:	Type: Primary  Bus: USB
	BD Address: 01:23:45:67:89:ab  ACL MTU: 310:10  SCO MTU: 64:8
	UP RUNNING 
	RX bytes:1457 acl:0 sco:0 events:116 errors:0
	TX bytes:1376 acl:0 sco:0 commands:107 errors:0

# bluetoothctl 
[NEW] Controller 01:23:45:67:89:ab BlueZ 5.47 [default]
Agent registered
[bluetooth]# scan on
Discovery started
[CHG] Controller 01:23:45:67:89:ab Discovering: yes
[NEW] Device ... [my headphones are detected]
So far so good. I also noticed that an application blueman-applet is added to autostart in XFCE, but it fails to start (as a regular user, I'm not using DE as root). This is the error message in the console:

Code:
$ blueman-applet 
blueman-applet version 2.0.6 starting
_________
Load (/usr/lib64/python2.7/site-packages/blueman/main/PluginManager.py:60)
['RecentConns', 'DhcpClient', 'AuthAgent', 'NMPANSupport', 'Headset', 'DBusService', 'ShowConnected', 'KillSwitch', 'Menu', 'NetUsage', 'StandardItems', 'GameControllerWakelock', 'PPPSupport', 'SerialManager', 'NMDUNSupport', 'Networking', 'StatusIcon', 'ExitItem', 'DiscvManager', 'TransferService', 'PowerManager'] 
ERROR:dbus.proxies:Introspect error on :1.0:/: dbus.exceptions.DBusException: org.freedesktop.DBus.Error.AccessDenied: Rejected send message, 2 matched rules; type="method_call", sender=":1.183" (uid=1000 pid=9382 comm="/usr/bin/python2.7 /usr/bin/blueman-applet ") interface="org.freedesktop.DBus.Introspectable" member="Introspect" error name="(unset)" requested_reply="0" destination=":1.0" (uid=0 pid=1227 comm="/usr/sbin/bluetoothd ")
Traceback (most recent call last):
  File "/usr/bin/blueman-applet", line 121, in <module>
    BluemanApplet()
  File "/usr/bin/blueman-applet", line 63, in __init__
    self.Plugins.Load()
  File "/usr/lib64/python2.7/site-packages/blueman/main/PluginManager.py", line 90, in Load
    __import__(self.module_path.__name__ + ".%s" % plugin, None, None, [])
  File "/usr/lib64/python2.7/site-packages/blueman/plugins/applet/AuthAgent.py", line 9, in <module>
    import blueman.main.applet.BluezAgent as BluezAgent
  File "/usr/lib64/python2.7/site-packages/blueman/main/applet/BluezAgent.py", line 23, in <module>
    from blueman.bluez.Agent import Agent, AgentMethod
  File "/usr/lib64/python2.7/site-packages/blueman/bluez/Agent.py", line 48, in <module>
    class Agent(dbus.service.Object):
  File "/usr/lib64/python2.7/site-packages/blueman/bluez/Agent.py", line 56, in Agent
    @AgentMethod
  File "/usr/lib64/python2.7/site-packages/blueman/bluez/Agent.py", line 38, in AgentMethod
    if BlueZInterface.get_interface_version()[0] < 5:
  File "/usr/lib64/python2.7/site-packages/blueman/bluez/BlueZInterface.py", line 17, in get_interface_version
    introspection = dbus.Interface(obj, 'org.freedesktop.DBus.Introspectable').Introspect()
  File "/usr/lib64/python2.7/site-packages/dbus/proxies.py", line 70, in __call__
    return self._proxy_method(*args, **keywords)
  File "/usr/lib64/python2.7/site-packages/dbus/proxies.py", line 145, in __call__
    **keywords)
  File "/usr/lib64/python2.7/site-packages/dbus/connection.py", line 651, in call_blocking
    message, timeout)
dbus.exceptions.DBusException: org.freedesktop.DBus.Error.AccessDenied: Rejected send message, 2 matched rules; type="method_call", sender=":1.183" (uid=1000 pid=9382 comm="/usr/bin/python2.7 /usr/bin/blueman-applet ") interface="org.freedesktop.DBus.Introspectable" member="Introspect" error name="(unset)" requested_reply="0" destination=":1.0" (uid=0 pid=1227 comm="/usr/sbin/bluetoothd ")
I understand that the application is trying to communicate with Bluetooth daemon over DBus, but the attempt is denied. And I see a similar error in the syslog when I'm trying to use bluetoothctl as a regular user:

Code:
Aug 11 16:53:16 myhost dbus[1225]: [system] Rejected send message, 2 matched rules; type="method_call", sender=":1.181" (uid=1000 pid=9107 comm="bluetoothctl ") interface="org.freedesktop.DBus.ObjectManager" member="GetManagedObjects" error name="(unset)" requested_reply="0" destination="org.bluez" (uid=0 pid=1227 comm="/usr/sbin/bluetoothd ")
It is possible to start blueman-applet as root user, so I think this is just a permission error. As far as I was able to investigate, default DBus configuration disallows sending messages for method calls, but files in /etc/dbus-1/ can specify exceptions to that rule. The file /etc/dbus-1/system.d/bluetooth.conf installed by blues says:

Code:
<busconfig>

  <!-- ../system.conf have denied everything, so we just punch some holes -->

  <policy user="root">
    <allow own="org.bluez"/>
    <allow send_destination="org.bluez"/>
    <allow send_interface="org.bluez.Agent1"/>
    <allow send_interface="org.bluez.MediaEndpoint1"/>
    <allow send_interface="org.bluez.MediaPlayer1"/>
    <allow send_interface="org.bluez.ThermometerWatcher1"/>
    <allow send_interface="org.bluez.AlertAgent1"/>
    <allow send_interface="org.bluez.Profile1"/>
    <allow send_interface="org.bluez.HeartRateWatcher1"/>
    <allow send_interface="org.bluez.CyclingSpeedWatcher1"/>
    <allow send_interface="org.bluez.GattCharacteristic1"/>
    <allow send_interface="org.bluez.GattDescriptor1"/>
    <allow send_interface="org.freedesktop.DBus.ObjectManager"/>
    <allow send_interface="org.freedesktop.DBus.Properties"/>
  </policy>

  <policy at_console="true">
    <allow send_destination="org.bluez"/>
  </policy>

  <!-- allow users of lp group (printing subsystem) to 
       communicate with bluetoothd -->
  <policy group="lp">
    <allow send_destination="org.bluez"/>
  </policy>

  <policy context="default">
    <deny send_destination="org.bluez"/>
  </policy>

</busconfig>
My user is in "lp" group, so I don't understand why am I not allowed to send these DBus messages?

Code:
$ id
uid=1000(arcctgx) gid=100(users) groups=100(users),7(lp),17(audio),18(video),19(cdrom),83(plugdev),84(power),86(netdev)
Unfortunately I don't know enough about DBus to debug this issue further. I would appreciate some help with this.

Maybe I am not supposed to run blueman-applet as a regular user at all? But if that was the case, why would it try to autostart with XFCE as regular user? And I would really prefer to use a GUI for handling Bluetooth devices, instead of doing everything in console as root.
 
Old 08-11-2019, 12:07 PM   #2
Richard Cranium
Senior Member
 
Registered: Apr 2009
Location: McKinney, Texas
Distribution: Slackware64 15.0
Posts: 3,858

Rep: Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225
You'll have to restart after adding your user to the lp group for DBus to pick up the change. (You can try restarting DBus, but not from an X session.)

If you've rebooted at least once after adding your user to the lp group, then it's a different issue.

You should do the following as your normal user:

When you run...
Code:
dbus-send --system --print-reply --type=method_call --dest=org.freedesktop.DBus /org/freedesktop/DBus org.freedesktop.DBus.ListNames
...does org.bluez show up in the list?

If it doesn't, that's a problem. If it does, what does...
Code:
dbus-send --system --print-reply --dest=org.bluez /org/bluez org.freedesktop.DBus.Introspectable.Introspect
...emit? (It'll be ugly.)
 
2 members found this post helpful.
Old 08-11-2019, 01:24 PM   #3
arcctgx
Member
 
Registered: Mar 2006
Location: EU
Distribution: Slackware, Gentoo
Posts: 58

Original Poster
Rep: Reputation: 23
Hi Richard,
Quote:
You'll have to restart after adding your user to the lp group for DBus to pick up the change. (You can try restarting DBus, but not from an X session.)
OK, I feel silly now. Rebooting the PC is all it took to make it work. In my defense, I rarely reboot these days, I mostly use hibernation. Before I rebooted the machine I only shut down the X session, logged out and in again so that my regular user would be in "lp" group. I wasn't aware that restarting DBus is necessary as well.

One more observation. Before I added my user to "lp" group using gpasswd (which permanently modified /etc/group), my regular user account was being added to "lp" group at login by means of CONSOLE_GROUPS defined in /etc/login.defs. But that wasn't enough to allow sending DBus messages to bluez. If I understand correctly, restarting DBus after logging in as my regular user would grant me the required permissions?

Anyway, it's looking good now, blueman-applet started and I was able to pair my headphones as a regular user. I guess the output of these commands it what is expected?

Code:
$ dbus-send --system --print-reply --type=method_call --dest=org.freedesktop.DBus /org/freedesktop/DBus org.freedesktop.DBus.ListNames | grep -i bluez
      string "org.bluez"

$ dbus-send --system --print-reply --dest=org.bluez /org/bluez org.freedesktop.DBus.Introspectable.Introspect
method return time=1565546289.378038 sender=:1.0 -> destination=:1.59 serial=199 reply_serial=2
   string "<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
<node><interface name="org.freedesktop.DBus.Introspectable"><method name="Introspect"><arg name="xml" type="s" direction="out"/>
</method></interface><interface name="org.bluez.AgentManager1"><method name="RegisterAgent"><arg name="agent" type="o" direction="in"/>
<arg name="capability" type="s" direction="in"/>
</method><method name="UnregisterAgent"><arg name="agent" type="o" direction="in"/>
</method><method name="RequestDefaultAgent"><arg name="agent" type="o" direction="in"/>
</method></interface><interface name="org.bluez.ProfileManager1"><method name="RegisterProfile"><arg name="profile" type="o" direction="in"/>
<arg name="UUID" type="s" direction="in"/>
<arg name="options" type="a{sv}" direction="in"/>
</method><method name="UnregisterProfile"><arg name="profile" type="o" direction="in"/>
</method></interface><node name="hci0"/></node>"
Thank you for your help, Richard.
 
Old 08-11-2019, 02:27 PM   #4
Richard Cranium
Senior Member
 
Registered: Apr 2009
Location: McKinney, Texas
Distribution: Slackware64 15.0
Posts: 3,858

Rep: Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225
Quote:
Originally Posted by arcctgx View Post
Hi Richard,

OK, I feel silly now. Rebooting the PC is all it took to make it work. In my defense, I rarely reboot these days, I mostly use hibernation. Before I rebooted the machine I only shut down the X session, logged out and in again so that my regular user would be in "lp" group. I wasn't aware that restarting DBus is necessary as well.
Oh, you aren't the only one who thinks that way. DBus appears to cache that information somewhere on startup and doesn't bother to update the cache when the group list changes. I was pretty annoyed myself when this happened to me. ¯\_(ツ)_/¯

Quote:
Originally Posted by arcctgx View Post
One more observation. Before I added my user to "lp" group using gpasswd (which permanently modified /etc/group), my regular user account was being added to "lp" group at login by means of CONSOLE_GROUPS defined in /etc/login.defs. But that wasn't enough to allow sending DBus messages to bluez. If I understand correctly, restarting DBus after logging in as my regular user would grant me the required permissions?
The only problem is that everything in your desktop environment is pointing to the old DBus socket; you'd be amazed at what stops working at that point.


I wrote something about this a while back in this forum, but I can't find the thread.
 
  


Reply

Tags
blueman, bluetooth, dbus



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Can't use blueman-applet or blueman-manager on Slackware64 -current danielldaniell Slackware 19 01-13-2019 07:30 PM
no blueman-applet(bluetooth-applet) in desktop tray when slack-current boots mainam Slackware 16 04-03-2016 07:26 PM
Authentication failure with Blueman applet and cell phone. camorri Slackware 1 05-29-2015 06:36 PM
Blueman-applet defaults Woodsman Slackware 1 01-28-2013 08:11 AM
Blueman-applet top cpu user whenever heavy processing is happening gmartin Slackware 1 12-25-2011 02:55 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 07:11 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration