I wanted to test the upgrade module on my test box. Installed the updater and it passed all the prereqs.
Started the upgrade and let it run. I came back to it saying i needed to drop to command line and run “fwconsole ma updateall”
When I try running any fwconsole command, i get this:
[root@demo ~]# fwconsole ma list
PHP Warning: require(/var/www/html/admin/libraries/Composer/vendor/composer/../nikic/fast-route/src/functions.php): failed to open stream: No such file or directory in /var/www/html/admin/libraries/Composer/vendor/composer/autoload_real.php on line 66
PHP Fatal error: require(): Failed opening required '/var/www/html/admin/libraries/Composer/vendor/composer/../nikic/fast-route/src/functions.php' (include_path='.:/usr/share/pear:/usr/share/php') in /var/www/html/admin/libraries/Composer/vendor/composer/autoload_real.php on line 66
I’ve tried updating all packages via yum (everything is up to date now), rebooting, etc. GUI is hosed, asterisk doesnt start, fwconsole is unusable.
[root@demo ~]# ls /usr/src/freepbx/framework/amp_conf/htdocs/admin/libraries/Composer/vendor/nikic
ls: cannot access /usr/src/freepbx/framework/amp_conf/htdocs/admin/libraries/Composer/vendor/nikic: No such file or directory
no directories exist beyond /usr/src/freepbx
[root@demo freepbx]# ls -l /usr/src/freepbx
lrwxrwxrwx. 1 root root 25 Nov 2 2016 /usr/src/freepbx -> /usr/src/freepbx-13.0.151
[root@demo ~]# cd /var/www/html/admin/libraries/Composer
[root@demo Composer]# php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('sha384', 'composer-setup.php') === '48e3236262b34d30969dca3c37281b3b4bbe3221bda826ac6a9a62d6444cdb0dcd0615698a5cbe587c3f0fe57a54d8f5') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"[root@demo Composer]# php -r "if (hash_file('sha384', 'composer-setup.php') === '48e3236262b34d30969dca3c37281b3b4bbe3221bda826ac6a9a62d6444cdb0dcd0615698a5cbe58erified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
Installer verified
[root@demo Composer]# php composer-setup.php
All settings correct for using Composer
Downloading...
Composer (version 1.8.5) successfully installed to: /var/www/html/admin/libraries/Composer/composer.phar
Use it: php composer.phar
[root@demo Composer]# php -r "unlink('composer-setup.php');"
[root@demo Composer]# ls
composer.json composer.lock composer.phar vendor
[root@demo Composer]# comp
compare compgen complete compopt composite
[root@demo Composer]# ./composer.phar install
Do not run Composer as root/super user! See https://getcomposer.org/root for details
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Package operations: 1 install, 0 updates, 0 removals
- Installing nikic/fast-route (v1.3.0): Downloading (100%)
Generating optimized autoload files
It then spit out a bunch of yellow text several hundred lines long, i then tried:
[root@demo Composer]# fwconsole ma list
PHP Fatal error: Call to undefined method FreePBX\Console\Application\FWApplication::setCommandLoader() in /var/lib/asterisk/bin/fwconsole on line 162
Whoops\Exception\ErrorException: Call to undefined method FreePBX\Console\Application\FWApplication::setCommandLoader() in file /var/lib/asterisk/bin/fwconsole on line 162
Stack trace:
1. Whoops\Exception\ErrorException->() /var/lib/asterisk/bin/fwconsole:162
Something is still wonky, tried restarting apache, but it didnt help
Your install is hosed. During installation/upgrades it simply extracts a tarball. in your case this extraction failed. I dont know why but it seems related to your system. Hundreds of files are missing.
I am getting the exact error Last login: Thu May 16 14:19:13 2019 PHP Warning: require(/var/www/html/admin/libraries/Composer/vendor/composer/../nikic/fast-route/src/functions.php): failed to open stream: No such file or directory in /var/www/html/admin/libraries/Composer/vendor/composer/autoload_real.php on line 66 PHP Fatal error: require(): Failed opening required '/var/www/html/admin/libraries/Composer/vendor/composer/../nikic/fast-route/src/functions.php' (include_path='.:/usr/share/pear:/usr/share/php') in /var/www/html/admin/libraries/Composer/vendor/composer/autoload_real.php on line 66 PHP Warning: require(/var/www/html/admin/libraries/Composer/vendor/composer/../nikic/fast-route/src/functions.php): failed to open stream: No such file or directory in /var/www/html/admin/libraries/Composer/vendor/composer/autoload_real.php on line 66 PHP Fatal error: require(): Failed opening required '/var/www/html/admin/libraries/Composer/vendor/composer/../nikic/fast-route/src/functions.php' (include_path='.:/usr/share/pear:/usr/share/php') in /var/www/html/admin/libraries/Composer/vendor/composer/autoload_real.php on line 66
Maybe something is wrong with the upgrade process.
Ok I got it to happen and I see the error. You most likely upgraded from the CLI right before you ran version upgrader. This ends up making directories owned by root. When the version upgrader runs it does everything as the asterisk user. Thus you are presented with errors like this:
TY sir, I ended up wiping the vm that originally had that issue, do you still think it was something wrong with my install or did the fact that these permissions were set wrong due to a fwconsole update contribute to my original problem?
There’s your answer. The CLI process didn’t DTRT when it came to permissions, and there wasn’t a manual “fwconsole chown” at the end of the process to make it right. The new script fixes that, so you’re fine.
No this wasn’t a user error at all. The upgrader broke your system but it also wasn’t directly releated to the upgrader. Apache (the http server) can read and execute and process files all day long that are not owned by Asterisk its just when you go to modify them that everything blows up.