Unable to Update Nextcloud From 24.0.3 to 24.0.4

Nextcloud version: 24.0.3
Operating system and version: TrueNAS-13.0-U1.1
nginx version: 1.22.0
PHP version: 8.0.22

The issue you are facing:
Nextcloud won’t update from version 24.0.3 to 24.0.4

Is this the first time you’ve seen this error?: No

Steps to replicate it:

  1. Login to Nextcloud Web Interface
  2. Try to Install Updates From Web Based Updater

The output of your Nextcloud log in Admin > Logging:
I can’t login to the web interface anymore to get this. Is there another way to get it?

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

<?php $CONFIG = array ( 'apps_paths' => array ( 0 => array ( 'path' => '/usr/local/www/nextcloud/apps', 'url' => '/apps', 'writable' => true, ), 1 => array ( 'path' => '/usr/local/www/nextcloud/apps-pkg', 'url' => '/apps-pkg', 'writable' => false, ), ), 'logfile' => '/var/log/nextcloud/nextcloud.log', 'memcache.local' => '\\OC\\Memcache\\APCu', 'one-click-instance' => true, 'one-click-instance.user-limit' => 100, 'memcache.distributed' => '\\OC\\Memcache\\Redis', 'memcache.locking' => '\\OC\\Memcache\\Redis', 'redis' => array ( 'host' => 'localhost', ), 'passwordsalt' => 'IDENTIFIABLE INFORMATION', 'secret' => 'IDENTIFIABLE INFORMATION', 'trusted_domains' => array ( 0 => 'localhost', 1 => 'IDENTIFIABLE INFORMATION', ), 'datadirectory' => '/usr/local/www/nextcloud/data', 'dbtype' => 'mysql', 'version' => '', The output of your nginx error.log in `/var/log/nginx`: 2022/08/14 15:02:06 [error] 3212#100725: send() failed (54: Connection reset by peer) Output errors in nextcloud.log in /var/www/ or as admin user in top right menu, filtering for errors. Use a pastebin service if necessary. There is no /www folder in /var. I found a nextcloud.log file stored in /var/log/nextcloud but I don't know how to copy it. I tried winscp but couldn't view that directory. If you need it please let me know how to copy this file and I'll be happy to get it for you. I started my Nextcloud journey with the All In One 40GB VM machine distributed by Hanssonit. It seemed like the best beginner version of Nextcloud and I ran it on my VMware ESXI server. For the most part it ran smoothly. It’s when I went to do updates that I ran into HUGE problems. This first time was my own fault because I didn’t do any backups and when I ran sudo bash /var/scripts/menu.sh and went down to updates it failed. When I went to the web address it told me it was in Maintenance mode. So I turned that off in the config.php file and the website said Nextcloud will be updated to version 24.0.4 Please make sure that the database, the config folder and the data folder have been backed up before proceeding. *To avoid timeouts with larger installations, you can instead run the following command from your installation directory: ./occ upgrade* I tried clicking the update button here and it gave me a series of errors. So I tried the .occ upgrade command and again was met with tons of errors. I searched everywhere I could to find a solution to this problem and eventually decided to turn off network security temporarily to see if something different would happen when I ran sudo bash /var/scripts/menu.sh. It didn’t fail this time. Instead it told me that I couldn’t update between major versions with that script. It told me to visit https://shop.hanssonit.se/product/upgrade-between-major-owncloud-nextcloud-versions/ I would have to pay fifty euros every time I want to update. For this server I just want to recover my Nextcloud data, files, contacts, calendar etc. How do I do this? Fast forward to today and I decided to host Nextcloud through TrueNas in hopes that updates would be more reliable or at least easier to roll back when I inevitably bricked something. Sadly I was wrong and I bricked my server again. This time I have lots of snapshots in TrueNas but when I click Rollback it doesn’t seem to do anything to restore my Nextcloud server. The steps I did are as follows. I ran updates from the web based updater. It immediately popped up an error message: The following extra files have been found: .htaccess.dist but a quick google search told me to delete the file and it worked. It went through all 12 steps of the updater and then had an error message. Before I could save the error message it reloaded the page and wanted me to login using an updater.secret. I didn’t see it in my config.php file so I made one by running php -r '$password = trim(shell_exec(“openssl rand -base64 48”));if(strlen($password) === 64) {$hash = password_hash($password, PASSWORD_DEFAULT) . “\n”; echo "Insert as “updater.secret”: ".$hash; echo “The plaintext value is: “.$password.”\n”;}else{echo “Could not execute OpenSSL.\n”;}; as shown in this post: https://help.nextcloud.com/t/cant-access-nextcloud-need-updater-secret/62348/3 I added the updater.secret to my config.php file but it never would let me login to the page using the updater.secret. I gave that up and tried disabling maintenance mode and going to the web address of my server. I clicked the update button it showed and it gave more errors: Preparing update Set log level to debug Turned on maintenance mode Repair step: Repair MySQL collation Repair info: All tables already have the correct collation -> nothing to do Repair step: Repair SQLite autoincrement Repair step: Copy data from accounts table when migrating from ownCloud Repair step: Drop account terms table when migrating from ownCloud Updating database schema Updated database Repair step: Repair MySQL collation Repair info: All tables already have the correct collation -> nothing to do Repair step: Repair mime types Repair step: Clean tags and favorites Repair info: 0 tags of deleted users have been removed. Repair info: 0 tags for delete files have been removed. Repair info: 0 tag entries for deleted tags have been removed. Repair info: 0 tags with no entries have been removed. Repair step: Repair invalid shares Repair step: Move .step file of updater to backup location Repair step: Add move avatar background job Repair info: Repair step already executed Repair step: Add preview cleanup background jobs Repair step: Migrate oauth2_clients table to nextcloud schema Repair info: Update the oauth2_access_tokens table schema. Repair info: Update the oauth2_clients table schema. Repair step: Fix potential broken mount points Repair info: No mounts updated Repair step: Repair language codes Repair step: Install new core bundle components Repair step: Add log rotate job Repair step: Clear frontend caches Repair info: Image cache cleared An error occurred. I gave that up and tried running occ upgrade on the TrueNas Jail Shell. It showed this: root@Nextcloud:/ # occ upgrade Nextcloud or one of the apps require upgrade - only a limited number of commands are available You may use your browser or the occ upgrade command to do the upgrade Setting log level to debug Updating database schema Updated database An unhandled exception has been thrown: TypeError: OC\EventDispatcher\ServiceEventListener::__invoke(): Argument #1 ($event) must be of type OCP\EventDispatcher\Event, OC\EventDispatcher\GenericEventWrapper given, called in /usr/local/www/nextcloud/3rdparty/symfony/event-dispatcher/EventDispatcher.php on line 264 and defined in /usr/local/www/nextcloud/lib/private/EventDispatcher/ServiceEventListener.php:65 Stack trace: #0 /usr/local/www/nextcloud/3rdparty/symfony/event-dispatcher/EventDispatcher.php(264): OC\EventDispatcher\ServiceEventListener->__invoke(Object(OC\EventDispatcher\GenericEventWrapper), '\\OCP\\Files::pos...', Object(Symfony\Component\EventDispatcher\EventDispatcher)) #1 /usr/local/www/nextcloud/3rdparty/symfony/event-dispatcher/EventDispatcher.php(239): Symfony\Component\EventDispatcher\EventDispatcher->doDispatch(Array, '\\OCP\\Files::pos...', Object(OC\EventDispatcher\GenericEventWrapper)) #2 /usr/local/www/nextcloud/3rdparty/symfony/event-dispatcher/EventDispatcher.php(73): Symfony\Component\EventDispatcher\EventDispatcher->callListeners(Array, '\\OCP\\Files::pos...', Object(OC\EventDispatcher\GenericEventWrapper)) #3 /usr/local/www/nextcloud/lib/private/EventDispatcher/SymfonyAdapter.php(122): Symfony\Component\EventDispatcher\EventDispatcher->dispatch(Object(OC\EventDispatcher\GenericEventWrapper), '\\OCP\\Files::pos...') #4 /usr/local/www/nextcloud/lib/private/Files/Node/Node.php(118): OC\EventDispatcher\SymfonyAdapter->dispatch('\\OCP\\Files::pos...', Object(Symfony\Component\EventDispatcher\GenericEvent)) #5 /usr/local/www/nextcloud/lib/private/Files/Node/File.php(133): OC\Files\Node\Node->sendHooks(Array, Array) #6 /usr/local/www/nextcloud/lib/private/Files/SimpleFS/SimpleFile.php(149): OC\Files\Node\File->delete() #7 /usr/local/www/nextcloud/lib/private/Template/SCSSCacher.php(386): OC\Files\SimpleFS\SimpleFile->delete() #8 /usr/local/www/nextcloud/lib/private/Repair/ClearFrontendCaches.php(62): OC\Template\SCSSCacher->resetCache() #9 /usr/local/www/nextcloud/lib/private/Repair.php(124): OC\Repair\ClearFrontendCaches->run(Object(OC\Repair)) #10 /usr/local/www/nextcloud/lib/private/Updater.php(293): OC\Repair->run() #11 /usr/local/www/nextcloud/lib/private/Updater.php(133): OC\Updater->doUpgrade('', '') #12 /usr/local/www/nextcloud/core/Command/Upgrade.php(235): OC\Updater->upgrade() #13 /usr/local/www/nextcloud/3rdparty/symfony/console/Command/Command.php(255):OC\Core\Command\Upgrade->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #14 /usr/local/www/nextcloud/3rdparty/symfony/console/Application.php(1009): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #15 /usr/local/www/nextcloud/3rdparty/symfony/console/Application.php(273): Symfony\Component\Console\Application->doRunCommand(Object(OC\Core\Command\Upgrade), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #16 /usr/local/www/nextcloud/3rdparty/symfony/console/Application.php(149): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #17 /usr/local/www/nextcloud/lib/private/Console/Application.php(211): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #18 /usr/local/www/nextcloud/console.php(100): OC\Console\Application->run() #19 /usr/local/www/nextcloud/occ(11): require_once('/usr/local/www/...') #20 {main}root@Nextcloud:/ # What can I do to save this mess I created? I would love to host Nextcloud in order to have privacy and control over my data but I'm a beginner at this and keep messing things up. This https://www.truenas.com/docs/ and https://docs.nextcloud.com/server/stable/admin_manual/ both have lots of info on how to set things up correctly and manage it but I still managed to mess it up. Is there any way to rollback the changes I made and/or make updates more reliable? Let me know if you need any more logs or info and I will do my best to supply.

You should disable apps like recognize or other not as “presented” defined apps prior your update steps. Do you have terminal access to your instance?

I do not have terminal access to Nextcloud. I do have shell access through TrueNas though. I ran occ app:disable and occ app:list I disabled everything I could just to be safe. (Especially recognize 2.20 like you said.) Should I run occ upgrade now?

Nextcloud or one of the apps require upgrade - only a limited number of commands are available
You may use your browser or the occ upgrade command to do the upgrade

  • cloud_federation_api: 1.7.0
  • dav: 1.22.0
  • federatedfilesharing: 1.14.0
  • files: 1.19.0
  • lookup_server_connector: 1.12.0
  • oauth2: 1.12.0
  • provisioning_api: 1.14.0
  • settings: 1.6.0
  • twofactor_backupcodes: 1.13.0
  • viewer: 1.8.0
  • workflowengine: 2.6.0
  • accessibility: 1.10.0
  • activity: 2.16.0
  • admin_audit: 1.14.0
  • apporder: 0.15.0
  • backup: 1.1.2
  • breezedark: 24.0.2
  • calendar: 3.4.2
  • circles: 24.0.1
  • comments: 1.14.0
  • contacts: 4.2.0
  • contactsinteraction: 1.5.0
  • dashboard: 7.4.0
  • deck: 1.7.1
  • encryption: 2.12.0
  • extract: 1.3.5
  • federation: 1.14.0
  • files_accesscontrol: 1.14.0
  • files_antivirus: 3.3.1
  • files_automatedtagging: 1.14.0
  • files_external: 1.16.1
  • files_pdfviewer: 2.5.0
  • files_retention: 1.13.2
  • files_rightclick: 1.3.0
  • files_sharing: 1.16.2
  • files_trashbin: 1.14.0
  • files_versions: 1.17.0
  • files_videoplayer: 1.13.0
  • firstrunwizard: 2.13.0
  • forms: 2.5.1
  • geoblocker: 0.5.6
  • groupfolders: 12.0.1
  • integration_google: 1.0.6
  • logreader: 2.9.0
  • mail: 1.13.8
  • maps: 0.2.0
  • music: 1.6.0
  • nextcloud_announcements: 1.13.0
  • notes: 4.5.0
  • notifications: 2.12.0
  • onlyoffice: 7.5.4
  • password_policy: 1.14.0
  • passwords: 2022.6.20
  • photos: 1.6.0
  • privacy: 1.8.0
  • quota_warning: 1.14.0
  • recognize: 2.2.0
  • recommendations: 1.3.0
  • registration: 1.5.0
  • richdocuments: 6.2.0
  • serverinfo: 1.14.0
  • sharebymail: 1.14.0
  • side_menu: 2.4.3
  • socialsharing_diaspora: 2.5.0
  • socialsharing_email: 2.5.0
  • socialsharing_facebook: 2.5.0
  • socialsharing_twitter: 2.5.0
  • spreed: 14.0.4
  • support: 1.7.0
  • survey_client: 1.12.0
  • suspicious_login: 4.2.0
  • systemtags: 1.14.0
  • terms_of_service: 1.10.2
  • text: 3.5.1
  • theming: 1.15.0
  • theming_customcss: 1.11.0
  • twofactor_totp: 6.4.0
  • twofactor_webauthn: 0.3.1
  • unsplash: 1.2.5
  • updatenotification: 1.14.0
  • user_ldap: 1.14.1
  • user_migration: 1.1.0
  • user_status: 1.4.0
  • weather_status: 1.4.0

Yes, use php occ upgrade to try it again

It successfully upgraded! Is there a way to automatically disable and then re-enable all the apps next time I do updates to reduce downtime?

same issue here but occ upgrade returns:

it is not the same error, i think you try to update from 23.x to 24.x or something linke this?

Most likely, I just ran update on TrueNas for the plugin but the error seemed the same.

When you click the update button from TrueNAS it makes a snapshot of the jail and updates the operating system of the jail. FreeBSD is the operating system of TrueNAS jails and the Nextcloud plugin runs on top of it. Nextcloud has some documentation on how to update. Have you checked that and does it help? How to upgrade — Nextcloud latest Administration Manual latest documentation

So I read that documentation but I had clicked upgrade from within TrueNas, how do I now execute the upgrade from shell?

it’s stuck in maintenance mode now but even when I disable that I still can’t reach the login page, it prompts upgrading