Cacti / cacti

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

1.1.34 upgrade step fails to complete #2358

Closed crequill closed 5 years ago

crequill commented 5 years ago

Archlinux platform up-to-date with Cacti 1.2.1

I try to upgrade an old database cacti 0.8.8a but there was a problem when upgrading from 1.3.1 to 1.3.4: ALTER TABLE version ADD PRIMARY KEY(cacti) USING BTREE failed because there was two values '1.1.31' in this table. So I correct it manually and launch manually again this alter table. It works but now after resetting my browser cache, close my browser and even reboot, the install is always blocked on this error. How to launch again the upgrade?

netniV commented 5 years ago

Can you provide a screenshot of the error that you are seeing? Also, try doing

SELECT * FROM version;
crequill commented 5 years ago

Sure see attached. capture d ecran du 2019-01-31 09-42-30 capture d ecran du 2019-01-31 09-41-48

MariaDB [cacti]> select * from version; +--------+ | cacti | +--------+ | 1.1.31 | +--------+ 1 row in set (0.000 sec)

cigamit commented 5 years ago

Show the output of

SHOW CREATE TABLE version;

crequill commented 5 years ago

MariaDB [cacti]> show create table version; +---------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Table | Create Table | +---------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | version | CREATE TABLE version ( cacti char(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', PRIMARY KEY (cacti) USING BTREE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci | +---------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ 1 row in set (0.001 sec)

cigamit commented 5 years ago

Well that's the problem. We are attempting to create the primary key even though it's already created.

cigamit commented 5 years ago

I just updated the file install/upgrades/1_1_34.php in the develop branch. Pull that file and see if the upgrade now completes as you expect.

crequill commented 5 years ago

Thanks. I update the file. If now the problem on version table disappear, I get always an error but I don’t know what is it. How to launch again the install ?

capture d ecran du 2019-01-31 14-32-56

And version table has not be updated. MariaDB [cacti]> select * from version; +--------+ | cacti | +--------+ | 1.1.31 | +--------+ 1 row in set (0.000 sec)

netniV commented 5 years ago

That's an interesting one because it reckons it failed at the 1.1.34 update, yet hasn't given you a break down. If you attempt it again do you see anything different?

crequill commented 5 years ago

I don’t see anything different.

netniV commented 5 years ago

Can you try running the following so I can see where in the 1.1.34 upgrade it's failing?

select * from version;
show create table poller_command\G
show create table data_template_rrd\G
show create table poller_item\G
show create table user_auth\G
show create table version\G
crequill commented 5 years ago

MariaDB [cacti]> select * from version;
+--------+
| cacti  |
+--------+
| 1.1.31 |
+--------+
1 row in set (0.000 sec)

MariaDB [cacti]> show create table poller_command\G
*************************** 1. row ***************************
       Table: poller_command
Create Table: CREATE TABLE poller_command (
  poller_id smallint(5) unsigned NOT NULL DEFAULT 1,
  time timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  action tinyint(3) unsigned NOT NULL DEFAULT 0,
  command varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  last_updated timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (poller_id,action,command),
  KEY poller_id_last_updated (poller_id,last_updated)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
1 row in set (0.000 sec)

MariaDB [cacti]> show create table data_template_rrd\G
*************************** 1. row ***************************
       Table: data_template_rrd
Create Table: CREATE TABLE data_template_rrd (
  id mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
  hash varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  local_data_template_rrd_id mediumint(8) unsigned NOT NULL DEFAULT 0,
  local_data_id mediumint(8) unsigned NOT NULL DEFAULT 0,
  data_template_id mediumint(8) unsigned NOT NULL DEFAULT 0,
  t_rrd_maximum char(2) COLLATE utf8mb4_unicode_ci DEFAULT '',
  rrd_maximum varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '0',
  t_rrd_minimum char(2) COLLATE utf8mb4_unicode_ci DEFAULT '',
  rrd_minimum varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '0',
  t_rrd_heartbeat char(2) COLLATE utf8mb4_unicode_ci DEFAULT '',
  rrd_heartbeat mediumint(6) NOT NULL DEFAULT 0,
  t_data_source_type_id char(2) COLLATE utf8mb4_unicode_ci DEFAULT '',
  data_source_type_id smallint(5) NOT NULL DEFAULT 0,
  t_data_source_name char(2) COLLATE utf8mb4_unicode_ci DEFAULT '',
  data_source_name varchar(19) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  t_data_input_field_id char(2) COLLATE utf8mb4_unicode_ci DEFAULT '',
  data_input_field_id mediumint(8) unsigned NOT NULL DEFAULT 0,
  PRIMARY KEY (id),
  UNIQUE KEY duplicate_dsname_contraint (local_data_id,data_source_name,data_template_id),
  KEY local_data_id (local_data_id),
  KEY data_template_id (data_template_id),
  KEY local_data_template_rrd_id (local_data_template_rrd_id)
) ENGINE=InnoDB AUTO_INCREMENT=1150 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
1 row in set (0.000 sec)

MariaDB [cacti]> show create table poller_item\G
*************************** 1. row ***************************
       Table: poller_item
Create Table: CREATE TABLE poller_item (
  local_data_id mediumint(8) unsigned NOT NULL DEFAULT 0,
  poller_id int(10) unsigned NOT NULL DEFAULT 1,
  host_id mediumint(8) unsigned NOT NULL DEFAULT 0,
  action tinyint(2) unsigned NOT NULL DEFAULT 1,
  present tinyint(4) NOT NULL DEFAULT 1,
  last_updated timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  hostname varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  snmp_community varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  snmp_version tinyint(1) unsigned NOT NULL DEFAULT 0,
  snmp_username varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  snmp_password varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  snmp_auth_protocol char(6) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  snmp_priv_passphrase varchar(200) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  snmp_priv_protocol char(6) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  snmp_context varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT '',
  snmp_engine_id varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT '',
  snmp_port mediumint(5) unsigned NOT NULL DEFAULT 161,
  snmp_timeout mediumint(8) unsigned NOT NULL DEFAULT 0,
  rrd_name varchar(19) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  rrd_path varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  rrd_num tinyint(2) unsigned NOT NULL DEFAULT 0,
  rrd_step mediumint(8) NOT NULL DEFAULT 300,
  rrd_next_step mediumint(8) NOT NULL DEFAULT 0,
  arg1 mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  arg2 varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  arg3 varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  PRIMARY KEY (local_data_id,rrd_name),
  KEY local_data_id (local_data_id),
  KEY host_id (host_id),
  KEY rrd_next_step (rrd_next_step),
  KEY action (action),
  KEY present (present),
  KEY poller_id_host_id (poller_id,host_id),
  KEY poller_id_action (poller_id,action),
  KEY poller_id_last_updated (poller_id,last_updated)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
1 row in set (0.000 sec)

MariaDB [cacti]> show create table user_auth\G
*************************** 1. row ***************************
       Table: user_auth
Create Table: CREATE TABLE user_auth (
  id mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
  username varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '0',
  password varchar(2048) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  realm mediumint(8) NOT NULL DEFAULT 0,
  full_name varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT '0',
  email_address varchar(128) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  must_change_password char(2) COLLATE utf8mb4_unicode_ci DEFAULT '',
  password_change char(2) COLLATE utf8mb4_unicode_ci DEFAULT 'on',
  show_tree char(2) COLLATE utf8mb4_unicode_ci DEFAULT 'on',
  show_list char(2) COLLATE utf8mb4_unicode_ci DEFAULT 'on',
  show_preview char(2) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'on',
  graph_settings char(2) COLLATE utf8mb4_unicode_ci DEFAULT '',
  login_opts tinyint(1) NOT NULL DEFAULT 1,
  policy_graphs tinyint(1) unsigned NOT NULL DEFAULT 1,
  policy_trees tinyint(1) unsigned NOT NULL DEFAULT 1,
  policy_hosts tinyint(1) unsigned NOT NULL DEFAULT 1,
  policy_graph_templates tinyint(1) unsigned NOT NULL DEFAULT 1,
  enabled char(2) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'on',
  lastchange int(12) NOT NULL DEFAULT -1,
  lastlogin int(12) NOT NULL DEFAULT -1,
  password_history varchar(4096) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '-1',
  locked varchar(3) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  failed_attempts int(5) NOT NULL DEFAULT 0,
  lastfail int(12) NOT NULL DEFAULT 0,
  reset_perms int(12) unsigned NOT NULL DEFAULT 0,
  PRIMARY KEY (id),
  KEY username (username),
  KEY realm (realm),
  KEY enabled (enabled)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
1 row in set (0.000 sec)

MariaDB [cacti]> show create table version\Gshow create table version\G
*************************** 1. row ***************************
       Table: version
Create Table: CREATE TABLE version (
  cacti char(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  PRIMARY KEY (cacti) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
1 row in set (0.000 sec)

*************************** 1. row ***************************
       Table: version
Create Table: CREATE TABLE version (
  cacti char(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  PRIMARY KEY (cacti) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
1 row in set (0.000 sec)
netniV commented 5 years ago

You were supposed to use the \G option so it just gives the raw SQL statement, but let me look it over so I can see what's going on.

crequill commented 5 years ago

Sorry. I correct.

netniV commented 5 years ago

So, comparing your output with what should have happened in the 1.1.34 upgrade, everything looks fine. So do the following and try to carry on with the upgrade:

update version set cacti = '1.1.34'

Note, this is not a normal recommendation, but in your case the upgrade does appear to have completed so it should be OK.

crequill commented 5 years ago

MariaDB [cacti]> update version set cacti = '1.1.34' ; Query OK, 1 row affected (0.114 sec) Rows matched: 1 Changed: 1 Warnings: 0

But nothing change. Always: Your Cacti Server v1.2.1 has been installed/updated with errors

netniV commented 5 years ago

Yet no error is presenting itself?

netniV commented 5 years ago

Can you check your apache error logs and if necessary your PHP logs

pedro-nonfree commented 5 years ago

I'm experiencing the same error, I'm following this guide https://gitlab.com/guifi-exo/wiki/blob/master/howto/cacti.md

mysql cacti -e "SELECT * FROM version;"

+--------+
| cacti  |
+--------+
| 1.1.34 |
| 1.1.34 |
+--------+
netniV commented 5 years ago

Ooo, that's interesting, you shouldn't have two of them. Apply the following:

DELETE FROM version;
INSERT INTO version VALUES ('1.1.34');

Also, can you run desc version or show create table version \G (the \G is better than using a semi-colon ;).

pedro-nonfree commented 5 years ago
MariaDB [cacti]> DELETE FROM version;
Query OK, 2 rows affected (0.01 sec)

MariaDB [cacti]> INSERT INTO version VALUES ('1.1.34');
Query OK, 1 row affected (0.01 sec)

then

mysql cacti -e "SELECT * FROM version;"
+--------+
| cacti  |
+--------+
| 1.1.34 |
+--------+

and the other commands you said

MariaDB [cacti]> desc version \G
*************************** 1. row ***************************
  Field: cacti
   Type: char(20)
   Null: NO
    Key: 
Default: 
  Extra: 
1 row in set (0.00 sec)

MariaDB [cacti]> show create table version \G
*************************** 1. row ***************************
       Table: version
Create Table: CREATE TABLE `version` (
  `cacti` char(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
1 row in set (0.00 sec)
netniV commented 5 years ago

OK, so with 1.1.34 you should have a primary key against the version.

PRIMARY KEY (cacti) USING BTREE

You can see that is in the CREATE TABLE above that @crequill posted. If you have 1.1.34 installed, I would recommend running the cli/upgrade_database.php script with forcever=1.1.31 to make it run through the 1.1.34 upgrade again as long as this isn't trying to upgrade to the 1.2 base? Otherwise, revert your version table back to 1.1.31 and then run the upgrade wizard via the browser.

pedro-nonfree commented 5 years ago

I'm stuck in the same place,

php7.0 cli/upgrade_database.php 
Upgrading from v1.1.31
Upgrading from v1.1.31 (DB 1.2.1) to v1.1.34
--------+--++++++-+-++-+-++-+++-+++++++++-+-+++++-++-
Upgrading from v1.1.34 (DB 1.2.1) to v1.1.35
+++
Upgrading from v1.1.35 (DB 1.2.1) to v1.1.36

Upgrading from v1.1.36 (DB 1.2.1) to v1.1.37
+
Upgrading from v1.1.37 (DB 1.2.1) to v1.2.0
++++++++++++++-+++++++++++++++++++++++
Upgrading from v1.2.0 (DB 1.2.1) to v1.2.1
++
MariaDB [cacti]> show create table poller_command\G
*************************** 1. row ***************************
       Table: poller_command
Create Table: CREATE TABLE `poller_command` (
  `poller_id` smallint(5) unsigned NOT NULL DEFAULT '1',
  `time` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  `action` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `command` varchar(191) NOT NULL DEFAULT '',
  `last_updated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`poller_id`,`action`,`command`),
  KEY `poller_id_last_updated` (`poller_id`,`last_updated`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
1 row in set (0.00 sec)

MariaDB [cacti]> show create table data_template_rrd\G
*************************** 1. row ***************************
       Table: data_template_rrd
Create Table: CREATE TABLE `data_template_rrd` (
  `id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
  `hash` varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `local_data_template_rrd_id` mediumint(8) unsigned NOT NULL DEFAULT '0',
  `local_data_id` mediumint(8) unsigned NOT NULL DEFAULT '0',
  `data_template_id` mediumint(8) unsigned NOT NULL DEFAULT '0',
  `t_rrd_maximum` char(2) COLLATE utf8mb4_unicode_ci DEFAULT '',
  `rrd_maximum` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '0',
  `t_rrd_minimum` char(2) COLLATE utf8mb4_unicode_ci DEFAULT '',
  `rrd_minimum` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '0',
  `t_rrd_heartbeat` char(2) COLLATE utf8mb4_unicode_ci DEFAULT '',
  `rrd_heartbeat` mediumint(6) NOT NULL DEFAULT '0',
  `t_data_source_type_id` char(2) COLLATE utf8mb4_unicode_ci DEFAULT '',
  `data_source_type_id` smallint(5) NOT NULL DEFAULT '0',
  `t_data_source_name` char(2) COLLATE utf8mb4_unicode_ci DEFAULT '',
  `data_source_name` varchar(19) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `t_data_input_field_id` char(2) COLLATE utf8mb4_unicode_ci DEFAULT '',
  `data_input_field_id` mediumint(8) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`),
  UNIQUE KEY `duplicate_dsname_contraint` (`local_data_id`,`data_source_name`,`data_template_id`),
  KEY `local_data_id` (`local_data_id`),
  KEY `data_template_id` (`data_template_id`),
  KEY `local_data_template_rrd_id` (`local_data_template_rrd_id`)
) ENGINE=InnoDB AUTO_INCREMENT=97 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
1 row in set (0.00 sec)

MariaDB [cacti]> show create table poller_item\G
*************************** 1. row ***************************
       Table: poller_item
Create Table: CREATE TABLE `poller_item` (
  `local_data_id` mediumint(8) unsigned NOT NULL DEFAULT '0',
  `poller_id` int(10) unsigned NOT NULL DEFAULT '1',
  `host_id` mediumint(8) unsigned NOT NULL DEFAULT '0',
  `action` tinyint(2) unsigned NOT NULL DEFAULT '1',
  `present` tinyint(4) NOT NULL DEFAULT '1',
  `last_updated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `hostname` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `snmp_community` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `snmp_version` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `snmp_username` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `snmp_password` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `snmp_auth_protocol` char(6) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `snmp_priv_passphrase` varchar(200) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `snmp_priv_protocol` char(6) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `snmp_context` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT '',
  `snmp_engine_id` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT '',
  `snmp_port` mediumint(5) unsigned NOT NULL DEFAULT '161',
  `snmp_timeout` mediumint(8) unsigned NOT NULL DEFAULT '0',
  `rrd_name` varchar(19) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `rrd_path` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `rrd_num` tinyint(2) unsigned NOT NULL DEFAULT '0',
  `rrd_step` mediumint(8) NOT NULL DEFAULT '300',
  `rrd_next_step` mediumint(8) NOT NULL DEFAULT '0',
  `arg1` mediumtext COLLATE utf8mb4_unicode_ci,
  `arg2` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `arg3` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  PRIMARY KEY (`local_data_id`,`rrd_name`),
  KEY `local_data_id` (`local_data_id`),
  KEY `host_id` (`host_id`),
  KEY `rrd_next_step` (`rrd_next_step`),
  KEY `action` (`action`),
  KEY `present` (`present`),
  KEY `poller_id_host_id` (`poller_id`,`host_id`),
  KEY `poller_id_action` (`poller_id`,`action`),
  KEY `poller_id_last_updated` (`poller_id`,`last_updated`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
1 row in set (0.00 sec)

MariaDB [cacti]> show create table user_auth\G
*************************** 1. row ***************************
       Table: user_auth
Create Table: CREATE TABLE `user_auth` (
  `id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
  `username` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '0',
  `password` varchar(256) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `realm` mediumint(8) NOT NULL DEFAULT '0',
  `full_name` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT '0',
  `email_address` varchar(128) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `must_change_password` char(2) COLLATE utf8mb4_unicode_ci DEFAULT '',
  `password_change` char(2) COLLATE utf8mb4_unicode_ci DEFAULT 'on',
  `show_tree` char(2) COLLATE utf8mb4_unicode_ci DEFAULT 'on',
  `show_list` char(2) COLLATE utf8mb4_unicode_ci DEFAULT 'on',
  `show_preview` char(2) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'on',
  `graph_settings` char(2) COLLATE utf8mb4_unicode_ci DEFAULT '',
  `login_opts` tinyint(1) NOT NULL DEFAULT '1',
  `policy_graphs` tinyint(1) unsigned NOT NULL DEFAULT '1',
  `policy_trees` tinyint(1) unsigned NOT NULL DEFAULT '1',
  `policy_hosts` tinyint(1) unsigned NOT NULL DEFAULT '1',
  `policy_graph_templates` tinyint(1) unsigned NOT NULL DEFAULT '1',
  `enabled` char(2) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'on',
  `lastchange` int(12) NOT NULL DEFAULT '-1',
  `lastlogin` int(12) NOT NULL DEFAULT '-1',
  `password_history` varchar(4096) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '-1',
  `locked` varchar(3) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `failed_attempts` int(5) NOT NULL DEFAULT '0',
  `lastfail` int(12) NOT NULL DEFAULT '0',
  `reset_perms` int(12) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`),
  KEY `username` (`username`),
  KEY `realm` (`realm`),
  KEY `enabled` (`enabled`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
1 row in set (0.00 sec)

MariaDB [cacti]> show create table version\G
*************************** 1. row ***************************
       Table: version
Create Table: CREATE TABLE `version` (
  `cacti` char(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  PRIMARY KEY (`cacti`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
1 row in set (0.00 sec)

I also tried

mysql cacti -e "update version set cacti = '1.1.31';"

still the web show is not installed correctly, right?

2019/02/02 15:25:51 - INSTALL: always: Installation was started at 2019-02-02 14:25:32, completed at 2019-02-02 14:25:51
2019/02/02 15:25:51 - INSTALL: always: WARNING: One or more upgrades failed to install correctly
2019/02/02 15:25:51 - INSTALL: always: Finished UPGRADE Process for v1.2.1
2019/02/02 15:25:50 - INSTALL: always: Upgrading from v1.1.31 (DB 1.1.31) to v1.1.34
2019/02/02 15:25:50 - INSTALL: always: Upgrading from v1.1.28 (DB 1.1.28) to v1.1.31
2019/02/02 15:25:50 - INSTALL: always: Upgrading from v1.1.26 (DB 1.1.26) to v1.1.28
2019/02/02 15:25:50 - INSTALL: always: Upgrading from v1.1.20 (DB 1.1.20) to v1.1.26
2019/02/02 15:25:50 - INSTALL: always: Upgrading from v1.1.17 (DB 1.1.17) to v1.1.20
2019/02/02 15:25:50 - INSTALL: always: Upgrading from v1.1.14 (DB 1.1.14) to v1.1.17
2019/02/02 15:25:50 - INSTALL: always: Upgrading from v1.1.11 (DB 1.1.11) to v1.1.14
2019/02/02 15:25:49 - INSTALL: always: Upgrading from v1.1.8 (DB 1.1.8) to v1.1.11
2019/02/02 15:25:49 - INSTALL: always: Upgrading from v1.1.7 (DB 1.1.7) to v1.1.8
2019/02/02 15:25:49 - INSTALL: always: Upgrading from v1.1.6 (DB 1.1.6) to v1.1.7
2019/02/02 15:25:49 - INSTALL: always: Upgrading from v1.1.4 (DB 1.1.4) to v1.1.6
2019/02/02 15:25:49 - INSTALL: always: Upgrading from v1.1.2 (DB 1.1.2) to v1.1.4
2019/02/02 15:25:49 - INSTALL: always: Upgrading from v1.0.5 (DB 1.0.5) to v1.1.2
2019/02/02 15:25:48 - INSTALL: always: Upgrading from v1.0.4 (DB 1.0.4) to v1.0.5
2019/02/02 15:25:48 - INSTALL: always: Upgrading from v1.0.0 (DB 1.0.0) to v1.0.4
2019/02/02 15:25:43 - INSTALL: always: Upgrading from v0.8.8h (DB 1.2.1 (DB: 0.8.8h)) to v1.0.0
2019/02/02 15:25:43 - INSTALL: always: NOTE: Using temporary file for db cache: /tmp/cdu34awLL
2019/02/02 15:25:43 - INSTALL: always: Switched from to /tmp/cdu34awLL
2019/02/02 15:25:43 - INSTALL: always: Converting Table #113 'version'
2019/02/02 15:25:42 - INSTALL: always: Converting Table #112 'vdef_items'
2019/02/02 15:25:42 - INSTALL: always: Converting Table #111 'vdef'
2019/02/02 15:25:42 - INSTALL: always: Converting Table #110 'user_log'
2019/02/02 15:25:42 - INSTALL: always: Converting Table #109 'user_domains_ldap'
2019/02/02 15:25:42 - INSTALL: always: Converting Table #108 'user_domains'
2019/02/02 15:25:42 - INSTALL: always: Converting Table #107 'user_auth_realm'
2019/02/02 15:25:42 - INSTALL: always: Converting Table #106 'user_auth_perms'
2019/02/02 15:25:42 - INSTALL: always: Converting Table #105 'user_auth_group_realm'
2019/02/02 15:25:42 - INSTALL: always: Converting Table #104 'user_auth_group_perms'
2019/02/02 15:25:42 - INSTALL: always: Converting Table #103 'user_auth_group_members'
2019/02/02 15:25:41 - INSTALL: always: Converting Table #102 'user_auth_group'
2019/02/02 15:25:41 - INSTALL: always: Converting Table #101 'user_auth_cache'
2019/02/02 15:25:41 - INSTALL: always: Converting Table #100 'user_auth'
2019/02/02 15:25:41 - INSTALL: always: Converting Table #99 'snmpagent_notifications_log'
2019/02/02 15:25:41 - INSTALL: always: Converting Table #98 'snmpagent_mibs'
2019/02/02 15:25:41 - INSTALL: always: Converting Table #97 'snmpagent_managers_notifications'
2019/02/02 15:25:41 - INSTALL: always: Converting Table #96 'snmpagent_managers'
2019/02/02 15:25:41 - INSTALL: always: Converting Table #95 'snmpagent_cache_textual_conventions'
2019/02/02 15:25:41 - INSTALL: always: Converting Table #94 'snmpagent_cache_notifications'
2019/02/02 15:25:40 - INSTALL: always: Converting Table #93 'snmpagent_cache'
2019/02/02 15:25:40 - INSTALL: always: Converting Table #92 'snmp_query_graph_sv'
2019/02/02 15:25:40 - INSTALL: always: Converting Table #91 'snmp_query_graph_rrd_sv'
2019/02/02 15:25:40 - INSTALL: always: Converting Table #90 'snmp_query_graph_rrd'
2019/02/02 15:25:40 - INSTALL: always: Converting Table #89 'snmp_query_graph'
2019/02/02 15:25:40 - INSTALL: always: Converting Table #88 'snmp_query'
2019/02/02 15:25:40 - INSTALL: always: Converting Table #87 'sites'
2019/02/02 15:25:40 - INSTALL: always: Converting Table #86 'settings_user_group'
2019/02/02 15:25:40 - INSTALL: always: Converting Table #85 'settings_user'
2019/02/02 15:25:40 - INSTALL: always: Converting Table #84 'settings_tree'
2019/02/02 15:25:40 - INSTALL: always: Converting Table #83 'settings_graphs'
2019/02/02 15:25:39 - INSTALL: always: Converting Table #82 'settings'
2019/02/02 15:25:39 - INSTALL: always: Converting Table #81 'sessions'
2019/02/02 15:25:39 - INSTALL: always: Converting Table #80 'rra_cf'
2019/02/02 15:25:39 - INSTALL: always: Converting Table #79 'rra'
2019/02/02 15:25:39 - INSTALL: always: Converting Table #78 'reports_items'
2019/02/02 15:25:39 - INSTALL: always: Converting Table #77 'reports'
2019/02/02 15:25:39 - INSTALL: always: Converting Table #76 'poller_time'
2019/02/02 15:25:39 - INSTALL: always: Converting Table #75 'poller_resource_cache'
2019/02/02 15:25:39 - INSTALL: always: Converting Table #74 'poller_reindex'
2019/02/02 15:25:39 - INSTALL: always: Converting Table #73 'poller_output_realtime'
2019/02/02 15:25:38 - INSTALL: always: Converting Table #72 'poller_output_boost_processes'
2019/02/02 15:25:38 - INSTALL: always: Converting Table #71 'poller_output_boost'
2019/02/02 15:25:38 - INSTALL: always: Converting Table #70 'poller_output'
2019/02/02 15:25:38 - INSTALL: always: Converting Table #69 'poller_item'
2019/02/02 15:25:38 - INSTALL: always: Converting Table #68 'poller_data_template_field_mappings'
2019/02/02 15:25:38 - INSTALL: always: Converting Table #67 'poller_command'
2019/02/02 15:25:38 - INSTALL: always: Converting Table #66 'poller'
2019/02/02 15:25:38 - INSTALL: always: Converting Table #65 'plugin_realms'
2019/02/02 15:25:38 - INSTALL: always: Converting Table #64 'plugin_hooks'
2019/02/02 15:25:38 - INSTALL: always: Converting Table #63 'plugin_db_changes'
2019/02/02 15:25:38 - INSTALL: always: Converting Table #62 'plugin_config'
2019/02/02 15:25:38 - INSTALL: always: Converting Table #61 'host_template_snmp_query'
2019/02/02 15:25:37 - INSTALL: always: Converting Table #60 'host_template_graph'
2019/02/02 15:25:37 - INSTALL: always: Converting Table #59 'host_template'
2019/02/02 15:25:37 - INSTALL: always: Converting Table #58 'host_snmp_query'
2019/02/02 15:25:37 - INSTALL: always: Converting Table #57 'host_snmp_cache'
2019/02/02 15:25:37 - INSTALL: always: Converting Table #56 'host_graph'
2019/02/02 15:25:37 - INSTALL: always: Converting Table #55 'host'
2019/02/02 15:25:37 - INSTALL: always: Converting Table #54 'graph_tree_items'
2019/02/02 15:25:37 - INSTALL: always: Converting Table #53 'graph_tree'
2019/02/02 15:25:37 - INSTALL: always: Converting Table #52 'graph_templates_item'
2019/02/02 15:25:37 - INSTALL: always: Converting Table #51 'graph_templates_graph'
2019/02/02 15:25:37 - INSTALL: always: Converting Table #50 'graph_templates_gprint'
2019/02/02 15:25:36 - INSTALL: always: Converting Table #49 'graph_templates'
2019/02/02 15:25:36 - INSTALL: always: Converting Table #48 'graph_template_input_defs'
2019/02/02 15:25:36 - INSTALL: always: Converting Table #47 'graph_template_input'
2019/02/02 15:25:36 - INSTALL: always: Converting Table #46 'graph_local'
2019/02/02 15:25:36 - INSTALL: always: Converting Table #45 'external_links'
2019/02/02 15:25:36 - INSTALL: always: Converting Table #44 'data_template_rrd'
2019/02/02 15:25:36 - INSTALL: always: Converting Table #43 'data_template_data_rra'
2019/02/02 15:25:36 - INSTALL: always: Converting Table #42 'data_template_data'
2019/02/02 15:25:36 - INSTALL: always: Converting Table #41 'data_template'
2019/02/02 15:25:36 - INSTALL: always: Converting Table #40 'data_source_stats_yearly'
2019/02/02 15:25:36 - INSTALL: always: Converting Table #39 'data_source_stats_weekly'
2019/02/02 15:25:35 - INSTALL: always: Converting Table #38 'data_source_stats_monthly'
2019/02/02 15:25:35 - INSTALL: always: Converting Table #37 'data_source_stats_hourly_last'
2019/02/02 15:25:35 - INSTALL: always: Converting Table #36 'data_source_stats_hourly_cache'
2019/02/02 15:25:35 - INSTALL: always: Converting Table #35 'data_source_stats_hourly' 
netniV commented 5 years ago

OK, this is the second database to get stuck at the 1.1.34 upgrade yet there does not appear to be a reason for it. Is there any chance you can export (mysqldump) and send it, or a link to it, developers@cacti.net. I would like to take the chance to see if this is a true database issue, code issue or something in the environment.

Also, can you confirm the operating system and method of install (package, source, git?).

pedro-nonfree commented 5 years ago

It is a mix of apt debian package transition to git latest release. I used this guide https://gitlab.com/guifi-exo/wiki/blob/master/howto/cacti.md so I hope is reproduceable (Debian stable). I sent an email with mysqldump

I'm trying to reproduce bug, I did

apt purge cacti
apt install cacti

OK, because I have to change again the this (it is in the guide):

adapt location in apache config file in /etc/apache2/conf-enabled/cacti.conf

-Alias /cacti /usr/share/cacti/site
+Alias /cacti /usr/local/src/cacti

-<Directory /usr/share/cacti/site>
+<Directory /usr/local/src/cacti>
pedro-nonfree commented 5 years ago

using develop version of file install/upgrades/1_1_34.php from @cigamit fails

2019-02-02-210306_811x75_scrot

but I did again the whole process (without @cigamit develop file) and it worked. So I cannot reproduce the bug (the first run I did probably I run into side effects trying to tune up everything...?). Now it works for the whole migration (from 0.8.8a to 1.2.1)

netniV commented 5 years ago

Yeah I was going to say that your DB dump is already at 1.2.1 and looks right. Strangely, whilst @cigamit's version failed for you, it wasn't because of his code but the existing stuff where it drops the primary key. Despite that, it still readded it and carried on next time.

I don't suppose you have a backup of your 0.8.8 database from before you started the whole upgrade process?

cigamit commented 5 years ago

Well for sure a 0.8.x user would not have realm 26. Could that have something to do with it?

pedro-nonfree commented 5 years ago

@netniV In my case I'm not having data on 0.8.8 this time. It is the startup database generated by debian 9 stable just doing apt install cacti. => But well, I send it this db file too by email that I generated with docker run -h debian-test -it -P debian:9 bash

netniV commented 5 years ago

Well for sure a 0.8.x user would not have realm 26. Could that have something to do with it?

No, the auth code of 1.2.x would add that anyway.

netniV commented 5 years ago

@netniV In my case I'm not having data on 0.8.8 this time. It is the startup database generated by debian 9 stable just doing apt install cacti. => But well, I send it this db file too by email that I generated with docker run -h debian-test -it -P debian:9 bash

OK, that makes much more sense if it's already on 1.2 it wouldn't do the realm upgrade code again. The answer there is to take out the version check just to make sure the system is never left with no one who can upgrade/install.

Just for your reference, since you were not upgrading from 0.8.8a, you really should have opened a separate issue for it to avoid confusion.

crequill commented 5 years ago

Can you check your apache error logs and if necessary your PHP logs

No nothing in logs

crequill commented 5 years ago

@netniV As you said for @pedro-nonfree, I launch cli/upgrade_database.php:

Upgrading from v1.1.34
Upgrading from v1.1.34 (DB 1.1.34) to v1.1.35
+++
Upgrading from v1.1.35 (DB 1.1.35) to v1.1.36

Upgrading from v1.1.36 (DB 1.1.36) to v1.1.37
+
Upgrading from v1.1.37 (DB 1.1.37) to v1.2.0
++++++++++++++++++++++++++++++++++++++++
Upgrading from v1.2.0 (DB 1.2.0) to v1.2.1
++

After that all is OK : I can log in at the interface normally.

netniV commented 5 years ago

another user has demonstrated that he had three columns show up with the name 'password' which i'm not even sure how that's possible. I am wondering if a similar issue exists for yourselves.

https://github.com/Cacti/cacti/issues/2360#issuecomment-460340941

crequill commented 5 years ago

No problem of password for me.

SELECT COLUMN_NAME,CHARACTER_MAXIMUM_LENGTH FROM information_schema.columns WHERE table_name = 'user_auth' and column_name IN ('password');
+-------------+--------------------------+
| COLUMN_NAME | CHARACTER_MAXIMUM_LENGTH |
+-------------+--------------------------+
| password    |                      256 |
+-------------+--------------------------+
1 row in set (0.066 sec)
netniV commented 5 years ago

This appears to now be resolved in 3f7442d75b81f7faa1767f455d523e4441285acb