[Home]

Summary:ASTERISK-16776: asterisk stops too late
Reporter:Andrew Thomas (raffles)Labels:
Date Opened:2010-10-07 04:17:33Date Closed:2011-07-26 14:43:46
Priority:TrivialRegression?No
Status:Closed/CompleteComponents:General
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description:When I do a reboot or shutdown of my server, it attempts to unload DAHDI before it unloads Asterisk.

This means that DAHDI can not unload as it is still in use (by Asterisk).

The run levels of DAHDI need to come after Asterisk (or Asterisk before DAHDI).

The startup scripts were installed with 'make config' for both DAHDI and Asterisk.

BTW - I am using Debian if that makes a difference.
Comments:By: Andrew Thomas (raffles) 2010-10-07 04:19:27

"The run levels of DAHDI need to come after Asterisk (or Asterisk before DAHDI)."

Meant to say the 'stop levels' as the start ones are correct of course.

By: Stefan Schmidt (schmidts) 2010-10-07 07:28:34

you have in the your /etc several rcX.d directorys for each runlevel. What you need is runlevel 0 (shutdown) and 6 (reboot) so you have to check if in rc0.d and rc6.d the Kxxdahdi has a higher value than Kxxasterisk.
For example
rc0.d/K20asterisk
rc0.d/K30dahdi

this make sure dahdi will be stoped after asterisk.
On the other side in rc3.d (normal startup without GUI) you should have something like K15dahdi and K20asterisk.

best regards

By: Andrew Thomas (raffles) 2010-10-07 07:31:50

Correct - but not resolved (well, not to me).

I can change them run-levels manually - but the 'make config' scripts should do this auto-magically.  Hence, this report.

By: Stefan Schmidt (schmidts) 2010-10-07 08:03:47

sorry i missed this part ;)
you are right but could you please post your dahdi-linux and tools version too.

By: Andrew Thomas (raffles) 2010-10-08 03:07:10

v2.4.0 of both linux and tools.

Thanks

By: Tzafrir Cohen (tzafrir) 2010-10-17 14:22:09

What distribution is it?

By: Andrew Thomas (raffles) 2010-10-18 03:25:16

Not sure what you're asking - but here's the lot...

Asterisk - 1.6.2.13
Add-ons - 1.6.2.2
Dahdi - 2.4.0 (using 'linux-complete')
Libpri 1.4.11.4
Debian Lenny (2.6.26-2-486)

The 'Dahdi before Asterisk unload' has been a problem for as long as I can remember.  It also happens with Zaptel (well, it did last time I used Zaptel).

It's never really been an issue for me before - but I am now using embedded hardware - so it could really do with fixing.

Thanks.

By: Tzafrir Cohen (tzafrir) 2010-10-18 03:50:50

The init script properly writes the dependencies. Technically it means you can use insserv. This may or may not work on your system.

The dahdi init scripts install dahdi as '15 30' , hoping that the asterisk script would be installed with the default 20.

Alas, asterisk is install with priorities '50 91'. Those seem to come from r25095 , that resolved issue ASTERISK-6907.

By: Andrew Thomas (raffles) 2010-10-18 04:03:57

"/usr/sbin/update-rc.d asterisk start 10 2 3 4 5 . stop 91 2 3 4 5 .; \"

There's the culprit :)

91 is way after Dahdi of course (Dahdi is at 30).  I've changed it manually by make Asterisk stop at 29 (1 before Dahdi) - and this seems to work perfectly for me.

Also, you changed the title of this report to "asterisk starts too late" - it should be "asterisk stops too late" as it is only the stop/reboot levels that need changing (0 and 6 in my case).

PS - Actually, shouldn't that line be "/usr/sbin/update-rc.d asterisk start 50 2 3 4 5 . stop 29 0 6 .; \"? (I am no init.d master - but that worked for me).



By: Tzafrir Cohen (tzafrir) 2010-10-18 04:18:40

That line has since been fixed to state 'defaults' instead of an explicit list of runlevels.

The whole thing will become moot once we avoid hardwiring priority numbers (LSB-init dependencies, upstart events, systemd sockets, whatever).

Until then, I'd like to understnd why Asterisk is stopped so late (after DAHDI, mysql and the rest of the gang).

By: Andrew Thomas (raffles) 2010-10-18 04:30:31

Found it!  This is from the 1.6.2.13 makefile :

"if [ -z "$(DESTDIR)" ]; then /usr/sbin/update-rc.d asterisk defaults 50 91; fi; \"

As you can see, 50 and 91 are still in there - hence Asterisk not stopping until '91'.

Like you said - it quite rightly starts at 50 (well after Dahdi) but stops at 91 (well after Dahdi again).  Dahdi can't be unloaded while Asterisk is still using it.

Perhaps a change to : "if [ -z "$(DESTDIR)" ]; then /usr/sbin/update-rc.d asterisk defaults 50 29; fi; \" ??

Thanks again for taking time to look at this 'little' problem.  I do appreciate your time.

By: Stefan Schmidt (schmidts) 2010-10-18 05:01:38

@tzafir its the same in all branches (1.4 to 1.8) and also in trunk.
i think thats one of these "it was allways like this, so why change it?" things.

i have looked at the 1.2 branche and there is just nothing in there about init levels so i thought this was just added without thinking about this.

By: Andrew Thomas (raffles) 2010-11-29 04:51:49.000-0600

BTW - it's in 1.6.2.14 as well ;)

By: Andrew Thomas (raffles) 2011-03-30 06:02:01

If this isn't going to be changed any time soon - then it may as well be closed (no point clogging up the 'open' issue stack).

cheers

By: Russell Bryant (russell) 2011-07-26 14:43:40.685-0500

Per the Asterisk maintenance timeline page at http://www.asterisk.org/asterisk-versions maintenance (bug) support for the 1.4 and 1.6.x branches has ended. For continued maintenance support please move to the 1.8 branch which is a long term support (LTS) branch. For more information about branch support, please see https://wiki.asterisk.org/wiki/display/AST/Asterisk+Versions

If this is still an issue, please open a new issue so it can be re-triaged appropriately. Thanks!