Backup and restore

Trying to restore user 'admin' from backup file will cause conflict

 
Picture of Peter Ruthven-Stuart
Trying to restore user 'admin' from backup file will cause conflict
Plugin developers
Hello,

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:
  1. I am admin of both Moodle systems.
  2. The backed up course is in a Moodle 1.9.4+ system
  3. I am trying to restore this course into a Moodle 1.9.7 system (downloaded 27th Jan, 2010)
  4. The backed up course included all course users, of which I am one (role = teacher)
  5. When I backed up the course without users, the restore worked.
I assume this is a security feature. If so, how is an admin supposed to move a course and its users from one server to another, when he / she is also a participant in that course?

Any suggestions will be greatly appreciated.
 
Average of ratings: -
Picture of Glenys Hanson
Re: Trying to restore user 'admin' from backup file will cause conflict
 
Hi Peter,

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.

Cheers,
Glenys

 
Average of ratings: -
Picture of Peter Ruthven-Stuart
Re: Trying to restore user 'admin' from backup file will cause conflict
Plugin developers
Glenys,

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:
  1. While logged in as an admin I de-selected Administrator (and Course Creator) as you suggested, and then backed up the course.
  2. 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.
  3. 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.
So, I am in the odd position of being the admin in both systems, but unable to copy over a complete course (content and users) from one system to the other. I can see that this is to prevent the admin login details getting in to the wrong hands, but it also prevents the legitimate transferring over of content and users from one system to another.

I must be missing something. I wonder if there is a solution?


 
Average of ratings: -
Picture of Helen Foster
Re: Trying to restore user 'admin' from backup file will cause conflict
Core developersDocumentation writersMoodle HQParticularly helpful MoodlersPlugin developersTestersTranslators
Hi Peter,

Please can you check that the admin accounts on each server have unique usernames and email addresses and then try again to backup up the course with user data and restore it to your 1.9.7 site. Please provide feedback on how you get on.
 
Average of ratings: Useful (6)
Picture of Glenys Hanson
Re: Trying to restore user 'admin' from backup file will cause conflict
 
Hi Helen,

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,
Glenys
 
Average of ratings: -
Picture of Peter Ruthven-Stuart
Re: Trying to restore user 'admin' from backup file will cause conflict
Plugin developers
Hello Helen,

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?
 
Average of ratings: -
Picture of Don Tainsh
Re: Trying to restore user 'admin' from backup file will cause conflict
 

Helen,

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???

 
Average of ratings: -
Picture of Toms Urdze
Re: Trying to restore user 'admin' from backup file will cause conflict
 
Dear Helen,
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.
 
Average of ratings: -
Picture of Toms Urdze
Re: Trying to restore user 'admin' from backup file will cause conflict
 
Did everyone find a solution to this problem? Please, can you share it with me, because I still have not found a way how to restore the courses with user data on the new platform. Thanks!
 
Average of ratings: -
Picture of Paul Nelson
Re: Trying to restore user 'admin' from backup file will cause conflict
 
This is still a problem. I manage dozens of Moodle sites and need to move courses around at will. We also publish courses through sites like MoodleCommons.org. Before 1.97 we could do this easily. Now I can't move courses from server to server or create courses that can be downloaded by other users.

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,

wink Paul
 
Average of ratings: Useful (1)
Picture of Paul Nelson
Re: Trying to restore user 'admin' from backup file will cause conflict
 
I did discover one solution for restoring courses without user content, it's to be sure to select NONE at the settings dialog box at the bottom of the restore page when restoring from a zip file.

Duh...

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.

restore no user settings
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.

Course location:
http://training.orvsd.org/moodle/course/view.php?id=173
Restore file:
http://training.orvsd.org/moodle/file.php/173/orvsd_cybersafety.zip

wink Paul
 
Average of ratings: Useful (1)
Picture of Helen Foster
Re: Trying to restore user 'admin' from backup file will cause conflict
Core developersDocumentation writersMoodle HQParticularly helpful MoodlersPlugin developersTestersTranslators
Hi Paul,

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.)
 
Average of ratings: Useful (1)
Picture of ricardo baudel
Re: Trying to restore user 'admin' from backup file will cause conflict
 

thanks !!!!! i changed the password, was different. it's ok now.

Ricardo(Richard) Baudel

Brazil.

 

 
Average of ratings: -
Picture of Janny Ng
回應: Trying to restore user 'admin' from backup file will cause conflict
 
We experienced the same problem before. The problem was disappeared after we changed the email addresses of admin and teacher accounts to be identical in both servers. Below are the testing results for your reference:

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.

 
Average of ratings: Useful (3)
Frank Ralf
Re: 回應: Trying to restore user 'admin' from backup file will cause conflict
Documentation writersPlugin developers
Thanks for these test cases! I am wondering whether this might be related to MDL-20962.

 
Average of ratings: -
Picture of Janny Ng
回應: Re: 回應: Trying to restore user 'admin' from backup file will cause conflict
 
Frank,

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.

 
Average of ratings: -
Picture of Horacio Segura
Re: 回應: Trying to restore user 'admin' from backup file will cause conflict
 
Thanks!!
Thanks very much!!
 
Average of ratings: -
Picture of Don Tainsh
Re: Trying to restore user 'admin' from backup file will cause conflict
 

Hello All,

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.

  1. 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.
  2. 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.

 
Average of ratings: Useful (2)
Picture of Sean Keogh
Re: Trying to restore user 'admin' from backup file will cause conflict
 
Hi,

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.

cheers

Sean K
 
Average of ratings: -
Picture of jon catuccio
Re: Trying to restore user 'admin' from backup file will cause conflict
 
Hi all,

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.

thanks!
Jon
 
Average of ratings: -
Janak Sodha
Re: Trying to restore user 'admin' from backup file will cause conflict
 
Trying to restore course + use data from one server to (say) a local server on your PC : simple solution is to ensure the admin username + email address are the same on both servers.

Janak
 
Average of ratings: Useful (2)
Picture of William Confer
Re: Trying to restore user 'admin' from backup file will cause conflict
 
I just found this thread because I had the same problem; however, I did not have the luxury of the original server being alive... I only had a backup ZIP and a fresh moodle 1.9.8+ install.

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:
  1. unziping the backup ZIP to my workstation
  2. search all its files for "admin"... it was only in "moodle.xml"
  3. looking at the XML file I noticed a "<USERS>" tag under which there were numerous "<USER>" (not plural like the first) tags.
  4. 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
  5. uploaded the custom ZIP
  6. restored it
While this seems to have worked completely for me, I should hope this gets fixed so no one has to do anything like this. After all, it was just a stab in the dark at solving the problem.
 
Average of ratings: Useful (2)
Picture of David Le Blanc
Re: Trying to restore user 'admin' from backup file will cause conflict
 
I managed to resolve this issue by logging in as the Admin user and changing my Admin user name to something unique. It wasn't necessary to change the password, nor the email address. I then made a course backup and successfully copied and restored this to my new site where the Admin user name differed from the backed-up course site. tongueout
 
Average of ratings: -
Grizzly Bear Print with Deer Print
Re: Changing Admin User Name
 

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!!

THANKS David!!

 
Average of ratings: -
Picture of Edwin Acuna
Re: Trying to restore user 'admin' from backup file will cause conflict
 
Thanks David,

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.

Thanks
Edwin
 
Average of ratings: -
Picture of Glen Keune
Re: Trying to restore user 'admin' from backup file will cause conflict
 
I'm having a similar issue as well... let me know if I should post this in a new thread or elsewhere.

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,
Glen
 
Average of ratings: -
Picture of User Ming
Re: Trying to restore user 'admin' from backup file will cause conflict
 

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.

 
Average of ratings: -
Dennis Maloney, ACE
Re: Trying to restore user 'admin' from backup file will cause conflict
 

Thanks Ming,

That worked. I changed the user name 'admin' to admin1' and it was successful..

Dennis Maloney
Amarillo, TX

 
Average of ratings: -
Picture of Howard Miller
Re: Trying to restore user 'admin' from backup file will cause conflict
Core developersDocumentation writersParticularly helpful MoodlersPlugin developers
I wonder if there's any final word on this. What are the *rules* for naming admin users from 1.9.7? When we say 'admin' do we actually mean the 'primary' admin (a manual user) or anybody with site admin role.

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)
 
Average of ratings: -
Picture of Erwin Meza
Re: Trying to restore user 'admin' from backup file will cause conflict
 
My hint on this issue, two instances of moodle on the same server:

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):

<ORIGINAL_WWWROOT>http://localhost/path_to_your_old_moodle</ORIGINAL_WWWROOT>

That should work.

Good luck!
 
Average of ratings: -
Picture of Julio Yépez
Re: Trying to restore user 'admin' from backup file will cause conflict
 
Hello everybody,

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.

Best regards,
--
jjyepez
 
Average of ratings: -
Picture of Chris Swaine
Re: Trying to restore user 'admin' from backup file will cause conflict
 

Solution that worked for me

Hi,

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.

Best regards...Chris...

 
Average of ratings: -
Ben talking on the phone beside a monitor
Re: Trying to restore user 'admin' from backup file will cause conflict
Particularly helpful MoodlersTesters

I'm just chiming in to say that this whole topic is one of the most useful I've found for the issue of resolving conflicts when restoring a course for both localhost and production sites.

 
Average of ratings: -
Ben talking on the phone beside a monitor
Re: Trying to restore user 'admin' from backup file will cause conflict
Particularly helpful MoodlersTesters

Cross referencing Colin Fraser's very helpful response of 12/29/2010 in this thread.

http://moodle.org/mod/forum/discuss.php?d=165224

 
Average of ratings: -
Picture of Yiannis Arapoglou
Re: Trying to restore user 'admin' from backup file will cause conflict
 

Hello,

 

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!

 
Average of ratings: -
Picture of roger damon
Re: Trying to restore user 'admin' from backup file will cause conflict
 

Thank you for this.  I've been beating my head over it since yesterday.  A perfect and elegant solution.

 
Average of ratings: -
Picture of Teresa Gibbison
Re: Trying to restore user 'admin' from backup file will cause conflict
Moodle Course Creator Certificate holdersTestersTranslators

Another alternative is (as per Colin's post and William's above) is to alter the backup file before uploading it.

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
Cheers
Teresa

 
Average of ratings: Useful (1)
Picture of Yorday Figueroa Sanchez
Re: Trying to restore user 'admin' from backup file will cause conflict
 

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
 <USER>
    ........
    <USERNAME>admin</USERNAME>
    .......
 </USER>

 
Average of ratings: -
Logo image for TeachRemote LLC
Re: Trying to restore user 'admin' from backup file will cause conflict
 

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).

Solution:

  1. I did a backup in App #1 including User data
  2. 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.
  3. In App#2 did the Restore including User data
  4. Restore went like clockwork. Successful.
  5. In App#2 returned to my Profile and changed the email address back to the one I use as admin for this site.
  6. 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.

Mike

 
Average of ratings: -
Picture of Brigitte Baquero
Re: Trying to restore user 'admin' from backup file will cause conflict
 
Average of ratings: -