Manual upgrade from 15.0.7 to Nextcloud 16.0.11 stalling on UnexpectedValueException

Nextcloud version (eg, 15.0.2): 15.0.7 to 16.0.11
Operating system and version (eg, Ubuntu 20.04):
Apache or nginx version (eg, Apache 2.4.25):
PHP version (eg, 7.1): 7.2.34

The issue you are facing:

Trying to upgrade to 16.0.11, using the manual upgrade instructions. I’m getting

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

Steps to replicate it:

  1. Unzip the new version, copy my config.php over. I’m moving to using an external data directory so I copied my data to that external directory ~/nextcloud/data/ and confirmed that the permissions are the same. Update config.php to use the new directory. Copy any missing app directories from my old apps directory to the new one.

  2. run the following commands:

    php occ maintenance:mode --on
    php occ upgrade

  3. Error! UnexpectedValueException: The files of the app "gallery" were not correctly replaced before running the update Update failed

  4. Tried running:

    php occ integrity:check-core
    php occ maintenance:repair

but I’m still getting the same error.

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

$CONFIG = array (
  'instanceid' => 'occ7c1677a99',
  'passwordsalt' => 'c8c4055cd1ab30f17585f25e64a987',
  'trusted_domains' => 
  array (
    0 => '',
    1 => '',
  'datadirectory' => '/home/REDACTED/nextcloud/data',
  'overwrite.cli.url' => '',
  'dbtype' => 'sqlite3',
  'version' => '',
  'installed' => true,
  'theme' => '',
  'maintenance' => true,
  'secret' => 'be61750202d8bf05cd0ebbd83a4557d098a048bf2a153062d0fe07b973e1a805ac29e374e20855388d7ce2843826b132',
  'mail_smtpmode' => 'smtp',
  'mail_smtpsecure' => 'tls',
  'mail_from_address' => 'REDACTED+nextcloud',
  'mail_domain' => '',
  'mail_smtpauthtype' => 'PLAIN',
  'mail_smtphost' => '',
  'mail_smtpauth' => 1,
  'mail_smtpport' => '587',
  'mail_smtpname' => 'REDACTED',
  'mail_smtppassword' => 'REDACTED',
  'loglevel' => 2,
  'trashbin_retention_obligation' => 'auto',
  'defaultapp' => 'calendar',
  'session_lifetime' => 86400,
  '' => 'stable',
  'updater.secret' => '$2y$10$y2oK6kXqYAAkbV64sV5Jiu1NimzLjJyYmTwpg/pvgx1V83Cya2vFe',

Try to disable the gallery app to finish the update. Due to the fact that you most likely want to migrate to a recent version, like Nextcloud 19/20, in which the Gallery app has been replaced by the Photos app it you shouldn’t focus on this problem.

Yup. That’s what i wound up doing – I disabled Gallery and upgraded.