[Home]

Summary:ASTERISK-10761: Error while launching /etc/init.d/asterisk start in non-bash shell
Reporter:Przemek Rozycki (prozycki)Labels:
Date Opened:2007-11-14 06:29:41.000-0600Date Closed:2007-11-14 10:05:49.000-0600
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Core/General
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description:Sript /etc/init.d/asterisk seems not to be compatibile whith non-bash, but POSIX-compatibile shell.
While trying to run /etc/init.d/asterisk start

I receive an error message:

/usr/sbin/safe_asterisk: 161: Syntax error: Bad fd number

and Asterisk does not start.


****** ADDITIONAL INFORMATION ******

OS: Ubuntu Server 7.10 i386
/bin/sh is linked to /bin/dash

Exact result of the execution:

przemek@ubuntu:~$ sudo /etc/init.d/asterisk start
Starting Asterisk PBX: 1024
/usr/sbin/safe_asterisk: 161: Syntax error: Bad fd number
asterisk.

After a short investigation I detected that in my system (Ubuntu Server 7.10 i386) /bin/sh points to /bin/dash shell. Changing the first line of the safe_asterisk script from '#!/bin/sh' to '#!/bin/bash' resolved the problem.
Probably, more reliable solution would be changing the link /bin/sh from /bin/dash to /bin/bash, because more asterisk scripts, that I didn't use yet might be dependant of bash extensions, but we never know if anything else in Ubuntu is dependant of dash.
Comments:By: Tilghman Lesher (tilghman) 2007-11-14 09:42:41.000-0600

Nothing is ever dependent on dash.  In fact, you can do:

apt-get remove dash

and the problem will be nicely solved for you.