opennetadmin / ona

OpenNetAdmin IP Address Management (IPAM) system
opennetadmin.com
GNU General Public License v2.0
136 stars 35 forks source link

Problem upgrading. #122

Closed Knitebane closed 6 years ago

Knitebane commented 6 years ago

Attempting to upgrade from 13.03.01 to 18.1.1 on Ubuntu 14.04, Apache 2.4.7, PHP 5.5.9, MariaDB 5.5.57

Either using the web upgrade or the cli I get a message about losing connectivity to the database.

CHECKING PREREQUISITES...

  PHP version greater than 5.0:               PASS
  PHP GMP module:                             PASS
  PHP XML module:                             PASS
  PHP mysqli function:                        PASS
  PHP mbstring function:                      PASS
  /opt/ona/www/local/config dir writable:     PASS
  /var/log/ona.log writable:                PASS

It looks as though you already have a version of OpenNetAdmin installed.
You should make a backup of the data for each context listed below before proceeding with this upgrade.

We will be upgrading to version 'v18.1.1'.

We have found 1 context(s) in your current db configuration file.

Context         DB type         Server          DB name         Version         Upgrade Index
DEFAULT         mysqli          localhost       ona_ona v13.03.01       11

Perform the upgrade? [y/N] : y
[DEFAULT/localhost] Keeping your original data.
There was an error upgrading tables. ERROR: Lost connection to MySQL server during query
There was a fatal error. Upgrade may be incomplete. Fix the issue and try again

I can manually connect to the database using the settings in database_settings.inc.php:

<?php

$ona_contexts=array (
  'DEFAULT' => 
  array (
    'databases' => 
    array (
      0 => 
      array (
        'db_type' => 'mysqli',
        'db_host' => 'localhost',
        'db_login' => 'ona_user',
        'db_passwd' => 'XXXX',
        'db_database' => 'ona_ona',
        'db_debug' => false,
      ),
    ),
    'description' => 'Default data context',
    'context_color' => '#D3DBFF',
  ),
);

?>

ona_user has ALL PRIVILEGES

I get this in the Apache logs:

[Fri Jan 05 20:24:13.366835 2018] [:error] [pid 607] [client 192.168.1.100:35716] PHP Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /opt/ona/www/include/adodb5/drivers/adodb-mysql.inc.php on line 462, referer: https://juno.knitebane.net/ona/?install_submit=Y&upgrade=Y

mattpascoe commented 6 years ago

hmm very strange.. I just tried this on my 14.04 instance and was unable to re-create the problem. I am however using mysql not mariadb.

Its odd you see the Deprecated error message in the apache log.. this would be something you would see if you didnt have the 'mysqli' type in your config. That most certainly is supported so it is strange.

I then looked into the 'Lost connection to MySQL server during query' message. one of the pages I read through (https://stackoverflow.com/questions/1884859/lost-connection-to-mysql-server-during-query) talks about mysql limits and timeouts etc. Nothing specifically relevant here but I'm wondering if anything is logging to your /var/log/mysql.err log file or similar.

ONA is not really that much of a DB hog so I cant imagine it reaching any limits.

A possible course might be to do a mysqldump of the ONA database. Then build out a new 16.04 system to import it into and perform the runinstaller=y upgrade. At least that might help us eliminate OS/ONA versions from the data in mysql. Plus you'll be on later versions of things..

Only other thing I could try to do at this point is use mariadb instead to try and re-create.

Knitebane commented 6 years ago

It ended up being a broken database server. I removed mariadb and installed mysql and re-ran the upgrade without issues.