Getting around the false Nextcloud update “Exception: Updates between multiple major versions and downgrades are unsupported. Update failed”

Anyone who updates their Nextcloud instance regularly and has it run smoothly, hats off you to you. Mine hasn’t been smooth for as long as I can remember. I’m just hoping that someday this will be easier. I love Nextcloud, but cringe when an update needs happen because something will go wrong. 

The major versions error is a usual problem. For some reason, the update check hits this and dies. I overcome it with this fix found on the nextcloud forums but forget it each time, so I’m doing a post here to not forget it!

When the updater runs via the web ui or if you run it via the command line occ command, it does some check on versions and gets it wrong. It triggers a stop in the Updater.php that inhibits the upgrade. This is really just one of the many upgrade issues I run into because I also have various app issues that trigger errors as well, but that’s another story. 

The fix / bypass is to go into the /lib/private directory in your nextcloud directory and edit the Updater.php file. Remove the logic that will trigger the fail and then run the update.

in the Updater.php file, on around lines 210-212 and lines 216-217 you’ll see the check logic. Remove it and just give it 

return true;

so it runs no matter what. Here is the before and after for Nextcloud 12.04.

Before:

and after:

When you do this, you can rerun the updater to get past it. The problem is though that after a successful update, this file gets changed back to standard so you’ll have to revisit this again later on the next update. But, at least you get past it to do you’re incremental update. 

Don’t kill this check if you are actually trying to update between major versions or who knows what mess you will make.