Librenms install problem with composer-wrapper on RHEL 8 and Alma Linux 8

Hi,

I want to check Librenms as an replacement for our very old OpenNMS system.
For my first steps i followed the install instructions from the online docu.

We use Alma Linux as an replacement for CentOS8 on dev and testing servers but as i came to the error point i switched to a native RHEL8 to make sure that Alma is not the problem.
This is the system:

[librenms@dbserv-intern ~]$ cat /etc/redhat-release
Red Hat Enterprise Linux release 8.5 (Ootpa)

I followed the steps in the docu step by step and failed at this point:

[librenms@dbserv-intern ~]$ ./scripts/composer_wrapper.php install --no-dev
-bash: ./scripts/composer_wrapper.php: /usr/bin/env: bad interpreter: Operation not permitted

First idea, execute rights but:

[librenms@dbserv-intern ~]$ ll /usr/bin/env
-rwxr-xr-x. 1 root root 42304 Jul 9 16:34 /usr/bin/env

Second try SELinux, so set “setenforce 0” to check and the same error appears.

If i start the script as root:

[root@dbserv-intern librenms]# ./scripts/composer_wrapper.php install --no-dev
Do not run Composer as root/super user! See How do I install untrusted packages safely? Is it safe to run Composer as superuser or root? - Composer for details

It will run but the message is right, i will not run it as root.
Additionally the package list in the docu is not complete because i get this error message if i run the script as root:

building 'psutil._psutil_linux' extension
creating build/temp.linux-x86_64-3.6
creating build/temp.linux-x86_64-3.6/psutil
gcc -pthread -Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fPIC -DPSUTIL_POSIX=1 -DPSUTIL_SIZEOF_PID_T=4 -DPSUTIL_VERSION=580 -DPSUTIL_LINUX=1 -DPSUTIL_ETHTOOL_MISSING_TYPES=1 -I/usr/include/python3.6m -c psutil/_psutil_common.c -o build/temp.linux-x86_64-3.6/psutil/_psutil_common.o
unable to execute 'gcc': No such file or directory
C compiler or Python headers are not installed on this system. Try to run:
sudo yum install gcc python3-devel
error: command 'gcc' failed with exit status 1

----------------------------------------

Command “/usr/bin/python3.6 -u -c “import setuptools, tokenize;file=‘/tmp/pip-build-t66ge6g6/psutil/setup.py’;f=getattr(tokenize, ‘open’, open)(file);code=f.read().replace(‘\r\n’, ‘\n’);f.close();exec(compile(code, file, ‘exec’))” install --record /tmp/pip-cwxezhsq-record/install-record.txt --single-version-externally-managed --compile --user --prefix=” failed with error code 1 in /tmp/pip-build-t66ge6g6/psutil/

The python36-devel package has to be installed to compile the packages …

Has someone seen this bad interpreter error and has a solution for this?

Thanks for your help

Silvio

What happens if you run /usr/bin/env php?
Else I’m still guessing selinux.

Regarding your other problem, LibreNMS is a PHP application more or less, the installation guide should ofc work, but it can’t oversee all possible missing dependencies for third party stuff, especially not for python libs.
You could just install python wheel and you don’t need to compile at all.
Send a pull request with docs changes!

Thanks for the reply.

The python “problem” is not critical it was only a point i have seen.

To your question:

[librenms@dbserv-intern ~]$ /usr/bin/env php

and then i only see a blinking cursor…

I now disabled SELinux completely and …

[root@dbserv-intern ~]# getenforce
Disabled
[root@dbserv-intern ~]# su - librenms
Letzte Anmeldung: Donnerstag, den 25. November 2021, 15:12:01 UTC auf pts/1
[librenms@dbserv-intern ~]$ LANG=C
[librenms@dbserv-intern ~]$ ./scripts/composer_wrapper.php install --no-dev
-bash: ./scripts/composer_wrapper.php: /usr/bin/env: bad interpreter: Operation not permitted

Silvio

/usr/bin/env php -v

you could just run it with php scripts/composer_wrapper.php install --no-dev else

Next try :slight_smile:

[librenms@dbserv-intern ~]$ /usr/bin/env php -v
PHP 7.3.20 (cli) (built: Jul 7 2020 07:53:49) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.20, Copyright (c) 1998-2018 Zend Technologies

So the interpreter is working and usable.

Only with the php part in front i get:

[librenms@dbserv-intern ~]$ php scripts/composer_wrapper.php install --no-dev
Error: Corrupted download, signature doesn’t match for https://getcomposer.org/installer
Composer not available, please manually install composer.

the same with else:

[librenms@dbserv-intern ~]$ php scripts/composer_wrapper.php install --no-dev else
Error: Corrupted download, signature doesn’t match for https://getcomposer.org/installer
Composer not available, please manually install composer.

But it looks like a little step in the right direction

Silvio

Does your system require a proxy maybe?

Just copy paste these commands in the librems folder: Composer
Then again run php scripts/composer_wrapper.php install --no-dev

No the system is direct behind a firewall system and we need no proxy for network access.
I used the script from the composer side and as librenms user i get an error in the second step.

As root i can install composer and after that i changed the owner.

If i now run the composer_wrapper i get a “can not open stream” message.

[librenms@dbserv-intern ~]$ php scripts/composer_wrapper.php install --no-dev
Could not scan for classes inside “vendor/dapphp/radius” which does not appear to be a file nor a folder

[ErrorException]
include(/opt/librenms/LibreNMS/ComposerHelper.php): failed to open stream: Operation not permitted

My next step is a reinstall of the server with:
Step 1 minimum security settings
if this is working
Step 2 … reinstall with more and more security settings until i know that happens here.

Thanks for your help
I will send updates if in know more

Silvio

Hi @Jellyfrog,

after a complete reinstall with a lower security rule (Level 1 Server) it was possible to install all packages.

The settings for all the stuff around weren’t a problem but I’m a little confused by the final install step.

My first connect to the installer ended with a 403 error because the server could not read the .htaccess file:

(13)Permission denied: [client xx:48976] AH00529: /opt/librenms/html/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that ‘/opt/librenms/html/’ is executable

I checked the file and it was set to librenms:librenms with 640. The dir had a 750 set.
Now my thinking was that the webser is running under the apache account and with these settings he can not access the dir and read the file. So i change the dir to 755 and the file to 644 and now the installer starts.
The side looks a “little bit” strange to me and so i looked in the error log again and:

(13)Permission denied: [client xx:48978] AH00529: /opt/librenms/html/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that ‘/opt/librenms/html/’ is executable
(13)Permission denied: [client xx:48992] AH00529: /opt/librenms/html/js/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable and that ‘/opt/librenms/html/js/’ is executable,

and so on.
At the end i changed the complete librenms dir to librenms:apache and everything is working.

Now in the verification step i can see the message:

Fail: We have found some files that are owned by a different user than ‘librenms’, this will stop you updating automatically and / or rrd files being updated causing graphs to fail.

So I’m a little bit confused about the right setting. With the apache group i this error message, with the librenms group set i get a lot of “permission denied message” and the system is not usable as you can see in the screenshot.

Any ideas or solutions for this?

Best

Silvio

Try browsing the CSS file and see what it says. Apart from that no, haven’t touched apache in a long time.
The install instructions with nginx works, that much I know.

Thanks for the answer,

the problem is not the css it is that apache can not read the imagefiles and files in the js folder.
So i think i have to deal with the rights.

Thanks

Silvio

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.