nextcloud / nextcloud/server

[Bug]: occ app:update exits with code 0 if update fails, no output, no retry possible

Open
#30,921 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

1. to develop 25-feedback bug feature: apps management feature: occ
Dominant language
PHP
Stars
36.9k
Forks
5.2k
Avg merge
2d 3h
Merged PRs (30d)
713

Description

⚠️ This issue respects the following points: ⚠️
  • This is a bug, not a question or a configuration/webserver/proxy issue.
  • This issue is not already reported on Github (I've searched it).
  • Nextcloud Server is up to date. See Maintenance and Release Schedule for supported versions.
  • I agree to follow Nextcloud's Code of Conduct.
Bug description

When occ app:update fails, e.g. because the update servers are not reachable or outbound network connections are denied by a firewall, then the command will take a few seconds, before exiting with code 0. No output is shown at all, even if using -vvv.

Repeating the same command afterwards will exit with code 0 (and without output) immediately. The process does not try to establish any outbound connection (it seems like it remembers that the last attempt failed and therefore just exits). This makes retries after configuration changes impossible.

Steps to reproduce
  1. Deny outbound network connections by firewall (such that app upgrade will fail)
  2. Run sudo -u www-data php occ app:update --all -vvv
  3. Repeat above command
Expected behavior
  • The command exits with a non-zero exit code, such that failures are detectable by scripts
  • The command prints the encountered error. With verbose flags (-vvv) it should print steps taken for debugging purposes.
  • When executed again, the attempt should be retried (instead of exiting immediately)
Installation method

Manual installation

Operating system

Debian/Ubuntu

PHP engine version

PHP 7.4

Web server

Apache (supported)

Database engine version

MariaDB

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

Updated to a major version (ex. 22.2.3 to 23.0.1)

Are you using the Nextcloud Server Encryption module?

Encryption is Enabled

What user-backends are you using?
  • Default user-backend (database)
  • LDAP/ Active Directory
  • SSO - SAML
  • Other
Configuration report
{
    "system": {
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "***REMOVED SENSITIVE VALUE***",
            "***REMOVED SENSITIVE VALUE***"
        ],
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "mysql",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "version": "23.0.1.2",
        "installed": true,
        "forcessl": true,
        "loglevel": 0,
        "logtimezone": "Europe\/Berlin",
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpmode": "smtp",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpport": 587,
        "mail_smtpsecure": "",
        "mail_smtpauth": true,
        "mail_smtpauthtype": "LOGIN",
        "mail_smtpname": "***REMOVED SENSITIVE VALUE***",
        "mail_smtppassword": "***REMOVED SENSITIVE VALUE***",
        "theme": "",
        "maintenance": false,
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trashbin_retention_obligation": "auto",
        "enable_previews": "false",
        "apps_paths": [
            {
                "path": "\/var\/www\/nextcloud\/apps",
                "url": "\/apps",
                "writable": false
            },
            {
                "path": "***REMOVED SENSITIVE VALUE***",
                "url": "\/userapps",
                "writable": true
            }
        ],
        "overwrite.cli.url": "***REMOVED SENSITIVE VALUE***",
        "encryption.legacy_format_support": true,
        "encryption.key_storage_migrated": false,
        "connectivity_check_domains": [],
        "app_install_overwrite": [
            "calendar"
        ]
    }
}
List of activated Apps
Enabled:
  - accessibility: 1.9.0
  - activity: 2.15.0
  - admin_audit: 1.13.0
  - circles: 23.0.1
  - cloud_federation_api: 1.6.0
  - contactsinteraction: 1.4.0
  - dashboard: 7.3.0
  - dav: 1.21.0
  - encryption: 2.11.0
  - federatedfilesharing: 1.13.0
  - files: 1.18.0
  - files_rightclick: 1.2.0
  - files_sharing: 1.15.0
  - files_trashbin: 1.13.0
  - files_versions: 1.16.0
  - firstrunwizard: 2.12.0
  - logreader: 2.8.0
  - lookup_server_connector: 1.11.0
  - notifications: 2.11.1
  - oauth2: 1.11.0
  - password_policy: 1.13.0
  - photos: 1.5.0
  - privacy: 1.7.0
  - provisioning_api: 1.13.0
  - serverinfo: 1.13.0
  - settings: 1.5.0
  - text: 3.4.0
  - theming: 1.14.0
  - twofactor_backupcodes: 1.12.0
  - viewer: 1.7.0
  - workflowengine: 2.5.0
Disabled:
  - bruteforcesettings: 2.0.1
  - calendar: 2.1.3
  - comments: 1.3.0
  - contacts: 3.4.3
  - federation: 1.0.1
  - files_external
  - files_pdfviewer: 0.8.1
  - files_videoplayer: 0.9.8
  - nextcloud_announcements: 1.2.0
  - recommendations: 1.0.0
  - sharebymail: 1.11.0
  - support: 1.4.0
  - survey_client: 0.1.5
  - systemtags: 1.0.2
  - tasks: 0.13.6
  - updatenotification: 1.3.0
  - user_ldap
  - user_status: 1.1.1
  - weather_status: 1.1.0
Nextcloud Signing status
No errors have been found.
Nextcloud Logs
Log file is over 20 MB in size, truncating it to the following lines which are repeated multiple times per second:

{"reqId":"F59mBXGEAPy57xZWcIOP","level":0,"time":"2022-01-29T22:21:33+01:00","remoteAddr":"172.40.0.2","user":"admin","app":"encryption","method":"GET","url":"/ocs/v2.php/apps/serverinfo/api/v1//basicdata?format=json","message":"/appinfo/app.php is deprecated, use \\OCP\\AppFramework\\Bootstrap\\IBootstrap on the application class instead.","userAgent":"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:95.0) Gecko/20100101 Firefox/95.0","version":"23.0.1.2"}
{"reqId":"F59mBXGEAPy57xZWcIOP","level":1,"time":"2022-01-29T22:21:33+01:00","remoteAddr":"172.40.0.2","user":"admin","app":"no app in context","method":"GET","url":"/ocs/v2.php/apps/serverinfo/api/v1//basicdata?format=json","message":"Unable to generate a URL for the named route \"contacts.contacts.directcircle\" as such route does not exist.","userAgent":"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:95.0) Gecko/20100101 Firefox/95.0","version":"23.0.1.2","exception":{"Exception":"Symfony\\Component\\Routing\\Exception\\RouteNotFoundException","Message":"Unable to generate a URL for the named route \"contacts.contacts.directcircle\" as such route does not exist.","Code":0,"Trace":[{"file":"/var/www/nextcloud/lib/private/Route/Router.php","line":365,"function":"generate","class":"Symfony\\Component\\Routing\\Generator\\UrlGenerator","type":"->"},{"file":"/var/www/nextcloud/lib/private/URLGenerator.php","line":91,"function":"generate","class":"OC\\Route\\Router","type":"->"},{"file":"/var/www/nextcloud/apps/circles/lib/Model/ModelManager.php","line":560,"function":"linkToRoute","class":"OC\\URLGenerator","type":"->"},{"file":"/var/www/nextcloud/apps/circles/lib/Model/Circle.php","line":703,"function":"generateLinkToCircle","class":"OCA\\Circles\\Model\\ModelManager","type":"->"},{"file":"/var/www/nextcloud/apps/circles/lib/Model/Circle.php","line":820,"function":"getUrl","class":"OCA\\Circles\\Model\\Circle","type":"->"},{"function":"jsonSerialize","class":"OCA\\Circles\\Model\\Circle","type":"->"},{"file":"/var/www/nextcloud/apps/circles/lib/Service/FederatedUserService.php","line":1225,"function":"json_encode"},{"file":"/var/www/nextcloud/apps/circles/lib/Service/FederatedUserService.php","line":999,"function":"cacheSingleCircle","class":"OCA\\Circles\\Service\\FederatedUserService","type":"->"},{"file":"/var/www/nextcloud/apps/circles/lib/Service/FederatedUserService.php","line":911,"function":"getSingleCircle","class":"OCA\\Circles\\Service\\FederatedUserService","type":"->"},{"file":"/var/www/nextcloud/apps/circles/lib/Service/FederatedUserService.php","line":489,"function":"fillSingleCircleId","class":"OCA\\Circles\\Service\\FederatedUserService","type":"->"},{"file":"/var/www/nextcloud/apps/circles/lib/ShareByCircleProvider.php","line":553,"function":"getLocalFederatedUser","class":"OCA\\Circles\\Service\\FederatedUserService","type":"->"},{"file":"/var/www/nextcloud/lib/private/Share20/Manager.php","line":1375,"function":"getSharedWith","class":"OCA\\Circles\\ShareByCircleProvider","type":"->"},{"file":"/var/www/nextcloud/apps/files_sharing/lib/MountProvider.php","line":90,"function":"getSharedWith","class":"OC\\Share20\\Manager","type":"->"},{"file":"/var/www/nextcloud/lib/private/Files/Config/MountProviderCollection.php","line":118,"function":"getMountsForUser","class":"OCA\\Files_Sharing\\MountProvider","type":"->"},{"file":"/var/www/nextcloud/lib/private/Files/Filesystem.php","line":429,"function":"addMountForUser","class":"OC\\Files\\Config\\MountProviderCollection","type":"->"},{"file":"/var/www/nextcloud/lib/private/Files/Filesystem.php","line":354,"function":"initMountPoints","class":"OC\\Files\\Filesystem","type":"::"},{"file":"/var/www/nextcloud/lib/private/legacy/OC_Util.php","line":326,"function":"init","class":"OC\\Files\\Filesystem","type":"::"},{"file":"/var/www/nextcloud/lib/private/Files/Filesystem.php","line":332,"function":"setupFS","class":"OC_Util","type":"::"},{"file":"/var/www/nextcloud/lib/private/Files/View.php","line":1156,"function":"resolvePath","class":"OC\\Files\\Filesystem","type":"::"},{"file":"/var/www/nextcloud/lib/private/Files/View.php","line":547,"function":"basicOperation","class":"OC\\Files\\View","type":"->"},{"file":"/var/www/nextcloud/lib/private/Encryption/Keys/Storage.php","line":269,"function":"file_exists","class":"OC\\Files\\View","type":"->"},{"file":"/var/www/nextcloud/lib/private/Encryption/Keys/Storage.php","line":229,"function":"getKey","class":"OC\\Encryption\\Keys\\Storage","type":"->"},{"file":"/var/www/nextcloud/lib/private/Encryption/Keys/Storage.php","line":121,"function":"getKeyWithUid","class":"OC\\Encryption\\Keys\\Storage","type":"->"},{"file":"/var/www/nextcloud/apps/encryption/lib/KeyManager.php","line":614,"function":"getSystemUserKey","class":"OC\\Encryption\\Keys\\Storage","type":"->"},{"file":"/var/www/nextcloud/apps/encryption/lib/KeyManager.php","line":170,"function":"getPublicShareKey","class":"OCA\\Encryption\\KeyManager","type":"->"},{"file":"/var/www/nextcloud/apps/encryption/lib/Users/Setup.php","line":62,"function":"validateShareKey","class":"OCA\\Encryption\\KeyManager","type":"->"},{"file":"/var/www/nextcloud/apps/encryption/lib/AppInfo/Application.php","line":55,"function":"setupSystem","class":"OCA\\Encryption\\Users\\Setup","type":"->"},{"file":"/var/www/nextcloud/apps/encryption/appinfo/app.php","line":37,"function":"setUp","class":"OCA\\Encryption\\AppInfo\\Application","type":"->"},{"file":"/var/www/nextcloud/lib/private/legacy/OC_App.php","line":304,"args":["/var/www/nextcloud/apps/encryption/appinfo/app.php"],"function":"require_once"},{"file":"/var/www/nextcloud/lib/private/legacy/OC_App.php","line":186,"function":"requireAppFile","class":"OC_App","type":"::"},{"file":"/var/www/nextcloud/lib/private/legacy/OC_App.php","line":140,"function":"loadApp","class":"OC_App","type":"::"},{"file":"/var/www/nextcloud/ocs/v1.php","line":56,"function":"loadApps","class":"OC_App","type":"::"},{"file":"/var/www/nextcloud/ocs/v2.php","line":23,"args":["/var/www/nextcloud/ocs/v1.php"],"function":"require_once"}],"File":"/var/www/nextcloud/3rdparty/symfony/routing/Generator/UrlGenerator.php","Line":143,"CustomMessage":"--"}}
Additional info

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the occ app:update --all command and its failure path, using the reproduction with blocked outbound connections. Check how exit status, output, and repeated attempts are handled. Done means failures return a non-zero status, report errors with verbose diagnostics, and retry when the command is run again.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.