/var/lib/asterisk/bin/freepbx_engine: line 98: Warning:: command not found
**** WARNING: ERROR IN CONFIGURATION ****
astrundir in ‘/etc/asterisk’ is set to but the directory
does not exists. Attempting to create it with: 'mkdir -p ’
mkdir: missing operand
Try `mkdir --help’ for more information.
**** ERROR: COULD NOT CREATE ****
Attempt to execute 'mkdir -p ’ failed with an exit code of 1
You must create this directory and the try again.
Prior to upgrade everything was ok - now everything is broken
Could really do with some quick pointers here.
As I am unable to get into freepbx I cant tell you the revision - all I can say is that I upgraded today 2.09-RC2? from 08 (sorry cant be more specific).
you should know what you upgraded from or how you upgraded.
Did you use the Upgrade Module or did you upgrade using install_amp from the tarball? Of were you already running 2.9 beta before you upgraded to RC. It’s hard to provide guidance without that sort of information. (The other info you provided is good though).
somewhere along the way you did not get migrated properly. It could be bugs related to the less common configuration that you have (being Umbuntu though most of the important directories are pretty standard which is a bit puzzling).
In any event, getting it fixed through a forum discussion is probably going to be far fetched. Do you have a backup, because your first best thing to do would be to go back to the backup to get up and working and then re-group as to what the issues may be or get some more intense logging configured and then re-try the upgrade.
If not, you could try to pull the tarball and use install_amp with --force-version 2.8.0 (or what ever you may have upgraded from previously and see if that ends up forcing the migration to happen correctly. It’s a long shot but isn’t going to do any more harm then the current state by doing that.
Thank you for the fast response - I misunderstood what you meant about upgrading.
Yes I upgraded using the module in freepbx from 2.8 up to 2.9. I have upgraded before and during the upgrade everything appeared to install succesfully. Everything was working after the upgrade and I would not have known there was any problem (all extensions and trunks working) if I had not rebooted.
As for reverting to backup, yes I did do a backup via freepbx backup, and I do backup every night. As I cant get in to freepbx, I am a bit stuck as to how to restore.
that would be a sql table in the normal asterisk database, not an entire database.
I didn’t think we made any sort of backup of freepbx.conf to freepbx.conf.bkup, I would have to look through the code to see if that is the case.
Bottom line though, are you saying your freepbx.conf file is empty? If so, that is a bit of a problem and could be related to or the root of your issues, though I don’t know why it would be empty.
It should look something like this:
[php]
<?php
$amp_conf['AMPDBUSER'] = 'freepbx_user';
$amp_conf['AMPDBPASS'] = 'freepbx_password';
$amp_conf['AMPDBHOST'] = 'localhost';
$amp_conf['AMPDBNAME'] = 'asterisk';
$amp_conf['AMPDBENGINE'] = 'mysql';
$amp_conf['datasource'] = ''; //for sqlite3
require_once('/var/www/html/admin/bootstrap.php');
[/php]
where the freepbx_user/freepbx_password would be your database credentials. However, if you have that but you don't have a table called freepbx_settings then something went wrong and it won't work. The freepbx.conf file is now the only configuration file used to 'boostrap' freepbx. We no longer use amportal.conf (though it is still there for legacy reasons. All the settings that were in amportal.conf, with the exception of those above, are now in the freepbx_settings table. So both need to be there for anything to work.
<?php
$amp_conf['AMPDBUSER'] = "asteriskuser";
$amp_conf['AMPDBPASS'] = "xxxx";
$amp_conf['AMPDBHOST'] = "localhost";
$amp_conf['AMPDBNAME'] = "asterisk";
$amp_conf['AMPDBENGINE'] = "mysql";
$amp_conf['datasource'] = "";
require_once('/var/www/admin/bootstrap.php');
xxxx replaces my real password :)
I have done a
cp /etc/asterisk/freepbx.conf.bkup /etc/freepbx.conf
Have checked and freepbx_settings has 29 rows.
AND.....
amportal start is now working - THANK YOU SIR :)
Now I am happy.
Also getting a bit late here in the UK.
Apologies - it was getting late.
Just re-checked using phpmyadmin and it was displaying
Showing rows 0 - 29 175 total
You are correct - 175 rows - I miss-read the message
System appears fine now - thank you once again for the fast response.
I am on FreePBX 2.9.0rc1.2
When moving from 2.8, it was a two stage process 2,8 to 2.9.0rc1.1 to 2.9.0rc1.2 (pretty sure that was the order).
I did not see any errors during the upgrade and as mentioned everything was working until the reboot.
This was a very strange one. If there were bread crumbs to follow what happened it would be useful since a bug in the migration process is obviously not out of the question.
As far as upgrading, the process involves:
[list]
[]Upgrade Button in the module which points module admin to the new repo
[]Upgrade framework module which was probably the 2.9.0rc1.1 you saw
[*]Upgrade core module which was probably the 2.9.0rc1.2 you saw
[/list]
and of course after that upgrading everything else…
The process of upgrading the framework module runs through the critical migrations that are responsible for setting up your freepbx.conf file and moving all your settings to the freepbx_settings table. Clearly some of that worked, just not sure how you ended up with the empty freepbx.conf in /etc which is the first one that is looked at, where as /etc/asterisk is looked at if that doesn’t exist (which would be the case if we didn’t have write permission at the time of migration into /etc).
One thing we can say is that if the upgrade fails under these conditions the effects are dramatic but the displayed errors did not help much - you were the star Philippe
assuming your browser is running as user asterisk, then the /etc/freepbx.conf file may have already been there.
Since you upgraded through the browser, it would otherwise be impossible to have root/root ownership (unless that is how your browser is configured).
The only way that it could otherwise be root/root ownership is if your call to amportal (freepbx_engine) subsequently created that and didn’t get around to changing the ownership to asterisk/asterisk before the crash happened since amportal is run by root.
It remains a mystery. I would love to know what ultimately happened but given how isolated this is, I probably don’t have the time to dig deeper on your system with you and see what potential logs and other things might show (and it’s likely that the info just isn’t there )
I’m glad you are up, that part is good - I’ve got notes to re-visit some of our checks and see if we could do a better job then just checking for the existence of the freepbx.conf file before choosing that is the one to use, though it’s likely enough of a corner case that things will stay the way they are…
My guess is that somehow the PEAR DB went missing or corrupt. It’s happened to me for no explainable reason. The result is that amportal can’t connect to the database. My suggestion for others that stumble upon this:
After some googling around I found this topic that is almost similar to my problem, but in my case the /etc/freepbx.conf is not missing.
I have installed FreePBX on Debian Squeeze using the script from http://www.corenetworks.com.au/wiki/doku.php?id=debian_asterisk_freepbx_script. This worked great and gave me FreePBX v2.8.1. Then I upgraded to the latest v2.8 from the ‘Module Admin’ and installed some extra modules. After that I upgraded to v2.9.0.7 following the ‘2.9 Upgrade Tool’. It seemed to work, but after a reboot Asterisk is not running anymore. I can access the FreePBX web GUI.
The terminal on boot (I added some output):
...
Starting FreePBX ...
ASTRUNDIR=/var/run/asterisk
@freepbx_engine: ASTRUNDIR = --
/var/lib/asterisk/bin/freepbx_engine: line 102: [FATAL]: command not found
**** WARNING: ERROR IN CONFIGURATION ****
astrundir in '/etc/asterisk' is set to but the directory
does not exists. Attempting to create it with: 'mkdir -p '
mkdir: missing operand
Try `mkdir --help' for more information.
**** ERROR: COULD NOT CREATE ****
Attempt to execute 'mkdir -p ' failed with an exit code of 1
You must create this directory and the try again.
Starting MySQL database server: mysqld.
Checking for corrupt, not cleanly closed and upgrade needing tables..
Debian GNU/Linux 6.0 pbx ttyS0
pbx login:
When I open a SSH connection to the box and start the amportal manually (amportal start), asterisk starts and it looks like everything is OK again.
Could someone give me a hint what is wrong here? And how to solve this? I am new to FreePBX so please be gentle ;-).
I also tried
pear install DB
but this gave me
No releases available for package "pear.php.net/DB"
install failed
You’re close in your config, but your system is still missing some php/pear hooks to get to mysql and access the config in the table. I’m not familiar with the debian packaging or where the it’s pear release is published, but if you can get the install to succeed I’ll bet your system will be good to go.
Thanks for your response! I’m afraid you lose the bet ;-).
Found that PEAR DB can be installed with apt-get, but it was already there:
root@pbx:~# apt-get install php-db
Reading package lists... Done
Building dependency tree
Reading state information... Done
php-db is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
And in PEAR:
root@pbx:~# pear list
Installed packages, channel pear.php.net:
=========================================
Package Version State
Archive_Tar 1.3.7 stable
Console_Getopt 1.2.3 stable
DB 1.7.13 stable
PEAR 1.9.1 stable
Structures_Graph 1.0.3 stable
XML_Util 1.2.1 stable
Looking at the console output, I see that the MySQL server (mysqld) is started AFTER FreePBX tries to start. Could this cause the problem?