Nach Upgrade-Versuch 34.0.5 → 35.0.2 bleibt needsDbUpgrade: true, obwohl alle App-Versionen übereinstimmen

Docker-Installation, MariaDB 10.11.19, Nextcloud 34.0.5.1. Verwandter Fall mit gleicher Tabelle, ohne Lösung: https://help.nextcloud.com/t/how-to-update-nextcloud-34-0-4-to-35-0-2-docker-with-mariadb-10-11/250358 . Bekannter Fehler: nextcloud/server#64505.

The Basics

Nextcloud Server version: 34.0.5.1 (Ziel: 35.0.2)

Operating system and version: Debian (Container-Image nextcloud:34.0.5)

Web server and version: Apache 2.4.68 (im Container)

Reverse proxy and version: Cloudflare Tunnel (cloudflared)

PHP version: 8.5.12

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

When did this problem seem to first start?: Beim Upgrade-Versuch auf 35.0.2, 22.10.2026

Installation method: Docker (Container Station, QNAP)

Are you using Cloudflare, mod_security, or similar?: Yes, Cloudflare Tunnel

Summary of the issue you are facing:

Nach einem fehlgeschlagenen occ upgrade von 34.0.5 auf 35.0.2 bleibt needsDbUpgrade: true, obwohl Kern und alle Apps-Versionen mit der Datenbank übereinstimmen. Ich habe die Datenbank aus einem Dump von vor dem Upgrade wiederhergestellt und das Image zurück auf 34.0.5 gesetzt. Der Hinweis bleibt. occ app:list | grep “(installed” zeigt keine Abweichung, in oc_appconfig fehlt für core der Eintrag installed_version.

Steps to replicate it:

occ upgrade von 34.0.5 auf 35.0.2 gestartet (Image nextcloud:35.0.2).

Fehler bei oc_sharing_classmap, Wartungsmodus bleibt aktiv.

Datenbank aus Dump zurückgespielt, Image auf 34.0.5 zurückgesetzt. needsDbUpgrade bleibt true.

Log entries (Nextcloud):

OCP\DB\Schema\SchemaException: The table with name “nextcloud.oc_sharing_classmap” already exists.

Update failed

Maintenance mode is kept active

Web Browser: Nicht betroffen, das Problem liegt im occ-Befehl.

Web server / Reverse Proxy: Keine relevanten Einträge.

Configuration: config.php wird aus Sicherheitsgründen (Zugangsdaten) nicht veröffentlicht. Eine bereinigte Ausgabe von occ config:list system reiche ich auf Anfrage nach. Beide Dateien (config.php und die Backup-Version) enthalten ‘version’ => ‘34.0.5.1’.

Apps: Auf Anfrage: die vollständige occ app:list-Ausgabe. Wichtige Versionen: spreed 24.0.6, notify_push 1.4.1, files_antivirus 6.5.0.

Frage: Welche Stelle setzt needsDbUpgrade, wenn Code und Datenbank versionsgleich sind? Und wie komme ich aus diesem Zustand auf needsDbUpgrade: false, ohne die Datenbank weiter manuell zu verändern?

Der Tabellenname deutet darauf hin, dass Du die School Planner app etc. auf Deinem Server installiert hast. Ich empfehle diese zu entfernen un die Installation erneut vorzunehmen.

Nur zur Information, wenn der im Support-Template angegebene Weg zur Abfrage der Konfiguration verwendet wird, werden Zugangsdaten und andere schützenswerte Information ausgeklammert.

Thanks for the suggestion. I checked my database and there is no “School Planner” app or related table:

oc_appconfig contains no app IDs matching “school” or “planner”

information_schema contains no tables matching “%school%” or “%planner%”

The affected table oc_sharing_classmap is part of core sharing, not of an app. It was already present in my dump from before the upgrade attempt, which is why I think the failure is a migration issue and not an app conflict.

Happy to run further read-only queries if someone tells me which ones would help.

Hy,

I have got also the error Message

OCP\DB\Schema\SchemaException: The table with name “nextcloud.oc_sharing_classmap” already exists.

and have deleted the table in the database. after that I have deleted other tables, they was also shown in this error message one after another: oc_sharing_classmap , oc_sharing_share, oc_sharing_share_permissions, oc_sharing_share_properties , oc_sharing_share_recipients , oc_sharing_share_recipient_permissions , oc_sharing_share_recipient_permissions

After I have deleted all this tables in the database, I’ve got the error message:

Doctrine\DBAL\Exception\ConnectionException: An exception occurred while executing a query: SQLSTATE[42000]: Syntax error or access violation: 1142 REFERENCES command denied to user … for table ‘nextcloud.oc_sharing_share’

I have checked the permissions for the nextcloud user in the Databse and have seen the user have not the permission “REFERENCES”. After I have given this perssion to the user, the update process run but stucked on another point:

Setting log level to debug
Updating database schema
Updated database
Starting code integrity check…
Finished code integrity check
Update successful
Maintenance mode is kept active
Resetting log level
The database schema does not match what is expected for the installed version:

  • …

I have found this while the troubleshooting:

In the second issue I have found the hint to check the app systemtags. That was already enabled in my case.

At the end I have done the following occ commands in the command line:

db:add-missing-columns
db:add-missing-primary-keys
maintenance:repair
maintenance:mode --off

With the last command I have disabled the maintenance mode and now the server is working with the version 35.0.2.

maybe some of my troubleshooting steps can help you.

Best Regards, Daniel

Update: Upgrade to 35.0.2 completed

Following the steps from Daniel3 in this thread, the upgrade to 35.0.2 now completes on my instance. Summary of what I did, in order:

Took a full database dump before changing anything.

Verified that all eight oc_sharing_* tables were empty (row count 0, checked via information_schema).

Dropped those eight tables, with FOREIGN_KEY_CHECKS disabled for that session only.

Changed the app and notify_push services from nextcloud:34.0.5 to nextcloud:35.0.2 in the compose file and recreated the container.

Ran occ upgrade. Result: “Update successful”. The oc_sharing_classmap error did not occur.

Ran occ db:add-missing-columns, occ db:add-missing-primary-keys and occ maintenance:repair. No errors.

Ran occ maintenance:mode --off. needsDbUpgrade is false.

Current state: Nextcloud 35.0.2.2, Talk 25.0.6, MariaDB 10.11.19, PHP 8.5.12, Docker. Talk works in the browser and in the Android app.

Remaining schema check output (not blocking):

missing table ‘oc_federated_invites’

unexpected indexes memories_parent_mimetype on oc_filecache and memories_type_tagid on oc_systemtag_object_mapping

unexpected tables oc_memories* (leftovers from a removed app)

Notes for anyone who hits this:

Dropping the tables requires the REFERENCES privilege for the database user. Check with SHOW GRANTS.

Keep a dump before dropping anything, and verify the row counts first.

References: #64505 and the thread “How to update Nextcloud 34.0.4 to 35.0.2 Docker with MariaDB 10.11”.