[Home]

Summary:ASTERISK-14785: Asterisk is looking in the wrong location for the asterisk.pid (and probably asterisk.ctl) file.
Reporter:Daniel Lynes (dlynes)Labels:
Date Opened:2009-09-07 22:45:53Date Closed:2011-06-07 14:07:53
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Core/Configuration
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description:Asterisk is not looking in the config file for where to locate the asterisk.pid file.  Using strings, it is readily apparent that the location is also hard-coded in the asterisk binary.

****** STEPS TO REPRODUCE ******

1.  Set astrundir to /var/run/asterisk in the /etc/asterisk/asterisk.conf file
2.  chown asterisk:asterisk /var/run/asterisk
3.  Run asterisk:   /usr/sbin/asterisk -f


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

If you scroll up to the top, to see where the process started before all the log spam, you'll see:

Unable to open pid file '/var/run/asterisk.pid': Permission denied
Unable to bind socket to /var/run/asterisk.ctl: Permission denied

As you can see, it's looking in the wrong directory.
Comments:By: Elazar Broad (ebroad) 2009-09-08 01:06:54

What do you have for astrundir in asterisk.conf?

By: Daniel Lynes (dlynes) 2009-09-08 07:12:49

/var/run/asterisk

By: Daniel Lynes (dlynes) 2009-09-11 10:12:56

In case there's confusion, the bug reporting system for the most part doesn't allow me to report the version number accurately.

This bug is in asterisk 1.6.1.6

By: Leif Madsen (lmadsen) 2009-09-16 09:48:05

Is this issue in previous versions, or other branches of Asterisk? My guess is this must be a general issue that has been around for a while? If not, then I'd like to find out if this is a regression, and if so, where it might have happened. Thanks!

By: Jason Parker (jparker) 2009-10-05 17:42:16

The `strings` command is showing the default.  astrundir in the directories context changes this behavior.

Can you upload your asterisk.conf?

By: Leif Madsen (lmadsen) 2009-10-07 08:54:24

When asking a reporter for a question, please don't forget to set the status to feedback. Thanks!

By: Gareth Coco (gcoco) 2009-10-09 14:47:36

As a question to dlynes, in /etc/asterisk/asterisk.conf have you removed the (!) after the [directories] directive? If not then this could be the problem.

By: mustardman (mustardman) 2009-10-21 04:10:12

I believe I am having the same problem.  Using Freepbx when I issue a "amportal stop" I get:

STOPPING ASTERISK
Asterisk ended with exit status 0
Asterisk shutdown normally.
Unable to connect to remote asterisk (does /var/run/asterisk/asterisk.ctl exist?)
Asterisk Stopped

"amportal start" seems to work normally

This is a fresh install and I tried re-installing a few times now.
Asterisk 1.6.1.6

/etc/asterisk/asterisk.conf
[directories]
astetcdir => /etc/asterisk
astmoddir => /usr/lib/asterisk/modules
astvarlibdir => /var/lib/asterisk
astagidir => /var/lib/asterisk/agi-bin
astspooldir => /var/spool/asterisk
astrundir => /var/run/asterisk
astlogdir => /var/log/asterisk

[options]
transmit_silence_during_record = yes
languageprefix=yes
execincludes=yes

Don't see any clues in /var/log/asterisk/full

I can see the asterisk.ctl and asterisk.pid files being created in /var/run/asterisk when I start asterisk and I have that directories permissions set to asterisk.asterisk.

It is like it is trying to remove the file twice when asterisk stops.



By: Elazar Broad (ebroad) 2009-10-21 09:40:26

I don't use FreePBX, so I am going to take a guess. The stop script is probably running 'asterisk -r' after it kills the process to make sure Asterisk is really stopped. With that said, Asterisk/Digium does not support FreePBX.

<ebroad> ~freepbx
<infobot> [~freepbx] FreePBX is unable to be supported here. It is made up of complex dialplans and scripts which can't be easily supported by people who aren't deeply involved. Try joining #freepbx and asking there

By: Leif Madsen (lmadsen) 2009-10-21 11:04:47

I still believe FreePBX must be using the safe_asterisk script, where this issue appears to exist. I have a feeling there is another issue already open about this. I will see if I can find it, and if so, mark either as a duplicate, or as related.

By: mustardman (mustardman) 2009-10-21 16:45:24

Ok, let me put it this way then.

/usr/sbin/asterisk -rx "core stop gracefully"
/usr/sbin/asterisk -rx "stop gracefully"

By: Daniel Lynes (dlynes) 2009-11-06 20:41:35.000-0600

From vim:
 1 [directories]
 2 astetcdir => /etc/asterisk
 3 astmoddir => /usr/lib/asterisk/modules
 4 astvarlibdir => /var/lib/asterisk
 5 astagidir => /var/lib/asterisk/agi-bin
 6 astspooldir => /var/spool/asterisk
 7 astrundir => /var/run/asterisk
 8 astlogdir => /var/log/asterisk

As you can see, I don't have anything commented out.  Also, I am not using freepbx, either.

By: Daniel Lynes (dlynes) 2009-11-06 20:44:51.000-0600

Also, I should note that I am using 'stop when convenient', then checking to make sure asterisk is not running, before running it with /etc/init.d/asterisk start (debian init script, created by 'make config')

By: Matthias Nick (mnick) 2009-11-18 14:13:46.000-0600

I haven't been able to reproduce the issue.
Can you please provide more information?
How you installed you're system, ...

By: Leif Madsen (lmadsen) 2009-12-21 09:52:51.000-0600

Closed due to lack of response from reporter. Please reopen if you're able to provide additional information. Thanks!