Fpbx 14 to 15 upgrade failed

Hi,

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:

[[email protected] ~]# 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.

Any ideas?

Run

ls /var/www/html/admin/libraries/Composer/vendor/nikic

What was that?

What?

I didn’t see the edit at first. So it looked weird.

[[email protected] ~]# 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

[[email protected] freepbx]# ls -l /usr/src/freepbx
lrwxrwxrwx. 1 root root 25 Nov  2  2016 /usr/src/freepbx -> /usr/src/freepbx-13.0.151

Sorry I meant

/var/www/html/admin/libraries/Composer/vendor/nikic

[[email protected] ~]# ls /var/www/html/admin/libraries/Composer/vendor/nikic
php-parser
cd /var/www/html/admin/libraries/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');"
composer.phar install
[[email protected] ~]# cd /var/www/html/admin/libraries/Composer
[[email protected] 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');"[[email protected] Composer]# php -r "if (hash_file('sha384', 'composer-setup.php') === '48e3236262b34d30969dca3c37281b3b4bbe3221bda826ac6a9a62d6444cdb0dcd0615698a5cbe58erified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
Installer verified
[[email protected] 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

[[email protected] Composer]# php -r "unlink('composer-setup.php');"
[[email protected] Composer]# ls
composer.json  composer.lock  composer.phar  vendor
[[email protected] Composer]# comp
compare    compgen    complete   compopt    composite
[[email protected] 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:

[[email protected] 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

Thanks for your time Andrew

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.

Weird, I was using it as a demo pbx for customers. It was fully functioning up until I ran the Updater module.

I can restore the VM and try again, but now I am a bit leery of that module.

Thanks for trying

Hi,

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.

I just went through it on another machine and it worked fine.

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:

'cp -rf' from src: '/var/www/html/admin/modules/framework/amp_conf/htdocs/*' to dst: '/var/www/html'...details follow
cp: cannot remove ‘/var/www/html/admin/libraries/Composer/vendor/mtdowling/cron-expression/composer.json’: Permission denied
cp: cannot remove ‘/var/www/html/admin/libraries/Composer/vendor/mtdowling/cron-expression/src/Cron/DayOfWeekField.php’: Permission denied
cp: cannot remove ‘/var/www/html/admin/libraries/Composer/vendor/mtdowling/cron-expression/src/Cron/AbstractField.php’: Permission denied
cp: cannot remove ‘/var/www/html/admin/libraries/Composer/vendor/mtdowling/cron-expression/src/Cron/YearField.php’: Permission denied
cp: cannot remove ‘/var/www/html/admin/libraries/Composer/vendor/mtdowling/cron-expression/src/Cron/MinutesField.php’: Permission denied
cp: cannot remove ‘/var/www/html/admin/libraries/Composer/vendor/mtdowling/cron-expression/src/Cron/FieldInterface.php’: Permission denied
cp: cannot remove ‘/var/www/html/admin/libraries/Composer/vendor/mtdowling/cron-expression/src/Cron/DayOfMonthField.php’: Permission denied
cp: cannot remove ‘/var/www/html/admin/libraries/Composer/vendor/mtdowling/cron-expression/src/Cron/FieldFactory.php’: Permission denied
cp: cannot remove ‘/var/www/html/admin/libraries/Composer/vendor/mtdowling/cron-expression/src/Cron/HoursField.php’: Permission denied
cp: cannot remove ‘/var/www/html/admin/libraries/Composer/vendor/mtdowling/cron-expression/src/Cron/MonthField.php’: Permission denied
cp: cannot remove ‘/var/www/html/admin/libraries/Composer/vendor/mtdowling/cron-expression/src/Cron/CronExpression.php’: Permission denied
cp: cannot remove ‘/var/www/html/admin/libraries/Composer/vendor/mtdowling/cron-expression/README.md’: Permission denied
cp: cannot remove ‘/var/www/html/admin/libraries/Composer/vendor/mtdowling/cron-expression/.editorconfig’: Permission denied
cp: cannot remove ‘/var/www/html/admin/libraries/Composer/vendor/mtdowling/cron-expression/tests/Cron/DayOfWeekFieldTest.php’: Permission denied
cp: cannot remove ‘/var/www/html/admin/libraries/Composer/vendor/mtdowling/cron-expression/tests/Cron/FieldFactoryTest.php’: Permission denied
cp: cannot remove ‘/var/www/html/admin/libraries/Composer/vendor/mtdowling/cron-expression/tests/Cron/AbstractFieldTest.php’: Permission denied
cp: cannot remove ‘/var/www/html/admin/libraries/Composer/vendor/mtdowling/cron-expression/tests/Cron/MinutesFieldTest.php’: Permission denied
cp: cannot remove ‘/var/www/html/admin/libraries/Composer/vendor/mtdowling/cron-expression/tests/Cron/DayOfMonthFieldTest.php’: Permission denied
cp: cannot remove ‘/var/www/html/admin/libraries/Composer/vendor/mtdowling/cron-expression/tests/Cron/YearFieldTest.php’: Permission denied
cp: cannot remove ‘/var/www/html/admin/libraries/Composer/vendor/mtdowling/cron-expression/tests/Cron/CronExpressionTest.php’: Permission denied
cp: cannot remove ‘/var/www/html/admin/libraries/Composer/vendor/mtdowling/cron-expression/tests/Cron/HoursFieldTest.php’: Permission denied
cp: cannot remove ‘/var/www/html/admin/libraries/Composer/vendor/mtdowling/cron-expression/tests/Cron/MonthFieldTest.php’: Permission denied
cp: cannot remove ‘/var/www/html/admin/libraries/Composer/vendor/mtdowling/cron-expression/CHANGELOG.md’: Permission denied
cp: cannot remove ‘/var/www/html/admin/libraries/Composer/vendor/mtdowling/cron-expression/LICENSE’: Permission denied
cp: cannot create directory ‘/var/www/html/admin/libraries/Composer/vendor/nikic/fast-route’: Permission denied

Looking at the directories on my system its because they are owned by root.

bash-4.2$ ls -l /var/www/html/admin/libraries/Composer/vendor/mtdowling/cron-expression
total 16
-rw-r--r-- 1 root root 1070 May 16 09:31 CHANGELOG.md
-rw-r--r-- 1 root root  695 May 16 09:31 composer.json
-rw-r--r-- 1 root root 1098 May 16 09:31 LICENSE
-rw-r--r-- 1 root root 2664 May 16 09:31 README.md
drwxr-xr-x 3 root root   17 May 16 09:31 src
drwxr-xr-x 3 root root   17 May 16 09:31 tests

Running fwconsole chown as root right before the upgrade solves this issue.

versionupgrade version 14.0.3 will now check for root owned files and stop the upgrade if it finds any

3 Likes

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.

yes you are right,

I tried it again but firstly i did fwconsole chown to fix permissions and the run the upgrader and it worked

Thanks

1 Like