Migrate all data from NC 13.0.7 to new snap installation NC 13.0.7 - changing instanceid possible?

Hi all,
I’m using nextcloud for a long time. Now I have to upgrade my server and will install new OS. What I currently have is NC installation 13.0.7 as lamp on a Debian server which is running fine. Now I want to install a snap installation of NC 13.0.7 and just migrate all user data. I have done several tests on a Vbox VM. What I have done, is just to migrate the data dir to the new snap installation data directory and the mysql DB dump to the new nextcloud mysql DB. I do not want to change any NC files from the new installation, because I do not know if there might be differences between my old installation and the new snap install. Also I use nginx on old installation and snap is using apache. The data dir is also different. Everything went fine so far, I could also see all my data. The only thing what I’m thinking about is the instance ID in config.php file. When I leave it as it has been created with the new installation, I run on problems with my keys (Invalid private key for encryption app. Please update your private key password in your personal settings to recover access to your encrypted files) and I’m not able to open my passwords in passman. So I just tried to change instanceid values in config.php to the values from the old installation. Afterwards error disappeared and I was also able to read my passwords again.

My main question here:
Is it OK to change the instance ID of the new installation to the values from the old installation? Or will it make problems later, because somewhere the original id from new installation is still used. I do not use encryption, so I do not have a problem with that. But maybe I will use it later.

Hope someone knows about and I would be glad to get an answer for that topic.

Many thanks
Robert

I have been doing something that sound similar.
Instanceid is not the only parameter to change.
You need to change the password and password salt and the other parameter used by the database.
When you update them and restart php, you should be prompted to upgrade the old database.
Make sure you have backups in place in the event this fails and corrupt the database itself.
In general, either you fail to connect and you need to figure out why (ie, wrong password or account details) or it succeeds.
Best to keep to CLI commands to proceed with the update.

Hi Apollo
sure, I have changed instanceid, salt and secret. I was not asked to upgrade DB after restart of nextcloud. I have left DB user and password as it was in the new installation. Everything worked as expected. My concern was just that it could be a problem later, what I do not see now.

Robert

The upgrade of the database will be performed by running ‘occ upgrade’. If you do it over CLI, you will get the details of the upgrade.
If the upgrade is successful then you should be fine. If it fails you will be prompted with some error messages you will have to resolve.
This is why you need to have a backup of your database just in case.

Back to the original concern about instanceid and password, if you don’t use the proper parameter, it will not affect affect the database. It will simply not be able to connect to it so it will not mess it up.

I’ll try that today on command line. I guess the upgrade process was running automatically as you mentioned and I did not notice that. Else I guess I would not see my data :grinning:

I’ve tried it. Here is the output I got:
root@debian-testvm:~# nextcloud.occ upgrade
Nextcloud is already latest version

It looks like that command is just for updating nextcloud installation in snap. It does not seem that it has to do directly with the database itself.

help says:
upgrade - run upgrade routines after installation of a new release. The release has to be installed before.
I do not have a new release. Both - old and new installation - are same versions. I think I will go for my ‘productive server’ update now :grinning:. Everything looks fine, hope I can say that later for the ‘live system’ also.