Package: bluetooth
Version: 4.99-2
Severity: normal
Tags: patch

Hi,

under systemd, starting long-running processes, like bluetoothd, from
udev rules is not recommended.
Instead, devices should be tagged instead and the service started from
the corresponding target.

99-systemd.rules contains
SUBSYSTEM=="bluetooth", TAG+="systemd", ENV{SYSTEMD_WANTS}="bluetooth.target"

and the systemd service file shipped in the bluetooth package has a
 
 [Install]
 WantedBy=bluetooth.target

section. By hooking up the service in bluetooth.target, it will be
started automatically when bluetooth hardware is attached.

This means, starting the bluetooth daemon in 97-bluetooth.rules is not
recommended under systemd. The best way is to simply skip those rules.

The attached patch does just this. Under sysvinit it doesn't have any
effects.

It would be nice if you could apply the patch in your next upload.

If you have more questions, please don't hesitate to ask.

Cheers,
Michael



-- System Information:
Debian Release: 7.0
  APT prefers unstable
  APT policy: (500, 'unstable'), (200, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.7-trunk-amd64 (SMP w/4 CPU cores)
Locale: LANG=de_DE.utf8, LC_CTYPE=de_DE.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages bluetooth depends on:
ii  bluez  4.99-2

Versions of packages bluetooth recommends:
ii  bluez-alsa       4.99-2
pn  bluez-cups       <none>
ii  bluez-gstreamer  4.99-2

bluetooth suggests no packages.

-- no debconf information
Description: Don't start bluetoothd directly from the udev rule under systemd
 systemd has better mechanisms to start services when hardware is
 hotplugged so we simply skip this rule when running under systemd.
 The bluetooth.service will be activated via bluetooth.target instead.
Author: Michael Biebl <bi...@debian.org>
Index: bluez-4.99/scripts/bluetooth.rules.in
===================================================================
--- bluez-4.99.orig/scripts/bluetooth.rules.in	2013-02-08 01:30:34.469946744 +0100
+++ bluez-4.99/scripts/bluetooth.rules.in	2013-02-08 01:34:31.192666562 +0100
@@ -1,4 +1,6 @@
 # Run helper every time a Bluetooth device appears
 # On remove actions, bluetoothd should go away by itself
+TEST=="/sys/fs/cgroup/systemd", GOTO="bluetooth_end"
 ACTION=="add", SUBSYSTEM=="bluetooth", RUN+="/lib/udev/bluez-udev --udev"
 ACTION=="change", SUBSYSTEM=="bluetooth", RUN+="/lib/udev/bluez-udev --udev"
+LABEL="bluetooth_end"

Reply via email to