[Home]

Summary:ASTERISK-15603: [patch] Unable to open pid file '/var/run/asterisk/asterisk.pid': No such file or directory
Reporter:Brian Rel (brian)Labels:
Date Opened:2010-02-10 12:39:09.000-0600Date Closed:2010-02-25 15:25:07.000-0600
Priority:BlockerRegression?Yes
Status:Closed/CompleteComponents:Core/PBX
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) 20100224__issue16802.diff.txt
Description:Debian/Ubuntu: A default build from source (without tweaking /etc/asterisk/asterisk.conf) gives an error on boot:

"Unable to open pid file '/var/run/asterisk/asterisk.pid': No such file or directory"

Attempting to log in with asterisk -cvv or asterisk -rvv throws:
"Unable to connect to remote asterisk (does /var/run/asterisk/asterisk.ctl exist?)"

Manually creating /var/run/asterisk and restarting the application clears the issue, but /var/run/asterisk disappears on reboot.

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

Editing /etc/asterisk/asterisk.conf and taking out the (!) lets the default:
astrundir => /var/run
take effect, which places the .pid and .ctl in /var/run and the errors are no longer present. However, setting astrundir => /var/run/asterisk does not work.

This is minor, but I've been asked to come here and report the issue as a possible 'bug'. It may be that by default Asterisk expects /var/run/asterisk to exist - when it is not created. Apologies for bringing it up.
Comments:By: Leif Madsen (lmadsen) 2010-02-10 15:18:58.000-0600

No apologies needed! I ran into this same issue the other day, and thought it was something I did, but it appears we're not creating something prior to starting Asterisk.

Thanks for reporting it!

By: Tilghman Lesher (tilghman) 2010-02-24 14:32:50.000-0600

This is actually not a regression in Asterisk.  An operating system change or upgrade probably caused this.

Patch attached and ready for testing.

By: Brian Rel (brian) 2010-02-25 01:46:30.000-0600

I disagree that it was an update to the O/S. The core system (An Ubuntu 8.10 server) had no changes made other than Asterisk being upgraded. A workaround was created by removing the default '!' from asterisk.conf and altering the init.d script.

By: Tzafrir Cohen (tzafrir) 2010-02-25 02:28:17.000-0600

Brian, while this is a indeed a regression for your system, it fixed many other systems.

The suggested patch (creating the directory if it doesn't exist, which will only work if you're root. If you're not, you're likely not to be able to generate the .ctl socket as well there) looks fine, and will require no configuration editing on your part (but will not break your modified system either).

Looks good to me.

By: Digium Subversion (svnbot) 2010-02-25 15:21:06.000-0600

Repository: asterisk
Revision: 248859

U   branches/1.4/main/asterisk.c

------------------------------------------------------------------------
r248859 | tilghman | 2010-02-25 15:21:05 -0600 (Thu, 25 Feb 2010) | 15 lines

Some platforms clear /var/run at boot, which makes connecting a remote console... difficult.

Previously, we only created the default /var/run/asterisk directory at install
time.  While we could create it in the init script, that would not work for
those who start asterisk manually from the command line.  So the safest thing
to do is to create it as part of the Asterisk boot process.  This also changes
the ownership of the directory, because the pid and ctl files are created after
we setuid/setgid.

(closes issue ASTERISK-15603)
Reported by: Brian
Patches:
      20100224__issue16802.diff.txt uploaded by tilghman (license 14)
Tested by: tzafrir

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=248859

By: Digium Subversion (svnbot) 2010-02-25 15:22:40.000-0600

Repository: asterisk
Revision: 248861

_U  trunk/
U   trunk/main/asterisk.c

------------------------------------------------------------------------
r248861 | tilghman | 2010-02-25 15:22:39 -0600 (Thu, 25 Feb 2010) | 22 lines

Merged revisions 248859 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
 r248859 | tilghman | 2010-02-25 15:21:05 -0600 (Thu, 25 Feb 2010) | 15 lines
 
 Some platforms clear /var/run at boot, which makes connecting a remote console... difficult.
 
 Previously, we only created the default /var/run/asterisk directory at install
 time.  While we could create it in the init script, that would not work for
 those who start asterisk manually from the command line.  So the safest thing
 to do is to create it as part of the Asterisk boot process.  This also changes
 the ownership of the directory, because the pid and ctl files are created after
 we setuid/setgid.
 
 (closes issue ASTERISK-15603)
  Reported by: Brian
  Patches:
        20100224__issue16802.diff.txt uploaded by tilghman (license 14)
  Tested by: tzafrir
........

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=248861

By: Digium Subversion (svnbot) 2010-02-25 15:24:07.000-0600

Repository: asterisk
Revision: 248862

_U  branches/1.6.0/
U   branches/1.6.0/main/asterisk.c

------------------------------------------------------------------------
r248862 | tilghman | 2010-02-25 15:24:07 -0600 (Thu, 25 Feb 2010) | 29 lines

Merged revisions 248861 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk

................
 r248861 | tilghman | 2010-02-25 15:22:39 -0600 (Thu, 25 Feb 2010) | 22 lines
 
 Merged revisions 248859 via svnmerge from
 https://origsvn.digium.com/svn/asterisk/branches/1.4
 
 ........
   r248859 | tilghman | 2010-02-25 15:21:05 -0600 (Thu, 25 Feb 2010) | 15 lines
   
   Some platforms clear /var/run at boot, which makes connecting a remote console... difficult.
   
   Previously, we only created the default /var/run/asterisk directory at install
   time.  While we could create it in the init script, that would not work for
   those who start asterisk manually from the command line.  So the safest thing
   to do is to create it as part of the Asterisk boot process.  This also changes
   the ownership of the directory, because the pid and ctl files are created after
   we setuid/setgid.
   
   (closes issue ASTERISK-15603)
    Reported by: Brian
    Patches:
          20100224__issue16802.diff.txt uploaded by tilghman (license 14)
    Tested by: tzafrir
 ........
................

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=248862

By: Digium Subversion (svnbot) 2010-02-25 15:24:50.000-0600

Repository: asterisk
Revision: 248863

_U  branches/1.6.1/
U   branches/1.6.1/main/asterisk.c

------------------------------------------------------------------------
r248863 | tilghman | 2010-02-25 15:24:49 -0600 (Thu, 25 Feb 2010) | 29 lines

Merged revisions 248861 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk

................
 r248861 | tilghman | 2010-02-25 15:22:39 -0600 (Thu, 25 Feb 2010) | 22 lines
 
 Merged revisions 248859 via svnmerge from
 https://origsvn.digium.com/svn/asterisk/branches/1.4
 
 ........
   r248859 | tilghman | 2010-02-25 15:21:05 -0600 (Thu, 25 Feb 2010) | 15 lines
   
   Some platforms clear /var/run at boot, which makes connecting a remote console... difficult.
   
   Previously, we only created the default /var/run/asterisk directory at install
   time.  While we could create it in the init script, that would not work for
   those who start asterisk manually from the command line.  So the safest thing
   to do is to create it as part of the Asterisk boot process.  This also changes
   the ownership of the directory, because the pid and ctl files are created after
   we setuid/setgid.
   
   (closes issue ASTERISK-15603)
    Reported by: Brian
    Patches:
          20100224__issue16802.diff.txt uploaded by tilghman (license 14)
    Tested by: tzafrir
 ........
................

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=248863

By: Digium Subversion (svnbot) 2010-02-25 15:25:06.000-0600

Repository: asterisk
Revision: 248864

_U  branches/1.6.2/
U   branches/1.6.2/main/asterisk.c

------------------------------------------------------------------------
r248864 | tilghman | 2010-02-25 15:25:05 -0600 (Thu, 25 Feb 2010) | 29 lines

Merged revisions 248861 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk

................
 r248861 | tilghman | 2010-02-25 15:22:39 -0600 (Thu, 25 Feb 2010) | 22 lines
 
 Merged revisions 248859 via svnmerge from
 https://origsvn.digium.com/svn/asterisk/branches/1.4
 
 ........
   r248859 | tilghman | 2010-02-25 15:21:05 -0600 (Thu, 25 Feb 2010) | 15 lines
   
   Some platforms clear /var/run at boot, which makes connecting a remote console... difficult.
   
   Previously, we only created the default /var/run/asterisk directory at install
   time.  While we could create it in the init script, that would not work for
   those who start asterisk manually from the command line.  So the safest thing
   to do is to create it as part of the Asterisk boot process.  This also changes
   the ownership of the directory, because the pid and ctl files are created after
   we setuid/setgid.
   
   (closes issue ASTERISK-15603)
    Reported by: Brian
    Patches:
          20100224__issue16802.diff.txt uploaded by tilghman (license 14)
    Tested by: tzafrir
 ........
................

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=248864