Unified Remote: Bluetooth: Could not connect to SDP
I installed Unified Remote today in hope that I can use it with my bluetooth adapter to control my PC using my phone. But as I installed Unified Remote and loaded up the web interface, I got this error:
Bluetooth: Could not connect to SDP
Google has absoluetly nothing helpful about this error so this is one of my only chances here.
some outputs:
noneatme@noneatme-desktop:/etc/bluetooth$ sudo sdptool browse local
Failed to connect to SDP server on FF:FF:FF:00:00:00: Connection refused
Ubuntu 16.04
noneatme@noneatme-desktop:/etc/bluetooth$ uname -a
Linux noneatme-desktop 4.4.0-22-generic #40-Ubuntu SMP Thu May 12 22:03:46 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
noneatme@noneatme-desktop:/etc/bluetooth$ /usr/lib/bluetooth/bluetoothd -C
D-Bus setup failed: Connection ":1.129" is not allowed to own the service "org.bluez" due to security policies in the configuration file
(it works with sudo)
Starting Bluetoothd with --compat argument won't fix the problem.
What can I do?
/edit: I fixed this problem by starting the unified remote server as sudo. Is this really the only option I have?
You need to run the bluetooth daemon in compatibility mode to provide deprecated command line interfaces. You're running Bluez5 and you need some Bluez4 functions. You can do this by editing this file
/etc/systemd/system/dbus-org.bluez.service
and changing this line
ExecStart=/usr/lib/bluetooth/bluetoothd
to this
ExecStart=/usr/lib/bluetooth/bluetoothd --compat
and then restarting bluetooth like this
sudo systemctl daemon-reload
sudo systemctl restart bluetooth
and you'll also have to change permissions on /var/run/sdp
sudo chmod 777 /var/run/sdp
and finally restart unified remote server
Another solution:
Edit /etc/systemd/system/dbus-org.bluez.service:
ExecStart=/usr/lib/bluetooth/bluetoothd --compat
ExecStartPost=/bin/chmod 777 /var/run/sdp
Because permissions of /var/run/sdp seems to reset on every reboot.
I managed to get it working by creating a new systemd
service.
-
Create a config file named
/etc/systemd/system/urserver.service
with contents of:[Unit] Description=Unified Remote Server After=syslog.target network.target [Service] Environment="HOME=/opt/urserver" Type=forking PIDFile=/opt/urserver/.urserver/urserver.pid ExecStartPre=/bin/chmod 777 /var/run/sdp ExecStart=/opt/urserver/urserver-start --no-manager --no-notify ExecStop=/opt/urserver/urserver-stop RemainAfterExit=no Restart=on-failure RestartSec=5s [Install] WantedBy=default.target
-
Set the permissions on the file:
sudo chmod a+x /etc/systemd/system/urserver.service
-
Reload
systemd
daemon:sudo systemctl daemon-reload
-
Start the actual service:
sudo systemctl start urserver
You should disable "Automatically start server when OS starts up." from Unified Remote Settings (web interface), because systemd
will start the service automatically. systemd
will also restart service if it crashes for some reason.
Edited: Environment and PIDFile, thanks to Niklas