Move to new server failed

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face:

help.nextcloud.com is for home/non-enterprise users. If you’re running a business, paid support can be accessed via portal.nextcloud.com where we can ensure your business keeps running smoothly.

In order to help you as quickly as possible, before clicking Create Topic please provide as much of the below as you can. Feel free to use a pastebin service for logs, otherwise either indent short log examples with four spaces:

example

Or for longer, use three backticks above and below the code snippet:

longer
example
here

Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can :heart:

Nextcloud version (eg, 20.0.5): Nextcloud Hub 3 (25.0.1)
Operating system and version (eg, Ubuntu 20.04): Debian 11 bullseye - up to date
Apache or nginx version (eg, Apache 2.4.25): nginx 1.18.0-6.1+deb11u3
PHP version (eg, 7.4): 7.4 ... 2:7.4+76

I had a fatal crash on my old server and was forced to urgently move everything to a new server. The above describes the situation on the new server. As far as I know, the environment was identical on the old server because I’m in the habit of keeping everything up-to-date.

I rsynced the web code from the old server to the new server and double checked it. I restored the data directory from the most recent backup. I also restored the mysql db from the same backup.

Now I am getting type errors that I wasn’t getting on the old server. It’s weird that 2 different apps are both giving type errors. Almost like different versions of php, but I’m sure they were the same.

The details about the errors are below. The real questions:

  1. How can I fix this?
    … or …
  2. Is there a maintenance tool that forces the database and the data into alignment
    … or …
  3. Is it possible to unload the data without using php, and then reloading it?

— details about the errors follow —

The issue you are facing:

  1. The Administration home page settings/admin/overview is causing an Internal Server Error.
    The error = Exception: json_decode() expects parameter 1 to be string, bool given in file ‘/var/www/nextcloud/lib/private/IntegrityCheck/Checker.php’ line 443

  2. Webdav to the Deck App causes an Internal Server Error.
    The error = TypeError: Return value of OCA\Deck\Cache\AttachmentCacheHelper::getAttachmentCount() must be of the type int or null, bool returned

Is this the first time you’ve seen this error? (Y/N): Yes

Steps to replicate it: Those 2 pages do the same thing every time.

The output of your Nextcloud log in Admin > Logging:

For the settings/admin page error, the error log is:

Error	index	Exception: json_decode() expects parameter 1 to be string, bool given in file '/var/www/nextcloud/lib/private/IntegrityCheck/Checker.php' line 443

    /var/www/nextcloud/lib/private/AppFramework/App.php - line 172:

    OC\AppFramework\Http\Dispatcher->dispatch()

    /var/www/nextcloud/lib/private/Route/Router.php - line 298:

    OC\AppFramework\App::main()

    /var/www/nextcloud/lib/base.php - line 1047:

    OC\Route\Router->match()

    /var/www/nextcloud/index.php - line 36:

    OC::handleRequest()

Caused by TypeError: json_decode() expects parameter 1 to be string, bool given

    /var/www/nextcloud/lib/private/IntegrityCheck/Checker.php - line 443:

    json_decode()

    /var/www/nextcloud/lib/private/IntegrityCheck/Checker.php - line 429:

    OC\IntegrityCheck\Checker->getResults()

    /var/www/nextcloud/apps/settings/lib/Controller/CheckSetupController.php - line 878:

    OC\IntegrityCheck\Checker->hasPassedCheck()

    /var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php - line 225:

    OCA\Settings\Controller\CheckSetupController->check()

    /var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php - line 133:

    OC\AppFramework\Http\Dispatcher->executeController()

    /var/www/nextcloud/lib/private/AppFramework/App.php - line 172:

    OC\AppFramework\Http\Dispatcher->dispatch()

    /var/www/nextcloud/lib/private/Route/Router.php - line 298:

    OC\AppFramework\App::main()

    /var/www/nextcloud/lib/base.php - line 1047:

    OC\Route\Router->match()

    /var/www/nextcloud/index.php - line 36:

    OC::handleRequest()

For the Deck App error, the error log is:

Error	webdav	TypeError: Return value of OCA\Deck\Cache\AttachmentCacheHelper::getAttachmentCount() must be of the type int or null, bool returned

    /var/www/nextcloud/apps/deck/lib/Service/AttachmentService.php - line 170:

    OCA\Deck\Cache\AttachmentCacheHelper->getAttachmentCount()

    /var/www/nextcloud/apps/deck/lib/Service/CardService.php - line 122:

    OCA\Deck\Service\AttachmentService->count()

    /var/www/nextcloud/apps/deck/lib/Service/CardService.php - line 178:

    OCA\Deck\Service\CardService->enrich()

    /var/www/nextcloud/apps/deck/lib/DAV/DeckCalendarBackend.php - line 85:

    OCA\Deck\Service\CardService->findCalendarEntries()

    /var/www/nextcloud/apps/deck/lib/DAV/Calendar.php - line 151:

    OCA\Deck\DAV\DeckCalendarBackend->getChildren()

    /var/www/nextcloud/apps/deck/lib/DAV/Calendar.php - line 134:

    OCA\Deck\DAV\Calendar->getBackendChildren()

    /var/www/nextcloud/apps/deck/lib/DAV/Calendar.php - line 89:

    OCA\Deck\DAV\Calendar->getChildren()

    /var/www/nextcloud/3rdparty/sabre/dav/lib/CalDAV/Plugin.php - line 598:

    OCA\Deck\DAV\Calendar->calendarQuery()

    /var/www/nextcloud/3rdparty/sabre/dav/lib/CalDAV/Plugin.php - line 258:

    Sabre\CalDAV\Plugin->calendarQueryReport()

    /var/www/nextcloud/3rdparty/sabre/event/lib/WildcardEmitterTrait.php - line 89:

    Sabre\CalDAV\Plugin->report()

    /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php - line 690:

    Sabre\DAV\Server->emit()

    /var/www/nextcloud/3rdparty/sabre/event/lib/WildcardEmitterTrait.php - line 89:

    Sabre\DAV\CorePlugin->httpReport()

    /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php - line 472:

    Sabre\DAV\Server->emit()

    /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php - line 253:

    Sabre\DAV\Server->invokeMethod()

    /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php - line 321:

    Sabre\DAV\Server->start()

    /var/www/nextcloud/apps/dav/lib/Server.php - line 360:

    Sabre\DAV\Server->exec()

    /var/www/nextcloud/apps/dav/appinfo/v2/remote.php - line 35:

    OCA\DAV\Server->exec()

    /var/www/nextcloud/remote.php - line 171:

    require_once("/var/www/ne ... p")

	
2022-12-15T18:56:27-0600
Error	webdav	TypeError: Return value of OCA\Deck\Cache\AttachmentCacheHelper::getAttachmentCount() must be of the type int or null, bool returned	
2022-12-15T18:56:23-0600
Error	webdav	TypeError: Return value of OCA\Deck\Cache\AttachmentCacheHelper::getAttachmentCount() must be of the type int or null, bool returned	
2022-12-15T18:56:20-0600
Error	webdav	TypeError: Return value of OCA\Deck\Cache\AttachmentCacheHelper::getAttachmentCount() must be of the type int or null, bool returned	
2022-12-15T18:56:16-0600
Error	webdav	TypeError: Return value of OCA\Deck\Cache\AttachmentCacheHelper::getAttachmentCount() must be of the type int or null, bool returned	
2022-12-15T18:46:25-0600
Error	webdav	TypeError: Return value of OCA\Deck\Cache\AttachmentCacheHelper::getAttachmentCount() must be of the type int or null, bool returned

The output of your CONFIG.PHP file in /path/to/nextcloud (make sure you remove any

?php
$CONFIG = array (
  'instanceid' => '12345',
  'passwordsalt' => 'GxCzulhXOi',
  'secret' => 'DFohBWY2',
  'trusted_domains' => 
  array (
    0 => 'nextcloud.something.com',
  ),
  'datadirectory' => '/data/nextcloud-data-store',
  'dbtype' => 'mysql',
  'version' => '25.0.1.1',
  'overwrite.cli.url' => 'https://nextcloud.something.com',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'user',
  'dbpassword' => 'password',
  'installed' => true,
  'maintenance' => false,
  'default_phone_region' => 'US',
  'memcache.distributed' => '\\OC\\Memcache\\Memcached',
  'app.mail.smtp.timeout' => 60,
  'app_install_overwrite' => 
  array (
    0 => 'cookbook',
    1 => 'bookmarks',
    2 => 'bruteforcesettings',
    3 => 'richdocuments',
  ),
  'theme' => '',
  'loglevel' => 2,
  'share_folder' => 'shared_with_me',
  'versions_retention_obligation' => 'auto, 7',
  'mail_from_address' => 'badelf',
  'mail_smtpmode' => 'smtp',
  'mail_sendmailmode' => 'smtp',
  'mail_domain' => 'something.com',
  'mail_smtpauth' => 1,
  'mail_smtphost' => 'localhost',
  'mail_smtpport' => '587',
  'mail_smtpname' => 'badelf@something.com',
  'mail_smtppassword' => 'password',
  'updater.secret' => 'ZiN2rFWP9mHjb',
);

Not sure if this would make a difference, but PHP 8.1 is the recommended version. 8.0 is also supported. 7.4 is listed as supported but deprecated.

It may also be possible that the former server’s data wasn’t intact in the backup. You might try installing a fresh copy of NC code.

Thanks @KarlF12 . When sw isn’t running perfectly, I’m rather loathe to change too many things at once. I was hoping that someone had a tool to make the db consistent with the actual data. That’s my real suspicion considering that the backup is done while NC is online. I’ll have to change that script if I get this working again.

My thought was to try 25.0.2 just in case the code on the old server got corrupted in the crash.

I think php 7.4 is the default on Debian 10. Going to php 8 would mean going to Deb 11. Too many changes at once.

Ok. You posted above that it was already on Debian 11.

I don’t know what sort of system failure you had, but my suspicion would be as I said that maybe the backup data isn’t good. If the problem is corrupt NC code, it can be replaced. If it’s corrupt in the data folder or database… that’s a bigger problem.

are alle the required php-modules, deps etc installed and loaded on the new server?
are they configured identically?
can you run occ in the nextcloud-directory?
if some of nextcloud’s files were not transfered correctly from the old server you could donwload the same version and try with that.
also, it might help to temporarily disable some apps (should workl with occ)
GOOD LUCK!

@KarlF12, sorry, I mistyped the Deb version. Both systems had/have Debian 11. What I mean is the PHP 8.x is not available on Deb 11, which is the latest stable version.

Ultimately, I made 2 mistakes, and I’m old enough to know better. But since it’s not a work issue, but a personal cloud, I was lazy and negligent.

The 2 things are:

  1. I should have put NC in maintenance mode before the backup ran - easy enough to do in the script.

  2. I should have tested that the backup actually worked.

No one to kick but me :roll_eyes:

@pete.dawgg , actually, occ fails with exactly the same error as the Admin Settings page.

Thanks for the other ideas. I’m going to try disabling some apps - the app Admin seems to be working. I don’t have much hope though. I will also download and install the same version.

The error is already in the code integrity checker. So perhaps the hint with bad code is not bad, however in that condition I’d do a manual update. I think there was also one type hint issue that was supposed to be solved with 25.0.2 (certainly not the one with the json-codeintegrity).

https://docs.nextcloud.com/server/latest/admin_manual/maintenance/manual_upgrade.html

In theory, you just keep the data folder and the config folder. The copy will be fully replaced and the guide gives you more hints if you need to adjust your permissions.

As already said, check if all modules are installed (https://docs.nextcloud.com/server/stable/admin_manual/installation/source_installation.html#prerequisites-for-manual-installation), empty the cache of your browser that you don’t have anything from the old session. And if possible reduce the number of apps in the beginning and turn them on one-by-one.

If you have a backup of your old configs, it might be helpful to check what you adjusted (for the server, database, redis, etc.).

Thanks @tflidd ! I will try a manual upgrade. But only after I’ve downloaded all my cloud data. That may take a while LOL

“manual” upgrade is pretty easy, i think. you need your (old) config-dir, data-dir and a db-backup.
it’s (probably) best to make a backup of everything before.

if you have all the needed php-modules and the database still works, first stop everything, (webserver, php-fpm, dbserver), then rename the old nextcloud-dir, put the new one (25.0.2) in its place, copy the old config.php into the new nextcloud dir, adjust perms/ownwership in the new dir, double-check everything is in the right place and you have backups of everything and then you can run occ and if it runs you can run occ upgrade.
you probably have to reintall your old apps but if the old db is still useable all their settings are (probably) still there.

(I always use an update-script that contains all the commands for a “manual” update and so far (the error-msg/example contains version 14) it has never failed.)

GOOD LUCK!

[SOLVED] Turns out a manual upgrade was impossible because occ was crashing on the Checker exception which I guess it runs before the command.

So, my next idea was to create a clean install and then copy stuff to the new install. And then I discovered that the old config.php file was the root of the problem. So rather than copying the old config, I started with the clean install config and added lines on an as needed basis. This worked. My original setup is running, and even the Deck app is working which I couldn’t get before.

That is bad. However, normally you shouldn’t just start with a new one, that can create problems (I suppose with federated sharing, server-side-encryption is certainly sure to break, even passwords). I just want to avoid that people now start manual upgrades by deleting their config.php. Anyway, if you do such a thing, please keep a full backup of everything (files, config-files, databse) so that you can get at least back to the previous state.