Rebuilding Nextcloud 17 after operating system crash

I’ve had an operating system crash and not a disk crash, so all my /var/lib/mysql and /var/www/nextcloud files and data are intact.

I’ve rebuild a server using same versions (Ubuntu 18.04, Mariadb 10.1, php7.2) and didn’t have any problems proving a brand new installation of 17.0.1.1.

However, reinstating the database and files from the original, it gave me an Internal Error page (instead of login page).

I was able to fix that by deleting the InstanceID
(sudo -u www-data php occ config:system:delete instanceid)
and the login page then appeared, with all original user accounts and passwords intact, and a working original site.

My question is why did I need a new InstanceID?
== all the original data is intact!
== is the InstanceID matched/compared to some server data that is not contained in the Database or in /var/www/Nextcloud?

did you restore the config.php along with the database and the data files? instanceid is one of the paramters in config.php

Yes, the whole /var/www/nextcloud was restored
ie. Identical to how it was
(only deleting the line in the existing …/config/config.php using the delete command as shown above caused the instance to come alive again)