Summary:ASTERISK-05559: init asterisk script bug
Reporter:lters (lters)Labels:
Date Opened:2005-11-10 12:11:56.000-0600Date Closed:2008-01-15 16:02:40.000-0600
Versions:Frequency of
Description:Using the init.d file for Debian on amd64 box, this lines causes the startup script to fail:

By commenting it out it starts fine.

< export LD_ASSUME_KERNEL=2.4.1
> #export LD_ASSUME_KERNEL=2.4.1


Not sure where contrib script updates should go?
Comments:By: Tilghman Lesher (tilghman) 2005-11-10 14:09:42.000-0600

That line is to combat an NPTL threads bug most often seen on Redhat.

By: Tilghman Lesher (tilghman) 2005-11-10 14:23:43.000-0600

An additional note:  the reason why it's failing on amd64 is that that platform only has NPTL, thus the requirement for an older threading library fails (since there's nothing older).

If you can come up with a patch that disables this only for amd64 and other platforms which don't have the older non-NPTL libraries, that can be considered for commit.  However, we have a policy against breaking older platforms just so the latest whizbang platforms will work.

By: lters (lters) 2005-11-10 15:22:51.000-0600

Here is a patch that corrects it for me.
There might be better ways...

--- /usr/src/asterisk/contrib/init.d/rc.debian.asterisk 2004-07-23 23:17:52.000000000 -0400
+++ /etc/init.d/asterisk        2005-11-10 16:21:16.245173608 -0500
@@ -19,9 +19,13 @@
# Full path to safe_asterisk script

-# Leave this set unless you know what you are doing.
-export LD_ASSUME_KERNEL=2.4.1
+#NTPL Compatibility for older kernels, rh especially
+NTPL=`uname -a | grep x86_64`

+if [ -z "$NTPL" ]; then
+       export LD_ASSUME_KERNEL=2.4.1
# Uncomment the following and set them to the user/groups that you
# want to run Asterisk as. NOTE: this requires substantial work to
# be sure that Asterisk's environment has permission to write the
@@ -52,6 +56,13 @@
       echo -n "Stopping $DESC: "
       $DAEMON -rx 'stop now' > /dev/null 2> /dev/null && echo -n "$NAME"
+       echo -e "\n\nStopping Music On Hold "
+       pkill -9 mpg123 > /dev/null 2> /dev/null
+       sleep 2
+       #In case of a crash make sure nothing is still running
+       pkill -9 safe_asterisk
+       pkill -9 asterisk
       echo "."
       exit 0

By: Tilghman Lesher (tilghman) 2005-11-10 16:12:53.000-0600

Please don't put patches in bugnotes.  Instead, upload your patches with the facility provided.

By: lters (lters) 2005-11-10 16:43:25.000-0600

Do you need this submitted again?

By: Tilghman Lesher (tilghman) 2005-11-10 17:55:41.000-0600

I need the patch uploaded as an attachment, yes.

By: Kevin P. Fleming (kpfleming) 2005-11-10 18:01:21.000-0600

I'm not sure we even need this line in the script any longer.

By: damin (damin) 2005-11-11 18:20:27.000-0600

I'm about to do an overhaul of the Debian and RedHat init scripts so that they make it into the 1.2 release. If you want me to remove the assumption and just leave it in there for people to comment it out, or if there is some way to test for a specific condition under which it should only be enabled, please let me know.

BTW: The init script /usr/src/asterisk/redhat/asterisk should be removed, as it is silly, old and out of date.

By: lters (lters) 2005-11-11 18:41:24.000-0600

I added a part to the stop function of the script because sometimes asterisk does not completely stop, or you start it and it hangs. It is nice to be able to have it for sure stop by doing the /etc/init.d/asterisk stop

By: Kevin P. Fleming (kpfleming) 2005-11-11 19:24:39.000-0600

At this point I would suggest only including it commented out with an explicit suggestion not to enable it unless they know _exactly_ why they need it. All modern distros don't need it any longer.

By: damin (damin) 2005-11-17 22:30:49.000-0600

Per Kevin's suggestion and some additional feedback that I have gotten along the way, and as a result of the discussion in this bug note, I have submitted http://bugs.digium.com/view.php?id=5785 which is an update to the Debian and RedHat init scripts that should alleviate this issue on x86_64 boxes.

I would suggest that this bug note is ready to be closed, pending review and submit of the changes in 5785.

By: Russell Bryant (russell) 2005-11-30 15:25:16.000-0600

fixed in the 1.2 branch and the trunk.  It will be in 1.2.1.  Thanks!

By: Digium Subversion (svnbot) 2008-01-15 16:02:39.000-0600

Repository: asterisk
Revision: 7241

U   trunk/contrib/init.d/rc.debian.asterisk
U   trunk/contrib/init.d/rc.redhat.asterisk

r7241 | russell | 2008-01-15 16:02:39 -0600 (Tue, 15 Jan 2008) | 4 lines

Comment out LD_ASSUME_KERNEL by default.
Print error messages if asterisk executable or the asterisk configuration
directory is not found. (issue ASTERISK-5636, ASTERISK-5559)



By: Digium Subversion (svnbot) 2008-01-15 16:02:40.000-0600

Repository: asterisk
Revision: 7242

U   branches/1.2/contrib/init.d/rc.debian.asterisk
U   branches/1.2/contrib/init.d/rc.redhat.asterisk

r7242 | russell | 2008-01-15 16:02:40 -0600 (Tue, 15 Jan 2008) | 4 lines

Comment out LD_ASSUME_KERNEL by default.
Print error messages if the asterisk executable or the asterisk configuration
directory are not found. (issue ASTERISK-5636, ASTERISK-5559)