Web and CLI update failed 22.2.3 => 22.2.10

I ran the web updater and ran into problems there. First the backup didn’t complete and then deleting old files failed. I turn to the CLI and noticed the occ file and version.php files were gone. Got new one from the repo though.
Running the command sudo -u www-data php /var/www/nextcloud/updater/updater.phar
I got a a bunch of HTML and and the following error message:

PHP Notice:  Undefined variable: OC_VersionString in phar:///var/www/nextcloud/updater/updater.phar/lib/Updater.php on line 75
PHP Notice:  Undefined variable: OC_Build in phar:///var/www/nextcloud/updater/updater.phar/lib/Updater.php on line 76
Current version is unknown.

The update process stopped at the extraction step:


[✘] Extracting failed
OC_Version not found in /var/www/nextcloud/updater/../version.php

Update failed. To resume or retry just execute the updater again.

What can I do to get this back on track?

I just ran into the same problem updating from 24.08 to 25.02. The best I can tell is that an error occurred during the “delete old files” step of the update process, and a portion of the current install’s files were deleted. When re-attempting to update NextCloud, the updater runs into issues when it can’t find files that should be there, including version.php that informs the updater what current version and build are being updated to a newer version.

My fix was to go into my NextCloud directory (not the docker directory in appdata, but the same directory where you NextCloud files are stored). You’ll find a directory similar to “updater-ocfp67qlxts8.”. Navigate to the backups folder and look for the most recent backup (e.g., nextcloud-24.0.8.2-1671816722) that is not missing files. Then copy the contents of that backup into your docker nextcloud web ui directory (/nextcloud/www/nextcloud/). Finally, re-run the updater, and all should work!

I don’t have any backups stored in /var/www/nextcloud/updater folder which you were mentioning. It just contains index.php and updater.phar. I’m not running Nextcloud as a docker image either so their way be a difference in how backups are stored or the previous update wiped out the folder structure.
In an attempt to update php from 7.3.31-1 to 8 I’ve stumbled upon a problem with the command lsb_release not working even though the lsb-release package is installed.

Yeah, those were the only files in my /www/nextcloud/updater folder, as well. Backups are not stored there (don’t think docker vs Windows/etc install matters). Instead, the updater-xxxxxxx directory (with the backups inside) is located wherever your NextCloud files are stored (as in, the actual cloud storage/user files, not the program’s install directory). In effect, the updater copies all of your previous install into a backup folder at your cloud storage location, then deletes it from the program’s install directory, then moves the newer version’s files into the install directory. When the updater hangs or flags errors, sometimes this process gets fouled up. In my case, it crashed on the delete step, removing a portion of the files in the install directory, then on a second update attempt it copied that half-baked set of install files as the backup, but some of those backup files that were missing are required to complete the update). Bottom line, search your entire hard drive for a folder that begins with “updater-oc” …if you can’t find it, I don’t know what to tell you, but if you do - copy the contents of a complete backup back into the install directory (in your case /var/www/nextcloud/) and you should be squared away.

I ended up doing a manual update after upgrading to php8. I could then progressively update to v.24 using the web interface.
I did the mistake to upgrade to php8.1 and could only get back to 8.0 by completely removing the higher version. Just mentioning this in case someonefaces the same problem.