Backup failed, how to diagnose problem?

Backup failed, how to diagnose problem?

Ken Russell -
回帖数:35

I tried to back up a course that I am the teacher for. Everything sees to work until the very end of the backup process:

Copying zip file
An error occurred while copying the zip file to the course directory
The backup did not complete successfully

By the "course directory" I assume it is referring to the "Files" area on the course admin menu. Nothing shows up in there except for some old files that were uploaded long ago.

How might I diagnose and fix this problem?

Thank you in advance!

Ken Russell
Bellingham Schools

Name: backup-bbp1-20080424-0931.zip
  • Creating temporary structures
  • Deleting old data
  • Creating XML file
    • Writing header
    • Writing general info
    • Writing course data
    • Writing users info. . . . . . . . . . . . . . . . . . . .
    • Writing categories and questions
    • Writing logs info. . . . . . . . . . . . . . . . . . . .
    • Writing scales info
    • Writing groupings info
    • Writing groups info
    • Writing events info
    • Writing gradebook info
    • Writing modules info
      • Forums
      • Quizzes
      • Resources
    • Course format data
  • Copying user files
  • Copying course files
  • Zipping backup
  • Copying zip file
    An error occurred while copying the zip file to the course directory
The backup did not complete successfully
回复Ken Russell

Sorry, no Re: Backup failed, how to diagnose problem?

Boris Kuntzmann -
Hello, sorry that i can´t help, but: I ve got exactly the same Prob with Moodle 1.8. But only with one course. Other Courses can be backuped without any poroblems. ???
Thanks for your help and excuse my bad english 眨眼
Boris Kuntzmann
回复Boris Kuntzmann

Re: Sorry, no Re: Backup failed, how to diagnose problem?

Timothy Takemoto -
Is the "one course" that does not backup larger (more activities, more resources) than the others? My *large* courses do not back up because they run out of memory, or process time, I believe.
回复Timothy Takemoto

Re: Sorry, no Re: Backup failed, how to diagnose problem?

Boris Kuntzmann -
Hy, thanx for your answer, but i´m sure the one who couldn´t be backedup is smaller. i believe it maybe an error in the data (strucure?) in this course ...
回复Boris Kuntzmann

Re: Sorry, no Re: Backup failed, how to diagnose problem?

Timothy Takemoto -

Can you post the place where the backup stops in the detailed backup log? If it is an error with the data structure that sounds difficult to fix. You might consider repairing relevant module tables using the Moodle addin PHPMyAdmin.

回复Timothy Takemoto

Re: Sorry, no Re: Backup failed, how to diagnose problem?

Timothy Takemoto -

Speaking of which....

I had always presumed that my backups were stopping because they were too large (since it is always the larger courses that are stopping) but looking at the detailed backup log it says that it stops at the place where it is meant to delete the previous files. The strange thing is that it only has this problem on certain courses.

08:30 AM:18                 found 17 backup files
08:30 AM:18                 keep limit (5) reached. Deleting old files
08:30 AM:18                 backup-es_fri-20080415-1133.zip deleted
Wednesday, 30 April 2008, 07:50 AM

It seemed to work okay even at the stage when there were six files and it had to delete one of them.

07:30 AM:36                 found 6 backup files
07:30 AM:36                 keep limit (5) reached. Deleting old files
07:30 AM:36                 backup-es_fri-20080409-0932.zip deleted
07:30 AM:36 End backup course Friday English Speaking - OK
Sunday, 13 April 2008, 07:20 AM

This continued for a while, with the backup happily deleting the 6th file until one day, it just would not delete the file any more.

Is there any reason why moodle should find it difficult to delete larger files? Is there some setting in php.ini that limits the size of file that one can delete?

Anyway, for the past three years ago I have been assuming that moodle has been timing out on part way throught the larger courses (since it was only the larger courses that are not completing). But it seems it is getting right to the end, completing the backup (I think) and just failing to delete the previous file. This is good news.
Tim

回复Timothy Takemoto

Re: Sorry, no Re: Backup failed, how to diagnose problem?

Boris Kuntzmann -
Hy, maybe i´ve a reason: today i received am email from my provider, that my Webspace was overused (120%) .... i deleted a lot of backups und will try later to backup this problematic course. I will tell here, wether this was the reason...
bye
回复Ken Russell

Re: Backup failed, how to diagnose problem?

Timothy Takemoto -

Some of my courses do not backup (I presume that they are just too big) so I was considering creating a thread like this.

My random thoughts...
1) Could there be a permissions problem...perhpas if your course directory was not created by Moodle (php) but copied over from a prior installation and thus owned by the user that copied it, Moodle (php) may be running as a user that can not write to the course folder. But if this were the case you would be having lots of other problems. Can you upload files *using the moodle GUI* to the course folder?
2) The backup is created in the "backupdata" subdirectory. Is that there?
3) Have you over stepped some sort of disk usage limit in your dataroot?
4) Is this the first backup? How many other backups are there in the backupdata subdirectory?
4) Is the course very large and the backup running out of process time (seems unlikely bearing in mind where it stops)?
5) What happens when you turn on debugging?

回复Timothy Takemoto

Re: Backup failed, how to diagnose problem?

Ken Russell -

Thanks very much for your reply, Tim.

I just found that despite the error report, there is a file in the data folder, I just don't know if it is complete and error free. I want to take that file and "restore" it on another moodle server (different domain). I cannot find instructions in the moodle docs on how to do this. Backup is easy, but how do I take that backup and create a new course on a different server? If I can do this, I will know if the backup is good, despite the error report at the end of the backup log. 

I have been unable to find instructions on how to backup and then restore a course on a different host. I tried working through it on my own but at one point I did not know how to proceed. Have you done this before or are you aware of any documentation on how to work through this process?

Thanks in advance for your help!

Ken Russell
Bellingham Schools

回复Ken Russell

Re: Backup failed, how to diagnose problem?

Boris Kuntzmann -
Hy,
I found similar results: With Filezilla I found a correct named zip file but not in the specified folder, where it should be (backup), i found it in the temp-folder. The name was correct, but i dont know too, wether its correct and error free.

Maybe this is interesting: Last week i tried to update Moodle from 1.8.2 to 1.9+. This update failed. After uploading the unpacked moodle files in the moodle directory on the server the first installing message page occured and told me that there were no errors, but after that nothing else happend for 20 minutes. With filezilla i wrote back my previously backedup moodle directory (the one made with 1.8.2) and everything seemed to be as before.
Greetings
Boris
回复Boris Kuntzmann

Re: Backup failed, how to diagnose problem?

Jeff Forssell -
I have for quite a while had problems with "restoring" (recreating) a course from another installation and noticed that I am also having problems with backing up courses. I'm running a Moodle 1.8.2 installed with Fantastico on a Linux server at Siteground.

When I try backing up a course, I get 2 screens where everything seems to be going OK then (see screen-shot at bottom)

I have checked and for that course there were only 2 backups and they were both <1Mb.

I know I checked in the docs and there was something about repairing the MySQL tables. I tried doing that, but nothing changed.

Ken asked about copying a course from one installation to another- this is covered here in the docs
附件 backupProblem.gif
回复Jeff Forssell

Re: Backup failed, how to diagnose problem?

Jeff Forssell -
I just now tried seeing if I could directly attack the "directory not empty" situation. I FTPed in with Filezilla to that directory and found 2 empty nested directories under that directory and deleted them. (I don't know if I could have found my way there "inside" Moodle's interface. Can one do this without FTP?)

I then attempted a restore which had previously stopped with this type of error. It didn't stopped there this time. Unfortunately it didn't complete and didn't give any error message. (Maybe that zip file is corrupt somehow.)

I then tried a backup which had failed before and it went fine now. I also tried restoring it as a new course on the same server and that worked fine too. So I seem to have had some success anyhow.

When I had already entered this into the Moodle Docs page I mentioned above, I noticed that there was already an item thereblush: " Delete old files from "moodledata/temp/backup": Delete the dir completely and try again." which had apparently escaped me (or been added after I tried the MySQL stuff there?)
回复Jeff Forssell

Re: Backup failed, how to diagnose problem?

Dan Marsden -
Core developers的头像 Particularly helpful Moodlers的头像 Peer reviewers的头像 Plugin developers的头像 Plugins guardians的头像 Testers的头像 Translators的头像
Hi Jeff,

that error shouldn't really cause the backup to completely fail - I've fixed this in Moodle 1.9 and 2.0(see MDL-14736) to just display a warning instead of stopping the backup.....but I can't seem to find it in Moodle 1.8 - are you sure you aren't running Moodle 1.9?

thanks,

微笑

Dan
回复Dan Marsden

Re: Backup failed, how to diagnose problem?

werner cyrmon -
My automated backup fails for all courses - but no definite error message there:
.
.
02:38:50 wiki
02:38:50 workshop
02:38:50 flash
02:38:50 ipodcast
02:38:50 copying user files
02:38:54 copying course files
02:40:41 zipping files
03:34:18 copying backup
03:34:18 End backup course Cyx's Math - ERROR!!
Tried different backup locations (all writable by everyone), nothing's changed - the destinationdir stay always empty
What could be the problem here (its moodle 1.8)?
Thx
Werner
回复werner cyrmon

Re: Backup failed, how to diagnose problem?

werner cyrmon -
have now debugging on and done a single course backup:
.
.
.
  • Nutzerdateien kopieren
  • Kursdateien kopieren
  • Sicherung komprimieren
    Status: 1
  • ZIP-Datei kopieren

From: /usr/local/moodledata/temp/backup/1211560280/sicherung-moodle_-tipps-20080523-1831.zip

Checking: /usr/local/moodledata/4

Checking: /usr/local/moodledata/4/backupdata

To: /usr/local/moodledata/4/backupdata/sicherung-moodle_-tipps-20080523-1831.zip

An error occurred while copying the zip file to the course directory

/usr/local/moodledata belongs to user www, group www and everyone can write there.
Monitored the /usr/local/moodledata/temp/backup/1211560280 dir and I think there was no sicherung-moodle_-tipps-20080523-1831.zip file, so maybe the copy failed because there wasnt even the zip file.
Possible?
回复werner cyrmon

Re: Backup failed, how to diagnose problem?

Sojiro Sato -
I believe the zip file is created before deleting /usr/local/moodledata/temp/backup/1211560280 and is sent to your backup destination. Check that you have a valid backup destination (writable by the web server) and also review your web server's error logs.
回复Sojiro Sato

Re: Backup failed, how to diagnose problem?

werner cyrmon -
/usr/local/moodledata/temp/backup/1211560280 never gets deleted!
And please read my post again: moodledata-dir belongs to user www, group www (which are the servers uid and gid) and is writeable fopr everyone.
NO entrys in the webserver logs ...
回复werner cyrmon

Re: Backup failed, how to diagnose problem?

Sojiro Sato -
Never hurts to check twice for file permissions and ownership. The temp directory wouldn't get deleted because that happens right after the ZIP file is copied (copy_zip_to_course_dir()).

As a test, don't back up any of the modules or their user data to see if anything changes.
回复werner cyrmon

Re: Backup failed, how to diagnose problem?

Sarah Hanssen -

I have a similar problem. I've just upgraded from 1.8 to 1.9 and now my scheduled backup fails, it doesn't do nothing, no logs to check. The destination folder is corret. Please, how can I solve this problem????

Thanks,

回复Ken Russell

Re: Backup failed, how to diagnose problem?

James MacLean -
I have found that there may be a 30 second timeout getting kicked off. I have php.ini set to max_execution_time = 900 , but the code appears to be reseting this timeout with set_time_limit(). I have just tried putting set_time_limit(900); in backup/backup_scheduled.php in the function schedule_backup_launch_backup in 3 places and so far it is running longer then before.
回复James MacLean

Re: Backup failed, how to diagnose problem?

Sarah Hanssen -

Sorry, I didn't undertand. Three places where? I've just found the function schedule_backup_launch_backup once.

Thanks,

回复Sarah Hanssen

Re: Backup failed, how to diagnose problem?

James MacLean -
In the file schedule_backup_launch.php I made the following diff. Basically added my own set_timer_limit()s :

@@ -214,15 +217,18 @@
$status = false;

mtrace(" Executing backup");
+ set_time_limit(900);
schedule_backup_log($starttime,$course->id,"Start backup course $course->fullname");
schedule_backup_log($starttime,$course->id," Phase 1: Checking and counting:");
$preferences = schedule_backup_course_configure($course,$starttime);

+ set_time_limit(900);
if ($preferences) {
schedule_backup_log($starttime,$course->id," Phase 2: Executing and copying:");
$status = schedule_backup_course_execute($preferences,$starttime);
}

+ set_time_limit(900);
if ($status && $preferences) {
//Only if the backup_sche_keep is set
if ($preferences->backup_keep) {
回复James MacLean

Re: Backup failed, how to diagnose problem?

Sarah Hanssen -

Hi, James,

I've made the changes but it hasn't worked yet. Is this a problem of 1.9 version???

Thanks,

回复Sarah Hanssen

Re: Backup failed, how to diagnose problem?

James MacLean -
Hi Sarah,

Do you see anything that helps if you go to your moodle site in a browser, or calling wget from a command line using the same URL that activates the cron.php? ie :

http://<yoursite>/admin/cron.php ? If you use wget do something like :

wget -O mylog.log http://<yoursite>/admin/cron.php and look at the mylog.log file when it is finished.

You may have a totally different issue then what we are seeing here 伤心.
回复James MacLean

Re: Backup failed, how to diagnose problem?

James MacLean -
We are using 1.9 so I don't know when it started. In our case, since the backups take 2 hours to complete, it was probably more apt to be seen.
回复James MacLean

Re: Backup failed, how to diagnose problem?

David Pike -
Has there been any resolution to this? I've been digging for answers to this problem here - and I think I've tried all the solutions I could find. Have changed the timing issues, the permission issues, some "suhosin" code addition, etc. But nothing has fixed it.

I'm running Moodle 1.9, I have 8 courses open. 5 are being developed, 1 has students enrolled but is only populated with quizzes (benchmark exams) and then 2 live courses. All will back up except the 2 live courses. When trying to manually backup I've tried it in the default settings, and it runs through all the back up process, but it simply stops when it says "Zipping Files". I've tried saving it with NO user data, no course files, no logs - and has the same results.

The zipped file can be found in the temp files, but it is corrupted and won't open (size shows 2MB)

Here is the error log from the server:
[Tue Jan 6 05:40:27 2009] [error] [client 206.76.239.74] File does not exist: /home/transi7/public_html/favicon.ico
[Tue Jan 6 05:37:50 2009] [error] [client 74.124.203.40] File does not exist: /home/transi7/public_html/500.shtml
[Tue Jan 6 05:37:50 2009] [alert] [client 74.124.203.40] /home/transi7/public_html/moodle/uploaddata/.htaccess: AllowOverride not allowed here
[Tue Jan 6 05:37:50 2009] [error] [client 74.124.203.40] File does not exist: /home/transi7/public_html/500.shtml
[Tue Jan 6 05:37:50 2009] [alert] [client 74.124.203.40] /home/transi7/public_html/moodle/uploaddata/.htaccess: AllowOverride not allowed here
[Tue Jan 6 05:37:50 2009] [error] [client 74.124.203.40] File does not exist: /home/transi7/public_html/500.shtml
[Tue Jan 6 05:37:50 2009] [alert] [client 74.124.203.40] /home/transi7/public_html/moodle/uploaddata/.htaccess: AllowOverride not allowed here

The "AllowOverride" was a solution the host suggested for a change to the .htaccess in lieu of unix command that was recommended in another post:

  • If you're getting this error then it is related to having a file chmod'ed to 0777.
  • Simply change the permissions on the file to 755. You do not need the file to be 777.
So in your case, I think you need to change the permissions on the files in the Moodle folder.

Probably the following unix command will do it:
find /home/learning/public_html/Moodle -type f -exec chmod 755 {} \;

Anything stand out here? Any other suggestions?
回复David Pike

Re: Backup failed, how to diagnose problem?

Julie Mohr -
David,

I have experienced this same issue with my backups. I am running version 1.9.5 and am trying to do manual backups of all of my courses before I perform the upgrade to version 1.9.7.

I have four courses currently installed. My settings are currently set to do an automatic back up once a week on Sunday at Midnight through the CRON job. I checked the log files and noticed that the last backup failed for all but one course. So I decided to do a manual back up. Three of the four courses back up without an issue. The last class is a very large course (had 23 students with many assignments, files, forums). The backups are all stored in their appropriate folder except for the one course that will not backup. I find the temporary files in the temp folder. There I find a slew of files and a zip file.

I am curious if this was solved as I seem to have the same issue. I get no error message. It just says as its final command, "Zipping backup" and then does not give me the continue button.

I don't know if this is one of the many fixes that were released in 1.9.7 but I don't want to upgrade until I can get a backup completed.

Juls
回复Julie Mohr

Re: Backup failed, how to diagnose problem?

Alex Little -
Hi,
I get exactly the same problem as Julie. The backup stops at 'zipping backup' action, but no subsequent error messages. This happens when running as manual or scheduled backup process.

As others have mentioned only seems to be a problem with large (file size) courses, all other courses are fine. If I try to backup the problem course but exclude the course files, then all works fine.

If anyone knows how to work around this, that would be great, is it a php timeout/memory setting issue or would more ram resolve this or is there something else?

All help greatly appreciated,
Alex

ps. am running 1.9.6

回复Julie Mohr

Re: Backup failed, how to diagnose problem?

Howard Miller -
Core developers的头像 Documentation writers的头像 Particularly helpful Moodlers的头像 Peer reviewers的头像 Plugin developers的头像
There's a whole bunch of basics. The two biggies though are.

1. Always set the external zip and unzip binaries...

http://docs.moodle.org/en/Backup_and_restore_FAQ#Backup_stops_at_Zipping_backup

2. Backup is very memory hungry. You may need to increase 'memory_limit' in php.ini. I have known figures like 512M to be required.

Before doing any of this, run with Debugging switch to full and note any additional warnings or errors. That will probably reveal the truth.
回复Howard Miller

Re: Backup failed, how to diagnose problem?

Alex Little -
Thanks Howard. Setting the external zip and unzip binaries have fixed the problem. I didn't need to change the PHP memory_limit.

Alex


回复Alex Little

Re: Backup failed, how to diagnose problem?

Julie Mohr -
Alex and Howard,

This solution worked for me as well. I searched for a solution and couldn't find the article that pointed to this configuration. Thanks Howard for your assistance.

Okay so now I have the back up run and I am using the zip tool as specified in the article. What if my server does not give a location for the unzip. When I use the ssh tool I get the path for the zip but it doesn't return anything (just gives me a prompt) for the unzip. Will this be necessary if I need to use this backup?

Julie

(P.S. And thanks again. I've been using this product for a while and have always been able to find the solutions and solve these things myself even with the little knowledge I have. It is good to know that when I need help to solve something, I can get it from the community.)
回复Julie Mohr

Re: Backup failed, how to diagnose problem?

hamed ajalli -
I have same problem . i recieve following error :

No warnings - Scroll to the continue button

backup


Backup tables could NOT be set up successfully!
)

please help me
回复hamed ajalli

Re: Backup failed, how to diagnose problem?

HJWUCGA INC. -
Did you try to reinstall moodle again? looks like the backup table already exist and you need to delete them first...

what were you trying to do before you got this message?
回复HJWUCGA INC.

Re: Backup failed, how to diagnose problem?

hamed ajalli -
Yes i did . i do it. i try to reinstall but always i configure my installation and setup database tables (Previous Step is making plugin tables) then show that error .
I click on continue button and then i see the following error :

A server error that affects your login session was detected. Please login again or restart your browser.

then when i click on continue i go to previous error.

please help my with my moodle installation.

thanks
回复Ken Russell

Re: Backup failed, how to diagnose problem?

Fred Senese -
I've had this problem when I've disabled exec in my php.ini.

look in your php.ini for

disable_functions= (stuff),exec,(stuff)

and remove the exec, part. Restart your webserver and see if your backups are working again.
回复Fred Senese

Re: Backup failed, how to diagnose problem?

Tim W -

I just encountered this problem myself and found the solution. In my particular case apache had crashed on the server hosting our moodle server. One quick restart and it was fixed. Once again the old IT Crowd addage "Have you tried turning it off and on again?" works 99% of the time. 微笑