Error message - "requce_once(): Failed opening required" during Moodle upgrade about the file setup.php in lib - "/usr/local/moodle/lib/setup.php"

Error message - "requce_once(): Failed opening required" during Moodle upgrade about the file setup.php in lib - "/usr/local/moodle/lib/setup.php"

by Dave Weninger -
Number of replies: 11
We are originally using Moodle 3.6.1 (2018120301), CentOS 7,4.1708, Apache 2.4.29, MySQL5.7.21, PHP 7.2.16, Theme- Essential 3.6.01 (201812704)

I am trying to upgrade it to Moodle 3.8.9.  I included the minimal necessary plugins that are previously installed, including upgrade version of Moove theme, plarigism - veriguide, lockdown browser, booktool wordimport.  However, it prompts the below error message after undergoing upgrade for several hours.

Warning: require_once(/usr/local/moodle/lib/navigationlib.pgp): failed to open stream: No such file or directory in /usr/local/moodle/lib/setup.php on line 599

Fatal error: require_once(): Failed opening required '/usr/local/moodle/lib/navigationlib.pgp' (include_path='/usr/local/moodle/lib/pear:.:/usr/local/php/lib/php') in /usr/local/moodle/lib/setup.php on line 599

It tried many times. The error message always occurs at the file under the directory /usr/local/moodle/lib/

Please let me know what is the cause of this error message. Kindly advise how to fix it. Thank you very much.
Attachment moodle7test_error.png
Average of ratings: -
In reply to Dave Weninger

Re: Error message - "requce_once(): Failed opening required" during Moodle upgrade about the file setup.php in lib - "/usr/local/moodle/lib/setup.php"

by Ken Task -
Picture of Particularly helpful Moodlers

Essential theme no longer supported.   Suggest using a theme that comes with core code (boost) for the upgrade and beyond.

You could use config.php to set default theme:

$CFG->theme='boost';

Please see:

https://moodle.org/plugins/theme_essential

'SoS', Ken


In reply to Ken Task

Re: Error message - "requce_once(): Failed opening required" during Moodle upgrade about the file setup.php in lib - "/usr/local/moodle/lib/setup.php"

by Dave Weninger -
As I know "Essential" theme is no longer supported, I uninstalled this theme and select "boost" theme in advance. Make sure the Moodle 3.6 working well with boost theme. Then, I delete the "boost" theme code and put the "Moove" theme code into Moodle to perform the Moodle upgrade to version 3.8. Anyway, when I delete the "Essential" theme, it prompts an error message "core_plugin/err_removing_unremovable folder"

Should I simply add "$CFG->theme='boost'" into config.php instead of uninstalling the "essential" theme?

Actually, I tried the upgrade with different options of plugin. The final error messages are similar - "Fatal error: require_once(): Failed opening required'..." and are related to the file "/usr/local/moodle/lib/setup.php"

Please kindly advise. Thank you very much.
Attachment moodle4test_error.PNG
Attachment moodle6test_zoom3.7.PNG
In reply to Dave Weninger

Re: Error message - "requce_once(): Failed opening required" during Moodle upgrade about the file setup.php in lib - "/usr/local/moodle/lib/setup.php"

by Ken Task -
Picture of Particularly helpful Moodlers

When you un-installed Essential theme how did you do that?

core_plugin/err_removing_unremovable folder??  Permissions on folders of code?

Fatal error: require_once(): Failed opening required '/usr/local/moodle/lib/navigationlib.pgp'

???? navigationlib.pgp?????

Did you look at line 559 of lib/setup.php?

Best to use core themes ... if not boost then classic.
Installing a new theme at the same time as upgrade very well could confuse things.

Are all your plugins compatible with the version you are upgrading to?

For more info, one could add the debugging lines from config-dist.php to config.php

'SoS', Ken

In reply to Ken Task

Re: Error message - "requce_once(): Failed opening required" during Moodle upgrade about the file setup.php in lib - "/usr/local/moodle/lib/setup.php"

by Dave Weninger -
I undergo the below steps to uninstall Essential theme.
1. Theme selector->Select "boost"
2. At Plugin overview->Theme->Essential->uninstall->It display SUCCESS.
3. Before clicking "Continue"->I delete the theme/essential folder in Linux
4. Click "Continue"->It prompts "core_plugin/err_removing_unremovable folder"
5. Then, I click "Upgrade Moodle database now"

The permission of code folder for directory is 755 and executable files are 644.

The below is a portion of setup.php. It looks like some PHP library file.
// Remember the default PHP timezone, we will need it later.
core_date::store_default_php_timezone();

// Load up standard libraries
require_once($CFG->libdir .'/filterlib.php'); // Functions for filtering test as it is output
require_once($CFG->libdir .'/ajax/ajaxlib.php'); // Functions for managing our use of JavaScript and YUI
require_once($CFG->libdir .'/weblib.php'); // Functions relating to HTTP and content
require_once($CFG->libdir .'/outputlib.php'); // Functions for generating output
require_once($CFG->libdir .'/navigationlib.php'); // Class for generating Navigation structure <----------"599"
require_once($CFG->libdir .'/dmllib.php'); // Database access
require_once($CFG->libdir .'/datalib.php'); // Legacy lib with a big-mix of functions.
require_once($CFG->libdir .'/accesslib.php'); // Access control functions
require_once($CFG->libdir .'/deprecatedlib.php'); // Deprecated functions included for backward compatibility

I will try to upgrade with Boost theme first and install Moove theme later. Thanks for advice.

I checked that all plugins are compatible to the version 3.8 I am upgrading except one plugin - Atto word import.
I had twice experience of successfully upgraded Moodle to 3.8 while I kept using the Atto word import 1.3.7 which is claimed to be compatible to Moodle 3.4 only. 

I tried to use Atto word import 1.4 which is compatible to Moodle 3.8, it popped up to request for the dependencies of Booktool word import. It is not allowed to install both of them because they own the same directory name "wordimport". If I only install the booktool one, the Moodle upgrade is also not successful.
In reply to Dave Weninger

Re: Error message - "requce_once(): Failed opening required" during Moodle upgrade about the file setup.php in lib - "/usr/local/moodle/lib/setup.php"

by Dave Weninger -
// Load up standard libraries
require_once($CFG->libdir .'/filterlib.php'); // Functions for filtering test as it is output
require_once($CFG->libdir .'/ajax/ajaxlib.php'); // Functions for managing our use of JavaScript and YUI
require_once($CFG->libdir .'/weblib.php'); // Functions relating to HTTP and content
require_once($CFG->libdir .'/outputlib.php'); // Functions for generating output
require_once($CFG->libdir .'/navigationlib.php'); // Class for generating Navigation structurelibdir .'/dmllib.php'); // Database access  <---599
require_once($CFG->libdir .'/datalib.php'); // Legacy lib with a big-mix of functions.
require_once($CFG->libdir .'/accesslib.php'); // Access control functions
require_once($CFG->libdir .'/deprecatedlib.php'); // Deprecated functions included for backward compatibilitylibdir .'/moodlelib.php'); // Other general-purpose functions <---603
require_once($CFG->libdir .'/enrollib.php'); // Enrolment related functions
require_once($CFG->libdir .'/pagelib.php'); // Library that defines the moodle_page class, used for $PAGElibdir <---606 .'/blocklib.php'); // Library for controlling blockslibdir .'/grouplib.php'); // Groups functions  <--607
require_once($CFG->libdir .'/sessionlib.php'); // All session and cookie related stuff
require_once($CFG->libdir .'/editorlib.php'); // All text editor related functions and classes
require_once($CFG->libdir .'/messagelib.php'); // Messagelib functions
require_once($CFG->libdir .'/modinfolib.php'); // Cached information on course-module instances
require_once($CFG->dirroot.'/cache/lib.php'); // Cache API


The permission of lib/blocklib.php is daemon,daemon is 644
The permission of lib/setup.php is daemon,daemon is 755
Attachment error.PNG
In reply to Ken Task

Re: Error message - "requce_once(): Failed opening required" during Moodle upgrade about the file setup.php in lib - "/usr/local/moodle/lib/setup.php"

by Dave Weninger -
For the error message during removal of essential theme, I turn on the debugging mode.

core_plugin/err_removing_unknown_plugin

Debug info: core_plugin_manager::get_plugin_info() returned null for the plugin to be deleted
Error code: err_removing_unknown_plugin
$a contents: Array
(
[plugin]=>theme_essential
)
Stack trace:
line 136 of /admin/plugins.php: moodle_exception thrown
In reply to Dave Weninger

Re: Error message - "requce_once(): Failed opening required" during Moodle upgrade about the file setup.php in lib - "/usr/local/moodle/lib/setup.php"

by Ken Task -
Picture of Particularly helpful Moodlers

First, for a CentOS 7 server, /usr/local/moodle is a strange location for moodle code.  CentOS 7 is Linux Standards Base distro which means apache config (httpd.conf) default would make /var/www/ apache users home directory.   In there, an html which is typically document root as defined in main config file for apache. /etc/httpd/conf/httpd.conf on typical setup.

Having moodle in /usr/local/ would mean there are or should be other config files that define that directory.   Do you have a special config file for that location or have you changed httpd.conf such that /usr/local/ is now apache home?

Plugin removal best done by Moodle Admin interface, but in the cases of plugins that have dependencies (require other plugins), one might have to resort to manually moving the plugin folders out to an archive directory, then visiting plugins via Moodle Admin interface ... it will say missing from disk ... that's ok, click the 'Upgrade Database' button and that should remove rows in mdl_config_plugins table that refer to those plugins.

In what you shared back about owner ... daemon,daemon????  The user for apache on CentOS 7 is typically 'apache' ... as defined in main config file /etc/httpd/conf/httpd.conf

A failed attempt to upgrade will mess with DB tables some so you might have to restore your DB to when site was running older version.

Hope you did a site backup ... code + DB minimally ... so you can restore and 'try it again'.

The next try, make sure you have debugging turned on from the get go.

What documents are you following for upgrading?

When your site was a 3.6, did you check server environment and update the component.   Then picked 3.8 as destination version to see if there were any reported issues concerning environment?

BTW, you never did answer the question about that strange file name ... ending with .pgp in moodle code related to navigation.   That's why I ask about what docs you are following for upgrading.

'SoS', Ken

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

Re: Error message - "requce_once(): Failed opening required" during Moodle upgrade about the file setup.php in lib - "/usr/local/moodle/lib/setup.php"

by Dave Weninger -
Sorry, I forgot to mention that it is just a UAT moodle site to test if upgrade is smooth.

Yes, it is a source code compile version of Apache. It is my Boss's habit that he always changes var/www/apache to /usr/local/moodle,

The user for apache on this CentOS 7 is daemone instead of 'apache' ... as defined in main config file /usr/local/apache2/conf/httpd.conf

After turn on the debugging mode, it shows the below error message:

Warning: array_key_exists() expects parameter 2 to be array, null given in /usr/local/moodle/lib/moodlelib.php on line 1499

Notice: Undefined property: stdClass::$dirroot in /usr/local/moodle/cache/classes/factory.php on line 476

Warning: require_once(/cache/classes/dummystore.php): failed to open stream: No such file or directory in /usr/local/moodle/cache/classes/factory.php on line 476

Fatal error: require_once(): Failed opening required '/cache/classes/dummystore.php' (include_path='/usr/local/moodle/lib/pear:.:/usr/local/php/lib/php') in /usr/local/moodle/cache/classes/factory.php on line 476

Fatal error: Uncaught Error: Call to a member function is_transaction_started() on null in /usr/local/moodle/lib/classes/shutdown_manager.php:137 Stack trace: #0 [internal function]: core_shutdown_manager::shutdown_handler() #1 {main} thrown in /usr/local/moodle/lib/classes/shutdown_manager.php on line 137
In reply to Dave Weninger

Re: Error message - "requce_once(): Failed opening required" during Moodle upgrade about the file setup.php in lib - "/usr/local/moodle/lib/setup.php"

by Ken Task -
Picture of Particularly helpful Moodlers

Do you mean true compile?!!!!???
Like acquire source code then following directions from
this http://httpd.apache.org/docs/current/programs/configure.html#installationdirectories ?

What compile options were included for cache?

https://httpd.apache.org/docs/2.4/mod/mod_cache.html

What does:
/usr/sbin/httpd -V
return

Also:

 /usr/sbin/httpd -t -D DUMP_MODULES

Since your boss did it, he/she should know exactly how compiled ... including any switches options for PHP and supports for MySQL as well!

I used to compile the AMP stack for my servers.   Decided that it was just as good (less issues) to use the package manager of the OS and acquire stack that way.

'SoS', Ken


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

[solve]: Error message - "requce_once(): Failed opening required" during Moodle upgrade about the file setup.php in lib - "/usr/local/moodle/lib/setup.php"

by Dave Weninger -
My boss replied that the switches options are ./configure --enable-so --enable-authnz-ldap --enable-ldap --enable-ssl --with-ssl--enable-rewrite

We cloned the production site. We turn on the debugging mode as you advised and perform moodle upgrade. The moodle can be upgraded successfully in much shorter time. There is no fatal error message except some minor errors which can be easily fixed.

One warning message is "cache/Unable to load the cache configuration file" - "Permission denied in /usr/local/moodle/cache/classes/config.php on line 334". We had fixed it by changing the permission of /mnt/sdb/moodledata/muc" to 777 although we don't know what caused the problem.

Another error message is that "error/Unable to obtain session lock". The problem had been fixed by turning off the Redis session handler.

It seems that the previous dummy moodle is unhealthy which causes serious error about cache and setup.php. We can give up troubleshooting the problematic dummy moodle.

Thank you very much for your advice. Your advice of turning on debugging mode is very useful.
Attachment session_lock - s.PNG
Attachment unable to load cache config-s.PNG
In reply to Dave Weninger

Re: [solve]: Error message - "requce_once(): Failed opening required" during Moodle upgrade about the file setup.php in lib - "/usr/local/moodle/lib/setup.php"

by Ken Task -
Picture of Particularly helpful Moodlers

Welcome ... glad you resolved.

For those who might find this thread ...

One of the reasons I gave up compiling AMP was updates.   Couldn't mix a OS repo upgrade (OS package manger) to any piece of compiled AMP stack.   While compiled AMP stack did allow running  well on non-server class workstations that were beefed up a little, the frequency of updates and upgrades using compile meant longer downtime.

One more piece of advice ... and now would be a good time for ya ... install/and maintain core moodle code via git.   See

https://docs.moodle.org/311/en/Git_for_Administrators

*by far* the best way to maintain moodle core code - fewer moving parts - and literally takes only minutes ... less prone to human error also! smile

'Spirit of Sharing', Ken




Average of ratings: Useful (1)