Bug 260085 - net-mgmt/librenms
Summary: net-mgmt/librenms
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Many People
Assignee: Dan Langille
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-11-28 01:55 UTC by Darren Henderson
Modified: 2023-07-31 00:00 UTC (History)
2 users (show)

See Also:
bugzilla: maintainer-feedback? (dvl)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Darren Henderson 2021-11-28 01:55:43 UTC
service librenms start fails. /var/log/librenms/librenms-service.log showing

env: php: No such file or directory
MainThread(ERROR):ERROR: Could not load or parse configuration! /usr/bin/env php /usr/local/www/librenms/config_to_json.php 2>&1: 
'NoneType' object has no attribute 'get'

The crux of the problem is that daemon starts with a very restricted path (/sbin:/bin:/usr/sbin:/usr/bin) - this causes env to fail to find php when /usr/local/www/librenms/snmp-scan.py attempts to grab the .env file.

I'm not sure what the "right" fix is for this, the two quickest work arounds are to add a soft link from /usr/bin/php to /usr/local/bin/php or adjusting the path in /usr/local/etc/rc.d/librenms to include /usr/local/bin. Neither of which I'm crazy about.
Comment 1 Dan Langille freebsd_committer freebsd_triage 2021-11-28 13:06:47 UTC
Usually, this is patched by modifying the script in question with the full path to php. re SHEBANG_FILES

A new release is available, I'm sure - I may update the port with a new release and patch this file.

What version of librenms are you running? On what version of FreeBSD please?
Comment 2 Darren Henderson 2021-11-28 15:36:11 UTC
Apologies for neglecting to complete the summary before filing the report and for leaving out the relevant details.

I noted the issue on 13.0-RELEASE-p4. I installed librenms-21.5.1_3,1 via pkg which is tracking "latest". 

Other details in case they are helpful:

php74-7.4.25
mod_php74-7.4.25
python38-3.8.12_1
Comment 3 Francis GUDIN 2021-12-07 17:27:24 UTC
btw Dan: 21.10 would bring a useful improvement in my setting ("Infer character encoding for ifAlias and sysLocation"), so thank you very much in advance!
Comment 4 Dan Langille freebsd_committer freebsd_triage 2021-12-07 17:28:58 UTC
This may take a while. I am overwhelmed with non-FreeBSD items at present.  Sorry.
Comment 5 Dan Langille freebsd_committer freebsd_triage 2022-01-26 16:48:03 UTC
I am now aiming for 22.1.0
Comment 6 Dan Langille freebsd_committer freebsd_triage 2022-02-17 19:48:04 UTC
I have a working 22.5.0 here.  I need to amend pkg-message
Comment 7 Dan Langille freebsd_committer freebsd_triage 2022-02-18 15:21:43 UTC
(In reply to Dan Langille from comment #6)
That should be 22.2.1
Comment 8 commit-hook freebsd_committer freebsd_triage 2022-02-18 15:22:00 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=467e569d02e854b4e3abd762b796da449b57ff72

commit 467e569d02e854b4e3abd762b796da449b57ff72
Author:     Dan Langille <dvl@FreeBSD.org>
AuthorDate: 2022-02-18 15:19:22 +0000
Commit:     Dan Langille <dvl@FreeBSD.org>
CommitDate: 2022-02-18 15:21:02 +0000

    net-mgmt/librenms: Update to 22.2.1

    re: https://github.com/librenms/librenms/releases/tag/22.2.1

    This port update skips over several releases.
    See: https://github.com/librenms/librenms/releases

    See UPDATING for details on storage directory which needs to
    move to /var/db/librenms

    LiberNMS wants to write to the %%WWWDIR%%/storage directory. To comply
    with man 7 hier, this entry is now a symlink to /var/db/librenms/storage
    Please adjust your filesystem accordingly.

    The contrib directory has been removed from the upstream tarball. As such,
    the port now installs the log rotation file to
    /${PREFIX}/etc/newsyslog.conf.d/librenms.conf.sample

    PR:             260085 261031

 UPDATING                                         |   8 ++
 net-mgmt/librenms/Makefile                       |  45 +++++----
 net-mgmt/librenms/distinfo                       |  10 +-
 net-mgmt/librenms/files/patch-config.php.default |  12 +--
 net-mgmt/librenms/files/patch-poller-wrapper.py  |  17 ++--
 net-mgmt/librenms/files/pkg-message.in           | 116 +++++++++++++----------
 6 files changed, 122 insertions(+), 86 deletions(-)
Comment 9 Dan Langille freebsd_committer freebsd_triage 2022-02-18 15:23:30 UTC
Darren: if I didn't get everything you wanted into the port, please let me know. There was a bunch of changes associated with this update and I fear I may have overlooked something.

Thank you.
Comment 10 Darren Henderson 2023-07-16 19:41:52 UTC
I happened to be moving librenms to a new server today and found that the original issue in this bug is still present or has regressed. The wording is slightly different:

MainThread(CRITICAL):Error in config fetching process: 127
MainThread(CRITICAL):ERROR: Could not execute command [['/usr/bin/env', 'php', '/usr/local/www/librenms/config_to_json.php']]: Expecting value: line 1 column 1 (char 0)


So "service librenms start" kicks off the daemon command which starts python which runs librenms-service.py, which at some point tries to run config_to_json.php.

Unfortunately, config_to_json.php can't start because env can't find php on the PATH it's running with.

Same work arounds, "ln -s /usr/local/bin/php /usr/bin/php" to force php onto the daemon path or add "/usr/local/bin" to the PATH in /usr/local/etc/rc.d/librenms

This is now on

FreeBSD 13.2-RELEASE-p1
librenms-23.5.0,1
mod_php81-8.1.21 
php81-8.1.21
Comment 11 commit-hook freebsd_committer freebsd_triage 2023-07-30 23:56:26 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=917c4c6dd4bbda3ce239856697e3607e8cfb4381

commit 917c4c6dd4bbda3ce239856697e3607e8cfb4381
Author:     Dan Langille <dvl@FreeBSD.org>
AuthorDate: 2023-07-30 23:51:50 +0000
Commit:     Dan Langille <dvl@FreeBSD.org>
CommitDate: 2023-07-30 23:55:25 +0000

    net-mgmt/librenms: add many files to SHEBANG_FILES

    While here, run portfmt over the Makefile - that accounts for the
    majority of changes seen in the diff

    patch LibreNMS/wrapper.py which contains "/usr/bin/env php" mid-file

    PR:             260085

 net-mgmt/librenms/Makefile                         | 59 ++++++++++++++++------
 .../librenms/files/patch-LibreNMS_wrapper.py (new) | 11 ++++
 2 files changed, 55 insertions(+), 15 deletions(-)
Comment 12 commit-hook freebsd_committer freebsd_triage 2023-07-30 23:56:27 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=3e1bdb56d6eb37603f21d0c8a1b6be3a79a15569

commit 3e1bdb56d6eb37603f21d0c8a1b6be3a79a15569
Author:     Dan Langille <dvl@FreeBSD.org>
AuthorDate: 2023-07-30 20:49:32 +0000
Commit:     Dan Langille <dvl@FreeBSD.org>
CommitDate: 2023-07-30 23:55:25 +0000

    net/syncthing: Update to 1.23.6

    re: https://github.com/syncthing/syncthing/releases/tag/v1.23.6

    PR:             260085

 net/syncthing/Makefile | 2 +-
 net/syncthing/distinfo | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)
Comment 13 Dan Langille freebsd_committer freebsd_triage 2023-07-30 23:58:39 UTC
(In reply to commit-hook from comment #12)
Yeah, that PR reference should have been 272036