nextcloud / server

☁️ Nextcloud server, a safe home for all your data
https://nextcloud.com
GNU Affero General Public License v3.0
27.54k stars 4.08k forks source link

[Bug]: migration 28000Date20231004103301 #42759

Closed jezcaudle closed 10 months ago

jezcaudle commented 10 months ago

⚠️ This issue respects the following points: ⚠️

Bug description

Attempting to use the web updater to upgrade to 28.0.1 from 27.x

I get the following error:

Update to 28.0.1

Exception: Database error when running migration 28000Date20231004103301 for app core Index name "user_index" for table "oc_files_trash" collides with the constraint on table "oc_files_trash_new".

Steps to reproduce

  1. In the Administration settings
  2. Click the update button
  3. Click on the webupdater

Expected behavior

An updated version of Nextcloud.

Installation method

Community Web installer on a VPS or web space

Nextcloud Server version

27

Operating system

Debian/Ubuntu

PHP engine version

PHP 8.3

Web server

Nginx

Database engine version

MariaDB

Is this bug present after an update or on a fresh install?

Upgraded to a MAJOR version (ex. 22 to 23)

Are you using the Nextcloud Server Encryption module?

None

What user-backends are you using?

Configuration report

--define apc.enable_cli=1

Nextcloud or one of the apps require upgrade - only a limited number of commands are available
You may use your browser or the occ upgrade command to do the upgrade
{
    "system": {
        "config_is_read_only": false,
        "updatechecker": false,
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "cloud.ipsosimplico.com"
        ],
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "overwrite.cli.url": "https:\/\/cloud.ipsosimplico.com",
        "dbtype": "mysql",
        "version": "27.1.5.1",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbtableprefix": "oc_",
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "logtimezone": "UTC",
        "installed": true,
        "appstore.experimental.enabled": true,
        "loglevel": 3,
        "maintenance": false,
        "theme": "",
        "mysql.utf8mb4": true,
        "mail_smtpmode": "smtp",
        "mail_smtpsecure": "ssl",
        "mail_sendmailmode": "smtp",
        "memcache.local": "\\OC\\Memcache\\APCu",
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "filelocking.enabled": true,
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "port": 6379,
            "dbindex": 0,
            "timeout": 0
        },
        "updater.secret": "***REMOVED SENSITIVE VALUE***"
    }
}
Nextcloud or one of the apps require upgrade - only a limited number of commands are available
You may use your browser or the occ upgrade command to do the upgrade
{
    "system": {
        "config_is_read_only": false,
        "updatechecker": false,
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "cloud.ipsosimplico.com"
        ],
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "overwrite.cli.url": "https:\/\/cloud.ipsosimplico.com",
        "dbtype": "mysql",
        "version": "27.1.5.1",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbtableprefix": "oc_",
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "logtimezone": "UTC",
        "installed": true,
        "appstore.experimental.enabled": true,
        "loglevel": 3,
        "maintenance": false,
        "theme": "",
        "mysql.utf8mb4": true,
        "mail_smtpmode": "smtp",
        "mail_smtpsecure": "ssl",
        "mail_sendmailmode": "smtp",
        "memcache.local": "\\OC\\Memcache\\APCu",
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "filelocking.enabled": true,
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "port": 6379,
            "dbindex": 0,
            "timeout": 0
        },
        "updater.secret": "***REMOVED SENSITIVE VALUE***"
    }
}

List of activated Apps

Nextcloud or one of the apps require upgrade - only a limited number of commands are available
You may use your browser or the occ upgrade command to do the upgrade
Enabled:
  - activity: 2.19.0
  - bookmarks: 13.1.3
  - bruteforcesettings: 2.7.0
  - calendar: 4.6.2
  - circles: 27.0.1
  - cloud_federation_api: 1.10.0
  - comments: 1.17.0
  - contacts: 5.5.1
  - contactsinteraction: 1.8.0
  - dashboard: 7.7.0
  - dav: 1.27.0
  - federatedfilesharing: 1.17.0
  - federation: 1.17.0
  - files: 1.22.0
  - files_mindmap: 0.0.30
  - files_pdfviewer: 2.8.0
  - files_reminders: 1.0.0
  - files_sharing: 1.19.0
  - files_trashbin: 1.17.0
  - firstrunwizard: 2.16.0
  - logreader: 2.12.0
  - lookup_server_connector: 1.15.0
  - nextcloud_announcements: 1.16.0
  - notes: 4.9.2
  - notifications: 2.15.0
  - oauth2: 1.15.1
  - password_policy: 1.17.0
  - photos: 2.3.0
  - privacy: 1.11.0
  - provisioning_api: 1.17.0
  - recommendations: 1.6.0
  - related_resources: 1.2.0
  - serverinfo: 1.17.0
  - settings: 1.9.0
  - sharebymail: 1.17.0
  - side_menu: 3.11.2
  - spreed: 17.1.4
  - support: 1.10.0
  - survey_client: 1.15.0
  - systemtags: 1.17.0
  - tasks: 0.15.0
  - text: 3.8.0
  - theming: 2.2.0
  - twofactor_backupcodes: 1.16.0
  - updatenotification: 1.17.0
  - user_status: 1.7.0
  - viewer: 2.1.0
  - weather_status: 1.7.0
  - workflowengine: 2.9.0
Disabled:
  - admin_audit: 1.18.0
  - encryption: 2.16.0 (installed 2.8.1)
  - files_external: 1.20.0
  - files_versions: 1.21.0 (installed 1.8.0)
  - suspicious_login: 6.0.0
  - twofactor_totp: 10.0.0-beta.2
  - user_ldap: 1.19.0

Nextcloud Signing status

Nextcloud will be updated to version 28.0.1
The following apps will be updated:

    Activity (activity)
    Brute-force settings (bruteforcesettings)
    Circles (circles)
    Cloud Federation API (cloud_federation_api)
    Comments (comments)
    Contacts Interaction (contactsinteraction)
    Dashboard (dashboard)
    WebDAV (dav)
    Federated file sharing (federatedfilesharing)
    Federation (federation)
    Files (files)
    PDF viewer (files_pdfviewer)
    File reminders (files_reminders)
    File sharing (files_sharing)
    Deleted files (files_trashbin)
    First run wizard (firstrunwizard)
    Log Reader (logreader)
    Lookup Server Connector (lookup_server_connector)
    Nextcloud announcements (nextcloud_announcements)
    Notifications (notifications)
    OAuth 2.0 (oauth2)
    Password policy (password_policy)
    Photos (photos)
    Privacy (privacy)
    Provisioning API (provisioning_api)
    Recommendations (recommendations)
    Related Resources (related_resources)
    Monitoring (serverinfo)
    Nextcloud settings (settings)
    Share by mail (sharebymail)
    Support (support)
    Usage survey (survey_client)
    Collaborative tags (systemtags)
    Text (text)
    Theming (theming)
    Two factor backup codes (twofactor_backupcodes)
    Update notification (updatenotification)
    User status (user_status)
    Viewer (viewer)
    Weather status (weather_status)
    Nextcloud workflow engine (workflowengine)

These incompatible apps will be disabled:

    files_rightclick (files_rightclick)
    Talk (spreed)

Please make sure that the database, the config folder and the data folder have been backed up before proceeding.
To avoid timeouts with larger installations, you can instead run the following command from your installation directory:

./occ upgrade

Nextcloud Logs

{"reqId":"x4lpab0aCd9pGn1cuzl3","level":3,"time":"2024-01-14T11:06:40+00:00","remoteAddr":"*.*.*.*","user":"--","app":"no app in context","method":"GET","url":"/core/ajax/update.php?requesttoken=xxxxxxxxP6zh5HaOzSkfQ4rkyaH9m2yP66KAUCyOtodo%3D%3ADLeY9g09mQBNVOLlLjefhtZXGAVXi0mWoIs%2FP3f37K4%3D","message":"Database error when running migration 28000Date20231004103301 for app core\nIndex name \"user_index\" for table \"oc_files_trash\" collides with the constraint on table \"oc_files_trash_new\".","userAgent":"Mozilla/5.0 (X11; OpenBSD amd64; rv:121.0) Gecko/20100101 Firefox/121.0","version":"27.1.5.1","exception":{"Exception":"Exception","Message":"Database error when running migration 28000Date20231004103301 for app core\nIndex name \"user_index\" for table \"oc_files_trash\" collides with the constraint on table \"oc_files_trash_new\".","Code":0,"Trace":[{"file":"/home/jez/php/nextcloud20/lib/private/Updater.php","line":322,"function":"migrate","class":"OC\\DB\\MigrationService","type":"->"},{"file":"/home/jez/php/nextcloud20/lib/private/Updater.php","line":261,"function":"doCoreUpgrade","class":"OC\\Updater","type":"->"},{"file":"/home/jez/php/nextcloud20/lib/private/Updater.php","line":140,"function":"doUpgrade","class":"OC\\Updater","type":"->"},{"file":"/home/jez/php/nextcloud20/core/ajax/update.php","line":187,"function":"upgrade","class":"OC\\Updater","type":"->"}],"File":"/home/jez/php/nextcloud20/lib/private/DB/MigrationService.php","Line":406,"Previous":{"Exception":"InvalidArgumentException","Message":"Index name \"user_index\" for table \"oc_files_trash\" collides with the constraint on table \"oc_files_trash_new\".","Code":0,"Trace":[{"file":"/home/jez/php/nextcloud20/lib/private/DB/MigrationService.php","line":517,"function":"ensureUniqueNamesConstraints","class":"OC\\DB\\MigrationService","type":"->"},{"file":"/home/jez/php/nextcloud20/lib/private/DB/MigrationService.php","line":402,"function":"executeStep","class":"OC\\DB\\MigrationService","type":"->"},{"file":"/home/jez/php/nextcloud20/lib/private/Updater.php","line":322,"function":"migrate","class":"OC\\DB\\MigrationService","type":"->"},{"file":"/home/jez/php/nextcloud20/lib/private/Updater.php","line":261,"function":"doCoreUpgrade","class":"OC\\Updater","type":"->"},{"file":"/home/jez/php/nextcloud20/lib/private/Updater.php","line":140,"function":"doUpgrade","class":"OC\\Updater","type":"->"},{"file":"/home/jez/php/nextcloud20/core/ajax/update.php","line":187,"function":"upgrade","class":"OC\\Updater","type":"->"}],"File":"/home/jez/php/nextcloud20/lib/private/DB/MigrationService.php","Line":671},"message":"Database error when running migration 28000Date20231004103301 for app core\nIndex name \"user_index\" for table \"oc_files_trash\" collides with the constraint on table \"oc_files_trash_new\".","exception":{},"CustomMessage":"Database error when running migration 28000Date20231004103301 for app core\nIndex name \"user_index\" for table \"oc_files_trash\" collides with the constraint on table \"oc_files_trash_new\"."}}
{"reqId":"x4lpab0aCd9pGn1cuzl3","level":3,"time":"2024-01-14T11:06:40+00:00","remoteAddr":"*.*.*.*","user":"--","app":"updater","method":"GET","url":"/core/ajax/update.php?requesttoken=xxxxxxxxP6zh5HaOzSkfQ4rkyaH9m2yP66KAUCyOtodo%3D%3ADLeY9g09mQBNVOLlLjefhtZXGAVXi0mWoIs%2FP3f37K4%3D","message":"\\OC\\Updater::failure: Exception: Database error when running migration 28000Date20231004103301 for app core\nIndex name \"user_index\" for table \"oc_files_trash\" collides with the constraint on table \"oc_files_trash_new\".","userAgent":"Mozilla/5.0 (X11; OpenBSD amd64; rv:121.0) Gecko/20100101 Firefox/121.0","version":"27.1.5.1","data":{"app":"updater"}}
{"reqId":"x4lpab0aCd9pGn1cuzl3","level":3,"time":"2024-01-14T11:06:40+00:00","remoteAddr":"*.*.*.*","user":"--","app":"updater","method":"GET","url":"/core/ajax/update.php?requesttoken=xxxxxxxxP6zh5HaOzSkfQ4rkyaH9m2yP66KAUCyOtodo%3D%3ADLeY9g09mQBNVOLlLjefhtZXGAVXi0mWoIs%2FP3f37K4%3D","message":"\\OC\\Updater::updateEnd: Update failed","userAgent":"Mozilla/5.0 (X11; OpenBSD amd64; rv:121.0) Gecko/20100101 Firefox/121.0","version":"27.1.5.1","data":{"app":"updater"}}
{"reqId":"x4lpab0aCd9pGn1cuzl3","level":1,"time":"2024-01-14T11:06:40+00:00","remoteAddr":"*.*.*.*","user":"--","app":"updater","method":"GET","url":"/core/ajax/update.php?requesttoken=xxxxxxxxP6zh5HaOzSkfQ4rkyaH9m2yP66KAUCyOtodo%3D%3ADLeY9g09mQBNVOLlLjefhtZXGAVXi0mWoIs%2FP3f37K4%3D","message":"\\OC\\Updater::maintenanceActive: Maintenance mode is kept active","userAgent":"Mozilla/5.0 (X11; OpenBSD amd64; rv:121.0) Gecko/20100101 Firefox/121.0","version":"27.1.5.1","data":{"app":"updater"}}
{"reqId":"x4lpab0aCd9pGn1cuzl3","level":1,"time":"2024-01-14T11:06:40+00:00","remoteAddr":"*.*.*.*","user":"--","app":"updater","method":"GET","url":"/core/ajax/update.php?requesttoken=xxxxxxxxP6zh5HaOzSkfQ4rkyaH9m2yP66KAUCyOtodo%3D%3ADLeY9g09mQBNVOLlLjefhtZXGAVXi0mWoIs%2FP3f37K4%3D","message":"\\OC\\Updater::resetLogLevel: Reset log level to Error(3)","userAgent":"Mozilla/5.0 (X11; OpenBSD amd64; rv:121.0) Gecko/20100101 Firefox/121.0","version":"27.1.5.1","data":{"app":"updater"}}

Additional info

I can't find the migrations - I've looked but can't find them anywhere. I can't find any mentions of them online either. If I could find them, then I could have had a look to see what was going on.

Please add the location of migrations to your documentation.

solracsf commented 10 months ago

Duplicate of https://github.com/nextcloud/server/issues/41253

jezcaudle commented 10 months ago

There is nothing in the duplicate that works. The error is the same.

jezcaudle commented 10 months ago

I can't work. Nothing here helps. I'm going to install a fresh copy and migrate the data as best as I can.

I'll also be looking for alternatives because, like I said, I can't work without my calendar, contacts, to-do list and notes.

joshtrichards commented 10 months ago

It's not a bug; it means there are orphan tables that aren't associated with any apps. If you post to the Nextcloud Help Forum - https://help.nextcloud.com someone can probably help you sort it out.

Based on the output you provided the table that probably is bogus is oc_files_trash_new since that doesn't match anything real I'm aware of. Always do backups before dropping of course.