Upgrade issue Nextcloud 31.0.11 to 32.0.2 k8s

The Basics

  • Nextcloud Server version (e.g., 29.x.x):
    • 31.0.11
  • Operating system and version (e.g., Ubuntu 24.04):
    • k8s talos
  • Web server and version (e.g, Apache 2.4.25):
    • Apache
  • Reverse proxy and version _(e.g. nginx 1.27.2)
    • Bunkerweb
  • PHP version (e.g, 8.3):
    • docker image version
  • Is this the first time you’ve seen this error? (Yes / No):
    • Yes
  • When did this problem seem to first start?
    • 08/12/2025
  • Installation method (e.g. AlO, NCP, Bare Metal/Archive, etc.)
    • Kubernetes community helm chart
  • Are you using CloudfIare, mod_security, or similar? (Yes / No)
    • yes

Summary of the issue you are facing:

Hello,

I am encountering an issue when attempting to update Nextcloud from version 31.0.11 to version 32.0.2. The following error appears: “UnexpectedValueException: The files of the app “files” were not correctly replaced before running the update.”

I am using Nextcloud in a K8S cluster, so I simply changed the tag version in my helm values file.

Does anyone have any ideas on how to resolve this issue?

Thank you for your help!

Steps to replicate it:

  1. Change the tag in the values.yaml file

  2. Apply with helm upgrade --install nextcloud nextcloud/nextcloud -f values.yaml -n nextcloud

Log entries

Nextcloud

Defaulted container "nextcloud" out of: nextcloud, nextcloud-cron
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
UnexpectedValueException: The files of the app "files" were not correctly replaced before running the update
Update failed
Maintenance mode is kept active
Resetting log level
command terminated with exit code 5

Configuration

Nextcloud

{
    "system": {
        "htaccess.RewriteBase": "\/",
        "apps_paths": [
            {
                "path": "\/var\/www\/html\/apps",
                "url": "\/apps",
                "writable": false
            },
            {
                "path": "\/var\/www\/html\/custom_apps",
                "url": "\/custom_apps",
                "writable": true
            }
        ],
        "maintenance_window_start": 1,
        "memcache.local": "\\OC\\Memcache\\APCu",
        "trusted_proxies": "***REMOVED SENSITIVE VALUE***",
        "forwarded_for_headers": [
            "HTTP_X_FORWARDED_FOR"
        ],
        "memcache.distributed": "\\OC\\Memcache\\Redis",
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "port": 6379
        },
        "mail_smtpmode": "smtp",
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpport": "587",
        "mail_smtpauthtype": "LOGIN",
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "upgrade.disable-web": true,
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "localhost",
            "cloud.****.ovh",
            "office.****.ovh"
        ],
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "pgsql",
        "version": "31.0.11.2",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbport": "",
        "dbtableprefix": "oc_",
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "maintenance": true,
        "loglevel": 0,
        "memories.db.triggers.fcu": true,
        "memories.exiftool": "\/var\/www\/html\/custom_apps\/memories\/bin-ext\/exiftool-amd64-glibc",
        "memories.vod.path": "\/var\/www\/html\/custom_apps\/memories\/bin-ext\/go-vod-amd64",
        "allow_local_remote_servers": true,
        "app_install_overwrite": [],
        "preview_imaginary_url": "***REMOVED SENSITIVE VALUE***",
        "enable_previews": true,
        "enabledPreviewProviders": [
            "OC\\Preview\\Movie",
            "OC\\Preview\\PNG",
            "OC\\Preview\\JPEG",
            "OC\\Preview\\GIF",
            "OC\\Preview\\BMP",
            "OC\\Preview\\XBitmap",
            "OC\\Preview\\MP3",
            "OC\\Preview\\MP4",
            "OC\\Preview\\TXT",
            "OC\\Preview\\MarkDown",
            "OC\\Preview\\PDF",
            "OC\\Preview\\TIFF",
            "OC\\Preview\\HEIC",
            "OC\\Preview\\Movie",
            "OC\\Preview\\MKV",
            "OC\\Preview\\MP4",
            "OC\\Preview\\AVI",
            "OC\\Preview\\Image"
        ],
        "overwriteprotocol": "https",
        "overwrite.cli.url": "https:\/\/cloud.***.ovh",
        "default_phone_region": "FR",
        "filesystem_check_changes": 1,
        "preview_max_x": 256,
        "preview_max_y ": 256,
        "preview_max_memory": 1024,
        "preview_max_filesize_image": 256,
        "mail_sendmailmode": "smtp",
        "mail_smtpauth": true,
        "mail_smtpname": "***REMOVED SENSITIVE VALUE***",
        "mail_smtppassword": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpsecure": "tls"
    }
}

Apps

Enabled:
  - activity: 4.0.0
  - app_api: 5.0.2
  - calendar: 5.5.9
  - circles: 31.0.0
  - cloud_federation_api: 1.14.0
  - comments: 1.21.0
  - contacts: 7.3.7
  - contactsinteraction: 1.12.1
  - cospend: 3.1.6
  - dashboard: 7.11.0
  - dav: 1.33.0
  - deck: 1.15.5
  - facerecognition: 0.9.70
  - federatedfilesharing: 1.21.0
  - federation: 1.21.0
  - files: 2.3.1
  - files_automatedtagging: 2.0.1
  - files_downloadlimit: 4.0.0
  - files_pdfviewer: 4.0.0
  - files_reminders: 1.4.0
  - files_retention: 2.0.1
  - files_sharing: 1.23.2
  - files_trashbin: 1.21.0
  - files_versions: 1.24.0
  - files_zip: 2.2.0
  - firstrunwizard: 4.0.0
  - logreader: 4.0.0
  - lookup_server_connector: 1.19.0
  - memories: 7.7.0
  - nextcloud_announcements: 3.0.0
  - notes: 4.12.4
  - notifications: 4.0.0
  - oauth2: 1.19.1
  - phonetrack: 0.9.1
  - photos: 4.0.0
  - previewgenerator: 5.11.0
  - privacy: 3.0.0
  - profile: 1.0.0
  - provisioning_api: 1.21.0
  - qownnotesapi: 25.8.0
  - recommendations: 4.0.0
  - related_resources: 2.0.0
  - richdocuments: 8.7.7
  - serverinfo: 3.0.0
  - settings: 1.14.0
  - sharebymail: 1.21.0
  - support: 3.0.0
  - systemtags: 1.21.1
  - tasks: 0.17.1
  - text: 5.0.2
  - theming: 2.6.1
  - twofactor_backupcodes: 1.20.0
  - twofactor_totp: 13.0.0-dev.0
  - updatenotification: 1.21.0
  - user_oidc: 8.1.0
  - user_status: 1.11.0
  - viewer: 4.0.0
  - weather_status: 1.11.0
  - workflowengine: 2.13.0
Disabled:
  - admin_audit: 1.22.0 (installed 1.19.0)
  - bruteforcesettings: 5.0.0-dev.0 (installed 2.3.0)
  - cookbook: 0.11.5 (installed 0.11.5)
  - csp_editor: 1.8.0 (installed 1.8.0)
  - documentserver_community: 0.2.1 (installed 0.2.0)
  - encryption: 2.20.0
  - files_external: 1.24.0 (installed 1.9.0)
  - password_policy: 4.0.0-dev.0 (installed 1.9.1)
  - survey_client: 4.0.0-dev.0 (installed 1.7.0)
  - suspicious_login: 10.0.0-dev.0
  - twofactor_nextcloud_notification: 5.0.0 (installed 2.3.0)
  - user_ldap: 1.22.0
  - webhook_listeners: 1.2.0 (installed 1.1.0-dev)
  - whiteboard: 1.4.0 (installed 1.4.0)

files is a core aspect of Server. The code for this app would normally be replaced on your persistent storage for /var/www/html from updated version found in the newer image version.

Th error suggests it wasn’t replaced for some reason.

Do you have the full container output from the upgrade? It’d be unusual to have it run occ upgrade automatically if something failed earlier with the code update (at least based on how the underlying image operates; I’ve have to check the Helm chart for other bits).

When was the last time you updated the chart itself and synced your names.yaml with the repo?

I’m running Nextcloud in my bare metal local Kubernetes cluster.

I’m not using any of the Helm charts (yet), but the behaviour you describe seems very similar to my experiences. I’ve had a look at the various Helm charts offered - the AIO and the community version - but it doesn’t seem like any of them offer any real upgrade help.

I have basically automated the upgrade process, and here’s what works for me:

I have created a set of manifest files to deploy Nextcloud to my cluster. These files are stored in a Git repository on my private Gitea server. They specify the exact version of Nextcloud I want to run.

I then run Renovate Bot on the Git repository to automatically create a pull request whenever a new version is available.

When I approve the PR and update the manifest files for the new version, Gitea triggers a Jenkins build job. This job does the rest of the update.

I looks to me like you’ve reached the point of your upgrade where my Jenkins job kicks in: The Helm chart has updated the relevant manifest files (like I do with Renovate Bot above), but no further action have been taken?

So here’s what my Jenkins job do:

  1. It applies the manifest files to update the container images.
  2. It pauses the cronjobs, etc.
  3. It attaches to the new NC container and runs
    • apt update
    • apt install sudo rsync
    • (and some cleanup)
  4. At this stage your setup is running a container with the new NC version, but your webroot still holds the old code. The new code is provided by the container and stored in /usr/src/nextcloud.
  5. Run chown -R www-data:www-data /usr/src/nextcloud.
  6. Run /bin/bash -c 'rsync -av /usr/src/nextcloud/* /var/www/html'.
  7. After step 6 you now have the correct updated code in your webroot, so now you can run /bin/bash -c ‘sudo -u www-data php -d memory_limit=512M /var/www/html/occ upgrade’.
  8. After the upgrade has finished, I run /bin/bash -c ‘sudo -u www-data php -d memory_limit=512M /var/www/html/occ db:add-missing-indices’ for good measure.

A lot of this functionality could be moved to initContainers in Kubernetes, but as the above works fine for me, I haven’t prioritized to do this yet.

But the Helm charts really should implement initContainers to do this work, making it transparent for most users.

Hope this can help.

Maybe you first need to upgrade to 31.0.12 and then to 32.0.2.

Hello everyone,
I apologize for the delay in responding; I’ve been quite busy at the end of the year. I wish you all a very happy new year!

I’m currently trying to upgrade to 31.0.12, but it doesn’t seem to be straightforward either…
An unhandled exception has been thrown:
Error: Failed opening required ‘/var/www/html/custom_apps/calendar/composer/../vendor/autoload.php’ (include_path=‘/var/www/html/3rdparty/pear/archive_tar:/var/www/html/3rdparty/pear/console_getopt:/var/www/ html/3rdparty/pear/pear-core-minimal/src:/var/www/html/3rdparty/pear/pear_exception:/var/www/html/apps:/var/www/html/custom_apps’) in /var/www/html/custom_apps/calendar/composer/autoload.php:5
Stack trace:
#0 /var/www/html/lib/private/legacy/OC_App.php(115): require_once()
#1 /var/www/html/lib/private/AppFramework/Bootstrap/Coordinator.php(80): OC_App::registerAutoloading(‘calendar’, ‘/var/www/html/c…’)
#2 /var/www/html/lib/private/AppFramework/Bootstrap/Coordinator.php(49): OC\AppFramework\Bootstrap\Coordinator->registerApps(Array)
#3 /var/www/html/lib/base.php(678): OC\AppFramework\Bootstrap\Coordinator->runInitialRegistration()
#4 /var/www/html/lib/base.php(1194): OC::init()
#5 /var/www/html/console.php(28): require_once(‘/var/www/html/l…’)
#6 /var/www/html/occ(33): require_once(‘/var/www/html/c…’)
#7 {main}command terminated with exit code 1

I just modified my helm image tag, like I did before.

What version of the Chart are you using? And why are you bumping the image version tag manually?

The other major factor is your persistence configuration.

Well, I think I’ve solved the problem, but I’m not quite sure how.

For the previous error, I deleted the custom_apps/calendar directory (like a brute, I know), then restarted the pod. Then I had the problem with files again, so I did the same thing: I deleted the apps/files directory, restarted the container, and ran an occ upgrade.

The update from 32.0.2 to 32.0.3 seems to have gone well, everything looks functional.

I update the versions of my charts very regularly with helm repo update. I like to have manual control over the versions of the applications I deploy, so I set the version tag manually each time.