Failed update on NS7.9 to NS8 migrated NextCloud

Edit or add the Nextcloud version in config.php as explained in the thread I posted above or in method “b” of the wiki.

Enter as app instance user nextcloud2:

runagent -m nextcloud2

Edit the config.php using nano:

podman unshare nano $(podman volume inspect nextcloud-app-data --format={{.Mountpoint}})/config/config.php

Set version to the current one

'version' => '30.0.7.2',

or the old one:

'version' => '27.1.11.3',

OK, it’s running again but in maintenance mode! WOOHOO … getting there.

# runagent -m nextcloud2 occ --version
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 30.0.7

Now it shows version 30.0.7.
I expect that I need to run

# runagent -m nextcloud2 occ upgrade

again to get to 30.0.7.2. Correct?

1 Like

Please try occ upgrade and disabling maintenance mode.
I think the version is already the right one…

Aaaaaaahhhhh!
Failure. Now it says 27.1.11.3 again.
This feels like groundhog day.

# runagent -m nextcloud2 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
[nextcloud][updater][1] {"reqId":"e99EJWPlIA8S99o8e6IZ","level":1,"time":"2025-03-29T21:44:09+00:00","remoteAddr":"","user":"--","app":"updater","method":"","url":"--","message":"\\OC\\Updater::setDebugLogLevel: Set log level to debug","userAgent":"--","version":"27.1.11.3","data":{"app":"updater"}}
[nextcloud][core][0] {"reqId":"e99EJWPlIA8S99o8e6IZ","level":0,"time":"2025-03-29T21:44:09+00:00","remoteAddr":"","user":"--","app":"core","method":"","url":"--","message":"starting upgrade from 27.1.11.3 to 30.0.7.2","userAgent":"--","version":"27.1.11.3","data":{"app":"core"}}
[nextcloud][no app in context][3] {"reqId":"e99EJWPlIA8S99o8e6IZ","level":3,"time":"2025-03-29T21:44:09+00:00","remoteAddr":"","user":"--","app":"no app in context","method":"","url":"--","message":"{\"Exception\":\"Exception\",\"Message\":\"Updates between multiple major versions and downgrades are unsupported.\",\"Code\":0,\"Trace\":[{\"file\":\"/var/www/html/lib/private/Updater.php\",\"line\":98,\"function\":\"doUpgrade\",\"class\":\"OC\\\\Updater\",\"type\":\"->\",\"args\":[\"30.0.7.2\",\"27.1.11.3\"]},{\"file\":\"/var/www/html/core/Command/Upgrade.php\",\"line\":190,\"function\":\"upgrade\",\"class\":\"OC\\\\Updater\",\"type\":\"->\",\"args\":[]},{\"file\":\"/var/www/html/3rdparty/symfony/console/Command/Command.php\",\"line\":326,\"function\":\"execute\",\"class\":\"OC\\\\Core\\\\Command\\\\Upgrade\",\"type\":\"->\",\"args\":[{\"__class__\":\"Symfony\\\\Component\\\\Console\\\\Input\\\\ArgvInput\"},{\"__class__\":\"Symfony\\\\Component\\\\Console\\\\Output\\\\ConsoleOutput\"}]},{\"file\":\"/var/www/html/3rdparty/symfony/console/Application.php\",\"line\":1078,\"function\":\"run\",\"class\":\"Symfony\\\\Component\\\\Console\\\\Command\\\\Command\",\"type\":\"->\",\"args\":[{\"__class__\":\"Symfony\\\\Component\\\\Console\\\\Input\\\\ArgvInput\"},{\"__class__\":\"Symfony\\\\Component\\\\Console\\\\Output\\\\ConsoleOutput\"}]},{\"file\":\"/var/www/html/3rdparty/symfony/console/Application.php\",\"line\":324,\"function\":\"doRunCommand\",\"class\":\"Symfony\\\\Component\\\\Console\\\\Application\",\"type\":\"->\",\"args\":[{\"__class__\":\"OC\\\\Core\\\\Command\\\\Upgrade\"},{\"__class__\":\"Symfony\\\\Component\\\\Console\\\\Input\\\\ArgvInput\"},{\"__class__\":\"Symfony\\\\Component\\\\Console\\\\Output\\\\ConsoleOutput\"}]},{\"file\":\"/var/www/html/3rdparty/symfony/console/Application.php\",\"line\":175,\"function\":\"doRun\",\"class\":\"Symfony\\\\Component\\\\Console\\\\Application\",\"type\":\"->\",\"args\":[{\"__class__\":\"Symfony\\\\Component\\\\Console\\\\Input\\\\ArgvInput\"},{\"__class__\":\"Symfony\\\\Component\\\\Console\\\\Output\\\\ConsoleOutput\"}]},{\"file\":\"/var/www/html/lib/private/Console/Application.php\",\"line\":183,\"function\":\"run\",\"class\":\"Symfony\\\\Component\\\\Console\\\\Application\",\"type\":\"->\",\"args\":[{\"__class__\":\"Symfony\\\\Component\\\\Console\\\\Input\\\\ArgvInput\"},{\"__class__\":\"Symfony\\\\Component\\\\Console\\\\Output\\\\ConsoleOutput\"}]},{\"file\":\"/var/www/html/console.php\",\"line\":87,\"function\":\"run\",\"class\":\"OC\\\\Console\\\\Application\",\"type\":\"->\",\"args\":[{\"__class__\":\"Symfony\\\\Component\\\\Console\\\\Input\\\\ArgvInput\"}]},{\"file\":\"/var/www/html/occ\",\"line\":33,\"args\":[\"/var/www/html/console.php\"],\"function\":\"require_once\"}],\"File\":\"/var/www/html/lib/private/Updater.php\",\"Line\":199,\"message\":\"Updates between multiple major versions and downgrades are unsupported.\",\"exception\":{},\"CustomMessage\":\"Updates between multiple major versions and downgrades are unsupported.\"}","userAgent":"--","version":"27.1.11.3"}
Exception: Updates between multiple major versions and downgrades are unsupported.
[nextcloud][updater][3] {"reqId":"e99EJWPlIA8S99o8e6IZ","level":3,"time":"2025-03-29T21:44:09+00:00","remoteAddr":"","user":"--","app":"updater","method":"","url":"--","message":"\\OC\\Updater::failure: Exception: Updates between multiple major versions and downgrades are unsupported.","userAgent":"--","version":"27.1.11.3","data":{"app":"updater"}}
Update failed
[nextcloud][updater][3] {"reqId":"e99EJWPlIA8S99o8e6IZ","level":3,"time":"2025-03-29T21:44:09+00:00","remoteAddr":"","user":"--","app":"updater","method":"","url":"--","message":"\\OC\\Updater::updateEnd: Update failed","userAgent":"--","version":"27.1.11.3","data":{"app":"updater"}}
Maintenance mode is kept active
[nextcloud][updater][1] {"reqId":"e99EJWPlIA8S99o8e6IZ","level":1,"time":"2025-03-29T21:44:09+00:00","remoteAddr":"","user":"--","app":"updater","method":"","url":"--","message":"\\OC\\Updater::maintenanceActive: Maintenance mode is kept active","userAgent":"--","version":"27.1.11.3","data":{"app":"updater"}}
Resetting log level
[nextcloud][updater][1] {"reqId":"e99EJWPlIA8S99o8e6IZ","level":1,"time":"2025-03-29T21:44:09+00:00","remoteAddr":"","user":"--","app":"updater","method":"","url":"--","message":"\\OC\\Updater::resetLogLevel: Reset log level to Debug(0)","userAgent":"--","version":"27.1.11.3","data":{"app":"updater"}}

OK, let’s try method b from the wiki.

Set the version to the old one.

Check status:

occ migrations:status core

Migrate the core:

occ migrations:migrate core

Set version to the new one:

Upgrade and turn off maintenance mode:

occ upgrade
occ maintenance:mode --off

Not sure what’s up now.

occ migrations:status core
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


  Command "migrations:status" is not defined.

  Did you mean one of these?
      encryption:status
      migrations:preview
      twofactorauth:state

Wow it’s upgrading. I can’t keep track of what is going on but I see it updating apps from the app store. So this looks to be working. :grinning:

1 Like

Yah! It’s working !!!

Thanks @mrmarkuz

1 Like

:cry:
I log in and all files are gone.

Is there still a nextcloud1 app, you can check using

ls /home

Check if the files are there, maybe you just need to scan them using occ:

ls -l /home/nextcloud2/.local/share/containers/storage/volumes/nextcloud-app-data/_data/data/

Check size of the data:

du -hs /home/nextcloud1/.local/share/containers/storage/volumes/nextcloud-app-data/_data/data/

Usually no data is deleted. Are you sure that the migration worked and the data was transferred to the NS8?

Hi @mrmarkuz
Thank you for the additional steps to check.

I checked again and there is no nextcloud1 in the /home folder.
When first migrated NextCloud, I aborted the migration as the migration filled the disk capacity. When I aborted it removed every portion of nextcloud1!

# ls -l /home/nextcloud2/.local/share/containers/storage/volumes/nextcloud-app-data/_data/data/
ls: cannot access '/home/nextcloud2/.local/share/containers/storage/volumes/nextcloud-app-data/_data/data/': No such file or directory

# du -hs /home/nextcloud1/.local/share/containers/storage/volumes/nextcloud-app-data/_data/data/
du: cannot access '/home/nextcloud1/.local/share/containers/storage/volumes/nextcloud-app-data/_data/data/': No such file or directory

So all the data is gone.
I will have to start again from NS7.9. I expect that I can’t just rsync the data across but rather have to run the migration again? I expect the database or something like that changed the data and as such will need to migrate again.

Assuming that is correct, I have to:

  1. Delete the container nextcloud1
  2. Start the migration again from NS7
  3. Follow the instructions above to upgrade the container from 27.x to 30.0.7.2
  4. I assume that the container will be nextcloud3

Is there a way to reset the container name so it is nextcloud1? I would make things easier in the future if the initial instance is numbered with a 1.

Thanks again for all your help.

The migration process is the supported and tested method, manual changes may lead to issues.

But it’s possible to do things manually, here’s the script used by the migration tool to get an idea: nethserver-ns8-migration/root/usr/share/nethesis/nethserver-ns8-migration/apps/nethserver-nextcloud/migrate at master · NethServer/nethserver-ns8-migration · GitHub

Check file owner on NS8:

nextcloud1@debianns8test:~/.config/state$ ls -l /home/nextcloud1/.local/share/containers/storage/volumes/nextcloud-app-data/_data/
total 1280
drwxr-xr-x 42    1017585    1017585    4096 Mar 29 22:29 3rdparty

From NS7 rsync the files for one user, adapt --chown= to the right owner and 192.168.3.175 to the IP of the NS8:

rsync -tr --owner --group --chown=1017585:1017585 -s --delete --exclude=appdata\* --exclude=nextcloud.log /var/lib/nethserver/nextcloud/92F1421A-BCE2-4E36-B80D-EBCEDCBB32C9/* 192.168.3.175:/home/nextcloud1/.local/share/containers/storage/volumes/nextcloud-app-data/_data/data/94D0079B-5F61-4EB8-837E-A7904971548D

On NS8 rescan the files:

occ files:scan --all

You may also need to revert the changes on NS7 for Nextcloud to be able to start over with a new migration, see also nethserver-ns8-migration — NethServer 7 documentation

That’s not possible to avoid name conflicts in the cluster but it’s possible to set custom names instead of app33, see also Applications — NS8 documentation

Thanks for the detailed instructions on the options, @mrmarkuz .

From what you wrote, it looks to me like resetting the NS7 migration might be easier. But I’m guessing there was a reason that the file server and AD were moved last so I expect that to create a few wrinkles in this. Would I need to roll back the file server and AD migration also?

Hmm, this is very strange.

I can mount my personal folder and the folder shares using SMB. On the surface it looks like all the files are there. I’ll need to do a du -hs and check the size of files but it appears that all my files are there. Nothing shows up in NextCloud. The Home shows the folder for the shares and also the Home folder but they are empty as we already determined.

The userid is wrong in the file server. In NS7 it was “userid@fqdn.tld” but now it is only “userid”. Could that be a reason why NextCloud doesn’t see or have the files?

Having a sleep in between troubleshooting helps the mind. That there are no files in NextCloud kind of makes sense as I remember what we did a few years ago.

At the time, the NS7 VM grew too large so we moved all the actual data files to a separate data harddisk image. I vaguely remember creating the data disk, moving files and linking directories. That was a few years ago and I can’t quite remember the steps.

So I’m wondering if I can link the NextCloud data directory to the file share again as before? I’m sure that has it’s own complications like how the NC database will update with the file records and how the users have to be set for it to work properly.

Is this even something that would be possible with the NS8 architecture?

I rechecked the migration tool and there must be no AD provider installed on NS8 to make the migration work so yes, you would need to roll back everything and completely start over with the migration.

Do you mean including samba file shares in Nextcloud by using the external storage app? Yes, that works.

It’s also possible to mount a disk to use it in Nextcloud, see also Ns8 storage management - #2 by mrmarkuz

1 Like

Thanks @mrmarkuz . I appreciate all the help.

What I meant was connecting the samba home for each user as the “Home” directory in NextCloud. So when the user logs into Nextcloud the files they access in Home are the identical files to what they access if they connect via smb.

Now some more reading … :grinning:

1 Like

You could use the Nextcloud external storage app.

It’s also possible to mount samba home dirs using variables, see also Configuring External Storage (GUI) — Nextcloud latest Administration Manual latest documentation

1 Like

Thanks again @mrmarkuz .

I have been able to add the shared folders that are in the File Server. But I’m not able to get the individual user folder to open.

I am trying to add it to the individual user from their Settings:External storage. I have entered the info as I believe it is correct. Once you press the Check Mark, it asks for another password. I put in the user password but it say it is wrong.

I’m not sure if I need to enable the specific user shares from the NextCloud Admin. The “shared folders” worked this way. I tried to add here using $user but that didn’t work either.

At the moment I’m stumped and not sure what to try next. Any suggestions appreciated.

Hmm, this sounds very much like a bug add external storage password failure on the NextCloud site.

Interestingly the external storage for the “Home” folder is still on the Setting:Externalstorages but it has the old IP address from the NS7. So I can’t update to the IP address of the new NS8. I suspect I updated the two “Share” folders from the Administrator Settings:Externalstorages before the updates and likely that is why it worked.

I’m trying to figure out how to manually change the IP address using the occ files_external:command but so far haven’t figured it out. There has to be a way to list the connection that moved over from NS7 but doesn’t work due to the wrong IP address without using occ to delete the connect and redoing???