Server: Upgrade from 16.0.5 to 17.0.0 fails (apps/dav migration crashes)

Created on 9 Oct 2019  路  5Comments  路  Source: nextcloud/server

Steps to reproduce

  1. Install 16.0.5
  2. Upgrade to 17.0.0
  3. issue occ upgrade

Expected behaviour

Upgrade procedure should complete and NC should run.

Actual behaviour

Upgrade crashes at "Updating ". NC is broken and cannot be used.

Server configuration

Operating system: ubuntu 18.04

Web server: apache 2.4.29

Database: mysql 5.7.27

PHP version: 7.2.22

Nextcloud version: 16.0.5/17.0.0

Updated from an older Nextcloud: 16.0.5. (Continuously updated since before NC10.)

Where did you install Nextcloud from: zip file from web page.

Signing status: ???

List of activated apps:


App list

Enabled:
  - activity: 2.10.1
  - admin_audit: 1.7.0
  - apporder: 0.8.0
  - audioplayer: 2.8.4
  - bruteforcesettings: 1.4.0
  - calendar: 1.7.1
  - carnet: 0.18.4
  - checksum: 0.4.3
  - cloud_federation_api: 1.0.0
  - comments: 1.7.0
  - contacts: 3.1.6
  - dav: 1.13.0
  - deck: 0.7.0
  - drawio: 0.9.4
  - event_update_notification: 1.0.0
  - external: 3.4.0
  - federatedfilesharing: 1.7.0
  - files: 1.12.0
  - files_antivirus: 2.2.0
  - files_downloadactivity: 1.6.0
  - files_external: 1.8.0
  - files_markdown: 2.1.0
  - files_mindmap: 0.0.15
  - files_pdfviewer: 1.6.0
  - files_rightclick: 0.15.1
  - files_sharing: 1.9.0
  - files_trackdownloads: 1.6.0
  - files_trashbin: 1.7.0
  - files_versions: 1.10.0
  - files_videoplayer: 1.6.0
  - firstrunwizard: 2.6.0
  - gallery: 18.4.0
  - impersonate: 1.4.0
  - logreader: 2.2.0
  - lookup_server_connector: 1.5.0
  - metadata: 0.10.0
  - music: 0.10.1
  - news: 14.0.0
  - nextcloud_announcements: 1.6.0
  - notifications: 2.5.0
  - oauth2: 1.5.0
  - ocdownloader: 1.7.2
  - passman: 2.3.2
  - password_policy: 1.7.0
  - passwords: 2019.10.0
  - previewgenerator: 2.1.0
  - privacy: 1.1.0
  - provisioning_api: 1.7.0
  - ransomware_protection: 1.5.0
  - richdocuments: 3.4.2
  - serverinfo: 1.7.0
  - sharerenamer: 2.7.2
  - spreed: 7.0.0
  - survey_client: 1.5.0
  - text: 1.1.0
  - theming: 1.8.0
  - twofactor_admin: 1.0.0
  - twofactor_backupcodes: 1.6.0
  - twofactor_nextcloud_notification: 2.1.1
  - updatenotification: 1.7.0
  - uploaddetails: 0.1.2
  - user_sql: 4.3.0
  - viewer: 1.1.0
  - workflowengine: 1.7.0
Disabled:
  - accessibility
  - bookmarks
  - camerarawpreviews
  - encryption
  - extract
  - federation
  - files_inotify
  - files_linkeditor
  - files_readmemd
  - groupfolders
  - ocsms
  - polls
  - radio
  - ransomware_detection
  - recommendations
  - sensorlogger
  - sharebymail
  - support
  - systemtags
  - tasks
  - timetracker
  - user_ldap
  - video_converter
  - weather

Nextcloud configuration:


Config report

<?php
$CONFIG = array (
  'apps_paths' => 
  array (
    0 => 
    array (
      'path' => '/opt/nextcloud/apps-added',
      'url' => '/apps-added',
      'writable' => true,
    ),
    1 => 
    array (
      'path' => '/opt/nextcloud/apps',
      'url' => '/apps',
      'writable' => false,
    ),
  ),
  'updatechecker' => false,
  'instanceid' => 'ocpgrep9qdhg',
  'passwordsalt' => '**************************',
  'secret' => '*******************************',
  'integrity.check.disabled' => true,
  'trusted_domains' => 
  array (
    0 => '********************',
  ),
  'datadirectory' => '/media/server/administration/owncloud/data',
  'overwrite.cli.url' => 'http://**************/owncloud',
  'htaccess.RewriteBase' => '/owncloud',
  'dbtype' => 'mysql',
  'version' => '17.0.0.9',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'oc_admin8',
  'dbpassword' => '************************',
  'logtimezone' => 'UTC',
  'installed' => true,
  'theme' => '',
  'mail_from_address' => 'cloud',
  'mail_smtpmode' => 'smtp',
  'mail_domain' => '************************',
  'maintenance' => false,
  'trashbin_retention_obligation' => '3, 5',
  'versions_retention_obligation' => '3, 5',
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'filelocking.enabled' => 'true',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' => 
  array (
    'host' => 'localhost',
    'port' => 6379,
    'timeout' => 1.5,
  ),
  'loglevel' => 0,
  'logfile' => '***************************',
  'preview_libreoffice_path' => '/usr/bin/soffice',
  'enable_previews' => true,
  'preview_max_scale_factor' => 1,
  'preview_max_x' => 1920,
  'preview_max_y' => 1000,
  'preview_max_filesize_image' => -1,
  'enabledPreviewProviders' => 
  array (
    0 => 'OC\\Preview\\Images',
    1 => 'OC\\Preview\\PNG',
    2 => 'OC\\Preview\\BMP',
    3 => 'OC\\Preview\\JPEG',
    4 => 'OC\\Preview\\GIF',
    5 => 'OC\\Preview\\TIFF',
    6 => 'OC\\Preview\\XBitmap',
    7 => 'OC\\Preview\\Photoshop',
    8 => 'OC\\Preview\\Illustrator',
    9 => 'OC\\Preview\\SVG',
    10 => 'OC\\Preview\\PDF',
    11 => 'OC\\Preview\\Postscript',
    12 => 'OC\\Preview\\Illustrator',
    13 => 'OC\\Preview\\Movie',
    14 => 'OC\\Preview\\MP3',
    15 => 'OC\\Preview\\TXT',
    16 => 'OC\\Preview\\Markdown',
    17 => 'OC\\Preview\\Font',
    18 => 'OC\\Preview\\MSOffice2003',
    19 => 'OC\\Preview\\MSOffice2007',
    20 => 'OC\\Preview\\MSOfficeDoc',
    21 => 'OC\\Preview\\OpenDocument',
    22 => 'OC\\Preview\\StarOffice',
  ),
  'enable_movie_transcode' => true,
  'updater.release.channel' => 'stable',
  'mysql.utf8mb4' => true,
  'mail_smtphost' => '***************',
  'mail_smtpauthtype' => 'LOGIN',
  'mail_smtpauth' => 1,
  'mail_smtpname' => '****************',
  'mail_smtppassword' =>'***************',
  'mail_smtpport' => '587',
  'has_rebuilt_cache' => true,
  'user_backend_sql_raw' => 
  array (
    'db_type' => 'mariadb',
    'db_host' => 'localhost',
    'db_port' => '3306',
    'db_name' => '*************',
    'db_user' => '************',
    'db_password' => '*************',
    'mariadb_charset' => 'utf8',
  ),
  'app_install_overwrite' => 
  array (
    0 => 'ldaporg',
    1 => 'user_sql',
  ),
  'ldapIgnoreNamingRules' => false,
  'ldapProviderFactory' => 'OCA\\User_LDAP\\LDAPProviderFactory',
);

Are you using external storage, if yes which one: no

Are you using encryption: no

Are you using an external user-backend, if yes which one: no

Client configuration

Browser: Chrome

Operating system: ubuntu 18.04

Logs

Web server error log

This is the trace from the occ updater:


Web server error log

Updating <dav> ...
An unhandled exception has been thrown:
TypeError: Return value of OCA\DAV\Migration\Version1012Date20190808122342::changeSchema() must implement interface OCP\DB\ISchemaWrapper or be null, none returned in /opt/nextcloud/apps/dav/lib/Migration/Version1012Date20190808122342.php:115
Stack trace:
#0 /opt/nextcloud/lib/private/DB/MigrationService.php(475): OCA\DAV\Migration\Version1012Date20190808122342->changeSchema(Object(OC\Migration\SimpleOutput), Object(Closure), Array)
#1 /opt/nextcloud/lib/private/DB/MigrationService.php(411): OC\DB\MigrationService->executeStep('1012Date2019080...', false)
#2 /opt/nextcloud/lib/private/legacy/app.php(906): OC\DB\MigrationService->migrate()
#3 /opt/nextcloud/lib/private/Updater.php(373): OC_App::updateApp('dav')
#4 /opt/nextcloud/lib/private/Updater.php(252): OC\Updater->doAppUpgrade()
#5 /opt/nextcloud/lib/private/Updater.php(128): OC\Updater->doUpgrade('17.0.0.9', '16.0.5.1')
#6 /opt/nextcloud/core/Command/Upgrade.php(258): OC\Updater->upgrade()
#7 /opt/nextcloud/3rdparty/symfony/console/Command/Command.php(255): OC\Core\Command\Upgrade->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#8 /opt/nextcloud/3rdparty/symfony/console/Application.php(908): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#9 /opt/nextcloud/3rdparty/symfony/console/Application.php(269): Symfony\Component\Console\Application->doRunCommand(Object(OC\Core\Command\Upgrade), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#10 /opt/nextcloud/3rdparty/symfony/console/Application.php(145): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#11 /opt/nextcloud/lib/private/Console/Application.php(213): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#12 /opt/nextcloud/console.php(97): OC\Console\Application->run()
#13 /opt/nextcloud/occ(11): require_once('/opt/nextcloud/...')</summary>

0. Needs triage bug

Most helpful comment

I found a possible workaround: I need to make one small edit in ./apps/dav/lib/Migration/Version1012Date20190808122342.php:
If I move the return $schema; command in line 113 down by 1 line (outside of the following closing bracket), the routine also return $schema when the argument of the if command in line 49 is false. In that event the upgrade completes successfully.
The upgrade routine reports this:

Fix broken values of calendar objects                                                               

 Done                                                                                               
    0/0 [>---------------------------]   0%                                                         

Everything appears to work correctly.

All 5 comments

I found a possible workaround: I need to make one small edit in ./apps/dav/lib/Migration/Version1012Date20190808122342.php:
If I move the return $schema; command in line 113 down by 1 line (outside of the following closing bracket), the routine also return $schema when the argument of the if command in line 49 is false. In that event the upgrade completes successfully.
The upgrade routine reports this:

Fix broken values of calendar objects                                                               

 Done                                                                                               
    0/0 [>---------------------------]   0%                                                         

Everything appears to work correctly.

cc @georgehrke

https://github.com/nextcloud/server/blob/bcce568c6d892ccacc598c5d5bfa6b24c3284741/apps/dav/lib/Migration/Version1012Date20190808122342.php#L43-L45

Looks good to return $schema or null if we typehint it.

https://github.com/nextcloud/server/blob/bcce568c6d892ccacc598c5d5bfa6b24c3284741/apps/dav/lib/Migration/Version1012Date20190808122342.php#L41 if 13.0.0 refers to the nextcloud version please adjust it to 17 ;) but it's also the version number of the dav app so its right somehow.

@schniepp Do you mind sending a pull-request for your fix? Thx!

same here, fix by @schniepp solved it, please include this fix

same here, fix by @schniepp solved it but i don't understand why this is still needed using current helm chart so (supposed) latest docker image

Was this page helpful?
0 / 5 - 0 ratings