Nextcloud upgrade from 31.0.5_1.7.3 to 31.0.6_2.0.2 fails on remove_same_storage_field

Hello, I’ve just attempted to upgrade on TrueNAS 25.04.1 my current Nextcloud installation of 31.0.5_1.7.3 to the version released 2025-06-19 per and the upgrade fails with:

[EFAULT] Failed to execute 'remove_same_storage_field' migration: Traceback (most recent call last): File "/mnt/.ix-apps/app_configs/nextcloud/versions/2.0.2/migrations/remove_same_storage_field", line 24, in print(yaml.dump(migrate(yaml.safe_load(f.read())))) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/mnt/.ix-apps/app_configs/nextcloud/versions/2.0.2/migrations/remove_same_storage_field", line 10, in migrate raise Exception( Exception: You are still using the old storage configuration. You need to migrate your storage configuration first in order to upgrade.

More details of the error show:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/middlewared/job.py", line 515, in run
    await self.future
  File "/usr/lib/python3/dist-packages/middlewared/job.py", line 562, in __run_body
    rv = await self.middleware.run_in_thread(self.method, *args)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/middlewared/main.py", line 622, in run_in_thread
    return await self.run_in_executor(io_thread_pool_executor, method, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/middlewared/main.py", line 619, in run_in_executor
    return await loop.run_in_executor(pool, functools.partial(method, *args, **kwargs))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/middlewared/api/base/decorator.py", line 101, in wrapped
    result = func(*args)
             ^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/middlewared/plugins/apps/upgrade.py", line 121, in upgrade
    config = self.upgrade_values(app, upgrade_version)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/middlewared/plugins/apps/upgrade.py", line 279, in upgrade_values
    raise CallError(f'Failed to execute {migration_file_basename!r} migration: {stderr.decode()}')
middlewared.service_exception.CallError: [EFAULT] Failed to execute 'remove_same_storage_field' migration: Traceback (most recent call last):
  File "/mnt/.ix-apps/app_configs/nextcloud/versions/2.0.2/migrations/remove_same_storage_field", line 24, in <module>
    print(yaml.dump(migrate(yaml.safe_load(f.read()))))
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/mnt/.ix-apps/app_configs/nextcloud/versions/2.0.2/migrations/remove_same_storage_field", line 10, in migrate
    raise Exception(
Exception: You are still using the old storage configuration. You need to migrate your storage configuration first in order to upgrade.

Anyone knows how to fix this? Certainly not a Nextcloud major breaking change since it’s just a patch update, but the TrueNAS app chart version jumps from v1 to v2 suggesting breaking change… the problematic task comes from trains/stable/nextcloud/2.0.2/app_migrations.yaml triggering trains/stable/nextcloud/2.0.2/migrations/remove_same_storage_field script.

I just noticed that my current installation has:

  1. Nextcloud AppData Storage (HTML, Custom Themes, Apps, etc.) with host path at /mnt/<volume>/<ownappdataset>/nextcloud/data,
  2. Nextcloud User Data Storage with the same host path as #1.

How can I safely extract user data from such combined set? Is the user data the /mnt/<volume>/<ownappdataset>/nextcloud/data/data subfolder?
I certainly seems so per the tool-tip:

DEPRECATED: Old Storage Structure (See the tooltip for more information)
Do NOT check this, if this is a new installation.

If this is checked, means that this is an installation coming from a previous version (where a different storage structure was used).

In order to have backwards compatibility, the older storage structure was kept for this installation.

If you want to utilize the new storage structure, move 'data' in a separate directory or dataset.
Change the 'Nextcloud User Data' configuration below to point to the new location and then uncheck this checkbox.



You will NOT likely want to change that if your setup uses ixVolume as storage.


See https://github.com/truenas/apps/issues/931 for more information on how to migrate.

Or maybe do I need to just move username-dirs from underneath ./data/data/ to the new location and then point user data field to host path of such new path where those named directories are moved to?

Ok, for anyone looking into this, per the tooltip in storage section, you need to move such (...)/data/data (where (...)/data is used for nextcloud app storage configuration) to a new path/dataset, then point user data storage location to (...)/newpath/data. Then uncheck the deprecated storage checkmark on storage section, and finally you can proceed with the upgrade to v2 chart… then it succeeds.