Bug 178210 - net-wireless/bluez-utils-3.10: init script stops only services enabled to start
Bug#: 178210 Product:  Gentoo Linux Version: unspecified Platform: All
OS/Version: Linux Status: RESOLVED Severity: normal Priority: P2
Resolution: FIXED Assigned To: betelgeuse@gentoo.org Reported By: flameeyes@gentoo.org
Component: Ebuilds
URL: 
Summary: net-wireless/bluez-utils-3.10: init script stops only services enabled to start
Keywords:  
Status Whiteboard: 
Opened: 2007-05-12 15:02 0000
Description:   Opened: 2007-05-12 15:02 0000
When stopping the bluetooth service, the stop() function checks which services
are enabled in the configuration file /etc/conf.d/bluetooth, and stops those
only. This creates a problem if the settings are changed since last time to
avoid starting a given service (I hit the problem when restarting bluetooth
after updating to the latest version from a previous 3.x version, and sdp
switched from enabled to disabled, sdp wasn't stopped, nor started, so the
previous one continue drunning). It also checks for presence of the executable
file, which makes it impossible to stop the services after the package is
uninstalled.

The solutions for this are are two, one is to avoid checking at all, and simply
stop everything every time, the other (IMHO nicer) is to split out the services
in a series of init scripts, adding bluetooth as an init meta-script that,
depending on the configured variables, depends on the various services;
starting and stopping the daemons would then be possible without problems.

------- Comment #1 From Dick Marinus 2007-05-13 09:49:38 0000 -------
Created an attachment (id=119087) [details]
/etc/init.d/hcid

------- Comment #2 From Dick Marinus 2007-05-13 09:49:55 0000 -------
Created an attachment (id=119089) [details]
/etc/init.d/sdpd

------- Comment #3 From Dick Marinus 2007-05-13 09:50:12 0000 -------
Created an attachment (id=119090) [details]
/etc/init.d/pand

------- Comment #4 From Dick Marinus 2007-05-13 09:50:33 0000 -------
Created an attachment (id=119092) [details]
/etc/init.d/dund

------- Comment #5 From Dick Marinus 2007-05-13 09:50:55 0000 -------
Created an attachment (id=119094) [details]
/etc/init.d/rfcomm

------- Comment #6 From Dick Marinus 2007-05-13 09:51:18 0000 -------
Created an attachment (id=119096) [details]
/etc/init.d/hidd

------- Comment #7 From Dick Marinus 2007-05-13 09:53:48 0000 -------
Created an attachment (id=119097) [details]
/etc/conf.d/pand

------- Comment #8 From Dick Marinus 2007-05-13 09:54:04 0000 -------
Created an attachment (id=119099) [details]
/etc/conf.d/dund

------- Comment #9 From Dick Marinus 2007-05-13 09:54:26 0000 -------
Created an attachment (id=119100) [details]
/etc/conf.d/rfcomm

------- Comment #10 From Dick Marinus 2007-05-13 09:54:44 0000 -------
Created an attachment (id=119102) [details]
/etc/conf.d/hidd

------- Comment #11 From Dick Marinus 2007-05-13 09:55:05 0000 -------
Created an attachment (id=119104) [details]
/etc/conf.d/hcid

------- Comment #12 From Dick Marinus 2007-05-13 09:56:05 0000 -------
Diago, I totally agree.

I've split up
/usr/portage/net-wireless/bluez-utils/files/bluez-utils-2.25-init.d into
seperate init scripts. Please review

------- Comment #13 From Petteri Räty 2007-05-13 14:39:59 0000 -------
(In reply to comment #12)
> Diago, I totally agree.
> 
> I've split up
> /usr/portage/net-wireless/bluez-utils/files/bluez-utils-2.25-init.d into
> seperate init scripts. Please review
> 

We should work on this in an overlay for example. I can get you commit access
to my dev overlay in overlays.gentoo.org if you want.

------- Comment #14 From Diego E. 'Flameeyes' Pettenò 2007-05-13 14:50:29 0000 -------
It came to me now that this only solves half the problem, as stop and restart
of the meta-service wouldn't stop the other services, I'll see to talk with
Roy, maybe there's a way to get that working too.

------- Comment #15 From Dick Marinus 2007-05-13 15:07:19 0000 -------
> I can get you commit access to my dev overlay in overlays.gentoo.org if you 
> want.
That would be nice.

> It came to me now that this only solves half the problem, as stop and restart
> of the meta-service wouldn't stop the other services
Hmm what do you mean? "/etc/init.d/hcid stop" also stops for example hidd.

------- Comment #16 From Petteri Räty 2007-05-13 15:17:15 0000 -------
(In reply to comment #15)
> > I can get you commit access to my dev overlay in overlays.gentoo.org if you 
> > want.
> That would be nice.
> 

genstef informed me that I have access to Sunrise so we can use that for the
time being.

------- Comment #17 From Diego E. 'Flameeyes' Pettenò 2007-05-13 15:18:36 0000 -------
Yeah but hotplug start/stop of the service might a bit tricky this way.
If you don't think a bluetooth meta-script is needed, that works for me :)

It was just to maintain the same behaviour as before, but it's probably worth
changing behaviour at this point.

------- Comment #18 From Dick Marinus 2007-05-13 17:35:57 0000 -------
Okay committed to sunrise

------- Comment #19 From Chris Carlin 2007-05-13 18:49:22 0000 -------
Don't forget the metascript...

------- Comment #20 From Petteri Räty 2007-05-16 10:47:17 0000 -------
(In reply to comment #18)
> Okay committed to sunrise
> 

It seems our work was in vain:
13:44 < Betelgeuse> I am wondering why bluetooth.init doesn't start sdpd any
more?
13:45 < holtmann> Not needed. It is part of hcid when you start it with -s.
13:45 < Betelgeuse> Ok I should change the Gentoo init script then
13:46 < Betelgeuse>
http://viewcvs.gentoo.org/viewcvs.py/gentoo-x86/net-wireless/bluez-utils/files/bluez-utils-2.25-init.d?rev=1.1&view=markup
13:46 < Betelgeuse> holtmann: What about the others?
13:46 < holtmann> Actually with the new service implementation no other daemon
than hcid is needed.

------- Comment #21 From Petteri Räty 2007-05-16 12:46:08 0000 -------
*bluez-utils-3.10.1 (16 May 2007)

  16 May 2007; Petteri Räty <betelgeuse@gentoo.org>
  +files/bluez-utils-3.10.1-init.d, +files/bluez-utils-3.10.1-udev.rules,
  +files/bluez-utils-3.10.1-udev.script, +bluez-utils-3.10.1.ebuild:
  Version bump. A new simpler init script that uses the service architechture
  so we only need the hcid daemon. Disabled alsa, obex and sync support
  because upstream says they are not working yet. Added examples use flag to
  install the echo example service, old-daemons to install the old daemons and
  test-programs to install l2test and rctest programs. Made the udev helper
  use IN_HOTPLUG and fix starting the service via udev. Fixes bug #178268,
  #178210, #178160, #160273 and #144812.

So this is fixed in 3.10.1 that only uses the hcid daemon.