Solved Problem with cacti upgrading

Hi,

I tried to upgrade cacti 0.8.8d to 0.8.8f.

Code:
--->  Upgrading 'cacti-0.8.8d' to 'cacti-0.8.8f' (net-mgmt/cacti)
--->  Building '/usr/ports/net-mgmt/cacti'
===>  Cleaning for cacti-0.8.8f
===>  License GPLv2 accepted by the user
===>   cacti-0.8.8f depends on file: /usr/local/sbin/pkg - found
=> cacti-0.8.8f.tar.gz doesn't seem to exist in /var/ports/distfiles/.
=> Attempting to fetch http://www.cacti.net/downloads/cacti-0.8.8f.tar.gz
fetch: http://www.cacti.net/downloads/cacti-0.8.8f.tar.gz: size mismatch: expected 2594481, actual 2594409
=> Attempting to fetch ftp://ftpmirror.uk/freebsd-ports/cacti/cacti-0.8.8f.tar.gz
cacti-0.8.8f.tar.gz                           100% of 2533 kB  992 kBps 00m03s
===> Fetching all distfiles required by cacti-0.8.8f for building
===>  Extracting for cacti-0.8.8f
=> SHA256 Checksum OK for cacti-0.8.8f.tar.gz.
===>  Patching for cacti-0.8.8f
===>  Applying FreeBSD patches for cacti-0.8.8f
/bin/rm -f -r /var/ports/basejail/usr/ports/net-mgmt/cacti/work/cacti-0.8.8f/log /var/ports/basejail/usr/ports/net-mgmt/cacti/work/cacti-0.8.8f/rra
===>   cacti-0.8.8f depends on shared library: libmysqlclient.so.18 - found (/usr/local/lib/mysql/libmysqlclient.so.18)
===>  Configuring for cacti-0.8.8f
===>  Staging for cacti-0.8.8f
===>   cacti-0.8.8f depends on executable: rrdtool - found
===>   cacti-0.8.8f depends on file: /usr/local/include/php/main/php.h - found
===>   cacti-0.8.8f depends on file: /usr/local/lib/php/20100525-zts/mysql.so - found
===>   cacti-0.8.8f depends on file: /usr/local/lib/php/20100525-zts/session.so - found
===>   cacti-0.8.8f depends on file: /usr/local/lib/php/20100525-zts/sockets.so - found
===>   cacti-0.8.8f depends on file: /usr/local/lib/php/20100525-zts/snmp.so - found
===>   cacti-0.8.8f depends on file: /usr/local/lib/php/20100525-zts/xml.so - found
===>   Generating temporary packing list
===> Creating users and/or groups.
/bin/mkdir -p /var/ports/basejail/usr/ports/net-mgmt/cacti/work/stage//usr/local/share/cacti
/bin/mkdir -p /var/ports/basejail/usr/ports/net-mgmt/cacti/work/stage/var/log/cacti
/bin/mkdir -p /var/ports/basejail/usr/ports/net-mgmt/cacti/work/stage/var/db/cacti/rra
/bin/mkdir -p /var/ports/basejail/usr/ports/net-mgmt/cacti/work/stage/var/db/cacti/scripts
/bin/cp -R /var/ports/basejail/usr/ports/net-mgmt/cacti/work/cacti-0.8.8f/* /var/ports/basejail/usr/ports/net-mgmt/cacti/work/stage//usr/local/share/cacti
if [ -f /usr/local/share/cacti/include/db-settings.php ]; then  echo "=======================================================================";  echo "WARNING! You have to move DB settings from";  echo "/usr/local/share/cacti/include/db-settings.php file to";  echo "/usr/local/share/cacti/include/config.php and remove db-settings.php";  fi
====> Compressing man pages (compress-man)
--->  Backing up the old version
--->  Uninstalling the old version
[Reading data from pkg(8) ... - 284 packages found - done]
--->  Deinstalling 'cacti-0.8.8d'
Updating database digests format: 100%
Checking integrity... done (0 conflicting)
Deinstallation has been requested for the following 1 packages (of 0 packages in the universe):

Installed packages to be REMOVED:
   cacti-0.8.8d

The operation will free 6 MiB.
[noc.terabit.net.ua] [1/1] Deinstalling cacti-0.8.8d...
==> You should manually remove the "cacti" user.
[noc.terabit.net.ua] [1/1] Deleting files for cacti-0.8.8d: 100%
[Reading data from pkg(8) ... - 283 packages found - done]
--->  Installing the new version via the port
===>  Installing for cacti-0.8.8f
===>   cacti-0.8.8f depends on executable: rrdtool - found
===>   cacti-0.8.8f depends on file: /usr/local/include/php/main/php.h - found
===>   cacti-0.8.8f depends on file: /usr/local/lib/php/20100525-zts/mysql.so - found
===>   cacti-0.8.8f depends on file: /usr/local/lib/php/20100525-zts/session.so - found
===>   cacti-0.8.8f depends on file: /usr/local/lib/php/20100525-zts/sockets.so - found
===>   cacti-0.8.8f depends on file: /usr/local/lib/php/20100525-zts/snmp.so - found
===>   cacti-0.8.8f depends on file: /usr/local/lib/php/20100525-zts/xml.so - found
===>   cacti-0.8.8f depends on shared library: libmysqlclient.so.18 - found (/usr/local/lib/mysql/libmysqlclient.so.18)
===>   Registering installation for cacti-0.8.8f
[noc.terabit.net.ua] Installing cacti-0.8.8f...
===> Creating users and/or groups.
Using existing group 'cacti'.
Using existing user 'cacti'.
=======================================================================
Cacti is now installed. If you intall it for the first time,
you may have to follow this steps to make it work correctly:

1. Create the MySQL database, a cacti user, and initialize:
   a) CREATE DATABASE cacti;
   b) Create a mysql user/password for cacti:
      CREATE USER 'cacti'@'localhost' IDENTIFIED BY 'password';
      FLUSH PRIVILEGES;
   c) Add GRANTS:
      GRANT ALL ON cacti.* TO 'cacti'@'localhost';
      FLUSH PRIVILEGES;
   d) Import the default cacti database:
      mysql --database=cacti -ucacti -p < /usr/local/share/cacti/cacti.sql

NOTE:
   * Cacti does not LOCK TABLES.

2. Edit /usr/local/share/cacti/include/config.php from the template
   config.php.orig.

   PHP requires the time zone to be explicitly set rather that rely on
   the system time zone, otherwise poller complains. I added the
   following line to my config.php:

   date_default_timezone_set('America/Los_Angeles');

3. Add the following line to cron for cacti:
*/5 * * * * /usr/local/bin/php /usr/local/share/cacti/poller.php > /dev/null 2>&1

4. Example Apache 2.4 configuration:

   LoadModule php5_module  libexec/apache22/libphp5.so

   <FilesMatch "\.php$">
       SetHandler application/x-httpd-php
   </FilesMatch>
   <FilesMatch "\.phps$">
       SetHandler application/x-httpd-php-source
   </FilesMatch>

   DirectoryIndex index.php

   DocumentRoot "/usr/local/share/cacti"

   Alias /cacti "/usr/local/share/cacti/"
   Alias /Cacti "/usr/local/share/cacti/"

   <Directory "/usr/local/share/cacti">
      Require all granted
      AllowOverride None
      Order Allow,deny
      Allow from all
   </Directory>

5. Open a Cacti login page in your web browser and login with
   admin/admin.

If you update cacti, open a login page and an updating process will
start automatically.

NOTEs as of 10Aug2014:

1) Cacti now better supports hier(7)

   a) Cacti log files are now found under /var/log/cacti where you can
      manage them using newsyslog.
   b) Cacti RRD files are now found under /var/db/cacti/rra.

   If you have an existing Cacti installation these paths are also
   found in Cacti's SQL database and MUST be updated. These two SQL
   commands should do the trick:

   UPDATE settings SET value='/var/log/cacti/log' \
     WHERE name='path_cactilog';

   UPDATE poller_item SET rrd_path=\
     REPLACE(rrd_path,'/usr/local/share/cacti/rra','/var/db/cacti/rra') \
     WHERE rrd_path REGEXP '^/usr/local/share/cacti/rra';

2) The PERL paths in the Cacti PERL scripts have been updated to
   /usr/local/bin.

Other Erratas:
Mount linprocfs in /compat/linux/proc will alow most scripts to work.

=======================================================================

===>  Cleaning for cacti-0.8.8f
--->  Cleaning out obsolete shared libraries

After upgrading I got blank page in web browser and several errors in Apache log:

Code:
[Tue Jul 21 10:33:04.623620 2015] [:error] [pid 36309] [client 94.XXX.XXX.244:55144] PHP Warning:  include(0_8_8f_to_0_8_8f.php): failed to open stream: No such file or directory in /usr/local/share/cacti/install/index.php on line 471, referer: http://noc.xxx.net/cacti/install/index.php
[Tue Jul 21 10:33:04.623688 2015] [:error] [pid 36309] [client 94.XXX.XXX.244:55144] PHP Warning:  include(): Failed opening '0_8_8f_to_0_8_8f.php' for inclusion (include_path='.:/usr/local/share/pear') in /usr/local/share/cacti/install/index.php on line 471, referer: http://noc.xxx.net/cacti/install/index.php
[Tue Jul 21 10:33:04.623707 2015] [:error] [pid 36309] [client 94.XXX.XXX.244:55144] PHP Fatal error:  Call to undefined function upgrade_to_0_8_8f() in /usr/local/share/cacti/install/index.php on line 472, referer: http://noc.xxx.net/cacti/install/index.php

How can I fix it?
 
What I understand of this problem is that portupgrade is trying to apply patches for FreeBSD and the patches are looking for the file 0_8_8f_to_0_8_8f.php.
Because when I download cacti here http://www.cacti.net/downloads/cacti-0.8.8f.tar.gz and check the file install/index.php, there is no line
Code:
include ("0_8_8f_to_0_8_8f.php");
I think this line makes my errors and a blank page in web browser.
 
You can take this and put in the port in the directory files and make a file named patch-install_index_php (only with one underscore between install and index, cause there is another patch with nearly the same name).
 
I had a typo in the last post I correct it the name should be patch-install_index_php (a underscore for a point before php).
 
Hello,
PR 201702 was where we covered the security update to 0.8.8f. I just did a follow up to that PR so that we can get the port fixed with haste.

If you can,
[DEL]fetch 'https://bugs.FreeBSD.org/bugzilla/attachment.cgi?id=159053' -o /tmp/cacti-0.8.8f_1.patch[/DEL]
fetch 'https://bugs.freebsd.org/bugzilla/attachment.cgi?id=159054' -o /tmp/cacti-0.8.8f_1.patch
cd /usr/ports/net-mgmt/cacti
patch < /tmp/cacti-0.8.8f_1.patch
make clean && make install


EDIT: Correct with right patch since upstream re-rolled the distfile.
 
Ok. There is more to this. I just downloaded the 0.8.8f tarball as you did and I see that is correct. It looks like upstream decided to re-roll their distfile to do this fix. The "good" distfile is a checksum mismatch so the ports system will obviously fetch the "bad" one that the SHA hash has as being valid.

EDIT: PR has been updated with the correct patch for the distfile's SHA hash change and the commands above have been fixed with the correct patch.
 
Back
Top