Can't use FreePBX anymore

I’m getting tired of it, the constant issues i’m experiencing with FreePBX, i hope this can be resolved without a reset, this is what the error is when opening my pbx, i’ve tried rebooting, and fwconsole doesnt work.

Stack Trace:
BX\modules\Pm2->getHomeDir() /var/www/html/admin/modules/pm2/Pm2.class.php:22
4. FreePBX\modules\Pm2->__construct() /var/www/html/admin/libraries/BMO/Self_Helper.class.php:126
5. FreePBX\Self_Helper->autoLoad() /var/www/html/admin/libraries/BMO/Self_Helper.class.php:39
6. FreePBX\Self_Helper->__get() /var/www/html/admin/modules/vqplus/Vqplus.class.php:23
7. FreePBX\modules\Vqplus->__construct() /var/www/html/admin/libraries/BMO/Self_Helper.class.php:126
8. FreePBX\Self_Helper->autoLoad() /var/www/html/admin/libraries/BMO/Self_Helper.class.php:39
9. FreePBX\Self_Helper->__get() /var/www/html/admin/libraries/BMO/FreePBX.class.php:127
10. FreePBX->__callStatic() /var/www/html/admin/modules/vqplus/functions.inc.php:6
11. require_once() /var/www/html/admin/bootstrap.php:353
12. require_once() /etc/freepbx.conf:12
13. include_once() /var/lib/asterisk/bin/fwconsole:12
root@voltpbx-v2:~# ^C

What was the last thing you did? An update? FreePBX version?

Nothing, it died today at around 12AM (amsterdam timezone)

FreePBX Version is 17 to the latest updates as far as i know, or maybe the automatic updates did something? I can’t see the full version since i can’t get in

@kgupta your help is needed! :wink:

I am just a regular user…of freePBX15&16 machines. Do you know how to access freePBX through SSH? A restart and a “fwconsole ma updateall” won’t hurt.

I’ve tried to use fwconsole via ssh and restart it, but it keeps spitting out the error even after a good ol’ restart

This is incomplete! It is missing frames one and two and only has part of the information for frame three (“BX” is part of “FreePBX”!). In particular, it doesn’t include the exception that has been triggered by the failure.

What the code is doing here is read the user name from the configuration, then look up the home directory, using the standard utilities for that, and validate that it is a directory, applying various fallbacks if it isn’t.

I think the exception is deep enough that it has to be in the configuration file lookup, or the the standard get home directory from account name function, but the missing information leaves too many options to consider.

By configuration here, I believe I mean the first level of configuration, which tells it basic things about the system as a whole, rather than the detailed configuration. My guess is that is in a file, or environment variables, not in a database.

This is what the SSH tells, im guessing this happened after a update, this is all i got from SSH, however i can go on the site and send the Whoop error from there

Most terminal programs allow you to scroll backward to text that has disappeared from the screen. You can also use the Unix/Linux “script” utility to capture the terminal session at the remote end.

Stack trace:

  1. Whoops\Exception\ErrorException->() /var/www/html/admin/modules/pm2/Pm2.class.php:364
  2. PhpConsole\Handler->handleError() /var/www/html/admin/modules/pm2/Pm2.class.php:364
  3. FreePBX\modules\Pm2->getHomeDir() /var/www/html/admin/modules/pm2/Pm2.class.php:22
  4. FreePBX\modules\Pm2->__construct() /var/www/html/admin/libraries/BMO/Self_Helper.class.php:126
  5. FreePBX\Self_Helper->autoLoad() /var/www/html/admin/libraries/BMO/Self_Helper.class.php:39
  6. FreePBX\Self_Helper->__get() /var/www/html/admin/modules/vqplus/Vqplus.class.php:23
  7. FreePBX\modules\Vqplus->__construct() /var/www/html/admin/libraries/BMO/Self_Helper.class.php:126
  8. FreePBX\Self_Helper->autoLoad() /var/www/html/admin/libraries/BMO/Self_Helper.class.php:39
  9. FreePBX\Self_Helper->__get() /var/www/html/admin/libraries/BMO/FreePBX.class.php:127
  10. FreePBX->__callStatic() /var/www/html/admin/modules/vqplus/functions.inc.php:6
  11. require_once() /var/www/html/admin/bootstrap.php:353
  12. require_once() /etc/freepbx.conf:12
  13. include_once() /var/lib/asterisk/bin/fwconsole:12

If you are using the initial FreePBX 17 version of the file, it is on this line

which makes me think that either the Asterisk Web User doesn’t exist as a Linux user (not in /etc/passwd), or AMPASTERISKWEBUSER is wrongly set in the basic configuration.

Is there not a message saying the nature of the exception?

If it is not that exact version, you will need to tell me what is on line 364, in /var/www/html/admin/modules/pm2/Pm2.class.php on your system.

it’s on that line indeed ( $home = trim($web[‘dir’]); )

i haven’t deleted a user; im guessing it was a automatic update that did something

1 Like

You should check /etc/amportal.conf to make sure that AMPASTERISKWEBUSER is correct (I believe it should be “asterisk”), and if it is present, you should check in /etc/passwd, to see if that user exists there.

At least one possibility is that you have been using a non-standard user name, possibly for security, and and the update has reverted the configuration to the standard name.

Also check that the home directory field is set for that user, in /etc/passwd.

1 Like

Looks fine, in passwd it has asterisk and the home directory is /home/asterisk:/bin/bash. it’s also in amportal.conf

Does /home/asterisk exist?

Yes, but it’s empty

Are you sure that the folder /home/asterisk is empty…or are the files/folders hidden?

Nevermind, however for me only these folders/file are there:

.pm2
.npm
/gnupg
.odbc.ini
.npmrc

Should i be worried?

If the source code line is the one that I highlighted in the 17.0 release version, the code hasn’t reached the point of even accessing the meta data for the directory, so the contents of the directory aren’t really relevant.

The code does: read the Asterisk web user from the FreePBX configuration file;
Read the /etc/passwd information for that user.
Trim leading and trailing space from that user.
The next step would be to test that it was actually a directory, but the OP says that his version of the source code file matches the one I referenced, in which case it hasn’t reached that line.

I think I’d expect a warning if the /etc/passwd file line wasn’t there, or didn’t have a directory, but, as far as I can tell from the documentation, I wouldn’t expect an error to be thrown.

I’m surprised that the OP hasn’t reported an error message, before the stack trace. I would expect a line like the first line in the second text box, in https://stackoverflow.com/questions/17555920/php-fatal-error-uncaught-exception-exception but with content relevant to the specific error in the FreePBX script.

what’s about fwconsole ma downloadinstall pm2 ?