Error prior to Login page display

Error prior to Login page display

by Jeff Parrett -
Number of replies: 14

I'm getting an error before the login page even displays. The error is:

error/generalexceptionmessage

My research has found nothing to address this issue. I've manually added the lines in config.php to turn on debugging and see no errors on the screen or in the error.log file.

Here are the details of the environment:

Unix hosted environment (hostgator.com)
Moodle 3.82
PHP 7.4
MySQL 5.6.41

I've been working with my hosting service support for 72 hours and they are useless! Any ideas?

Average of ratings: -
In reply to Jeff Parrett

Re: Error prior to Login page display

by Jeff Parrett -
I now know the following error is happening on the server...

home1/starman/public_html/admin/cli/error_log features the following repeating error:
[03-Nov-2020 16:41:54 America/New_York] PHP Fatal error: Maximum execution time of 30 seconds exceeded in /home1/starman/public_html/lib/filestorage/tgz_packer.php on line 482

This is what my hosting service support person is telling me...

It appears that backup feature / plugin may not be suitable for a Shared hosting environment due to the PHP execution time limit on these server types as the backup looks to be continuously failing but has already generated over 144G of data.
144G /home1/starman/fcea_test/temp/backup

You will likely need to disable the Moodle backups but as I am personally unfamiliar with this CMS do not know the exact steps to do so. If you are using a specialized plugin you may need to contact the makers of the plugin while for built in backups the Moodle developers would be the recommended support contact.

Anybody got a hint?
In reply to Jeff Parrett

Re: Error prior to Login page display

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
The support person is right: Your hosting package is too weak to run Moodle, its automatic backup to be specific.

But now you have a new problem. The many broken attempts have created junk to the tune of 144 GB! I am not sure just deleting the content of the .../temp/backup directory will solve that problem.
In reply to Visvanath Ratnaweera

Re: Error prior to Login page display

by Jeff Parrett -
This provides me with no help!

I renamed the backup directory, creating a new empty one, hoping it might clear the issue. This morning there are 15 files in the directory.

What would be helpful is for someone to tell if it's possible to turn this feature off and be able to get access to my system again.
In reply to Jeff Parrett

Re: Error prior to Login page display

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
You mean, you are looking for the Site administration - Courses - Backups - Automated backup setup: Active switch?
In reply to Visvanath Ratnaweera

Re: Error prior to Login page display

by Jeff Parrett -
If I could log into the system that would be the switch.

However, as the post says I can't log into the system to access Site Administration.

I need to find a way to disable whatever is generating this login error.
In reply to Jeff Parrett

Re: Error prior to Login page display

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
You could stop the cron job and make some space free by purging some temp files. Once you can start the web GUI, you can switch off the automated backup and restart the cron job. (I am assuming that the GUI doesn's start because your quota is full.)
In reply to Jeff Parrett

Re: Error prior to Login page display

by Ken Task -
Picture of Particularly helpful Moodlers

See if you can go directly to the setting for automated backups:

https://yoursite/admin/settings.php?section=automated

If you can set Active to disabled.

Manually remove all files/folders in your moodledata/temp/backup directory.

Do not turn auto backups on again until you find a hosting site that can handle.

If that doesn't work, the only alternative for turning off is to edit database for your moodle directly to turn it off ... not recommended, but ...

table: mdl_plugins_config

name: backup_auto_active

 select * from mdl_config_plugins where name like 'backup_auto_active';

should show:

+----+--------+--------------------+-------+
| id | plugin | name               | value |
+----+--------+--------------------+-------+
| 72 | backup | backup_auto_active | 1     |
+----+--------+--------------------+-------+

Set 'value' to '0' - which means off ... shouldn't run.

'SoS', Ken


Average of ratings: Useful (1)
In reply to Ken Task

Re: Error prior to Login page display

by Jeff Parrett -
Thanks Ken.

The URL method gets the same error as trying to bring up the login screen.

I see a moodle table mdl_config_plugins. There is an entry in the table for plugin "backup" and auto_active=0

This tells me the auto backup feature is turned off...yet I'm getting lots of temp files being generated.

I'm going to push back on the hosting service as it still feels like a server side issue.

I see 2 row entries that might be
In reply to Jeff Parrett

Re: Error prior to Login page display

by Ken Task -
Picture of Particularly helpful Moodlers

moodledata/temp/backup/ is the build area for making course backups.   If auto is turned off, could mean a backlog of backups that didn't complete and everytime cron job runs it seeds backups to be made.   But, the solution is not to stop running cron ... that's *needed* to clean up stuff.

Also, your browser probably has cookies and is also caching ... just like server is caching.

So time to get nasty ...

Until you get done with the following list, do not attempt to login:

1. in your browser, delete cookies and cache for your site.

2. on your server, delete the contents of the moodledata/cache/ directory (safe to do, Moodle will rebuild as it needs)

3. restart apache service

4. watch the moodledata/temp/backup/ folder ... if it starts to populate does it fail leaving a directory with a long name consisting of letters and numbers?

Change into one of those using shared hosting file browser (ugh! much easier from command line) ... and see if there is a backup.mbz file there.   If it is, it means the backup did finish and moodle is trying to do the very last thing in backup process which is to copy ... note I say copy .. to the configuration destination directory for course backups ... if you didn't manually create that destination directory, it's trying to copy the backup.mbz file to the sea of files in moodledata/filedir/ and that is no fun figuring that out.

So as your server creates the backups but can't do last step, use file browser in your shared hosted cPanel and manually remove folders/files ... continually ... what that area and if one appears remove it.   Until you see none being created.

Also, in whatever tool you have to look at tables in the DB ... there is a table called "mdl_backup_courses" ... it's the 'road map' for backups.   Contains:

+---------------+------------+------+-----+---------+----------------+
| Field         | Type       | Null | Key | Default | Extra          |
+---------------+------------+------+-----+---------+----------------+
| id            | bigint(10) | NO   | PRI | NULL    | auto_increment |
| courseid      | bigint(10) | NO   | UNI | 0       |                |
| laststarttime | bigint(10) | NO   |     | 0       |                |
| lastendtime   | bigint(10) | NO   |     | 0       |                |
| laststatus    | varchar(1) | NO   |     | 5       |                |
| nextstarttime | bigint(10) | NO   |     | 0       |

Truncate that table ... that means remove data contained therein ** but not the table**.

mysql> truncate mdl_backup_courses;

mysql> select * from mdl_backup_courses;
Empty set (0.00 sec)

With auto shut off, table truncated, cron should run without trying to catch up.

And ... fingers crossed, you can login.

You might be moving off of shared hosting sooner than you planned.

Am out of ideas now.

One more question ... I take it that you are the only teacher in this moodle and there are no other teachers that could be making backups of their own courses.   That right?

Now am really out of ideas! :|

Cept one .... move your site in same hosting from shared to either managed or unmanaged VPS hosting.   With 'managed' VPS now the help desk is diretly involved cause managed means they do the 'heavy lifting' ... and can (should be able to) fix this for you.

'SoS', Ken



Average of ratings: Useful (2)
In reply to Ken Task

Re: Error prior to Login page display

by Jeff Parrett -
Ken you have been a great help. Here is the outcome of what I did based on your instructions...

1) cleared cache and cookies on browser.

2) renamed the cache (I'm a chicken). Moodle recreated it.

3) I can't restart Apache as I don't have access through the hosting service.

4) The temp/backup directory contained a large number of subdirectories all with cryptic names (I'm assuming some type of hash). I deleted them all and waited!

5) Reviewed the database using phpMyAdmin. The mdl_backup_courses table is empty. The mdl_backup_logs has 1241 rows. Can I TRUNCATE this table?

After a short time a folder was created in the temp/backup directory with the name '4d0a6c110bb1ea7ccee671b9432ff68e' along with a file with the same name .log. Here are the contents of the .log file which also correspond to a set of rows the mdl_backup_logs table.

[Sat 07 Nov 2020 14:41:06 PST] [info] instantiating backup controller 4d0a6c110bb1ea7ccee671b9432ff68e
[Sat 07 Nov 2020 14:41:06 PST] [debug] setting controller status to 100
[Sat 07 Nov 2020 14:41:06 PST] [debug] loading controller plan
[Sat 07 Nov 2020 14:41:06 PST] [debug] setting controller status to 300
[Sat 07 Nov 2020 14:41:06 PST] [debug] applying plan defaults
[Sat 07 Nov 2020 14:41:06 PST] [debug] setting controller status to 400
[Sat 07 Nov 2020 14:41:06 PST] [debug] setting file inclusion to
[Sat 07 Nov 2020 14:41:06 PST] [info] checking plan security
[Sat 07 Nov 2020 14:41:06 PST] [debug] setting controller status to 700
[Sat 07 Nov 2020 14:41:06 PST] [debug] saving controller to db
[Sat 07 Nov 2020 14:41:06 PST] [debug] calculating controller checksum f932d253047bca8842d4a697c4533169
[Sat 07 Nov 2020 14:41:06 PST] [debug] loading controller from db
[Sat 07 Nov 2020 14:41:06 PST] [debug] setting file inclusion to 1
[Sat 07 Nov 2020 14:41:06 PST] [debug] setting controller status to 800
[Sat 07 Nov 2020 14:41:06 PST] [debug] saving controller to db
[Sat 07 Nov 2020 14:41:06 PST] [debug] calculating controller checksum 202683ce4c9d748a962f32f06d536859
[Sat 07 Nov 2020 14:41:06 PST] [debug] loading controller from db

I also found this row mdl_backup_controllers table:
 SELECT * FROM `mdltst_backup_controllers` WHERE backupid='4d0a6c110bb1ea7ccee671b9432ff68e'

1485    4d0a6c110bb1ea7ccee671b9432ff68e    backup    activity    1177    moodle2    0    50    2    800    1    0    202683ce4c9d748a962f32f06d536859    1604788866    1604788866    0.00000000000000    TzoxNzoiYmFja3VwX2NvbnRyb2xsZXIiOjE4OntzOjExOiIAKg...   

There are also a bunch of XML files in the "funny name" directory, and a backup.mbz file.

I review the mdl_config_plugins table...row dump of files attached. I highlighted the row I think controls auto backup and it appears to me that auto backup is turned off yet it appears to be doing it.
In reply to Jeff Parrett

Re: Error prior to Login page display

by Ken Task -
Picture of Particularly helpful Moodlers

Autobackups ... is set to 'manual'?

IF so, that means another cron job could be created to run the cli script for autobackups in code/admin/cli/

The fact that there is a backup.mbz file there in the hashnamed directory means your server could NOT copy ... note I said copy ... the backup.mbz file and rename it to the destination directory.   If you didn't use 'designated' in config of autobackups, backups are being saved to moodledata/filedir/ ... somewhere.

The controllers table is used on every course backup.  Not really useful for what we seek.

The table I told you to truncate is the one that holds the scheduling of autobackups.   *truncate that table*

'SoS', Ken

Average of ratings: Useful (1)
In reply to Ken Task

Re: Error prior to Login page display

by Jeff Parrett -
Thanks again for all your help Ken.

On the positive side I was able to get all of my course definitions out of the database by creating another domain, copying all the Moodle code to it then pointing the config files to the domain, datadir and database. It WORKED!

The original domain is still failing and generating all the backup files. I put on my php debugging hat and started tracing the code. The actual problem was in a REQUIRE statement in on of the /lib files. This same statement works fine in other installs with the same version of Moodle and PHP. That tells me there is an issue in the PHP install for the domain that's failing. I've pointed my support admin at that...not holding my breath!

The backup is still happening. I've truncated the mdl_backup_courses so that table is empty. Now I did a truncate on the mdl_backup_controllers table. Even though I don't need to anymore, a part of me whats to find the rat in the hole!
In reply to Ken Task

Re: Error prior to Login page display

by Jeff Parrett -

For further information I did a little debugging on my own by adding some 'echo' statements to the php files starting at the index.php. What I determined is it is failing on a 'require' statement so now have the hosting service looking for PHP issues. This same php file works just fine on another Moodle site.

What I'm wondering is, can I create a new Moodle install  under a different domain. Then use the data directory and database from this install with the new one and at least recover some of the course curriculum I've built?

In reply to Jeff Parrett

Re: Error prior to Login page display

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
You wrote:
> Unix hosted environment (hostgator.com)
> Moodle 3.82
> PHP 7.4
> MySQL 5.6.41

If you mean Moodle 3.8.2, it is not PHP 7.4 compatible. See note 4) in http://www.syndrega.ch/blog/#php-and-dbms-compatibility-of-major-moodle-releases.

> I've been working with my hosting service support for 72 hours and they are useless! Any ideas?

What makes you think a) volunteers b) having zero access to the server can solve a problem that a) professionals b) with full access to the server can not solve?