Moving to new Nextcloud installation (same version)

Hi, I am trying to restore an old nextcloud setup onto a new server but having a few issues.

Firstly, I backed up the database (.sql file) and the nextcloud directory files from the www folder.

I then installed nextcloud on the new server, ran it like a new program to confirm it worked. I then delete the contents of the nextcloud directory and uploaded the backup.

I then deleted the new (test) database, then created it again, not changing anything and then uploaded the old database in to it.

When I try to login to the cloud, it keeps saying invalid password on both accounts.

Any ideas?

*Quick update:

I tried importing the database onto a locally hosted mysql database, using phpmyadmin and it seemed to import correctly, I can see groups etc. In the oc_users table, I can see the user accounts listed alongside their passwords and display names.

You do two tasks, you restore an old setup (https://docs.nextcloud.com/server/stable/admin_manual/maintenance/restore.html), run it and then you upgrade through all major versions (e.g. NC 10 -> NC 11 -> NC 12 -> …).

Sorry, I don’t quite understand what you mean.

I am already running the latest version of nextcloud and I simply want to restore old database and files from another machine.

@tflidd

You can only restore an old setup 1:1. You can’t import stuff from a different version or partially import. Or there is no function to do that. You can of course do it manually, some data can be easier than others. If it is for business purposes, I wouldn’t take a risk and check with enterprise support.

Yeah, the versions are identical as far as I am aware, they are both running version 15.

Any other ideas?

Then please let us know how your restore procedure was, was it different from that in the documentation? For the passwords, you need the config.php. Or if you don’t have it, the passwords won’t work and you have to reset them. If you were using server-side encryption, without the config.php, I’m not sure if it possible to restore.

I will describe it step by step here:

1 - On the old machine I created a backup of all files and the database.

2 - I install nextcloud on the new machine and set up as new instance to ensure apache etc is working correctly. No issues here.

3 - I then located the www directory, delete the files inside of the nextcloud folder, uploaded all the files from the previous install.

4 - Finally, i imported the old database and then tried logging in. Didn’t work, I’ve tried restarting, but no luck with that either.

Any ideas? In theory, I’m using the exact same files as the previous install.

Thanks, Tom.

Looks not bad. One thing that comes in my mind is that the location of the data-folder could have been changed. There could be the old paths, so it’s like you changed the data folder location and therefore we have a howto:

But before you change anything, did you check your logfiles? They might tell you some more reason, perhaps some missing modules which are needed in apps, or database, cache settings that are slightly different and not adjusted.

Within this setup I didn’t actually change the data-folder from inside the nextcloud directory on either setup.

The nextcloud.log file appears to say “login error”, one line I noticed was the user: “user”:"–".

Does that look normal? Apart from that and the login failed message, the log doesn’t look out of place.

you can set the user and admin password with an occ command on the command line.
so in case you have only two users that should be the quickest way to solve your problem.

https://docs.nextcloud.com/server/15/admin_manual/configuration_user/reset_admin_password.html
https://docs.nextcloud.com/server/15/admin_manual/configuration_server/occ_command.html#user-commands

I’ve done this, I’ve tried to login and now it’s just hanging there on login screen.

Will I have to do this every time I need to move server?

no.
the problem is that something went wrong with your restore. more than just a broken password.

sure that you didn’t change anything in the config/config.php file? instanceid, passwordsalt, secret?

Nope, I did very little to be honest, I just uploaded all the files from the previous instance, restored database and tried to login.

That was, after deleting the newly created files in this one from when I was testing the new setup.

@Reiner_Nippes

Update: After waiting some time it has now logged me in, some files are there on one account, but not there on the account that shared them. Strange.

It does seem to be working correctly asides a few glitches with previously shared folders and files.

indeed.

maybe this https://www.c-rieger.de/nextcloud-backup-and-restore/ is helpful for your next backup.
but instead of tar.gz I would use restic/rclone. Rsync to cloud storage for backups?