I am trying to copy a course from one server to another, but get the following error on trying to restore the course:
# Checking user data
. . . . . . . . . .
Some problems were detected when checking user data (Trying to restore user 'admin' from backup file will cause conflict)
An error has occurred and the restore could not be completed!
The situation is:
- I am admin of both Moodle systems.
- The backed up course is in a Moodle 1.9.4+ system
- I am trying to restore this course into a Moodle 1.9.7 system (downloaded 27th Jan, 2010)
- The backed up course included all course users, of which I am one (role = teacher)
- When I backed up the course without users, the restore worked.
Any suggestions will be greatly appreciated.
I had this problem just recently and found that the solution was to untick "Administrator" at the bottom of the backup window (see screenshot below).
I've also found it useful to create several accounts for myself: one as admin, one as teacher, one as student. And then only to use the admin account for doing admin things ; I do almost everything in my "teacher" rôle.
Thank your for your reply.
Unfortunately, I'm still not able to copy the course content and its users to another another moodle system. Here's what I tried:
- While logged in as an admin I de-selected Administrator (and Course Creator) as you suggested, and then backed up the course.
- In the other Moodle, again logged in as an admin, I tried to restore the course and again got the same error message as described above.
- I again tried to restore the course, but this time logged in as a teacher. I was able to restore the course, but not any users.
I must be missing something. I wonder if there is a solution?
That's a very useful comment. I'd thought I should have exactly the same username, password and email for my online and local "admin" and "teacher" accounts. Now I realise they should be different.
Thanks a lot,
Thank you for your help.
My username in both systems was the same. Changing my username in the new system allowed me to copy the course from the old system and restore it into the new system.
BUT, none of the user data was copied over. The participant list in the new course is empty, as is the list of users viewable from the top page - as the admin, I am the only user listed. However, activities in this course-copy contain 'ghosts' of the original students, their names and activities are still visible (e.g. forum postings are preserved, quiz attempts are visible), but clicking on a student name shows a profile headed with, "This user account has been deleted". When I backed up the original course and did the restore, I made sure that all user data was included, and the backup included all course users. I have also looked in the moodle.xml file contained within the zipped course, and have confirmed that all the user data was included in the backup.
Any ideas how to ensure that users are also copied over with the course contents?
We are also experiencing the same issue with restore since upgrading to 1.9.7. We are currently trying to restore between our development and production environments.
Just to clarify what you are saying here:
If the admin account has the same username and email address in both servers, then this will cause the restore to fail?
What if there are LDAP authenticated accounts that are assigned the administrator role? These would obviously be duplicated (all attributes including pwd) since there is only a single directory.
I've tried the following things but have still not been able to get around this error.
1) Changed admin account passwords on both servers to a different password, then doing a fresh backup and restore
2) Set different password salt on both servers, changed the admin account passwords again, the did a fresh backup and restore.
If anyone can help that would be greatly appreciated, as we are needing to restore many (>100) courses to be ready for the beginning of semester.
I should add that the message is different in that it lists about 7 user accounts that are LDAP accounts???
In my case the user names and e-mail addresses are different on both servers, still I receive this error when trying to restore courses.
I've tried backing up with no user data in teacher role and unchecking all roles in the backup window and still get this error.
This is creating a major roadblock in how we use courses. A sure-fire work around would be helpful. I don't have the coding skills to make it happen but my suggestion would be to create a backup option for "public archived" courses that contain no user info or any server info, or any other kind of info that would prevent them from being easily moved from one server to another.
Any help appreciated,
I thought selecting "none" on user data when creating the backup would be enough. You have to make sure they are also set to NO and NONE during the restore process too.
With ALL of these set to NONE and NO, I get a clean moodle.xml file without user info that should restore to ANY Moodle server.
I'd appreciate it if someone could test this and download this course and then restore it. It should work.
If you want to test whether a backup file will restore on a different Moodle server, please feel free to try uploading it to our Moodle demonstration site.
Everyone, if you're trying to backup and restore a course with user data to a different server and have tried following the suggestions in this discussion but are still having problems, please create an issue in the Moodle Tracker. (You'll need a tracker account in order to create an issue.)
thanks !!!!! i changed the password, was different. it's ok now.
1.) Test case 1: the admin account with different password in both moodle sites.
Results : we can restore the backup file successfully.
2.) Test case 2 : the admin account with different surname in both moodle sites.
Results : we can restore the backup file successfully.
3.) Test case 3 : The admin account with different email address in both moodle sites.
Results : we can’t restore the backup file!
4.) Test case 4 : only a teacher with different email address in both moodle sites.
Results : we can’t restore the backup file!
Please note that I did a fresh backup and restore for each test case.
I don’t think it is due to the password problem. It is because I found the problem will be occurred if the email addresses of either 'admin' or teacher account are different in both servers. Below are two more test cases for your reference:
Test Case 5:
I change the email address of a teacher and backup the course in one of my Moodle server (1.9.7+, build 20091230, let’s call it MoodleA). Then, I tried to restore the backup file in two other Moodle servers. One is in 1.9.7+ build 20091214 (let’s call it MoodleB) and the other is in 1.9.7+, build 20091116 (let’s call it MoodleC). I can successfully restore the course in MoodleB and MoodleC.
However, when I tried to restore the file in another Moodle server (1.9.7+, build 20091230, let’s call it MoodleD), the error occurred. Then, I change the email address of that teacher account to the same as my target Moodle server (ie another 1.9.7+, build 20091230) and backup the course again. I can successfully restore the course in my Moodle server.
Test Case 6:
I change the email address of a teacher (to a different email addresses) and backup the course in MoodleB. Then, I tried to restore the backup file MoodleD. In this case, I can successfully restore the course in MoodleD.
Thanks very much!!
I think that we may be on the wrong track in trying to change accounts/pwds in order to get a course to restore. I've read a long discussion in MDL-16658 about the changes to the restore functionality in version 1.9.7.
The whole purpose of the change is to match users (either on the same server or from different servers) by their username, email address and mnet host. For example, if the username is the same but the email is different then the restore is flagging that there could be a conflict and stops.
The problem that I was experiencing was twofold.
- We had an issue with our mnet host table and some missing records. This is described in this bug here:MDL-16879 So even though our users had matching username and email addresses, the mnet host was different causing a potential conflict. In other words, check the mnet hosts table on both servers to make sure that there is a 'localhost' record in the table.
- The second problem was that both servers (in fact all 3 in our environment) had identical site identifiers. This causes the restore to always think that the backup was taken on the same server, even though it was imported from another server. This can happen if you use any method of cloning your server (in our case we used virtual machine templates to create the 3 servers). To check this simply compare the 'siteidentifier' record from the mdl_config table on each server. If they are identical delete the record and a new identifier will be automatically generated.
I haven't completely finished fixing this problem though (trying to find time when the server isn't being used), but it may be worth checking these two things in your environments to see if they are affecting your restores.
Hope this helps.
We had this problem as well, trying to restore a backup from one site to another, with the target being a clone of the source site. It was the siteidentifier record as you so rightly pointed out. As soon as thet was deleted, the restore worked.
We had to rebuild our instance of 1.9.7 the other day, and I made a few backups as Admin of 2 courses.
I can't restore, and I'm wondering if the above fix will pertain to us as we have the same server, but a new instance?
I have emailed our apps development people, but still waiting to hear their thoughts.
Needless to say, the "admin" user is created by default, so there was a conflict restoring my course to even a fresh moodle server.
I did overcome the problem moments ago by:
- unziping the backup ZIP to my workstation
- search all its files for "admin"... it was only in "moodle.xml"
- looking at the XML file I noticed a "<USERS>" tag under which there were numerous "<USER>" (not plural like the first) tags.
- I hand deleted the all lines from <USER> to </USER> that identified the "admin" user and ZIPped the files again... not just the one line that had the "admin" string
- uploaded the custom ZIP
- restored it
It has been a long day changing passwords, e-mail addresses, usernames . . . deselecting this that and the other thing, selecting this that and the other thing . . . seemingly every possible combination. I do not have access to the orginating server, but do on what is our new server . . . made a one character change on the root admin username and presto . . . now restoring courses from the old to the new - without any issues!!
I was able to restore my backup by changing the Admin user or by creating a new Admin. However, I can only do this if my webroot is pointed to localhost. I tried doing the same thing on a published Moodle, still I'm getting the user conflict error.
I have two moodle instances running on the same server, different sub-domains. Initially, they were setup as two different sites available to the LMS subscribers. In rare circumstances, people registered (and used) both sites. Now the owner of the two domains wishes to merge the courses, users, and their associated data from the older site to the newer, unified site.
That's fine, however when I try to import the courses from the soon-to-be-retired site into the newer site, I get the error "Trying to restore user 'xyz' from backup file will cause conflict".
The usernames / email addresses are identical, however the firstaccess dates and site identifiers are different.
Is there a way to import the course from the old site, and retain the user course data (i.e. grades)? Can I bypass some of the checking in restorelib.php restore_check_user?
Thanks for the solution. I managed to restore course by changing admin user name from 'admin' to 'admin1' in new server (without changing password or email address although my old and new moodle site have different admin email) then unclick all user data (plus users = none) in restore process.
That worked. I changed the user name 'admin' to admin1' and it was successful..
FWIW, I don't think that having to have different usernames/passwords on different sites is neccessarily acceptable. We have a number of sites with LDAP authentication and the administrator username is (of course) exactly the same on all of them (and can't be changed)
Deleting the 'siteidentifier' record didn't work for me. Also changing the 'admin' username was not an option.
1. For the 'admin' user,
Data for user 'admin' (username, password, e-mail, ..etc) must match on both instances (old moodle and new moodle). If You don't know the old 'admin' data, just change the 'admin' username, as suggested.
2. As for the other users,
My guess is that the problem is related with the ORIGINAL_WWWROOT element on the moodle.xml file. Moodle thinks that the course is being restored into the same instance of (moodle) that the backup was generated from. Try changing the hostname part of the ORIGINAL_WWWROOT element (to localhost, for instance):
That should work.
I have faced same situation as described, and I was finally able to overcome it by un-checking all the "User Data" checkboxes just before taking the final step in restoring the course.
This way I prevent from restoring (overwriting) user data that might collide with existing same-named users.
You may lost user's "progress status" but you will be able to successfully restore your courses.
So, go give it a try!
And then share your experience w/us.
Solution that worked for me
I had a backed up Moodle course in V1.6 some years ago. I have just installed v1.9 and thought it would be nice to restore it. Like you I restored the course and had the same message as you about the admin conflict.
The solution that worked for me was to create a new user account in v1.9 and assign it as a 'Teacher' role. This role gives the permission for 'Teachers' to restore courses.
I then used that login to restore the course and it worked. I guess because I 'wasn't admin' and therefore causing a problem.
i had face the same problem a few days ago. i solved it doing the following. In the Moodle i wanted to restore the course i just renamed my admin's username (from site administration-->Users-->accounts...) from admin to administrator!
The course was restored successfully after that! So simple!
Thank you for this. I've been beating my head over it since yesterday. A perfect and elegant solution.
I've noticed that if using Moodle 2.0x you'll may need to rename the '...backup.mbz' file to '...backup.zip' so you can open & alter the file (remember to rename it back before you uplaod!)
Open the user file insdie the zip and rename 'admin' to something like 'codeadmin' or 'tempadmin'. You can then delete that user after you've restored the course.
I hope this helps
para arreglar la copia de seguridad y no de problema con el usuario admin en el momento de restaurar.
- en el archivo moodle.xml que se encuentra dentro de la copia construida
- busque MOODLE_BACKUP/USERS/USER/<USERNAME>admin</USERNAME> y elimina esta estructura USER completa
Just ran across this issue for the first time while trying to copy an existing course from one server to a new Moodle application on another server. (2.0+ to 2.0+). I was hoping to retain the User data in the backup/restore process. Because I had done this many times before without issues I was trying to figure out what was different about this one Vs. the past??
Realized that on the new application (we'll call this App#2) I had used a different email address than in my original application (call this App#1). (The Username and Password were both the same in both apps).
- I did a backup in App #1 including User data
- In App#2 I went to my Profile and changed the email address to the same as in App#1. So now the Username, Password and email address were exactly the same in both App#1 and App#2.
- In App#2 did the Restore including User data
- Restore went like clockwork. Successful.
- In App#2 returned to my Profile and changed the email address back to the one I use as admin for this site.
- Went back to new course in App#2, logged out, logged back in everything worked business-as-usual.
I was wondering if the details from my Profile in App#1 (picture, description, interests etc) would overwrite my Profile in App#2 but it did not.
Hope this was helpful.