Unable to access WebUI - composer_wrapper.php install --no-dev fails - Invalid repository data

In an effort to minimize thread crap, and keep unique issues in unique threads, I present to you another issue with the WebUI dropping after an update.

In our case, we have the following output when trying to run composer_wrapper.php

[Composer\Repository\InvalidRepositoryException]                                                                                                                                                                    
Invalid repository data in /opt/librenms/vendor/composer/installed.json, packages could not be loaded: [Seld\JsonLint\ParsingException] "/opt/librenms/vendor/composer/installed.json" does not contain valid JSON  
Parse error on line 1:                                                                                                                                                                                              
                                                                                                                                                                                                                  
^                                                                                                                                                                                                                   
Expected one of: 'STRING', 'NUMBER', 'NULL', 'TRUE', 'FALSE', '{', '['                                                                                                                                              
                                                                                                                                                                                                                
[Composer\Repository\InvalidRepositoryException]                                                                                                                                                                    
Invalid repository data in /opt/librenms/vendor/composer/installed.json, packages could not be loaded: [Seld\JsonLint\ParsingException] "/opt/librenms/vendor/composer/installed.json" does not contain valid JSON  
Parse error on line 1:                                                                                                                                                                                              
                                                                                                                                                                                                                  
^                                                                                                                                                                                                                   
Expected one of: 'STRING', 'NUMBER', 'NULL', 'TRUE', 'FALSE', '{', '['

Hi,
first try to install (again) required packages from https://docs.librenms.org/#Installation/Installation-Ubuntu-1604-Nginx/
then run ./scripts/composer_wrapper.php install --no-dev

P.S.
my steps:
584 apt install composer fping git graphviz imagemagick mariadb-client mariadb-server mtr-tiny nginx-full nmap php7.0-cli php7.0-curl php7.0-fpm php7.0-gd php7.0-mbstring php7.0-mcrypt php7.0-mysql php7.0-snmp php7.0-xml php7.0-zip python-memcache python-mysqldb rrdtool snmp snmpd whois
585 ./scripts/composer_wrapper.php install --no-dev
586 chown -R librenms:librenms /opt/librenms

Did you have the same issue? Re-installing everything seems to be akin to using a pile driver when all I need is a pin hammer, especially when 1) everything had been installed from the initial deployment and 2) something specific to the last update broke it.

Any more elegant approach that should be taken?

Hi,
it’s not full reinstall, in my case only needed packages be installed. Please check/compare required packages.

Hi,

all dependencies are installed from this:
https://docs.librenms.org/#Installation/Installation-Ubuntu-1604-Apache/
WebUI still dont work.

Hi,
after dependencies installation try to run /opt/librenms/scripts/composer_wrapper.php install --no-dev

Try “php artisan key:generate” and add the generate key into the “.env” file as the “APP_KEY”.

If that doesn’t work, repeat with “php artisan key:generate --force”

/opt/librenms/scripts/composer_wrapper.php install --no-dev

LibreNMS\ComposerHelper::preInstall
Loading composer repositories with package information
Installing dependencies from lock file
Nothing to install or update
Generating autoload files
LibreNMS\ComposerHelper::postInstall
Illuminate\Foundation\ComposerScripts::postInstall
php artisan optimize
PHP Notice: date_default_timezone_set(): Timezone ID ‘’ is invalid in /opt/librenms/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/LoadConfiguration.php on line 49
Generating optimized class loader
The compiled services file has been removed.

So I ended up with…

The following additional packages will be installed:
  libsnmp30 mariadb-client-10.0 mariadb-client-core-10.0 mariadb-common mariadb-server-10.0 mariadb-server-core-10.0 php7.0-common php7.0-json php7.0-opcache php7.0-readline snmptrapd
Suggested packages:
  mailx mariadb-test tinyca
The following NEW packages will be installed
  php7.0-mbstring
The following packages will be upgraded:
  libsnmp30 mariadb-client mariadb-client-10.0 mariadb-client-core-10.0 mariadb-common mariadb-server mariadb-server-10.0 mariadb-server-core-10.0 php7.0-cli php7.0-common php7.0-curl php7.0-fpm php7.0-gd php7.0-json php7.0-mcrypt
  php7.0-mysql php7.0-opcache php7.0-readline php7.0-snmp php7.0-xml php7.0-zip snmp snmpd snmptrapd

…and re-ran the script with the same result.

Also, FWIW, after the above…

====================================
Component | Version
--------- | -------
LibreNMS  | 1.39-31-g0020479
DB Schema | ?
PHP       | 7.0.28-0ubuntu0.16.04.1
MySQL     | ?
RRDTool   | 1.5.5
SNMP      | NET-SNMP 5.7.3
====================================

[FAIL]  No composer available, please install composer
        [FIX] https://getcomposer.org/

Fortunately I took a snapshot prior to installing/upgrading the other packages referenced here. I’ll more than likely revert. But in either case, needless to say it’s still an issue.

@CDawson1 You could try removing the vendor folder completely and running composer_wrapper.php install --no-dev again.

Note this will completely break your LibreNMS install between when you delete it and when composer completes so, you may lose polled data.

Before we go off the rails here…

One additional piece to note, in this instance, said json file is empty. I’ve seen other references to that, but not necessarily specific to Libre.

As for the suggestion of whacking the /vendor directory, what is the thought behind that? Given the error, could the file be (re)moved? I appreciate it might cascade to other issues, hence the suggestion, and I’m all for the suggestions, but I’d like to understand the reasoning behind them.
:+1:

More importantly, what happened/changed in this latest update that seems to have caused all these issues for a few folks.

Ran this command “./composer_wrapper.php install --no-dev” and got this below. My instance has been running fine until today.

Problem 1
- Installation request for erusev/parsedown 1.7.1 -> satisfiable by erusev/parsedown[1.7.1].
- erusev/parsedown 1.7.1 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
Problem 2
- Installation request for laravel/framework v5.4.36 -> satisfiable by laravel/framework[v5.4.36].
- laravel/framework v5.4.36 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
Problem 3
- laravel/framework v5.4.36 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- oriceon/toastr-5-laravel dev-master requires illuminate/session >=5.0.0 -> satisfiable by laravel/framework[v5.4.36].
- Installation request for oriceon/toastr-5-laravel dev-master -> satisfiable by oriceon/toastr-5-laravel[dev-master].

To enable extensions, verify that they are enabled in your .ini files:

Can you please refrain from posting in this thread as it’s OT from the original subject.

This thread has a similar issue as you posted.

Ok. So instead of removing all under /vendor… I moved the installed.json file and then re-ran the composer_wrapper script and was met with similar results as mentioned above…

LibreNMS\ComposerHelper::preInstall
Loading composer repositories with package information
Installing dependencies from lock file
Your requirements could not be resolved to an installable set of packages.

Problem 1
- Installation request for erusev/parsedown 1.7.1 -> satisfiable by erusev/parsedown[1.7.1].

…etc…

Ran apt install php-mbstring…

The following packages were automatically installed and are no longer required:
  linux-headers-4.4.0-87 linux-headers-4.4.0-87-generic linux-image-4.4.0-87-generic linux-image-extra-4.4.0-87-generic
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  php7.0-cli php7.0-common php7.0-curl php7.0-fpm php7.0-gd php7.0-json php7.0-mbstring php7.0-mcrypt php7.0-mysql php7.0-opcache php7.0-readline php7.0-snmp php7.0-xml php7.0-zip
The following NEW packages will be installed
  php-mbstring php7.0-mbstring
The following packages will be upgraded:
  php7.0-cli php7.0-common php7.0-curl php7.0-fpm php7.0-gd php7.0-json php7.0-mcrypt php7.0-mysql php7.0-opcache php7.0-readline php7.0-snmp php7.0-xml php7.0-zip
13 to upgrade, 2 to newly install, 0 to remove and 153 not to upgrade.

…etc…

Re-ran the composer_wrapper script once more…

LibreNMS\ComposerHelper::preInstall
Loading composer repositories with package information
Installing dependencies from lock file
Package operations: 59 installs, 0 updates, 0 removals
  - Installing amenadiel/jpgraph (3.6.14): Downloading (100%)         
  - Installing dapphp/radius (2.5.2): Downloading (100%)         
  - Installing doctrine/inflector (v1.1.0): Downloading (100%)         
  - Installing doctrine/instantiator (1.0.5): Downloading (100%)         
...
Generating autoload files
> LibreNMS\ComposerHelper::postInstall
Application key [base64:FnnK71DYRzwUsK6lvSCSTVXhGVvpC5tNsitm0kTkVKs=] set successfully.
> Illuminate\Foundation\ComposerScripts::postInstall
> php artisan optimize
Generating optimized class loader
The compiled services file has been removed.

…then restarted php and all became well once again.

So…why?! What happened to the update that caused the json file to be empty to begin with? And why are the dependencies not apparently updating?

1 Like

I need help, my Web UI is sill broken.

I’m getting this message.

I’ve already run php artisan key:generate --force as sugested above, but I got an error related to mysqli.

erro

What should I do? Librenms is important to our flow of work.

I am getting something similar. Error log is complaining about ciphers. But I am using HTTP.

I was able to solve my error.

The password in the .env file was set wrong. My password has an $ in some part, everything after this character was not there, everything before was there.

Correcting the password worked.

Merged a fix for the issue @leandrojmp had.

I am getting this error.

[Composer\Repository\InvalidRepositoryException]
Invalid repository data in /opt/librenms/vendor/composer/installed.json, pa
ckages could not be loaded: [Seld\JsonLint\ParsingException] “/opt/librenms
/vendor/composer/installed.json” does not contain valid JSON
Parse error on line 1:
[$\\\▒▒6{▒\▒
^
Expected one of: ‘STRING’, ‘NUMBER’, ‘NULL’, ‘TRUE’, ‘FALSE’, ‘{’, ‘[’

Also If I run

php artisan key:generate --force

It just tells me to run ./scripts/composer_wrapper.php install --no-dev and I get the same error as above.