Restoring backup produces error/tmp_backup_directory_not_found

Restoring backup produces error/tmp_backup_directory_not_found

Edward Hewlett -
回帖数:12

Trying to restore a backup of a course from one Moodle instance to a second Moodle instance with the same codebase (2.0.2+, set up a week or two ago) fails at step 2 with the following error message:

error/tmp_backup_directory_not_found

Stack trace:

  • line 242 of /backup/util/helper/backup_general_helper.class.php: backup_helper_exception thrown
  • line 177 of /backup/util/ui/restore_ui_stage.class.php: call to backup_general_helper::detect_backup_format()
  • line 56 of /backup/restore.php: call to restore_ui_stage_confirm->display()

The backup in question is a partial course backup (a couple of topics), without user data, deliberately excluding all quizzes (given the unresolved issues with quiz question backups noted previously in this forum), taken from a file-system repository that I set up so I could FTP the large backup file (120MB) to the new instance. Any help or advice that might be offered would be greatly appreciated.

回复Edward Hewlett

Re: Restoring backup produces error/tmp_backup_directory_not_found

Jonathan Nativ -

Hi, I am having the exact same problem.

I would greatly appreciate any help in the matter.

Thank you in advance.

回复Edward Hewlett

Re: Restoring backup produces error/tmp_backup_directory_not_found

Jason Maitland -

I am having a similar problem trying to restore a 1.9 course into Moodle 2.1 The error I receive is:

error/tmp_backup_directory_not_found

More information about this error

Stack trace:
  • line 92 of /backup/util/helper/convert_helper.class.php: convert_helper_exception thrown
  • line 242 of /backup/util/helper/backup_general_helper.class.php: call to convert_helper::detect_moodle2_format()
  • line 188 of /backup/util/ui/restore_ui_stage.class.php: call to backup_general_helper::detect_backup_format()
  • line 62 of /backup/restore.php: call to restore_ui_stage_confirm->display()
Any assitance would be appreciated.
Thank you.
回复Edward Hewlett

Re: Restoring backup produces error/tmp_backup_directory_not_found

Ian McNaught -

I had the same issue, and discovered that it appears to work with manual backups (e.g. go to the 1.9 version of moodle, find the course, click through the backup process), but if I try using one of the nightly cron backed up versions I get this error.

回复Edward Hewlett

Re: Restoring backup produces error/tmp_backup_directory_not_found

Chris Jacobs -

At util/helper/convert_helper.class.php:136:

// CJ - fix attempt
// $dirpath = $CFG->tempdir . '/backup/' . $tempdir; //orig
$dirpath = $CFG->tempdir . '/backup/'; //new

That seemed to work, but I can't confirm.  The $tempdir appears to be bunk.  Someone please verify or repudiate.  Thanks.

回复Chris Jacobs

Re: Restoring backup produces error/tmp_backup_directory_not_found

Ken Task -
Particularly helpful Moodlers的头像

Check version of Moodle.

line 136 of 2.3.3+ (Build: 20121123)

        $dirpath    = $CFG->tempdir . '/backup/' . $tempdir;

Not same in 2.2.6 (Build: 20121112)

'spirit of sharing', Ken

 

 

回复Ken Task

Re: Restoring backup produces error/tmp_backup_directory_not_found

Chris Jacobs -

My mistake. tyty

回复Chris Jacobs

Re: Restoring backup produces error/tmp_backup_directory_not_found

Karen Williams -

Hello

I've just migrated 98% of the courses on an old and failing server (v 2+) onto a shiny new and super server (v 2.3.4) and right at the last minute, I'm now getting this error:

Debug info:
Error code: tmp_backup_directory_not_found
$a contents: D:\inetpub\moodledata/temp/backup/a4dcd7bf0654cf965609219f7422eaa0
Stack trace:
line 140 of \backup\util\helper\convert_helper.class.php: convert_helper_exception thrown
line 250 of \backup\util\helper\backup_general_helper.class.php: call to convert_helper::detect_moodle2_format()
line 188 of \backup\util\ui\restore_ui_stage.class.php: call to backup_general_helper::detect_backup_format()
line 67 of \backup\restore.php: call to restore_ui_stage_confirm->display()

It's not a massive file and I have to admit to not understanding the fix or solution above.

What can I do, to solve my problem please? We're running Windows 2008, MySQL and the latest version of PHP (as far as I'm aware). I'm just puzzled why this has happened now.

Any ideas would be greatly appreciated.

Thanks

Karen 微笑

 

 

回复Karen Williams

Re: Restoring backup produces error/tmp_backup_directory_not_found

Ken Task -
Particularly helpful Moodlers的头像

Not a Winders person, but ... the backup/restore process on that flavor used to have issues with the a 'user' (assuming apache here) being able to create temporary folders/files to build a backup or de-mbz (unzip a zip) for restoring.  In the debug output you have provided the specific directory for this instance is a4dcd7bf0654cf965609219f7422eaa0

Moodle should use moodledata/temp/backup for this but has the system suddenly started using operating system temp directory to which apache user doesn't have access rights to create or remove temp files folders (ie, unlink)?

Check apache error logs to see if there is something related to 'linking and 'unlinking'.  Check the temp directory for recursive permissions and the backup directory as well.  That's where all the work is done.

One can inspect the .xml files contained therein and sometimes that provides a clue.  Maybe there was an addon in the backup for which there is no 'handler' in the 2.  .xml files will show what addon and .log files with any byte size found there should also list the items for which there was 'no handler'.

It is safe to manually remove the contents of the 'backup' directory if there are files/folders in there.

'spirit of sharing', Ken

回复Ken Task

Re: Restoring backup produces error/tmp_backup_directory_not_found

Karen Williams -

Hi Ken

I'll have a look to see if I can find anything. Thanks so much for your quick response 微笑

Karen

回复Edward Hewlett

Re: Restoring backup produces error/tmp_backup_directory_not_found

Nadav Kavalerchik -
Core developers的头像 Plugin developers的头像 Testers的头像 Translators的头像

[solution] After some digging...

I found out that the error was a little bit different from the one above, which I was also getting, on Moodle 2.5 but not on Moodle 2.8, in which I was getting: "error/moodle/wrong setting level moodle backup xml file" and the fix is: https://docs.moodle.org/25/en/error/moodle/wrong_setting_level_moodle_backup_xml_file

回复Edward Hewlett

Re: Restoring backup produces error/tmp_backup_directory_not_found

Mochamad Nur Qomarudin -

Bismillah. I have encountered that problem. We use moodle v2.5.1. I backup a course and created 4.1 GB mbz file. I need to restore it to another category, seems like creating a duplicate course. When I tried to restore it, after long time waiting, the process have been suspended and give me a message

error/tmp_backup_directory_not_found

Something odd in my mind, when I download the file, it only 147 MB in size. This happen many times. Then, I try to backup partially, not the whole course. It just 2 GB mbz file. I try to restore it to another place and seems completed normally. Then I backup the rest and restore it, it seems normal too.

tmp folder allocation size

Then, I suddenly remembered that our server have allocated only 4 GB to tmp folder. I think that's probably the case. If our backup file more than this size, the file would be corrupted and could not be restored.

So, if you have the same problem, try to backup-restore partially.

That's my opinion. Happy moodeling.