After Upgrade Images Do Not Load

After Upgrade Images Do Not Load

by Mark Spidle -
Number of replies: 10

So I upgraded our moodle from 2.9 to 3.7 (3.2 then to 3.7 per the docs)  After the upgrade no image will load.  I attempt to upload an image and it seems to work but it will not display.  I tried this in a new course and in my private files.

It seems as if the actual hash file is not getting created in the moodledata/filedir/  I have debugging on but nothing useful ever shows up.


I do see this in the httpd error log once in a while:

PHP Warning:  readfile(/Volumes/MoodleData/moodledata/filedir/73/ee/73eeeab493172a84afd66c7c7aa44a46236e2867): failed to open stream: No such file or directory in /Volumes/MoodleData/www/html/lib/filelib.php on line 2102, referer: https://xxxxxxx/user/files.php

and I can verify that no that file does not exist.

Previews do not work either.






Attachment Screen Shot 2019-06-20 at 12.27.53 PM.png
Average of ratings: -
In reply to Mark Spidle

Re: After Upgrade Images Do Not Load

by Mark Spidle -
Just did a test with a pdf file and added it to my test course as a file. That works and displays, although preview of it still doesn't work in the upload window.

Anyone have ideas? Could this be an issue with GD etc.

This is a CentOS 6.10 server with php 7.1
In reply to Mark Spidle

Re: After Upgrade Images Do Not Load

by Mark Spidle -
More... I was able to install some more php modules including mcrypt, I though maybe that would fix something, but no luck.

May be getting closer now when I try to view an image using its url I get the following

Attachment Screen Shot 2019-06-20 at 12.56.14 PM.jpg
In reply to Mark Spidle

Re: After Upgrade Images Do Not Load

by Michael Farrell -
I am having the exact same issue. Just upgraded to 3.71. Can anyone help?
In reply to Mark Spidle

Re: After Upgrade Images Do Not Load

by Michael Farrell -

Since the upgrade to 3.71 from 3.5 images in the forums do not load, unless I add them as an attachment. Can anyone help me with this?

In reply to Mark Spidle

Re: After Upgrade Images Do Not Load

by Mark Spidle -

Do tested something else.  I installed a new fresh install of Moodle 3.7 in the same directory as current install.  eg.  html/moodle/

And same for moodledata, /Volumes/MoodleData/moodle/moodledata

Everything in fresh install works perfectly. 

So there is something in the upgrade that went wrong, really need a fix for this.

In reply to Mark Spidle

Re: After Upgrade Images Do Not Load

by Ken Task -
Picture of Particularly helpful Moodlers

What is /Volumes/MoodleData/?  On a CentOS 6 linux box drive devices are usually id'd by a device ID - like /dev/xvda1

Is /Volumes/MoodleData a view from the Mac you are using?

Is it a mounted drive/device?

What are ownerships/permissions on /Volumes/MoodleData?  and are they recursive?

Normally, an upgrade doesn't touch moodledata.

From ssh CLI, cd path to moodledata/filedir/

Then issue

find ./ -name 73eeeab493172a84afd66c7c7aa44a46236e2867

Above is on one line

Example:

[root@server filedir]# find ./ -name 41cfeee5884a43a4650a851f4f85e7b28316fcc9

responds with

./41/cf/41cfeee5884a43a4650a851f4f85e7b28316fcc9

then do a file -b on that file ... again from moodledata/filedir and an example

file -b ./41/cf/41cfeee5884a43a4650a851f4f85e7b28316fcc9

should show at least a mime-type - following above example:

JPEG image data, EXIF standard

'SoS', Ken

In reply to Ken Task

Re: After Upgrade Images Do Not Load

by Mark Spidle -
Hi Ken,

/Volumes/MoodleData is the drive all our moodle data and web pages for moodle are on:

/dev/sdb1 3.9T 802G 2.9T 22% /Volumes/MoodleData

I don't think the problem lies with the drive or the moodledata directory, since it was all working fine before the upgrade. To get our upgrade to work though, I first deleted everything in moodledata, we had about 1TB of cache files so when the upgrade started it would first never finish the purge all caches. I deleted everything from moodledata, (not realizing that is where documents etc. are stored) Once the upgrade finished I then did a restore from a backup (this is a ESXI VM, I restored using Veeam) the restore of everything took about 20 hours.

find ./ -name 73eeeab493172a84afd66c7c7aa44a46236e2867 does not find the file

Mark
In reply to Mark Spidle

Re: After Upgrade Images Do Not Load

by Mark Spidle -
Well something must have worked. Here is what I did... I changed the permissions per the security suggestions, at least for the directories. I also change the top level permissions for the disk the data is on

1. moodledata directory and all of its contents (and subdirectories, includes sessions):
owner: apache user (apache, httpd, www-data, whatever; see above)
group: apache group (apache, httpd, www-data, whatever; see above)
permissions: 700 on directories, 600 on files

That didn't seem to do anything. I then ended up turning off the Slashes variable in Admin->Server->HTTP (I turned this off before but it had no effect) this did the trick. All images and previews are now loading properly.
Average of ratings: Useful (1)
In reply to Mark Spidle

Re: After Upgrade Images Do Not Load

by Ken Task -
Picture of Particularly helpful Moodlers

Glad you have it sorted.

For your next upgrade, info ...

in moodlecode/admin/cli/ there is a script called cfg.php

One could redirect it's output to a text file for future reference or grep it for a value if one knows the short name of the setting:

[root@server cli]# php cfg.php |grep slash
slasharguments    1

Above on a CentOS 7 box.

'SoS', Ken