Bug 198569 - split install breaks ss_host_disk.php script
split install breaks ss_host_disk.php script
Status: CLOSED NEXTRELEASE
Product: Fedora
Classification: Fedora
Component: cacti (Show other bugs)
5
All Linux
medium Severity medium
: ---
: ---
Assigned To: Mike McGrath
Fedora Extras Quality Assurance
:
Depends On:
Blocks: FE7Target
  Show dependency treegraph
 
Reported: 2006-07-11 18:50 EDT by Orion Poplawski
Modified: 2007-11-30 17:11 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2006-11-02 20:55:30 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description Orion Poplawski 2006-07-11 18:50:46 EDT
Description of problem:

After commenting out the error suppression:

// error_reporting(E_ERROR);

you can see that ss_host_disk.php script fails:

/usr/bin/php  /usr/share/cacti/scripts/ss_host_disk.php alexandria.cora.nwra.com
3 '2:161:500:cora0201:::MD5::[None]' query index
PHP Warning:  include_once(/var/lib/cacti/scripts/../include/config.php): failed
to open stream: No such file or directory in
/var/lib/cacti/scripts/ss_host_disk.php on line 8
PHP Warning:  include_once(): Failed opening
'/var/lib/cacti/scripts/../include/config.php' for inclusion
(include_path='.:/usr/share/pear') in /var/lib/cacti/scripts/ss_host_disk.php on
line 8
PHP Warning:  include_once(/var/lib/cacti/scripts/../lib/snmp.php): failed to
open stream: No such file or directory in
/var/lib/cacti/scripts/ss_host_disk.php on line 10
PHP Warning:  include_once(): Failed opening
'/var/lib/cacti/scripts/../lib/snmp.php' for inclusion
(include_path='.:/usr/share/pear') in /var/lib/cacti/scripts/ss_host_disk.php on
line 10
PHP Fatal error:  Call to undefined function cacti_snmp_walk() in
/var/lib/cacti/scripts/ss_host_disk.php on line 59

This is because the scripts and the lib/include/rest of cacti are not in the
same location.  I think if you are going to split, you need links in
/var/lib/cacti back to /usr/share/cacti.  When I do that it works.

Why the split?  selinux labeling?



Version-Release number of selected component (if applicable):
cacti-0.8.6h-6.fc5
Comment 1 Mike McGrath 2006-07-11 21:01:17 EDT
Was this an upgrade from a non-fedora to a fedora package?
Comment 2 Orion Poplawski 2006-07-12 11:26:35 EDT
At one point I had a different cacti, but the current install checks out:

[root@wind ~]# rpm -V cacti
S.5....T. c /etc/cacti/db.php
S.5....T. c /etc/cron.d/cacti
S.5....T. c /etc/httpd/conf.d/cacti.conf
.......T.   /usr/share/cacti/lib/rrd.php
S.5....T.   /var/lib/cacti/scripts/ss_host_disk.php
S.5....T.   /var/log/cacti/cacti.log

My guess is that php has started resolving __FILE__ to the actual location on
disk, not the name the program was started with.
Comment 3 Mike McGrath 2006-07-23 12:30:17 EDT
The reason for the split is because of FHS standards.  These files have all been
properly linked back to /usr/share/cacti so they should work.  I haven't been
able to recreate this error.  I'm guessing there was an upgrade issue from the
other RPM.  Is there any way you could try re-creating this on a fresh install?
Comment 4 Thomas Vander Stichele 2006-08-30 17:36:34 EDT
The reason is simple - symlinks are used to break up the install, but some of
the paths needed for these scripts to work are not symlinked.

As an example, here's what happened when I executed lmsensors scripts I added:

 /usr/bin/php -q /usr/share/cacti/scripts/netsnmp_lmsensors.php fan ana.amantes,
public, 1, , , 161, 500 query sensorDevice
PHP Warning:  include(/var/lib/cacti/scripts/../include/config.php): failed to
open stream: No such file or directory in
/var/lib/cacti/scripts/netsnmp_lmsensors.php on line 18
PHP Warning:  include(): Failed opening
'/var/lib/cacti/scripts/../include/config.php' for inclusion
(include_path='.:/usr/share/pear') in
/var/lib/cacti/scripts/netsnmp_lmsensors.php on line 18
PHP Warning:  include(/var/lib/cacti/scripts/../lib/snmp.php): failed to open
stream: No such file or directory in
/var/lib/cacti/scripts/netsnmp_lmsensors.php on line 19
PHP Warning:  include(): Failed opening '/var/lib/cacti/scripts/../lib/snmp.php'
for inclusion (include_path='.:/usr/share/pear') in
/var/lib/cacti/scripts/netsnmp_lmsensors.php on line 19
PHP Fatal error:  Call to undefined function cacti_snmp_walk() in
/var/lib/cacti/scripts/netsnmp_lmsensors.php on line 245

the lib and include dirs are in /usr/share/cacti/ and not symlinked to
/var/lib/cacti like the scripts.

[root@onzenbak cacti]# ln -sf /usr/share/cacti/include/ /var/lib/cacti/
[root@onzenbak cacti]# ln -sf /usr/share/cacti/lib /var/lib/cacti/ 

these two commands fixed it for now; it would be good to verify that the split
was done correctly, and if any other mistakes were made, and an update made.
Comment 5 Orion Poplawski 2006-08-30 18:10:07 EDT
I meant to follow up but haven't had time to do a full report.  Suffice to say
that I can reproduce on a fresh install.  I fully agree with comment #4.
Comment 6 Mike McGrath 2006-08-30 18:19:27 EDT
Fresh install on what OS?
Comment 7 Orion Poplawski 2006-08-30 18:21:10 EDT
(In reply to comment #6)
> Fresh install on what OS?

FC5 with FC5 package.
Comment 8 Mike McGrath 2006-08-30 18:51:57 EDT
Thanks, did the fix in comment #4 work for you?
Comment 9 Orion Poplawski 2006-08-31 13:07:02 EDT
The links fix part of the problems.

Other issues:

# /usr/bin/php -q /usr/share/cacti/scripts/ss_host_disk.php
alexandria.cora.nwra.com 3 '2:161:500:cora0201:::MD5::[None]' index
sh: /usr/bin/snmpbulkwalk: No such file or directory

Looks like cacti should Require net-snmp-utils

Also, selinux issues:

Aug 31 10:48:26 scud kernel: audit(1157042906.500:325): avc:  denied  { read }
for  pid=4131 comm="sh" name="[1181676]" dev=eventpollfs ino=1181676
scontext=root:system_r:httpd_sys_script_t:s0 tcontext=root:system_r:httpd_t:s0
tclass=file
Aug 31 10:48:26 scud kernel: audit(1157042906.668:326): avc:  denied  { read }
for  pid=4131 comm="php" name="ss_host_disk.php" dev=dm-3 ino=360467
scontext=root:system_r:httpd_sys_script_t:s0
tcontext=system_u:object_r:var_lib_t:s0 tclass=file

Changing the context of /var/lib/cacti/scripts (and contents) to
httpd_sys_script_exec_t helps, but then I'm stuck on trying to get it to allow
it to read the include and lib links:

Aug 31 10:58:03 scud kernel: audit(1157043483.451:389): avc:  denied  { getattr
} for  pid=4451 comm="php" name="lib" dev=dm-3 ino=360620
scontext=root:system_r:httpd_sys_script_t:s0
tcontext=root:object_r:httpd_sys_script_exec_t:s0 tclass=lnk_file
Aug 31 10:58:03 scud kernel: audit(1157043483.451:390): avc:  denied  { read }
for  pid=4451 comm="php" name="lib" dev=dm-3 ino=360620
scontext=root:system_r:httpd_sys_script_t:s0
tcontext=root:object_r:httpd_sys_script_exec_t:s0 tclass=lnk_file
Aug 31 10:58:03 scud kernel: audit(1157043483.451:391): avc:  denied  { getattr
} for  pid=4451 comm="php" name="include" dev=dm-3 ino=360621
scontext=root:system_r:httpd_sys_script_t:s0
tcontext=root:object_r:httpd_sys_script_exec_t:s0 tclass=lnk_file
Aug 31 10:58:03 scud kernel: audit(1157043483.451:392): avc:  denied  { read }
for  pid=4451 comm="php" name="include" dev=dm-3 ino=360621
scontext=root:system_r:httpd_sys_script_t:s0
tcontext=root:object_r:httpd_sys_script_exec_t:s0 tclass=lnk_file


Comment 10 Mike McGrath 2006-11-02 20:55:30 EST
Sorry this has taken so long.  I've added the symlinks as well as updated to
release i.  Please re-open this ticket if these issues are not fixed.

Note You need to log in before you can comment on or make changes to this bug.