Git upgrading failed

Git upgrading failed

by Michael Rice -
Number of replies: 4

I tried to upgrade our 3.4 installation to 3.5 via git, but have run into a problem. I was able to pull the latest weekly release of 3.4 with "sudo git pull" and everything went smoothly. After that, I tried upgrading to 3.5. I ran "git branch -a" which showed all of the branches. Then I ran "git checkout MOODLE_35_STABLE" which threw the following errors:

error: unable to unlink old 'auth/mnet/classes/privacy/provider.php' (Permission denied)

error: unable to unlink old 'course/classes/privacy/provider.php' (Permission denied)

fatal: cannot create directory at 'enrol/cohort/classes/task': Permission denied

Realizing that I didn't run it with sudo permissions I then ran "sudo git checkout MOODLE_35_STABLE". Then I ran into the following error:

error: Your local changes to the following files would be overwritten by checkout:

.eslintignore

.stylelintignore

.travis.yml

Gruntfile.js

...

error: The following untracked working tree files would be overwritten by checkout:

admin/roles/classes/allow_view_page.php

admin/searchreindex.php

...

Aborting

Hoping that it hadn't made any changes I tried to revert back to the 3.4 branch with "git checkout MOODLE_34_STABLE". Which looked like it undid any changes:

M .eslintignore

M .stylelintignore

M .travis.yml

M Gruntfile.js

...

Already on 'MOODLE_34_STABLE'

Your branch is up-to-date with 'origin/MOODLE_34_STABLE'.

Thinking that everything should be good I ran "sudo git pull" to make sure that everything is good and got "Already up-to-date.".

Now when I log in to moodle with the admin account I get a page staying that a bunch of plugins need to be updated.   I ran into a bunch of problems upgrading to 3.4 since it required php 7.0+ and don't want to mess up moodle again. Did I mess something up by inconsistently using sudo and how can I properly upgrade to 3.5 or revert to 3.4?


Average of ratings: -
In reply to Michael Rice

Re: Git upgrading failed

by Michael Rice -

If I try running "sudo git reset --hard ; sudo git pull" will that reset the plugins version back to 3.4? I tried that on a duplicated moodle folder with sucess, but don't know if it will negatively interact with the moodledata folder.

In reply to Michael Rice

Re: Git upgrading failed

by Ken Task -
Picture of Particularly helpful Moodlers

In the 3.4 did you install the plugins related to GDPR?  Privacy, etc..

If so, think the conflict is .... 3.5 those are not plugins but build into core.

Suggest removing the GDPR plugins from the 3.4 and try the git pull, etc. again to go to 3.5.

Uhhh ... one doesn't use git to 'roll back' a site ... one has to restore a backup of code and db that you took just prior to the attempted upgrade.

However, you can try this from the 3.4 code directory

Reissue:

git branch --track MOODLE_34_STABLE origin/MOODLE_34_STABLE
git checkout MOODLE_34_STABLE

Git might complain about both of those .... that's ok.

Then this one:

git reset --hard

Hopefully, that last one will reset to 3.4 ...

do a git branch -a to see if * is beside the 3.4 branch.

And at that point, do db dump and tar ball of code.

Then:

git pull

That might result in a minor 3.4.x update ... which is ok.

Finger X'd for ya!

'spirit of sharing', Ken


In reply to Ken Task

Re: Git upgrading failed

by Michael Rice -
Thanks for the reply!


The only GDPR changes have come from updating to the weekly 3.4 build. I didn't install any third party GDPR plugins.

Also, I haven't updated the database yet. Once I got to the page saying that the plugins need to be updated I stopped and started testing in a duplicated moodle build.

Whenever I run "git branch -a" it has always shown an asterisk next to the 3.4 branch.

Running "git reset --hard" and then "git pull" fixed it for me! I had to delete two new folders that were created by the 3.5 update attempt, but it looks like everything is back to normal.

Thanks for your help!

In reply to Michael Rice

Re: Git upgrading failed

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Personally, I wouldn't try using git to jump between major versions on anything beyond a trivial site at all. 

As Ken points out, you have added optional plugins which are now clashing with core plugins.

I would pull a completely clean version of 3.5, add any required plugins (,test) and then replace the 3.4 install. You can then 'gut pull' to do minor upgrades. 

In fact, I have a Github account and I push my 'version' with all my custom plugins (some of which I write/maintain myself).