nextcloud / user_saml

:lock: App for authenticating Nextcloud users using SAML https://apps.nextcloud.com/apps/user_saml
https://portal.nextcloud.com/article/configuring-single-sign-on-10.html
GNU Affero General Public License v3.0
96 stars 76 forks source link

Update NC 27.1.6 -> NC 28.0.2 failed #811

Closed raphael247 closed 8 months ago

raphael247 commented 9 months ago

Steps to reproduce

  1. NC is running 27.1.6
  2. sudo -u www-data php /var/www/nextcloud/updater/updater.phar

Expected behaviour

Update successfull

Actual behaviour

Upgrade failed:

Nextcloud Updater - version: v27.1.0rc3-15-gfa7af53

Current version is 27.1.6.

Update to Nextcloud 28.0.2 available. (channel: "stable") Following file will be downloaded automatically: https://download.nextcloud.com/server/releases/nextcloud-28.0.2.zip Open changelog ↗

Steps that will be executed: [ ] Check for expected files [ ] Check for write permissions [ ] Create backup [ ] Downloading [ ] Verify integrity [ ] Extracting [ ] Enable maintenance mode [ ] Replace entry points [ ] Delete old files [ ] Move new files in place [ ] Done

Start update? [y/N] y

Info: Pressing Ctrl-C will finish the currently running step and then stops the updater.

[✔] Check for expected files [✔] Check for write permissions [✔] Create backup [✔] Downloading [✔] Verify integrity [✔] Extracting [✔] Enable maintenance mode [✔] Replace entry points [✔] Delete old files [✔] Move new files in place [✔] Done

Update of code successful.

Should the "occ upgrade" command be executed? [Y/n] 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 Setting log level to debug Repair step: Repair MySQL collation Repair info: All tables already have the correct collation -> nothing to do Repair step: Copy data from accounts table when migrating from ownCloud Repair step: Drop account terms table when migrating from ownCloud Updating database schema Updated database Disabled incompatible app: files_rightclick Disabled incompatible app: richdocuments Disabled incompatible app: user_saml Updating ... Updated to 1.18.0 Updating ... Updated to 1.16.0 Updating ... Repair step: Update OAuth token expiration times Updated to 1.16.3 Updating ... Updated to 1.18.0 Updating ... Updated to 2.4.0 Updating ... Repair step: Insert UUIDFix background job for user and group in batches Repair step: Remove deprecated refresh time markers for LDAP user records Updated to 1.19.0 Updating ... Updated to 2.0.0 Updating ... Updated to 2.20.0 Updating ... Repair step: Upgrading Circles App Updated to 28.0.0-dev Updating ... Updated to 1.11.0 Updating ... Repair step: Fix component of birthday calendars Repair info: 1 birthday calendars updated. Repair step: Regenerating birthday calendars to use new icons and fix old birthday events without year Repair info: Adding background jobs to regenerate birthday calendar Repair step: Fix broken values of calendar objects Fix broken values of calendar objects

Starting ... 0/0 [>---------------------------] 0% Repair step: Registering building of calendar search index as background job Repair info: Add background job Repair step: Register building of social profile search index as background job Repair step: Registering background jobs to update cache for webcal calendars Repair info: Added 0 background jobs to update webcal calendars Repair step: Registering building of calendar reminder index as background job Repair info: Add background job Repair step: Clean up orphan event and contact data Repair info: 0 events without a calendar have been cleaned up Repair info: 0 properties without an events have been cleaned up Repair info: 0 changes without a calendar have been cleaned up Repair info: 0 cached events without a calendar subscription have been cleaned up Repair info: 0 changes without a calendar subscription have been cleaned up Repair info: 0 contacts without an addressbook have been cleaned up Repair info: 0 properties without a contact have been cleaned up Repair info: 0 changes without an addressbook have been cleaned up Repair step: Remove activity entries of private events Repair info: Removed 0 activity entries Repair step: Clean up old calendar subscriptions from deleted users that were not cleaned-up Clean up old calendar subscriptions from deleted users that were not cleaned-up

Starting ... 0/0 [->--------------------------] 0% Repair info: 0 calendar subscriptions without an user have been cleaned up Repair step: Remove invalid object properties Repair info: 0 invalid object properties removed. Updated to 1.29.1 Updating ... Repair step: Fix the share type of guest shares when migrating from ownCloud Repair step: Copy the share password into the dedicated column Repair step: Set existing shares as accepted Updated to 1.20.0 Updating ... Updated to 1.18.0 Updating ... Updated to 1.21.0 Updating ... Updated to 1.18.0 Updating ... Repair step: Populating added database structures for workflows Updated to 2.10.0 Updating ... Updated to 1.18.0 Updating ... Updated to 2.17.0 Updating ... Updated to 2.13.0 Updating ... Updated to 1.17.0 Updating ... Updated to 2.16.0 Updating ... Updated to 1.18.0 Updating ... Repair step: Failed to clean up the old administration theming images folder Repair info: Migrating administration images Repair info: No administration images to migrate Repair step: Migrate old user accessibility config Migrate old user accessibility config

Starting ... 0/0 [--->------------------------] 0% Starting ... 1/0 [----->----------------------] 0% Repair step: Initialize migration of background images from dashboard to theming app Updated to 2.3.0 Updating ... Updated to 1.9.0 Updating ... Updated to 7.8.0 Updating ... Updated to 1.18.0 Updating ... Updated to 2.9.0 Updating ... Updated to 1.1.0 Updating ... Updated to 1.12.0 Updating ... Updated to 1.18.0 Updating ... Updated to 2.0.0 Updating ... Updated to 1.3.0 Updating ... Updated to 1.18.0 Updating ... Updated to 1.10.1 Updating ... Repair step: Switches from default updater server to the customer one if a valid subscription is available Updated to 1.11.0 Updating ... Repair step: Send an admin notification if monthly report is disabled Updated to 1.16.0 Updating ... Repair step: Force-reset all Text sessions before Yjs migration Updated to 3.9.1 Updating ... Repair step: Add background job to check for backup codes Updated to 1.17.0 Updating ... Updated to 1.18.0 Updating ... Updated to 1.8.1 Updating ... Updated to 2.2.0 Updating ... Updated to 1.8.0 Update app richdocuments from App Store Repair step: Install default fonts Update app user_saml from App Store An unhandled exception has been thrown: Error: Call to undefined method OC\Server::getEventDispatcher() in /var/www/nextcloud/apps/user_saml/lib/AppInfo/Application.php:77 Stack trace:

0 /var/www/nextcloud/apps/user_saml/lib/AppInfo/Application.php(58): OCA\User_SAML\AppInfo\Application->timezoneHandling()

1 /var/www/nextcloud/lib/private/ServerContainer.php(107): OCA\User_SAML\AppInfo\Application->__construct()

2 /var/www/nextcloud/lib/private/ServerContainer.php(188): OC\ServerContainer->getAppContainer()

3 /var/www/nextcloud/lib/private/ServerContainer.php(153): OC\ServerContainer->getAppContainerForService()

4 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(64): OC\ServerContainer->query()

5 /var/www/nextcloud/lib/public/Server.php(55): OC\AppFramework\Utility\SimpleContainer->get()

6 /var/www/nextcloud/lib/private/DB/MigrationService.php(479): OCP\Server::get()

7 /var/www/nextcloud/lib/private/DB/MigrationService.php(503): OC\DB\MigrationService->createInstance()

8 /var/www/nextcloud/lib/private/DB/MigrationService.php(402): OC\DB\MigrationService->executeStep()

9 /var/www/nextcloud/lib/private/legacy/OC_App.php(775): OC\DB\MigrationService->migrate()

10 /var/www/nextcloud/lib/private/Installer.php(202): OC_App::updateApp()

11 /var/www/nextcloud/lib/private/Updater.php(422): OC\Installer->updateAppstoreApp()

12 /var/www/nextcloud/lib/private/Updater.php(284): OC\Updater->upgradeAppStoreApps()

13 /var/www/nextcloud/lib/private/Updater.php(140): OC\Updater->doUpgrade()

14 /var/www/nextcloud/core/Command/Upgrade.php(222): OC\Updater->upgrade()

15 /var/www/nextcloud/3rdparty/symfony/console/Command/Command.php(298): OC\Core\Command\Upgrade->execute()

16 /var/www/nextcloud/3rdparty/symfony/console/Application.php(1040): Symfony\Component\Console\Command\Command->run()

17 /var/www/nextcloud/3rdparty/symfony/console/Application.php(301): Symfony\Component\Console\Application->doRunCommand()

18 /var/www/nextcloud/3rdparty/symfony/console/Application.php(171): Symfony\Component\Console\Application->doRun()

19 /var/www/nextcloud/lib/private/Console/Application.php(206): Symfony\Component\Console\Application->run()

20 /var/www/nextcloud/console.php(100): OC\Console\Application->run()

21 /var/www/nextcloud/occ(11): require_once('...')

22 {main}

Keep maintenance mode active? [y/N]

Server configuration

Operating system: Debian GNU/Linux 12

Web server: apache2 2.4.57-2

Database: mariadb-server 1:10.11.6-0+deb12u1

PHP version: php8.2-fpm 8.2.7-1~deb12u1

Nextcloud version: (see Nextcloud admin page) 27.1.6

Where did you install Nextcloud from:

List of activated apps: Enabled:

Nextcloud configuration: { "system": { "passwordsalt": "REMOVED SENSITIVE VALUE", "secret": "REMOVED SENSITIVE VALUE", "trusteddomains": [ "localhost", "REMOVED SENSITIVE VALUE", "REMOVED SENSITIVE VALUE", "REMOVED SENSITIVE VALUE", "REMOVED SENSITIVE VALUE", "REMOVED SENSITIVE VALUE" ], "datadirectory": "REMOVED SENSITIVE VALUE", "dbtype": "mysql", "version": "27.1.6.2", "overwrite.cli.url": "http:\/\/localhost", "dbname": "REMOVED SENSITIVE VALUE", "dbhost": "REMOVED SENSITIVE VALUE", "dbport": "", "dbtableprefix": "oc", "mysql.utf8mb4": true, "dbuser": "REMOVED SENSITIVE VALUE", "dbpassword": "REMOVED SENSITIVE VALUE", "installed": true, "instanceid": "REMOVED SENSITIVE VALUE", "default_phone_region": "DE", "memcache.local": "\OC\Memcache\APCu", "memcache.distributed": "\OC\Memcache\Redis", "memcache.locking": "\OC\Memcache\Redis", "redis": { "host": "REMOVED SENSITIVE VALUE", "port": 0 }, "mail_from_address": "REMOVED SENSITIVE VALUE", "mail_smtpmode": "smtp", "mail_sendmailmode": "smtp", "mail_domain": "REMOVED SENSITIVE VALUE", "mail_smtphost": "REMOVED SENSITIVE VALUE", "mail_smtpport": "25", "ldapProviderFactory": "OCA\User_LDAP\LDAPProviderFactory", "maintenance": false, "loglevel": 2 } }

blizzz commented 9 months ago

Did you upgrade via web or command line?

user_saml: 5.2.6

is not compatible with NC 28, and the updater should have fetched 6.1.1 from the app store in the step _Update app usersaml from App Store

blizzz commented 9 months ago

OK, i oversaw it ran from command line. Could you check the nextcloud.log file for entries during the update run? Is there anything related to user_saml?

raphael247 commented 9 months ago

ok, let's take a look in the nextcloud.log:

{
  "reqId": "VfBjX4GDufSf3QouTNFC",
  "level": 1,
  "time": "2024-02-20T13:04:32+00:00",
  "remoteAddr": "",
  "user": "--",
  "app": "updater",
  "method": "",
  "url": "--",
  "message": "\\OC\\Updater::incompatibleAppDisabled: Disabled incompatible app: user_saml",
  "userAgent": "--",
  "version": "27.1.6.2",
  "data": {
    "app": "updater"
  }
}
...
...
{
  "reqId": "VfBjX4GDufSf3QouTNFC",
  "level": 0,
  "time": "2024-02-20T13:04:37+00:00",
  "remoteAddr": "",
  "user": "--",
  "app": "updater",
  "method": "",
  "url": "--",
  "message": "\\OC\\Updater::checkAppStoreApp: Checked for update of app \"files_rightclick\" in appstore",
  "userAgent": "--",
  "version": "27.1.6.2",
  "data": {
    "app": "updater"
  }
}
{
  "reqId": "VfBjX4GDufSf3QouTNFC",
  "level": 3,
  "time": "2024-02-20T13:04:38+00:00",
  "remoteAddr": "",
  "user": "--",
  "app": "no app in context",
  "method": "",
  "url": "--",
  "message": "App \"Right click\" cannot be installed because it is not compatible with this version of the server.",
  "userAgent": "--",
  "version": "27.1.6.2",
  "exception": {
    "Exception": "Exception",
    "Message": "App \"Right click\" cannot be installed because it is not compatible with this version of the server.",
    "Code": 0,
    "Trace": [
      {
        "file": "/var/www/nextcloud/lib/private/legacy/OC_App.php",
        "line": 264,
        "function": "installApp",
        "class": "OC\\Installer",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/Updater.php",
        "line": 431,
        "function": "enable",
        "class": "OC_App",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/Updater.php",
        "line": 284,
        "function": "upgradeAppStoreApps",
        "class": "OC\\Updater",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/Updater.php",
        "line": 140,
        "function": "doUpgrade",
        "class": "OC\\Updater",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/core/Command/Upgrade.php",
        "line": 222,
        "function": "upgrade",
        "class": "OC\\Updater",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/3rdparty/symfony/console/Command/Command.php",
        "line": 298,
        "function": "execute",
        "class": "OC\\Core\\Command\\Upgrade",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/3rdparty/symfony/console/Application.php",
        "line": 1040,
        "function": "run",
        "class": "Symfony\\Component\\Console\\Command\\Command",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/3rdparty/symfony/console/Application.php",
        "line": 301,
        "function": "doRunCommand",
        "class": "Symfony\\Component\\Console\\Application",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/3rdparty/symfony/console/Application.php",
        "line": 171,
        "function": "doRun",
        "class": "Symfony\\Component\\Console\\Application",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/Console/Application.php",
        "line": 206,
        "function": "run",
        "class": "Symfony\\Component\\Console\\Application",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/console.php",
        "line": 100,
        "function": "run",
        "class": "OC\\Console\\Application",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/occ",
        "line": 11,
        "args": [
          "/var/www/nextcloud/console.php"
        ],
        "function": "require_once"
      }
    ],
    "File": "/var/www/nextcloud/lib/private/Installer.php",
    "Line": 133,
    "message": "App \"Right click\" cannot be installed because it is not compatible with this version of the server.",
    "exception": {},
    "CustomMessage": "App \"Right click\" cannot be installed because it is not compatible with this version of the server."
  }
}
...
{
  "reqId": "VfBjX4GDufSf3QouTNFC",
  "level": 0,
  "time": "2024-02-20T13:04:40+00:00",
  "remoteAddr": "",
  "user": "--",
  "app": "updater",
  "method": "",
  "url": "--",
  "message": "\\OC\\Updater::checkAppStoreAppBefore: Checking for update of app \"user_saml\" in appstore",
  "userAgent": "--",
  "version": "27.1.6.2",
  "data": {
    "app": "updater"
  }
}
{
  "reqId": "VfBjX4GDufSf3QouTNFC",
  "level": 1,
  "time": "2024-02-20T13:04:40+00:00",
  "remoteAddr": "",
  "user": "--",
  "app": "updater",
  "method": "",
  "url": "--",
  "message": "\\OC\\Updater::upgradeAppStoreApp: Update app \"user_saml\" from appstore",
  "userAgent": "--",
  "version": "27.1.6.2",
  "data": {
    "app": "updater"
  }
}
raphael247 commented 9 months ago

I can successfully update Nextcloud if I disable the user_saml app. Then I can update the user_saml app to version 6.1.1 But user_saml app will not be enabled:

{
"reqId": "EMHEXqSWZWj65fAlSGWb",
"level": 3,
"time": "2024-02-20T13:24:23+00:00",
"remoteAddr": "10.190.1.2",
"user": "nc-admin",
"app": "settings",
"method": "POST",
"url": "/index.php/settings/apps/enable",
"message": "could not enable apps",
"userAgent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36",
"version": "28.0.2.5",
"exception": {
"Exception": "Exception",
"Message": "App "SSO & SAML authentication" cannot be installed because it is not compatible with this version of the server.",
"Code": 0,
"Trace": [
{
"file": "/var/www/nextcloud/apps/settings/lib/Controller/AppSettingsController.php",
"line": 454,
"function": "installApp",
"class": "OC\Installer",
"type": "->"
},
{
"file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
"line": 230,
"function": "enableApps",
"class": "OCA\Settings\Controller\AppSettingsController",
"type": "->"
},
{
"file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
"line": 137,
"function": "executeController",
"class": "OC\AppFramework\Http\Dispatcher",
"type": "->"
},
{
"file": "/var/www/nextcloud/lib/private/AppFramework/App.php",
"line": 184,
"function": "dispatch",
"class": "OC\AppFramework\Http\Dispatcher",
"type": "->"
},
{
"file": "/var/www/nextcloud/lib/private/Route/Router.php",
"line": 315,
"function": "main",
"class": "OC\AppFramework\App",
"type": "::"
},
{
"file": "/var/www/nextcloud/lib/base.php",
"line": 1069,
"function": "match",
"class": "OC\Route\Router",
"type": "->"
},
{
"file": "/var/www/nextcloud/index.php",
"line": 39,
"function": "handleRequest",
"class": "OC",
"type": "::"
}
],
"File": "/var/www/nextcloud/lib/private/Installer.php",
"Line": 133,
"message": "could not enable apps",
"exception": {},
"CustomMessage": "could not enable apps"
}
}
blizzz commented 9 months ago

This is odd.

Do you have setup warnings about opcache configuration? If that's wrong I'd expect more issues than just user_saml though.

Do you have perhaps two copies of the user_saml app in your app directory?

raphael247 commented 9 months ago

Hi,

I have no opcache warnings.

My apps directory looks like:

activity          files_sharing        settings
admin_audit       files_trashbin           sharebymail
bruteforcesettings    files_versions           support
calendar          firstrunwizard           survey_client
circles           logreader            suspicious_login
cloud_federation_api  lookup_server_connector  systemtags
comments          nextcloud_announcements  text
contactsinteraction   notes            theming
dashboard         notifications        twofactor_backupcodes
dav           oauth2               twofactor_totp
encryption        password_policy          updatenotification
federatedfilesharing  photos               user_ldap
federation        privacy              user_saml
files             provisioning_api         user_status
files_external        recommendations          viewer
files_pdfviewer       related_resources        weather_status
files_reminders       richdocuments        workflowengine
files_rightclick      serverinfo

There is no other user_saml app installed

Irkhar commented 9 months ago

I have the same problem when updating nextcloud from 27.1.6 to 28.0.2. System: Debian 12 php: PHP 8.2.7 database: PostgreSQL 15.5 web server: nginx/1.18.0

solracsf commented 8 months ago

Fixed by https://github.com/nextcloud/user_saml/pull/818