Server: Often App Upgrades Fail When They InstallTo app/app

Created on 5 Oct 2018  路  7Comments  路  Source: nextcloud/server

Often when I upgrade Apps from the GUI, the upgrade fails and Nextcloud goes to maintenance mode.

When I then look into the App's directory, I see, that the app is inside the app, e.g. currently it happens e.g. to contacts, calendar and notes. Then there is e.g. a directory /var/www/nextcloud/apps/contacts/contacts.

To fix the issue, I remove the app, e.g. /var/www/nextcloud/apps/contacts, then call occ app:install contacts.

Since it happens often, I wrote a script. APPSDIR is set to /var/www/nextcloud/apps:

echo "**** repair broken apps"
for app in $(ls $APPSDIR); do
    if test -d ${APPSDIR}/${app}/${app}; then
        echo "---- broken app: ${app}"
        rm -rf ${APPSDIR}/${app}
        sudo -u www-data ./occ app:install ${app}
    fi
done
sudo -u www-data ./occ maintenance:mode --off

Steps to reproduce

Currently it happened in two installations with the following steps:

  1. Upgrade existing Server to Nexcloud 14 from 13
  2. Do the upgrade for e.g.: contacts, calendar or notes
  3. Problem occurs.

Expected behaviour

Upgrade should work without problems from the GUI.

Actual behaviour

New app is installed into the wrong directory.

Server configuration

Operating system: Ubuntu 18.04

Web server: Apache

Database: MySQL

PHP version: 7

Nextcloud version: 14.0.1 (also happened in 13)

Updated from an older Nextcloud/ownCloud or fresh install: update from 13

Where did you install Nextcloud from: latest.tar.gz, docker image mwaeckerlin/nextcloud

Client configuration

Browser: Firefox Quantum

Operating system: Ubuntu 18.04

0. Needs triage bug apps management

All 7 comments

GitMate.io thinks possibly related issues are https://github.com/nextcloud/server/issues/5515 (Upgrade fails 10.0.5 to 11.0.3 ), https://github.com/nextcloud/server/issues/3168 (Failed Upgrade to 11), https://github.com/nextcloud/server/issues/3175 (Failed to enable app workflowengine), https://github.com/nextcloud/server/issues/5531 (Upgrade fails from NC11-12), and https://github.com/nextcloud/server/issues/5024 (Update fails with OAuth2 app).

GitMate.io thinks possibly related issues are #5515 (Upgrade fails 10.0.5 to 11.0.3 ), #3168 (Failed Upgrade to 11), #3175 (Failed to enable app workflowengine), #5531 (Upgrade fails from NC11-12), and #5024 (Update fails with OAuth2 app).

Nope.

I get hit by exactly this. Just got again today with the contacts 2.1.8 update.

My apps setup is a little non-stock since my Nextcloud is in a Docker container, but the Apps folder is stored on a NFS share and mounted into /apps2/. Either way, when I click "update" the app appears in nextcloud/apps2/contacts/contacts. Then I get an error that Nextcloud can't read the appinfo file, followed by Nextcloud getting left in maintenance mode.

I didn't write a script to fix it, but I just rm -rf the app, turn off maintenance mode and just download the app again. The data in SQL remains fine.

My config.php

'apps_paths' => 
  array (
    0 => 
    array (
      'path' => '/usr/share/nginx/html/nextcloud/apps',
      'url' => '/apps',
      'writable' => false,
    ),
    1 => 
    array (
      'path' => '/usr/share/nginx/html/nextcloud/apps2',
      'url' => '/apps2',
      'writable' => true,
    ),
  ),

Thank you @cvandesande. I wonder why no one of the team cares about this annoying problem?!?

As I cannot reproduce the original issue anymore, I will close this ticket. If this is still happening please make sure to upgrade to the latest version. After that, feel free to reopen.

This just happened to me with calendar:2.0.3 on nextcloud 19.0.0.12. Thank you for the diagnosis and fix!

Since this issue happened, I've learned that my NFS mount options seem to have an effect. Switching my NFS mounts from sync to async seemed to prevent this, however there have been consequences with upgrades. After a NC update, I run "occ upgrade", which turns off maintenance mode when complete. However maintenance still appears on after when I refresh NC. Fixing seems to be a simple PHP restart, (or docker restart in my case). Restarting PHP after an upgrade bothers me less than app errors, but I'm still interested in discovering what NFS mount options are the best for Nextcloud

Was this page helpful?
0 / 5 - 0 ratings