Cacti / cacti

Cacti ™
http://www.cacti.net
GNU General Public License v2.0
1.64k stars 405 forks source link

When installing, multiple issues can be seen due to bad packages #3313

Closed ndilooc closed 4 years ago

ndilooc commented 4 years ago

i am new to installing cacti, but i have issue when instaling it keep looping and stay 41 % cacti

Jh0nHerrera commented 4 years ago

If you don't select any template to install the installation is succeed

Jh0nHerrera commented 4 years ago

UPDATE 2 NOTE: If you uncheck Cisco Template, the installation is succeed

larsf96 commented 4 years ago

UPDATE 2 NOTE: If you uncheck Cisco Template, the installation is succeed

Is there any way to reset an installation? I'm also getting stuck at 41%, but how to start from the beginning?

Jh0nHerrera commented 4 years ago

UPDATE 3 NOTE: I finally found the problem, this issue occurred if you check the latest option, please check the image with the red circle image

Unchecking this one solve the installation problem

In order to start the installation again do the following: 1- delete symbolic link and cacti directory 2- delete cacti db from mariadb or mysql 3- extract again cacti latest version and create symbolic link 4- create again cacti db from mariadb or mysql 5- import database structure to cacti db 6- modify config.php to reflect username and passwor for cacti db 7- start again the installation process from Web Browser.

netniV commented 4 years ago

You can restart the installation process a little more simply using MySQL:

delete from settings where name like 'install_%';

I'm curious over the blank line, it sounds like a change has been made to the templates or there's a template that isn't being parsed properly but is being placed into the array somehow.

TheWitness commented 4 years ago

Sounds like the Cisco package is broken. Likely a file transfer of a tar file in ASCII mode. That would break it.

netniV commented 4 years ago

Actually, the missing package appears to be the Cacti Stats package.

Cacti_Stats.xml.gz
Cisco_Router.xml.gz
Generic_SNMP_Device.xml.gz
Local_Linux_Machine.xml.gz
NetSNMP_Device.xml.gz
Windows_Device.xml.gz
Jh0nHerrera commented 4 years ago

Yes, in fact the installation process stuck when importing Cacti_Stats.xml.gz

netniV commented 4 years ago

If you remove that package and restart, installation should complete (or just untick the box as mentioned). We will look at fixing the installer to handle bad packages.

cigamit commented 4 years ago

This is resolved no.

netniV commented 4 years ago

Not sure, I haven't fixed a bad package freezing things myself, but we have fixed the package.

TheWitness commented 4 years ago

I recreated the package and committed it. Also, testing multiple times now.

TheWitness commented 4 years ago

I guess fixing if a package is damaged is optional at this point.

netniV commented 4 years ago

I'm going to reopen and just submit another commit for that portion later. It's not hard to replicate, we just need to isolate the part that adds it regardless of a lack of info.

netniV commented 4 years ago

So testing with the latest version does show the package with no details and allow installation to complete. However, at the moment, the packages do not flag that they have failed. Not a major issue, but we probably should log it.

2020/03/09 17:33:26 - INSTALL: always: Import of Package #4 'Local_Linux_Machine.xml.gz' under Profile '3' failed 2020/03/09 17:33:26 - INSTALL: always: About to import Package #4 'Local_Linux_Machine.xml.gz'.

majed17 commented 4 years ago

Peace, on Fedora 31, it is stuck at 2% `

Refresh in   ProgressLast updated: 09:16:18
    2 %
[2020-03-13 09:16:18] [ always  ] Spawning background process: /bin/php '/usr/share/cacti/install/background.php' 1584080178.1171
[2020-03-13 09:16:18] [ always  ] Setting PHP Option max_execution_time = 0
[2020-03-13 09:16:18] [ always  ] Setting PHP Option memory_limit = -1
[2020-03-13 09:16:18] [ always  ] Starting UPGRADE Process for v1.2.10
[2020-03-13 09:32:27] [ always  ] Spawning background process: /bin/php '/usr/share/cacti/install/background.php' 1584081147.6839
[2020-03-13 09:32:27] [ always  ] Setting PHP Option max_execution_time = 0
[2020-03-13 09:32:27] [ always  ] Setting PHP Option memory_limit = -1
[2020-03-13 09:32:28] [ always  ] Starting UPGRADE Process for v1.2.10
[2020-03-13 09:36:32] [ always  ] Spawning background process: /bin/php '/usr/share/cacti/install/background.php' 1584081392.2176
[2020-03-13 09:36:32] [ always  ] Setting PHP Option max_execution_time = 0
[2020-03-13 09:36:32] [ always  ] Setting PHP Option memory_limit = -1
[2020-03-13 09:36:32] [ always  ] Starting UPGRADE Process for v1.2.10

tried renaming moving the Cacti_Stats.xml.gz to /opt and restarting the installation with no success.. what to do?

netniV commented 4 years ago

This sounds like your background process is failing to start for some reason. I would suggest trying to run the command above using something like:

sudo -u <website user> /bin/php ....

Just replace the dots with the remainder of the command.

majed17 commented 4 years ago

sudo -u apache /bin/php '/usr/share/cacti/install/background.php' produces no output..

[2020-03-13 10:26:34] [ always  ] Setting PHP Option max_execution_time = 0
[2020-03-13 10:26:34] [ always  ] Setting PHP Option memory_limit = -1
[2020-03-13 10:26:34] [ always  ] Starting UPGRADE Process for v1.2.10
[2020-03-16 09:02:36] [ always  ] Spawning background process: /bin/php '/usr/share/cacti/install/background.php' 1584338556.8927
[2020-03-16 09:02:37] [ always  ] Setting PHP Option max_execution_time = 0
[2020-03-16 09:02:37] [ always  ] Setting PHP Option memory_limit = -1
[2020-03-16 09:02:37] [ always  ] Starting UPGRADE Process for v1.2.10
[2020-03-16 09:09:09] [ always  ] no parameters passed

[2020-03-16 09:09:33] [ always  ] Spawning background process: /bin/php '/usr/share/cacti/install/background.php' 1584338973.858
[2020-03-16 09:09:34] [ always  ] Setting PHP Option max_execution_time = 0
[2020-03-16 09:09:34] [ always  ] Setting PHP Option memory_limit = -1
[2020-03-16 09:09:34] [ always  ] Starting UPGRADE Process for v1.2.10
[2020-03-16 09:10:02] [ always  ] no parameters passed

[2020-03-16 09:10:39] [ always  ] no parameters passed

[2020-03-16 09:10:44] [ always  ] Spawning background process: /bin/php '/usr/share/cacti/install/background.php' 1584339044.1615
[2020-03-16 09:10:44] [ always  ] Setting PHP Option max_execution_time = 0
[2020-03-16 09:10:44] [ always  ] Setting PHP Option memory_limit = -1
[2020-03-16 09:10:44] [ always  ] Starting UPGRADE Process for v1.2.1
netniV commented 4 years ago

You are seeing zero output, even with the numbers at the end that you are supposed to supply?

majed17 commented 4 years ago

sorry i do not understand, what numbers?

majed17 commented 4 years ago

if you mean what is after v1.2.1, i just did not select the last 0.

mckaygerhard commented 4 years ago

ok this stupid error still persist! the problem are the stats package Cacti_Stats.xml.gz how developers can release a broken version? where's the real fix commit due after applied 501009a there's no files or fixeds .. neither commit 8e68706 not fix anything!

if we skip the "ghost ptioin" at templates step, how we can use the stats package in cacti manually? at least?

TheWitness commented 4 years ago

Hey, @mckaygerhard it's open source. You got what you paid for. Grab the 1.2.x branch and try again.

mckaygerhard commented 4 years ago

and seems mikrotik plugin fails due depents of stat template? https://github.com/Cacti/plugin_mikrotik/issues/41

netniV commented 4 years ago

@TheWitness said something usefull? nah i dont think so.. well in any case, how we can use the stat in cacti if we skiped the step of template?

That was neither useful nor productive either @mckaygerhard, and as someone who works with Linux a lot, unless you have a large test bed or team, mistakes can happen, even to seasoned linux guru's (or are you trying to say there are no other bug trackers out there?). Heck Microsoft and AV vendors a like have released patches that crippled machines across the world, so maybe think a little before you try the easy option of berating without thought.

I think we've been reasonable in our responses and if you download the latest packages folder that is under install/templates you shouldn't have an issue. Failing that, an updated package will be released by next weekend (health, work and life balances permitting).

For now, I'm going to get back to the actual issue that was being experienced before you derailed this thread, so please have more patience and more curtesy.

netniV commented 4 years ago

@majed17: sorry i do not understand, what numbers?

On the command line where the /usr/bin/php command is, the full command has numbers at the very end. These are a timestamp used as a simple test to make sure there are not more than one process run at once.

For example, the full command you could have run is:

sudo -u apache /bin/php '/usr/share/cacti/install/background.php' 1584338556.8927
vegnuli commented 4 years ago

hi @netniV but that template never install, and a max_execution_time are hardcoded in the file:

I think we've been reasonable in our responses and if you download the latest packages folder that is under install/templates you shouldn't have an issue. Failing that, an updated package will be released by next weekend (health, work and life balances permitting).

i try to make it to work by modify to 256 seconsdd and hangs if set to unlimited, men see tha picture!..

/usr/share/webapps/cacti/install/templates$ php /usr/share/webapps/cacti/cli/import_package.php --filename=Cacti_Stats.x
ml.gz 
Read 85563 bytes of Package data
PHP Fatal error:  Maximum execution time of 50 seconds exceeded in /usr/share/webapps/cacti/lib/import.php on line 280

Captura de pantalla de 2020-03-19 22-58-38

majed17 commented 4 years ago

something constructive? you mean like mentioning from where must I get that timestamp?

TheWitness commented 4 years ago

@netniV may want to take this longer, but the install_package.php will not timeout any longer. Thanks for the debug output.

capricorn800 commented 4 years ago

Its been closed withouth any solution telling how to kill this process. Even though I restarted the server still its running with same status

TheWitness commented 4 years ago

https://forums.cacti.net/viewtopic.php?f=21&t=60803&p=282080#p282080

mckaygerhard commented 4 years ago

and newer package does not work any way @capricorn800 seem we cannot use the stats package as many people just reported! please apply the patch in the previously comments.. it's the only way to install the cacti, do not select the last template at install process and will go under good way..

majed17 commented 4 years ago

sudo -u apache /bin/php '/usr/share/cacti/install/background.php' 1585896763.8316 PHP Fatal error: Uncaught ArgumentCountError: Too few arguments to function install_create_csrf_secret(), 0 passed in /usr/share/cacti/lib/installer.php on line 639 and exactly 1 expected in /usr/share/cacti/install/functions.php:68 Stack trace:

0 /usr/share/cacti/lib/installer.php(639): install_create_csrf_secret()

1 /usr/share/cacti/lib/installer.php(2849): Installer->setCSRFSecret()

2 /usr/share/cacti/lib/installer.php(3346): Installer->install()

3 /usr/share/cacti/install/background.php(54): Installer::beginInstall('1585896763.8316')

4 {main}

thrown in /usr/share/cacti/install/functions.php on line 68

netniV commented 4 years ago

Hi @majed17,

Thanks for that info, can you log that as a new issue so I can tag against it. I can see the problem already with it.

netniV commented 4 years ago
diff --git a/lib/installer.php b/lib/installer.php
index f46c89784..ebf1076ed 100644
--- a/lib/installer.php
+++ b/lib/installer.php
@@ -637,7 +637,7 @@ class Installer implements JsonSerializable {
                        if (empty($secret)) {
                                if (is_resource_writable($path_csrf_secret)) {
                                        log_install_medium('csrf', 'setCSRFSecret(): Updated CSRF secret - "' . $path_csrf_secret . '"');
-                                       install_create_csrf_secret();
+                                       install_create_csrf_secret($path_csrf_secret);
                                } else {
                                        log_install_high('csrf', 'setCSRFSecret(): Unable to create file - "' . $path_csrf_secret . '"');
                                }
GAS85 commented 4 years ago

Meet the same error on 1.2.11 when select only "Linux Local Machine" and "Generic SNMP"

2020/04/09 08:44:15 - IMPORT Importing XML Data for Local_Linux_Machine.xml 
mckaygerhard commented 4 years ago

confirmed! @GAS85 .. as i wrote several times still raise errors

netniV commented 4 years ago

So this is another package issue? The last was the cacti stats one. Lets open that as a new issue then.

hiddenicon commented 4 years ago

Was a new issue opened? I'm seeing this issue on 1.2.10 to 1.2.11 upgrade. Stuck on the Cisco_Router.xml.gz import.

majed17 commented 4 years ago

i had your same problem, and was intending on asking for help, but first, i terminated the upgrade process ... and then it just let me in :D

mckaygerhard commented 4 years ago

still problems on new version of cacti.. confirmed! pufff marked as "solved" .. wow! so much solved!

majed17 commented 4 years ago

it's not nice to communicate "yes" meaning a "no" and i'm just trying to be nice ;)

TheWitness commented 4 years ago

Some asses can not be covered by makeup and fancy clothing.

netniV commented 4 years ago

i'm just trying to be nice ;)

Always appreciated. Whilst we had previously fixed one issue, that introduced another problem due to changing the mechanics. Alas, the limited testing that we can do doesn't always show everything so we are greatful to those of you who keep with the cutting edge and help us out 👍