Strange Catch 22 when running ./validate.php

From the command line if I run ./validate.php I will get an error at the end stating I need to run as root, however, if I run as root, I get an error stating do not run as root. Anyone else seeing this?
See below:

asg@librenms:/opt/librenms$ sudo ./daily.sh
[sudo] password for asg:
Re-running /opt/librenms/daily.sh as librenms user
Fetching new release information OK
Between releases, waiting for newer release
Updating Composer packages OK
Updated from unset to OK
Updating SQL-Schema OK
Updating submodules OK
Cleaning up DB OK
Fetching notifications OK
Caching PeeringDB data OK
Caching Mac OUI data OK

asg@librenms:/opt/librenms$ ./validate.php

Component Version
LibreNMS 23.2.0-44-g0a889ad36 (2023-03-23T21:29:53-04:00)
DB Schema 2023_03_14_130653_migrate_empty_user_funcs_to_null (249)
PHP 8.1.7-1ubuntu3.3
Python 3.10.7
Database MariaDB 10.6.12-MariaDB-0ubuntu0.22.10.1
RRDTool 1.7.2
SNMP 5.9.3
===========================================

[OK] Composer Version: 2.5.5
[OK] Dependencies up-to-date.
[OK] Database connection successful
[OK] Database Schema is current
[OK] SQL Server meets minimum requirements
[OK] lower_case_table_names is enabled
[OK] MySQL engine is optimal
[OK] Database and column collations are correct
[OK] Database schema correct
[OK] MySQl and PHP time match
[OK] Active pollers found
[OK] Dispatcher Service not detected
[OK] Locks are functional
[OK] Python poller wrapper is polling
[OK] Redis is unavailable
[OK] rrd_dir is writable
[OK] rrdtool version ok
[FAIL] You need to run this script as ‘librenms’ or root

asg@librenms:/opt/librenms$ sudo ./validate.php
[sudo] password for asg:
Do not run validate.php as root
asg@librenms:/opt/librenms$

What about: sudo su - librenms then try validate?

2 Likes

That worked !!! Thank you !!!
Still puzzled. Maybe the error should have been worded differently? Was confusing to me :slight_smile:

Thanks again for the guidance and help.

Not sure about what was causing the initial error saying “run as root” But I’ve always found switching user to librenms (as @rhinoau stated) is needed before running any of the cli commands.

[FAIL] You need to run this script as ‘librenms’ or root

I would guess your normal user didn’t have the rights for this check to run and it told you who would have them.

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