Upgrade to 16.0.08 failed

Trying to upgrade my nextcloud instance from 15.0.05 to latest versions, I face an issue with the upgrade to 16.0.08.

[/details]

Nextcloud version (eg, 12.0.2): internal version 15.0.5.3
Operating system and version (eg, Ubuntu 17.04): Debian 8.11, kernel version 4.14.154
Apache or nginx version (eg, Apache 2.4.25): Apache
PHP version (eg, 7.1): 7.2
Sqlite3

The issue you are facing:

Trying to upgrade my nextcloud instance from 15.0.05 to latest versions, I face an issue with the upgrade to 16.0.08 related to sqlite db. I get the message :

Mise à jour vers 16.0.8

Doctrine\DBAL\Exception\UniqueConstraintViolationException: An exception occurred while executing ‘INSERT INTO oc_activity (activity_id, timestamp, priority, type, user, affecteduser, app, subject, subjectparams, message, messageparams, file, link, object_type, object_id) SELECT activity_id, timestamp, priority, type, user, affecteduser, app, subject, subjectparams, message, messageparams, file, link, object_type, object_id FROM __temp__oc_activity’: SQLSTATE[23000]: Integrity constraint violation: 19 UNIQUE constraint failed: oc_activity.activity_id
Journaux détaillés

Préparation de la mise à jour

Réglage du niveau de journalisation à “déboguage”

Mode de maintenance activé

Étape de réparation : Repair MySQL collation

Informations de réparation : Not a mysql database -> nothing to do

Étape de réparation : Repair SQLite autoincrement

Doctrine\DBAL\Exception\UniqueConstraintViolationException: An exception occurred while executing ‘INSERT INTO oc_activity (activity_id, timestamp, priority, type, user, affecteduser, app, subject, subjectparams, message, messageparams, file, link, object_type, object_id) SELECT activity_id, timestamp, priority, type, user, affecteduser, app, subject, subjectparams, message, messageparams, file, link, object_type, object_id FROM __temp__oc_activity’: SQLSTATE[23000]: Integrity constraint violation: 19 UNIQUE constraint failed: oc_activity.activity_id

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

Steps to replicate it:

  1. relaunch the upgrade using the web interface. As the server is hosted remotely, I cannot run updater.phar.

I did try to fix db issues by running php -f occ maintenance:repair and i got :

  • Repair MySQL collation
    • Not a mysql database -> nothing to do
  • Repair mime types
  • Clean tags and favorites
    • 0 tags of deleted users have been removed.
    • 0 tags for delete files have been removed.
    • 0 tag entries for deleted tags have been removed.
    • 0 tags with no entries have been removed.
  • Repair invalid shares
  • Remove shares of a users root folder
  • Move .step file of updater to backup location
  • Fix potential broken mount points
    • No mounts updated
  • Repair invalid paths in file cache
  • Add log rotate job
  • Clear frontend caches
    • Image cache cleared
    • SCSS cache cleared
    • JS cache cleared
  • Clear every generated avatar on major updates
  • Add preview background cleanup job
  • Queue a one-time job to cleanup old backups of the updater
  • Repair pending cron jobs
    • No need to repair pending cron jobs.
  • Extract the vcard uid and store it in the db
  • Cleanup invalid photocache files for carddav
  • Add background job to cleanup login flow v2 tokens
  • Remove potentially over exposing share links
    • No need to remove link shares.
  • Clear access cache of projects

In AbstractSQLiteDriver.php line 63:

An exception occurred while executing ‘DELETE FROM “oc_collres_accesscache” WHERE “collection_id” <> ?’ with params [0]:

SQLSTATE[HY000]: General error: 1 no such table: oc_collres_accesscache

In PDOConnection.php line 82:

SQLSTATE[HY000]: General error: 1 no such table: oc_collres_accesscache

In PDOConnection.php line 80:

SQLSTATE[HY000]: General error: 1 no such table: oc_collres_accesscache

maintenance:repair [–include-expensive]

I have a v15.0.5 rsync backup.

How should I proceed :shushing_face:
1 - fixing sqlite db issues (I am not proficient)
2 - restoring v15.0.05 and restart the upgrade
3 - installing a brand new v18 and importing the necessary files from v15.0.05

The output of your Nextcloud log in Admin > Logging:

PASTE HERE

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

<?php
$CONFIG = array (
  'instanceid' => 'AAAAAA',
  'passwordsalt' => 'ZZZZ',
  'trusted_domains' => 
  array (
    0 => 'www.YYYYYYY',
  ),
  'datadirectory' => 'XXXXXX/data',
  'dbtype' => 'sqlite3',
  'version' => '15.0.5.3',
  'overwrite.cli.url' => 'YYYYYY',
  'installed' => true,
  'maintenance' => false,
  'mail_from_address' => 'webmaster',
  'mail_smtpmode' => 'smtp',
  'mail_sendmailmode' => 'smtp',
  'mail_domain' => 'YYYYY.org',
  'mail_smtpauthtype' => 'LOGIN',
  'mail_smtpauth' => 1,
  'updater.secret' => 'XXXXXXXXX,
  'theme' => '',
  'loglevel' => 2,
);

The output of your Apache/nginx/system log in /var/log/____:

PASTE HERE

it seems as if your database could cause the problem. so this iks what i would do:

then

by switching to mariaDB - the manual knows how

followed by another backup so you could give it another try to update.

:wink:
good luck

Attempting to restore the V15.05 backup, I read the manual https://docs.nextcloud.com/server/stable/admin_manual/maintenance/restore.html. Will the rsync -Aax nextcloud-dirbkp/ nextcloud/ be sufficient (I did save it this way)? I have a concern with restoring the db (sqlite3 data/owncloud.db < nextcloud-sqlbkp.bak) as i cannot access the sqlite3 command on the hosted server.

I did launch the backup recovery. and then occ maintenance:repair I had issues with:
OCA\DAV\Migration\FixBirthdayCalendarComponent’ is unknown
Failed to load repair step for dav: Repair step ‘OCA\DAV\Migration\CalDAVRemoveEmptyValue’ is unknown
Failed to load repair step for dav: Repair step ‘OCA\DAV\Migration\BuildCalendarSearchIndex’ is unknown
Failed to load repair step for dav: Repair step ‘OCA\DAV\Migration\RefreshWebcalJobRegistrar’ is unknown
Failed to load repair step for dav: Repair step ‘OCA\DAV\Migration\RemoveClassifiedEventActivity’ is unknown
Failed to load repair step for files_sharing: Repair step ‘OCA\Files_Sharing\Migration\OwncloudGuestShareType’ is unknown
Failed to load repair step for files_sharing: Repair step ‘OCA\Files_Sharing\Migration\SetPasswordColumn’ is unknown
Failed to load repair step for oauth2: Repair step ‘OCA\OAuth2\Migration\SetTokenExpiration’ is unknown
Failed to load repair step for twofactor_backupcodes: Repair step ‘OCA\TwoFactorBackupCodes\Migration\CheckBackupCodes’ is unknown

When logging using the web interface, I did recover the files when logging as admin; A normal user cannot see the files and do not see activites. Using cli, the files are present in the /data/user/files directory.

Generally speaking, we use the nextcloud instance only for documentation repository, not using the apps, contacts, calendar, communcations…

Don’t know how to fix this.
I envisage to rebuild a new clean v18 instance besides, reconfigure the users (not a big deal) and import files. As i intend to use Mariadb instead of SQLite, i cannot use the migration path as described in the administration manual. Any clue of this intended method or any advice to process another way?