Summary: | net-mgmt/librenms: ./validate.php script cannot find python3 | ||
---|---|---|---|
Product: | Ports & Packages | Reporter: | Alexander Moisseev <moiseev> |
Component: | Individual Port(s) | Assignee: | Dan Langille <dvl> |
Status: | Closed FIXED | ||
Severity: | Affects Only Me | Flags: | bugzilla:
maintainer-feedback?
(dvl) |
Priority: | --- | ||
Version: | Latest | ||
Hardware: | Any | ||
OS: | Any |
Description
Alexander Moisseev
2020-07-25 07:52:23 UTC
I encountered the same error when updating to 1.65.1 The patch at https://svnweb.freebsd.org/ports/head/net-mgmt/librenms/files/patch-LibreNMS_Util_Version.php?revision=542675&view=markup#l7 tries to fix this: - $proc = new Process(['python3', '--version']); + $proc = new Process(['/usr/local/bin/python3', '--version']); That worked in my situation because I had lang/python3 installed. The symlink made that work for you. What is the best approach for detecting python? This works from the command line: [dan@besser:~] $ env python --version Python 3.7.8 However, changing that in the code still fails: $proc = new Process(['env python', '--version']); Any ideas anyone? (In reply to Dan Langille from comment #1) I believe "$ env python --version" works just because you have the `python` executable or symlink somewhere in the searchable path. It won't help to find `python3.7` without lang/python3. Probably lang/python3 is the only option, but we can't add it as a port dependency. At least its pkg-descr says so. (In reply to Alexander Moisseev from comment #2) I also tried 'env python3', which works from the command line: $ env python3 --version Python 3.7.8 But not in the code. A recent change allows lang/python3 to be added as a dependency, but it requires a configuration change and won't help in this situation: https://svnweb.freebsd.org/ports?view=revision&revision=542671 I have no idea how to invoke env in Python or is it possible, but it doesn't matter since `env pyhon3` won't help without lang/python3 anyway. Hopefully the issue doesn't break anything except config validation, so as the last resort we can recommend to install lang/python3 in the pkg-message. Just FYI, I've managed to get env working in the code like so: $proc = new Process(['env', 'python3', '--version']); but IMO $proc = new Process(['/usr/local/bin/python3', '--version']); is better since we generally don't want to execute python3 from non-default locations. (In reply to Alexander Moisseev from comment #4) FYI, the env is invoked in PHP (In reply to Alexander Moisseev from comment #5) re $proc = new Process(['/usr/local/bin/python3', '--version']); I'm OK with that. That's what the code has now, but it does require lang/python3 With that fix, at the end of the outpu, are you also seeing this? I am. sh: pip3: not found (In reply to Dan Langille from comment #7) Yes, I see this line too. I don't have pip installed. Fixing Now it works: $ sudo /usr/local/www/librenms/validate.php ==================================== Component | Version --------- | ------- LibreNMS | 1.65.1 DB Schema | 2020_06_23_00522_alter_availability_perc_column (170) PHP | 7.4.8 Python | 3.7.8 MySQL | 5.7.31 RRDTool | 1.7.2 SNMP | NET-SNMP 5.7.3 ==================================== [OK] Installed from package; no Composer required [OK] Database connection successful [OK] Database schema correct [WARN] fping FAILURES can be ignored if running LibreNMS in a jail without ::1. You may want to test it manually: fping ::1 [FAIL] /usr/local/sbin/fping could not be executed. /usr/local/sbin/fping must have CAP_NET_RAW capability (getcap) or suid. Selinux exclusions may be required. (This account is currently not available.) [WARN] fping FAILURES can be ignored if running LibreNMS in a jail without ::1. You may want to test it manually: fping ::1 [FAIL] /usr/local/sbin/fping6 could not be executed. /usr/local/sbin/fping6 must have CAP_NET_RAW capability (getcap) or suid. Selinux exclusions may be required. (This account is currently not available.) This is how I think validation needs to be run. The pwd is not relevant. [dan@besser:~] $ echo /usr/local/www/librenms/validate.php | sudo su -fm www ==================================== Component | Version --------- | ------- LibreNMS | 1.65.1 DB Schema | 2020_06_23_00522_alter_availability_perc_column (170) PHP | 7.4.8 Python | 3.7.8 MySQL | 5.7.31 RRDTool | 1.7.2 SNMP | NET-SNMP 5.7.3 ==================================== [OK] Installed from package; no Composer required [OK] Database connection successful [OK] Database schema correct [dan@besser:~] $ (In reply to Dan Langille from comment #11) I prefer passing command as an argument # su -m www -c /usr/local/www/librenms/validate.php For some reason, I found that didn't work in some cases. I use -fm because that's what I found in FreeBSD periodic scripts. A commit references this bug: Author: dvl Date: Sat Jul 25 19:15:50 UTC 2020 New revision: 543428 URL: https://svnweb.freebsd.org/changeset/ports/543428 Log: Add lang/pyton3 recommendation to pkg-message While here, patch pip3 warnings, which we don't use because we are a package and we don't do things like that. PR: 248255 Submitted by: Alexander Moisseev <moiseev@mezonplus.ru> Changes: head/net-mgmt/librenms/Makefile head/net-mgmt/librenms/files/patch-LibreNMS_Validations_Python.php head/net-mgmt/librenms/files/pkg-message.in (In reply to Alexander Moisseev from comment #12) Do you have time to try the recent commit? (In reply to Dan Langille from comment #15) It works, thank you! Thank you. MARKED AS SPAM |