moodle course failed to open stream warngin when backing up

by Era Rosenbaum 5 min read

Why is my Moodle course not working after a backup?

Usually, it's caused by some "illegal" characters added in the original course due to some copy/paste of text containing them (control characters, or invalid sequences...). The best method to handle this issue is: Unzip the problematic backup file under one empty folder. Open the moodle.xml with Firefox.

Why are my Moodle files not loading?

This has been known to be caused by older versions of libxml2 and PHP - try updating them to the latest versions. How can I extract original files from a Moodle backup file?

Where is the Moodle courseid 25 backup file?

The .mbz backup file for courseid=25 will be stored in the backup subfolder in the Moodledata ($CFG->dataroot) folder. Lose content after a restore in Moodle 2.0 ?

How do I resolve user conflicts in Moodle?

c) In Moodle 3.0.3 onwards and for admin user conflicts only, enable the setting 'Allow admin conflict resolution' in Site admin > Courses > Backups > General import defaults. This will result in the username in the backup file being renamed to 'admin_xyz'.

Re: Failed to open stream - Debugging

In the Moodle source code folder have you got a folder in the mod folder called tiles? What does it contain?

Απάντηση: Re: Failed to open stream - Debugging

I have tried looking everywhere to find the culprit that is messing up the site. I have turned debugging on and now I am getting this.

Re: Απάντηση: Re: Failed to open stream - Debugging

Try purging caches: under Site administration ▸ Development ▸ Purge caches click Purge all caches. Does that fix it?

Απάντηση: Re: Απάντηση: Re: Failed to open stream - Debugging

Yes, I got rid of all the debugging messages by purging the caches, but whenever I try importing questions using the Aiken format, I get the error Invalid permissions detected when trying to create a directory. Turn debugging on for further details.

Re: Απάντηση: Re: Απάντηση: Re: Failed to open stream - Debugging

Well you can enable debugging and post details here (or in a new discussion if it's not related to this issue).

Re: Απάντηση: Re: Απάντηση: Re: Απάντηση: Re: Failed to open stream - Debugging

Did you get anywhere with the above about the lock only I have exactly the same issue. I too was thinking about installing a later version of Moodle in the hope that it took the issue away, but when I looked at the code in the above file it looked the same in both versions to me.

Απάντηση: Re: Απάντηση: Re: Απάντηση: Re: Failed to open stream - Debugging

Ok. So , I reinstalled moodle once again. This time I try to upload a file using AIKEN format and I get a bit more info on the error.

How to backup a course?

To backup a course. Go into the course. Click the Backup link either in the gear menu or the Administration block (depending upon the theme). Initial settings - Select activities , blocks, filters and other items as required then click the Next button. Users with appropriate permissions, such as administrators and managers, ...

Can you continue working while a course backup is being made?

Note: With large courses it is helpful to be able to continue working while a course backup is being made. To achieve this, you need to enable asynchronous backups in Site Administration / Courses / Backups / Asynchronous backup/restore .

Can you save a course on Moodle?

Course backup. A course can be saved with some or all of its parts by using the course backup. Typically, the site administrator will set a schedule of automated course backups for the whole site. A teacher can create a backup or download an existing backup for safe keeping, or for use on another Moodle site.

How to backup a course?

To backup a course. Go into the course. Click the Backup link either in the gear menu or the Administration block (depending upon the theme). Initial settings - Select activities , blocks, filters and other items as required then click the Next button. Users with appropriate permissions, such as administrators and managers, ...

Can you save a course on Moodle?

Course backup. A course can be saved with some or all of its parts by using the course backup. Typically, the site administrator will set a schedule of automated course backups for the whole site. A teacher can create a backup or download an existing backup for safe keeping, or for use on another Moodle site.

What are the pros and cons of course versus site backups?

Site backups are recommended in order to have all data saved with the best confidence and the shortest recovery time.

Why is my automated course backup much smaller in size than my manual course backup?

This is an intentional design decision. Because of the way files are stored in Moodle 2.x, there is no need to include the files in the backup if you are planning to restore them to the same Moodle site. Leaving them out saves huge amounts of disk space and makes the backup procedure much faster.

What data is not contained in course backups?

By selecting all the options when setting up the backup you can include almost all the data in the course. However you should be aware of the fact that some things are not backed up:

How do I fix backups that lack the student log and participation data?

In Site administration > Courses > Backups > General backup defaults, there is a setting for "Include logs." By default, this is off.

How do I fix backups that lack the student grade history?

In Site administration > Courses > Backups > General backup defaults, there is a setting for "Include histories." By default, this is off.

How can I backup or restore a very large course?

See Backup via CLI in Course backup and Restore via CLI in Course restore (new in 3.10 onwards).

The process ends with: "Error: An error occurred deleting old backup data". What should I do?

This part of the backup (or restore) procedure tries to delete old info, used in previous executions, performing the following tasks:

Anonymizing user information

Anonymize user information is a backup feature which "protects user identities" by making each user anonymous. If this box is checked in the backup initial settings, Moodle will substitute aliases for real names, substituting @doesntexist.com email addresses and so forth. For example "Max Manager" might become "anonfirstname4 anonlastname4".

Backup and restore from 1.9 to 2

Courses created in 1.9 can be backed up and then restored into a 2.1 Moodle or later but blocks are not currently restored and nor is user data (such as forum posts, grades, submissions etc).

Backup and restore of assignments from Moodle 2.2 and older

The assignment activity module was completely rewritten in Moodle 2.3. Thus, assignments from Moodle 2.2 and older (e.g. from Moodle 1.9) need to be upgraded in order to continue being usable. See the section 'Restoring course backups from Moodle 2.2 and older' in Assignment upgrade tool for details of what to do.

Tips and tricks

Lose content after a restore in Moodle 2.0 ? Do you see topic headings that say "Orphaned activities"? Solution: Go to course settings and increase the number of topic sections and things will return to normal.

Creative uses

The backup and restore processes can offer the teacher and administrators many creative solutions.

General backup defaults

Default settings for course backups can be set by a site administrator in Settings > Site administration > Courses > Backups > General backup defaults .

image