Update failed, again - “The files of the app OAuth 2.0 (oauth2) were not replaced correctly


I have run into problem after problem when upgrading from Nextcloud 13.0.12 to 14.0.12.

Now, the update ran just fine - Until this showed up:
“The files of the app OAuth 2.0 (oauth2) were not replaced correctly. Make sure it is a version compatible with the server.”

The file is there. If I try to copy the contents and then delete it from the apps directory nothing changes.

Any ideas how to skip this app for now?


depending of oauth2 correct naming and folder location, this may help.

before update, try
integrity:check-app oauth2

And then, do a
app:disable oauth2
followed by
app:remove oauth2

Then you can go to
…/var/www/nextcloud/apps or …/var/www/html/apps
and do a ( caution !!! )
rm -rf oauth2

Thank you for your quick reply.

I ran integrity:check-app, followed by app:disable oauth2 and also app:remove ouath2.

All above commands tells me that the Nextcloud or one of the apps require upgrade - Only a limited number of commands are available.

The disable command also gave me: oauth2 can´t be disabled.

oauth2 can´t be disabled.

Means you have an active configuration.

Need to remove it before

An active configuration, what do you mean?

Edit: When I tried to enable oauth2 (just for trial and error) it said that the app cannot be installed because it is not compatible with this version of the server.

Did I get stuck in the middle of nowhere because of this…?

using GUI https://yourserver/index.php/settings/admin/oauth2 ( i guess the link as i dont use oauth2 )

And remove any configuration present.

After that, we have ssh option to modify the …/nextcloud/config/config.php
and look for
‘app_install_overwrite’ =>
array (
0 => ‘external’,
1 => ‘occweb’,
2 => ‘files_downloadactivity’,
3 => ‘admin_notifications’,
4 => ‘twofactor_yubikey’,
and delete anything related to oauth2

And apache2 restart may be needed

I cannot access the GUI as everything related to my server redirects to the page telling me that: “The files of the app OAuth 2.0…”

I dont have anything related to:
‘app_install_overwrite’ =>
array (
0 => ‘external’,
1 => ‘occweb’,
2 => ‘files_downloadactivity’,
3 => ‘admin_notifications’,
4 => ‘twofactor_yubikey’,

In my config.php file. Nothing at all.

I tried to add the above strings into the config file, and then removing the oauth2 directory. But still no luck.


I must say that I highly appreciate your will to help me.

my suggestion is to save your actual config file.

Then delete and start from scratch with the config.php.sample provided.

rm -rf the full /nextcloud/apps so you dont have any file in it

Then restart apache2 and retry

Start from scratch you say… This is a production environment that will be needed up and running at the latest, this friday…

Are there no other way?.. :confused:

I cant “get out of update mode”, or something similar to manually disable the app from the UI, and then perform the update again?

This is probably just my wildest dream talking. But, its worth a shot to ask, in my opinion.

honestly, without “seing” the whole serveur conf it is difficult to troubleshoot.

yes you can “get out”.

Access to /nextcloud/config/config.php Find and modify the params to look like
'maintenance' => false,

This is done. But I am still stuck at screen telling me the files of the app was not found…

The config is as follows: <?php
$CONFIG = array (
‘instanceid’ => ‘’,
‘passwordsalt’ => '
‘secret’ => '
‘trusted_domains’ =>
array (
0 => '
1 => ‘’,
‘datadirectory’ => ‘/volume1/Web/owncloud/data’,
‘overwrite.cli.url’ => '’,
‘dbtype’ => ‘mysql’,
‘version’ => ‘’,
‘logtimezone’ => ‘Europe/Stockholm’,
‘installed’ => true,
‘theme’ => ‘’,
‘loglevel’ => 2,
‘maintenance’ => false,
‘forcessl’ => true,
‘mail_smtpmode’ => ‘smtp’,
‘mail_smtpauthtype’ => ‘LOGIN’,
‘dbname’ => ‘Owncloud’,
‘dbhost’ => ‘localhost’,
‘dbtableprefix’ => ‘oc_’,
‘dbuser’ => ‘oc_administrator’,
‘dbpassword’ => '
‘mail_smtpauth’ => 1,
‘mail_from_address’ => '
‘mail_domain’ => '
‘mail_smtphost’ => ‘smtp-mail.outlook.com’,
‘mail_smtpport’ => ‘587’,
‘mail_smtpname’ => '
‘mail_smtppassword’ => '
‘mail_smtpsecure’ => ‘tls’,
‘htaccess.RewriteBase’ => ‘/owncloud’,
‘appstore.experimental.enabled’ => false,
‘memcache.local’ => ‘\OC\Memcache\APCu’,
‘memcached_servers’ =>
array (
0 => ‘localhost’,
1 => 11211,
‘trashbin_retention_obligation’ => ‘auto’,
‘integrity.check.disabled’ => true,
‘updater.secret’ => '
‘updater.release.channel’ => ‘production’,


 * Checks an app before install whether it uses private APIs instead of the
 * proper public APIs. If this is set to true it will only allow to install or
 * enable apps that pass this check.
 * Defaults to ``false``
'appcodechecker' => true,
  • and false, just in case too

Send my an email in private message, i upload the files and send them to you, so you can manually replace them.

You got a PM.

The above config changes did not change the situation…

send in email. hope this will fix it.

Got the mail, removed the old file, pasted your file. Still: The files of the app OAuth 2.0 (oauth2) were not replaced correctly. Make sure it is a version compatible with the server…

you need to decompress !
the folder oauth2 and all the subfolder/files need to be re-upload to the correct location, and you need to reapply the linux ownship and rights.

Then restart apache2

Then retry

seem you were pretty fast

Yeah, ofcourse I decompressed the file.

I restarted Apache2 as well.

Edit: Never mind, I gave it the needed rights via the GUI of my server.
Resupply the owner rights though… How? This is a Asustor server where the Linux commands is not always what one may think…

How come I cannot deactivate the app and just carry on with my life… :cry:

welllll …

by any chance, does the app:remove oauth2 works now ?

The app:remove gives me :Command app:remove is not defined…

If I were to restore everything but the Data directory from backup (it is simply to big). What files do I need to restore? Or, is it not possible because of database changes made by the updater?

Last idea !

Accessing your DB, tables oc_appconfig.
Fist save the three entry for oauth2 ( enable/installedversion/types) then delete them…

apache2 restart and maybe mysql too.