Can't login following new install + full restore

Can't login following new install + full restore

by Rick Sparrow -
Number of replies: 5

Hi there, hoping someone can help!

Our Moodle server had hardware problems...I'm reinstalling from scratch, including reinstalling Ubuntu Server 12.04.1 LTS 64-bit onto a new hard disk.

I have a good backup of the moodle database, the moodle code directory, and the moodledata directory from before things went haywire.

I thought I'd take the opportunity to upgrade Moodle to the latest 2.4.1 but am having issues and am hoping someone can clarify the restore process.

1) After fresh install of Ubuntu + LAMP, used GIT to download Moodle 2.4.1 and successfully installed Moodle using the web browser-based script. I installed using the same directory paths and database settings/usernames as before. The default, black & white and bare bones Moodle home page appeared. I entered a new Moodle admin password and was good.

2) Next, I imported the database I backed up earlier, as well as restored the original moodledata folder.

3) Now, when I went back to our moodle login page, local admin can't login. I read elsewhere here to check the config.php and copy over the $CFG->passwordsaltmain = line. I did that, but I still can't login!

What am I doing wrong? How can I reset this so I can get back on?

If all else fails, can I restore the database, moodledata, and orignal moodle code folders? config.php is the only file i copied over from the old moodle code directory, as I was hoping to keep the newer version of Moodle installed (the previous version being 2.4)

Is it necessary to run the install script to properly setup Moodle, or should restoring the moodle directory, database, and moodledata directory suffice?

I'm wondering if my problem is trying to do a restore/upgrade at the same time. That is, new Moodle install + old Moodledata + old database? Should I be restoring the original three components, then try the upgrade?

Any help would be greatly appreciated! Thanks in advance.

Rick

Average of ratings: -
In reply to Rick Sparrow

Re: Can't login following new install + full restore

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

When I have done this, I have always installed the database and the moodledata folder before adding the new Moodle folder.  This way the install takes your existing data from the original data instead of creating new data and then you copied over it.  I am guessing you have a conflict with 2 admin users - one from the fresh install and one from when you copied over your data.

I would check in the database first and see if there are two entries for admin there.  If you have to start from scratch - bring your database and moodledata over first and then install moodle.  What version where you on before?  If too old, you might need to install in interim version, get it all running and then upgrade to latest version.

 

In reply to Rick Sparrow

Re: Can't login following new install + full restore

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

When I have done this, I have always installed the database and the moodledata folder before adding the new Moodle folder.  This way the install takes your existing data from the original data instead of creating new data and then you copied over it.  I am guessing you have a conflict with 2 admin users - one from the fresh install and one from when you copied over your data.

I would check in the database first and see if there are two entries for admin there.  If you have to start from scratch - bring your database and moodledata over first and then install moodle.  What version where you on before?  If too old, you might need to install in interim version, get it all running and then upgrade to latest version.

 

In reply to Rick Sparrow

Re: Can't login following new install + full restore

by Ken Task -
Picture of Particularly helpful Moodlers

You've not mentioned what the original version of Moodle was.  Can go to 2.4.+ only from a 2.3.x.  Check the old code directory files version.php file to see what you had.

Might be best to 'git' the code for the same version you were running - even if that which is in 'git' is slightly newer it results in an upgrade within the series.  Recommended before moving upwards anyway.   Move first ... get up and running.  Then look at upgrading to next highest version.

Make sure you save the originial config.php file some place safe during your migrations.  That has the original unique password salt.

When restoring a site, the information in the DB and the contents of the moodledata directory must match ... new file system.

Think I'd 'start over' in your case. ;)

'spirit of sharing', Ken

Average of ratings: Useful (2)
In reply to Rick Sparrow

Re: Can't login following new install + full restore

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
What you are trying to do is a migration, in this case from one server to another. Check http://docs.moodle.org/24/en/Moodle_migration.
Average of ratings: Useful (1)
In reply to Visvanath Ratnaweera

Re: Can't login following new install + full restore

by Rick Sparrow -

Thanks for the feedback everyone. I ended up restoring all three components, instead of trying to use the new 2.4.1 code (the version I restored was 2.4) and that did the trick. Guess I'll try upgrading from 2.4 to 2.41 separately.