Problem upgrading from 2.6.1 to 2.9 (different OS and DB)

Problem upgrading from 2.6.1 to 2.9 (different OS and DB)

by Marius Jugariu -
Number of replies: 9

Hello,

Need some help with a problem please

System A: Moode 2.6.1, CentOS 5.10 running MySQL (with latest PHP)
System B: Moodle 2.9 (latest stable), CentOS 6.5 running MariaDB (with latest PHP)

I am looking to migrate Moodle from A to B.

I have done the following:
- copied over the moodledata folder with rsync
- have set up appropriate folder permissions
- created an empty database on system B
- did a mysqldump from system A to B into the empty database
- copied over and configured accordingly config.php on system B
- converted tables from InnoDB to Barracuda on system B

Appart from an ldap issue which I commented out for now to sort it out later, I am getting "Error reading from database" with no other comments or any other info when I try to continue with the migration.

Any suggestions please?

Average of ratings: -
In reply to Marius Jugariu

Re: Problem upgrading from 2.6.1 to 2.9 (different OS and DB)

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Assuming your database is running....

Your GRANT command doesn't match what you put in your config.php in some respect. If the web server and database are on different machines (hostname is something other than 'localhost') I would repeat the GRANT with the IP if you used the hostname - or vice versa. 

Mariadb is fully compatible with MySQL so it won't be that. 

In reply to Howard Miller

Re: Problem upgrading from 2.6.1 to 2.9 (different OS and DB)

by Marius Jugariu -

Hi Howard,

Thanks for your reply. The database is running. The database and web server are on the same machine, the hostname is localhost. I have checked and there are appropriate permissions for database and folder access.

Still can't figure what the problem might be ;(

In reply to Marius Jugariu

Re: Problem upgrading from 2.6.1 to 2.9 (different OS and DB)

by Ken Task -
Picture of Particularly helpful Moodlers

Pardon intrusion ...

In CentOS 6.6 does it still use SELinux?   In the past, SELinux on by default.   Might set from enforcing to 'permissive'.

cd /etc/selinux

nano config

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#    enforcing - SELinux security policy is enforced.
#    permissive - SELinux prints warnings instead of enforcing.
#    disabled - SELinux is fully disabled.
SELINUX=permissive <--- CHANGE THIS

Reboot box and watch the boot up for any issues dealing with SELinux.

Also, localhost DB should be using mysqli (see the 'i' on the end of that?).   It's not connecting to the MySQL port, but rather, it should be using a 'socket' connection to the DB.


$CFG->dbtype    = 'mysqli';

From a terminal session on the server, see if you can connect to the DB as the same user you have set in config.php of Moodle using the same password in the config.php:

mysql -u [moodleuser] -p[moodleuserpassword]

And, as Howard as already mentioned, does that user have the permissions it needs to run Moodle?

Gonna put a plug in here for git.   Hope you installed the 2.9 using git.   That will make your Moodle/OS admin role much much much easier.  My 2 cents, of course.

'spirit of sharing', Ken


In reply to Ken Task

Re: Problem upgrading from 2.6.1 to 2.9 (different OS and DB)

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Nope...  it should be

$CFG->dbtype = 'mariadb';


In reply to Howard Miller

Re: Problem upgrading from 2.6.1 to 2.9 (different OS and DB)

by Ken Task -
Picture of Particularly helpful Moodlers

< Begin-red-in-face >

You are 100% correct, Howard,   Apologies for my confused state and not taking it a little slower in reponse.

< /end red-in-face >

'spirit of sharing', Ken

In reply to Ken Task

Re: Problem upgrading from 2.6.1 to 2.9 (different OS and DB)

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

"You are 100% correct, Howard"

Not according to my wife wink

In reply to Ken Task

Re: Problem upgrading from 2.6.1 to 2.9 (different OS and DB)

by Marius Jugariu -

Thank you both, Ken and Howard.

SELINUX It is already set to "enforcing". I changed it to permissive and restarted it to see if it makes a difference but no joy so I changed it back to enforcing, the way it was.

Yes, I am able to connect to the database via SSH (with Putty) and execute commands so the database is definitely working. I can also see all the tables, etc. from phpmyadmin.

In config.php I have it as:

<?php  // Moodle configuration file
 
unset($CFG);
global $CFG;
$CFG = new stdClass();
 
$CFG->dbtype    = 'mariadb';
$CFG->dblibrary = 'native';
$CFG->dbhost    = 'localhost';
$CFG->dbname    = '[content]';
$CFG->dbuser    = 'root';
$CFG->dbpass    = '[content]';
$CFG->prefix    = 'mdl_';
$CFG->dboptions = array (
  'dbpersist' => 0,
  'dbsocket' => 1,
);
 
$CFG->wwwroot   = '[content]';
$CFG->dataroot  = '/var/www/moodledata';
$CFG->admin     = 'admin';
 
$CFG->directorypermissions = 0777;
 
$CFG->passwordsaltmain = '[content]';
 
require_once(dirname(__FILE__) . '/lib/setup.php');


libxml_disable_entity_loader(false);
 
// There is no php closing tag in this file,
// it is intentional because it prevents trailing whitespace problems!


Any other thoughts? sad

In reply to Marius Jugariu

Re: Problem upgrading from 2.6.1 to 2.9 (different OS and DB)

by Ken Task -
Picture of Particularly helpful Moodlers

Add the debug lines to the config.php file.

Still think SELinux might be involved there.  Did you check your secure/apache error logs to see if there were any references to SELinux allowing in permissive mode that would also indicate it would deny if it were enforcing?

Ok ... I know others might dis-agree, but ... you are trying to not only move but upgrade in one step.

Might be a little more work but think it best to move the site you've got first to the new server.   That is easier to do as 1st step.   You need a copy of the data directory and an sql dump and the config.php file of the 2.6.x.   On the new server use git to acquire the latest 2.6.x code, move your config.php file into the new code directory - edit config.php for new server.  NOTE: if the URL is going to change then one needs to search/replace for http://oldsite/ replace with http://newsite/.   In other words, get the old site to the new server up and running.   That will result in a minor update of the site.

Do a full site backup once you get it working.   This becomes the fall back point should any steps upwards fail.

Then, using git, march it upwards to 2.7.highest.   At that point, stop ... check the site for errors.   Get updates to plugins etc..    Working?  OK, another full site backup ... that backup now becomes the fall back point.

Then, using git again, march it upwards to 2.8.highest.

Know that takes longer but have found that there are fewer issues lurking for later discovery.

'spirit of sharing', Ken


In reply to Ken Task

Re: Problem upgrading from 2.6.1 to 2.9 (different OS and DB)

by mohammad moreb -

its simply just delete the config file and use empty DB then the system will generate new config file copy new code and add to your olde config file with olde DB name and path

<?php  // Moodle configuration file

unset($CFG);
global $CFG;
$CFG = new stdClass();

$CFG->dbtype    = 'mysqli';
$CFG->dblibrary = 'native';
$CFG->dbhost    = 'localhost';
$CFG->dbname    = '***';
$CFG->dbuser    = '****';
$CFG->dbpass    = '*******';
$CFG->prefix    = 'mdl_';
$CFG->dboptions = array (
  'dbpersist' => 0,
  'dbport' => '',
  'dbsocket' => '',
);

$CFG->wwwroot   = 'http://*****';
$CFG->dataroot  = 'D:\\*****4';
$CFG->admin     = 'admin';

$CFG->directorypermissions = 0777;

require_once(dirname(__FILE__) . '/lib/setup.php');

// There is no php closing tag in this file,
// it is intentional because it prevents trailing whitespace problems!