Hotpot (plugin)

Moodle 2.4 automatic update: Unable to read the passphrase file

 
Picture of Joseph Rézeau
Moodle 2.4 automatic update: Unable to read the passphrase file
Core developersParticularly helpful MoodlersPlugin developersTestersTranslators

Hi Gordon.

I am currently conducting tests on moodle 2.4 (soon to be released) and have come upon a problem when trying to upgrade my current HP mod to your latest release.

When I visit admin->notifications, I am told that a new version of HP is available.screenshot #1

If I click the Download link I can download the zipped HP on my machine, and then unzip and copy to my moodle/mod folder, i.e. perform a "manual" install as usual. And it works fine!

Anyway I decided to try out the - new to moodle 2.4 - "automatic update" and clicked the Install this update button. But that threw out an error:

Oops! It did it again
Moodle deployment utility had a trouble with your request. See the debugging information for more details.
exception 'unauthorized_access_exception' with message 'Unable to read the passphrase file.' in moodle\mdeploy.php:830
Stack trace:
#0 M:\server\htdocs\moodle24\moodle\mdeploy.php(699): worker->authorize()
#1 M:\server\htdocs\moodle24\moodle\mdeploy.php(1314): worker->execute()
#2 {main}

Should I (or would you, Gordon) open an issue in the tracker?

ATB

Joseph

 
Average of ratings: -
Picture of Gordon Bateson
Re: Moodle 2.4 automatic update: Unable to read the passphrase file
Core developersParticularly helpful MoodlersPlugin developersTranslators

Hi Joseph,
I have seen not that screen before, and I have no idea what the error message means. If you have the time and energy to open a tracker issue, please go ahead.

regards
Gordon

 
Average of ratings: -
Picture of Gordon Bateson
Re: Moodle 2.4 automatic update: Unable to read the passphrase file
Core developersParticularly helpful MoodlersPlugin developersTranslators

Hmm, a quick look at the code shows the expected path to the passfile as:

  • $passpath = $dataroot.'/mdeploy/auth/'.$passfile;

I tried a similar thing on my Moodle 2.4 site, and I got a different error saying the zip file could not be downloaded (see schreeshot).

regards
Gordon


 
Average of ratings: -
Picture of Joseph Rézeau
Re: Moodle 2.4 automatic update: Unable to read the passphrase file
Core developersParticularly helpful MoodlersPlugin developersTestersTranslators

Hi Gordon,

Let's wait and see if I get a reply to my post in this discussion.

Joseph

 
Average of ratings: -
Picture of David Mudrák
Re: Moodle 2.4 automatic update: Unable to read the passphrase file
Core developersDocumentation writersMoodle HQParticularly helpful MoodlersPlugin developersPlugins guardiansTestersTranslators
Gordon. Is your site behind a proxy defined in Moodle? Can you please look at the file moodledata/mdeploy/mdeploy.log to see if there is any additional information?
 
Average of ratings: -
Picture of Gordon Bateson
Re: Moodle 2.4 automatic update: Unable to read the passphrase file
Core developersParticularly helpful MoodlersPlugin developersTranslators

Hi David,
I am not behind a proxy, and like Joseph I was just testing on my localhost.

The contents of moodledata/mdeploy/mdeploy.log appear below:

2012-11-26 01:03:02 === MDEPLOY EXECUTION START ===
2012-11-26 01:03:02 Successfully authorized using the passphrase file
2012-11-26 01:03:02 Plugin upgrade requested
2012-11-26 01:03:02 Downloading package https://moodle.org/plugins/download.php/1725/mod_hotpot_moodle24_2010080352.zip
2012-11-26 01:03:02 cURL error 60 SSL certificate problem, verify that the CA cert is OK. Details:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
2012-11-26 01:03:02 Unable to download the file
2012-11-26 01:03:02 exception 'download_file_exception' with message 'Unable to download the package' in /path/to/Moodle/24/mdeploy.php:720
Stack trace:
#0 /path/to/Moodle/24/mdeploy.php(1314): worker->execute()
#1 {main}

A little extra info from phpinfo():

PHP 5.3.6
cURL support enabled
cURL Information 7.24.0
Protocols dict, file, ftp, ftps, gopher, http, https, imap, imaps, ldap, ldaps, pop3, pop3s, rtsp, smtp, smtps, telnet, tftp
Host x86_64-apple-darwin10.8.0
SSL Version OpenSSL/0.9.8r
ZLib Version 1.2.5

I was using the Chrome browser at the time. The link to the zip file is accessible via my browser. I'll try some other browsers later, and report back.

best regards
Gordon

 
Average of ratings: -
Picture of Gordon Bateson
Re: Moodle 2.4 automatic update: Unable to read the passphrase file
Core developersParticularly helpful MoodlersPlugin developersTranslators

Hi David,
it seems that the version of cURL I was using did not have the requisite CA certificate, so it was not able to communicate via https.

I found the fix to my issue among several workarounds suggested on the following page:

I believe this only happens on Mac machines using MAMP or "MAMP PRO".

The fix is remove the MAMP cURL library which is usually located at "/Applications/MAMP/Library/bin/curl". You can do this quickly, if you open a Mac terminal window and copy and paste the following command:

  • mv /Applications/MAMP/Library/bin/curl /Applications/MAMP/Library/bin_curl

You may also have to restart MAMP (I did). After doing so, phpinfo reported the same version of cURL as I showed earlier.

In addition I had to reset the permissions on the appropriate folders:

  • chmod -R 777 /path/to/moodle/mod/hotpot
  • chmod     777  /path/to/moodle/mod

And "hey presto" it worked. David, congratualations on this excellent implementation of a most useful functionality.

I would like to humbly suggest that title of the mdeploy error page is changed to something that inspires confidence more than "Oops, it did it again"wink Also, I think admins would find a link from the error page to the mdeploy.log useful, or at least a copy of the last few lines of the log displayed right on the error page, so that they can begin diagnostic investigations more quickly. "Could not download zip file" was a mildly helpful message, but "cURL error 60 SSL certificate problem" enabled me to track down a solution right away. Finally, if my understanding is correct, then my original version of cURL could not ever communicate via https, so if it is possible to detect that situation automatically and report it nicely, that would the icing on the cake !

Joseph, while I was investigating this, I used the browser's back and forward arrows to skip between the steps in the deployment process, and I did see the "passphrase" error at one point. Were you doing something similar? When I did a "clean" run of the deployment, simply going from one step to the next by pressing the next/continue buttons, everything worked as expected.

best regards
Gordon

 
Average of ratings: -
Picture of David Mudrák
Re: Moodle 2.4 automatic update: Unable to read the passphrase file
Core developersDocumentation writersMoodle HQParticularly helpful MoodlersPlugin developersPlugins guardiansTestersTranslators

Good debugging job! Well done Gordon.

Please note that the log is not displayed to the screen intentionally. The log is supposed to contain sensitive information about the site, files location, and actual values passed to the script. Bad guys might abuse the log output to obtain valuable details about your site. That is why the log file is accessible from the moodledata folder only.

And correct, using back/forward buttons can easily get you into the passphrase error page. The authorization workflow relies on a those two "Install this update" buttons being pressed in a sequence. If you use the back button to return from an error page, you have to return up to the page where the button appears first (i.e. the list of available updates) and jump to the confirmation page again by re-pressing the button. In other words, the confirmation screen can not be re-used.

 
Average of ratings: -
Picture of Gordon Bateson
Re: Moodle 2.4 automatic update: Unable to read the passphrase file
Core developersParticularly helpful MoodlersPlugin developersTranslators

Thanks for the explanation David - makes sense.

I found a better looking fix for the missing CA certificates in MAMP's cURL:

I don't know if this affects the Moodle Package for Mac OSX but I would like to recommend the above fix to the maintainer of the Moodle Package for Mac OSX. DO you know who I should contact?

regards
Gordon

 
Average of ratings: -
Picture of David Mudrák
Re: Moodle 2.4 automatic update: Unable to read the passphrase file
Core developersDocumentation writersMoodle HQParticularly helpful MoodlersPlugin developersPlugins guardiansTestersTranslators

Do you know who I should contact?

I did not know but I knew who to ask. My source told me the maintainer should be Ralf Krause.

 
Average of ratings: Useful (1)
Picture of David Mudrák
Re: Moodle 2.4 automatic update: Unable to read the passphrase file
Core developersDocumentation writersMoodle HQParticularly helpful MoodlersPlugin developersPlugins guardiansTestersTranslators

Hmmm, that is weird. Automatic updates deployment should work and it passed our internal testing. There is a known lack of support for sites behind proxy (i.e. sites that have proxy defined in Moodle administration) that should be fixed yet.

However, the error you describe has nothing to do with fetching data from the plugins repository. Do you have access to your moodledata folder? If so, can you perform the following test.

  1. At the screen you posted above, click the Install this update.
  2. A confirmation screen should appear - do not continue yet though.
  3. Instead, look at your moodledata folder, into moodledata/mdeploy/auth/ folder.
  4. Can you see any file there? It should have the timecreated set to the moment when you click the button. Is that correct?

If you confirm the file is there, there are some other things we can test. But they will probably require looking at the source code of the page and understanding HTML forms a bit. Please let me know if you are able to perform such a test.

Thanks for raising this.

 
Average of ratings: -
Picture of Joseph Rézeau
Re: Moodle 2.4 automatic update: Unable to read the passphrase file
Core developersParticularly helpful MoodlersPlugin developersTestersTranslators

Hi David,

Do you have access to your moodledata folder? Yes, this is my localhost on my local computer.

If so, can you perform the following test.

  1. At the screen you posted above, click the Install this update. OK.
  2. A confirmation screen should appear - do not continue yet though. OK.
  3. Instead, look at your moodledata folder, into moodledata/mdeploy/auth/ folder.
  4. Can you see any file there? It should have the timecreated set to the moment when you click the button. Is that correct? Yes, there is an mdeploy_50b3e365bc79f4.94953144 file created at the time of clicking Install this update. This file contains what looks like an encrypted password, ending with 1353966437.

When I click the Install this update button (on the confirmation screen), I get the same error message I posted in my original post to this discussion.

Waiting for more or should I post a bug report somewhere?

Joseph

 
Average of ratings: -
Picture of David Mudrák
Re: Moodle 2.4 automatic update: Unable to read the passphrase file
Core developersDocumentation writersMoodle HQParticularly helpful MoodlersPlugin developersPlugins guardiansTestersTranslators
Thanks Joseph. To be honest, I can't see why this happening to you at the moment. You can report it as a bug and we can move this conversation into the tracker, for sure.

When reporting the bug, please provide a link to this thread. Also, please append the info about your local machine - what operating system you are running, what PHP version you have and what web server type and version you use.

Thanks in advance.
 
Average of ratings: -
Picture of Rich Stevenson
Re: Moodle 2.4 automatic update: Unable to read the passphrase file
 
Hello Gents

It appears I am having the same issue when I attempted to update the "Progress Bar" plugin.

Did anyone ever come up with a solution as it now appears I am unable to actually install any new plugins or updates.

Rich



 
Average of ratings: -
Picture of Gordon Bateson
Re: Moodle 2.4 automatic update: Unable to read the passphrase file
Core developersParticularly helpful MoodlersPlugin developersTranslators

Hello Rich,

well I came up with a soultion for my situation earlier in this thread. Did you try that already?

Gordon

 
Average of ratings: -