Update from 18.0.6 to 18.0.7 fails "Could not unlink:/usr/share/nginx/nextcloud/updater/…/ocs/v2.php”

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face:

help.nextcloud.com is for home/non-enterprise users. If you’re running a business, paid support can be accessed via portal.nextcloud.com where we can ensure your business keeps running smoothly.

In order to help you as quickly as possible, before clicking Create Topic please provide as much of the below as you can. Feel free to use a pastebin service for logs, otherwise either indent short log examples with four spaces:

example

Or for longer, use three backticks above and below the code snippet:

longer
example
here

Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can :heart:

Nextcloud version (eg, 18.0.2): 18.0.6
Operating system and version (eg, Ubuntu 20.04): Fedora Server 31
Apache or nginx version (eg, Apache 2.4.25): nginx 1.18.0.1
PHP version (eg, 7.1): 7.3.20

The issue you are facing:

Update stalls using web-based updater. Message “Could not unlink: /usr/share/nginx/nextcloud/updater/…/ocs/v2.php”

Is this the first time you’ve seen this error? (Y/N):
Y

Steps to replicate it:

  1. Retry Update

The output of your Nextcloud log in Admin > Logging:
Output of data/updater.log

    2020-07-28T17:36:42+0000 qM8CR9KCoo [info] request to updater
    2020-07-28T17:36:42+0000 qM8CR9KCoo [info] currentStep()
    2020-07-28T17:36:42+0000 qM8CR9KCoo [info] show HTML page
    2020-07-28T17:36:42+0000 qM8CR9KCoo [info] current version: 18.0.6 build time: 2020-06-09T07:36:10+00:00 dbb46a72b1cafa15c330515ee2bd0caf8d5151eb
    2020-07-28T17:36:42+0000 qM8CR9KCoo [info] getUpdateServerResponse()
    2020-07-28T17:36:42+0000 qM8CR9KCoo [info] updaterServer: https://updates.nextcloud.com/updater_server/
    2020-07-28T17:36:42+0000 qM8CR9KCoo [info] releaseChannel: stable
    2020-07-28T17:36:42+0000 qM8CR9KCoo [info] internal version: 18.0.6.0
    2020-07-28T17:36:42+0000 qM8CR9KCoo [info] updateURL: https://updates.nextcloud.com/updater_server/?version=18x0x6x0xxxstablexx2020-06-09T07%3A36%3A10%2B00%3A00+dbb46a72b1cafa15c330515ee2bd0caf8d5151ebx7x3x20
    2020-07-28T17:36:43+0000 qM8CR9KCoo [info] getUpdateServerResponse response: Array
    (
        [version] => 18.0.7.1
        [versionstring] => Nextcloud 18.0.7
        [url] => https://download.nextcloud.com/server/releases/nextcloud-18.0.7.zip
        [web] => https://docs.nextcloud.com/server/18/admin_manual/maintenance/upgrade.html
        [changes] => https://updates.nextcloud.com/changelog_server/?version=18.0.7
        [autoupdater] => 1
        [eol] => 0
        [signature] => jqE+H1D6TdPdnU+FTpI+oiRw2yktKp0J4Kjpy1x0BSC0yVjQ/wzaM3cVdYtQfK/n
    3THCUr2tr7ya5z5KN3QxPRnzwQ7y8VPT/OX67Ex6ocad6js0A5n+rGdxsQwfErGL
    AAIcVJZvHkZY/u37doqReli7uiGXefYBl+TMxA7xHcCjMiK/Q3N4TwXuIdqqs4jm
    LDj/nxXiwNcVjEeBgSI86kAsa5LjfC/x/lRK4RYcxrDJ1/zrGrxZIDoM1AeCaTiH
    4UdS8yCpLhSrTTnEcAVsCw7B+dUl3tMMEsZ6tIj0rBiM2w64UrrDKa+6nT1blC4D
    2MV0GGQs+KG1zib7TRfNlg==
    )
    
    2020-07-28T17:36:43+0000 qM8CR9KCoo [info] checkForUpdate() Array
    (
        [version] => 18.0.7.1
        [versionstring] => Nextcloud 18.0.7
        [url] => https://download.nextcloud.com/server/releases/nextcloud-18.0.7.zip
        [web] => https://docs.nextcloud.com/server/18/admin_manual/maintenance/upgrade.html
        [changes] => https://updates.nextcloud.com/changelog_server/?version=18.0.7
        [autoupdater] => 1
        [eol] => 0
        [signature] => jqE+H1D6TdPdnU+FTpI+oiRw2yktKp0J4Kjpy1x0BSC0yVjQ/wzaM3cVdYtQfK/n
    3THCUr2tr7ya5z5KN3QxPRnzwQ7y8VPT/OX67Ex6ocad6js0A5n+rGdxsQwfErGL
    AAIcVJZvHkZY/u37doqReli7uiGXefYBl+TMxA7xHcCjMiK/Q3N4TwXuIdqqs4jm
    LDj/nxXiwNcVjEeBgSI86kAsa5LjfC/x/lRK4RYcxrDJ1/zrGrxZIDoM1AeCaTiH
    4UdS8yCpLhSrTTnEcAVsCw7B+dUl3tMMEsZ6tIj0rBiM2w64UrrDKa+6nT1blC4D
    2MV0GGQs+KG1zib7TRfNlg==
    )
    
    2020-07-28T17:36:43+0000 qM8CR9KCoo [info] getChangelogURL()
    2020-07-28T17:36:43+0000 qM8CR9KCoo [info] end of checkForUpdate() Update to Nextcloud 18.0.7 available. (channel: "stable")<br /><span class="light">Following file will be downloaded automatically:</span> <code class="light">https://download.nextcloud.com/server/releases/nextcloud-18.0.7.zip</code><br /><a class="external_link" href="https://nextcloud.com/changelog/#18-0-7" target="_blank" rel="noreferrer noopener">Open changelog ↗</a>
    2020-07-28T17:36:49+0000 Ge3lbd4sYi [info] request to updater
    2020-07-28T17:36:49+0000 Ge3lbd4sYi [info] currentStep()
    2020-07-28T17:36:49+0000 Ge3lbd4sYi [info] POST request for step "1"
    2020-07-28T17:36:49+0000 Ge3lbd4sYi [info] startStep("1")
    2020-07-28T17:36:49+0000 Ge3lbd4sYi [info] checkForExpectedFilesAndFolders()
    2020-07-28T17:36:49+0000 Ge3lbd4sYi [info] end of checkForExpectedFilesAndFolders()
    2020-07-28T17:36:49+0000 Ge3lbd4sYi [info] endStep("1")
    2020-07-28T17:36:49+0000 nOTFZDeqrO [info] request to updater
    2020-07-28T17:36:49+0000 nOTFZDeqrO [info] currentStep()
    2020-07-28T17:36:49+0000 nOTFZDeqrO [info] Step 1 is in state "end".
    2020-07-28T17:36:49+0000 nOTFZDeqrO [info] POST request for step "2"
    2020-07-28T17:36:49+0000 nOTFZDeqrO [info] startStep("2")
    2020-07-28T17:36:49+0000 nOTFZDeqrO [info] checkWritePermissions()
    2020-07-28T17:36:49+0000 nOTFZDeqrO [info] end of checkWritePermissions()
    2020-07-28T17:36:49+0000 nOTFZDeqrO [info] endStep("2")
    2020-07-28T17:36:49+0000 uqCw8mP1Eq [info] request to updater
    2020-07-28T17:36:49+0000 uqCw8mP1Eq [info] currentStep()
    2020-07-28T17:36:49+0000 uqCw8mP1Eq [info] Step 2 is in state "end".
    2020-07-28T17:36:49+0000 uqCw8mP1Eq [info] POST request for step "3"
    2020-07-28T17:36:49+0000 uqCw8mP1Eq [info] startStep("3")
    2020-07-28T17:36:49+0000 uqCw8mP1Eq [info] createBackup()
    2020-07-28T17:37:29+0000 uqCw8mP1Eq [info] end of createBackup()
    2020-07-28T17:37:29+0000 uqCw8mP1Eq [info] endStep("3")
    2020-07-28T17:37:30+0000 aCaVkM7nxG [info] request to updater
    2020-07-28T17:37:30+0000 aCaVkM7nxG [info] currentStep()
    2020-07-28T17:37:30+0000 aCaVkM7nxG [info] Step 3 is in state "end".
    2020-07-28T17:37:30+0000 aCaVkM7nxG [info] POST request for step "4"
    2020-07-28T17:37:30+0000 aCaVkM7nxG [info] startStep("4")
    2020-07-28T17:37:30+0000 aCaVkM7nxG [info] downloadUpdate()
    2020-07-28T17:37:30+0000 aCaVkM7nxG [info] getUpdateServerResponse()
    2020-07-28T17:37:30+0000 aCaVkM7nxG [info] updaterServer: https://updates.nextcloud.com/updater_server/
    2020-07-28T17:37:30+0000 aCaVkM7nxG [info] releaseChannel: stable
    2020-07-28T17:37:30+0000 aCaVkM7nxG [info] internal version: 18.0.6.0
    2020-07-28T17:37:30+0000 aCaVkM7nxG [info] updateURL: https://updates.nextcloud.com/updater_server/?version=18x0x6x0xxxstablexx2020-06-09T07%3A36%3A10%2B00%3A00+dbb46a72b1cafa15c330515ee2bd0caf8d5151ebx7x3x20
    2020-07-28T17:37:30+0000 aCaVkM7nxG [info] getUpdateServerResponse response: Array
    (
        [version] => 18.0.7.1
        [versionstring] => Nextcloud 18.0.7
        [url] => https://download.nextcloud.com/server/releases/nextcloud-18.0.7.zip
        [web] => https://docs.nextcloud.com/server/18/admin_manual/maintenance/upgrade.html
        [changes] => https://updates.nextcloud.com/changelog_server/?version=18.0.7
        [autoupdater] => 1
        [eol] => 0
        [signature] => jqE+H1D6TdPdnU+FTpI+oiRw2yktKp0J4Kjpy1x0BSC0yVjQ/wzaM3cVdYtQfK/n
    3THCUr2tr7ya5z5KN3QxPRnzwQ7y8VPT/OX67Ex6ocad6js0A5n+rGdxsQwfErGL
    AAIcVJZvHkZY/u37doqReli7uiGXefYBl+TMxA7xHcCjMiK/Q3N4TwXuIdqqs4jm
    LDj/nxXiwNcVjEeBgSI86kAsa5LjfC/x/lRK4RYcxrDJ1/zrGrxZIDoM1AeCaTiH
    4UdS8yCpLhSrTTnEcAVsCw7B+dUl3tMMEsZ6tIj0rBiM2w64UrrDKa+6nT1blC4D
    2MV0GGQs+KG1zib7TRfNlg==
    )
    
    2020-07-28T17:37:30+0000 aCaVkM7nxG [info] storage location exists
    2020-07-28T17:37:49+0000 aCaVkM7nxG [info] end of downloadUpdate()
    2020-07-28T17:37:49+0000 aCaVkM7nxG [info] endStep("4")
    2020-07-28T17:37:49+0000 Y512Amo8CK [info] request to updater
    2020-07-28T17:37:49+0000 Y512Amo8CK [info] currentStep()
    2020-07-28T17:37:49+0000 Y512Amo8CK [info] Step 4 is in state "end".
    2020-07-28T17:37:49+0000 Y512Amo8CK [info] POST request for step "5"
    2020-07-28T17:37:49+0000 Y512Amo8CK [info] startStep("5")
    2020-07-28T17:37:49+0000 Y512Amo8CK [info] verifyIntegrity()
    2020-07-28T17:37:49+0000 Y512Amo8CK [info] getUpdateServerResponse()
    2020-07-28T17:37:49+0000 Y512Amo8CK [info] updaterServer: https://updates.nextcloud.com/updater_server/
    2020-07-28T17:37:49+0000 Y512Amo8CK [info] releaseChannel: stable
    2020-07-28T17:37:49+0000 Y512Amo8CK [info] internal version: 18.0.6.0
    2020-07-28T17:37:49+0000 Y512Amo8CK [info] updateURL: https://updates.nextcloud.com/updater_server/?version=18x0x6x0xxxstablexx2020-06-09T07%3A36%3A10%2B00%3A00+dbb46a72b1cafa15c330515ee2bd0caf8d5151ebx7x3x20
    2020-07-28T17:37:49+0000 Y512Amo8CK [info] getUpdateServerResponse response: Array
    (
        [version] => 18.0.7.1
        [versionstring] => Nextcloud 18.0.7
        [url] => https://download.nextcloud.com/server/releases/nextcloud-18.0.7.zip
        [web] => https://docs.nextcloud.com/server/18/admin_manual/maintenance/upgrade.html
        [changes] => https://updates.nextcloud.com/changelog_server/?version=18.0.7
        [autoupdater] => 1
        [eol] => 0
        [signature] => jqE+H1D6TdPdnU+FTpI+oiRw2yktKp0J4Kjpy1x0BSC0yVjQ/wzaM3cVdYtQfK/n
    3THCUr2tr7ya5z5KN3QxPRnzwQ7y8VPT/OX67Ex6ocad6js0A5n+rGdxsQwfErGL
    AAIcVJZvHkZY/u37doqReli7uiGXefYBl+TMxA7xHcCjMiK/Q3N4TwXuIdqqs4jm
    LDj/nxXiwNcVjEeBgSI86kAsa5LjfC/x/lRK4RYcxrDJ1/zrGrxZIDoM1AeCaTiH
    4UdS8yCpLhSrTTnEcAVsCw7B+dUl3tMMEsZ6tIj0rBiM2w64UrrDKa+6nT1blC4D
    2MV0GGQs+KG1zib7TRfNlg==
    )
    
    2020-07-28T17:37:49+0000 Y512Amo8CK [info] storage location: /usr/share/nginx/nextcloud/data/updater-oc45iog74pfu/downloads/
    2020-07-28T17:37:50+0000 Y512Amo8CK [info] end of verifyIntegrity()
    2020-07-28T17:37:50+0000 Y512Amo8CK [info] endStep("5")
    2020-07-28T17:37:50+0000 L4ZY4Cu8fI [info] request to updater
    2020-07-28T17:37:50+0000 L4ZY4Cu8fI [info] currentStep()
    2020-07-28T17:37:50+0000 L4ZY4Cu8fI [info] Step 5 is in state "end".
    2020-07-28T17:37:50+0000 L4ZY4Cu8fI [info] POST request for step "6"
    2020-07-28T17:37:50+0000 L4ZY4Cu8fI [info] startStep("6")
    2020-07-28T17:37:50+0000 L4ZY4Cu8fI [info] extractDownload()
    2020-07-28T17:37:50+0000 L4ZY4Cu8fI [info] storage location: /usr/share/nginx/nextcloud/data/updater-oc45iog74pfu/downloads/
    2020-07-28T17:37:55+0000 L4ZY4Cu8fI [info] end of extractDownload()
    2020-07-28T17:37:55+0000 L4ZY4Cu8fI [info] endStep("6")
    2020-07-28T17:37:55+0000 9hzRoKVGdR [info] request to updater
    2020-07-28T17:37:55+0000 9hzRoKVGdR [info] currentStep()
    2020-07-28T17:37:55+0000 9hzRoKVGdR [info] Step 6 is in state "end".
    2020-07-28T17:37:55+0000 9hzRoKVGdR [info] POST request for step "7"
    2020-07-28T17:37:55+0000 9hzRoKVGdR [info] startStep("7")
    2020-07-28T17:37:55+0000 9hzRoKVGdR [info] setMaintenanceMode("true")
    2020-07-28T17:37:55+0000 9hzRoKVGdR [info] configFileName /usr/share/nginx/nextcloud/updater/../config/config.php
    2020-07-28T17:37:55+0000 9hzRoKVGdR [info] end of setMaintenanceMode()
    2020-07-28T17:37:55+0000 9hzRoKVGdR [info] endStep("7")
    2020-07-28T17:37:55+0000 xtlTZtIM4s [info] request to updater
    2020-07-28T17:37:55+0000 xtlTZtIM4s [info] currentStep()
    2020-07-28T17:37:55+0000 xtlTZtIM4s [info] Step 7 is in state "end".
    2020-07-28T17:37:55+0000 xtlTZtIM4s [info] POST request for step "8"
    2020-07-28T17:37:55+0000 xtlTZtIM4s [info] startStep("8")
    2020-07-28T17:37:55+0000 xtlTZtIM4s [info] replaceEntryPoints()
    2020-07-28T17:37:55+0000 xtlTZtIM4s [info] replace index.php
    2020-07-28T17:37:55+0000 xtlTZtIM4s [info] replace status.php
    2020-07-28T17:37:55+0000 xtlTZtIM4s [info] replace remote.php
    2020-07-28T17:37:55+0000 xtlTZtIM4s [info] replace public.php
    2020-07-28T17:37:55+0000 xtlTZtIM4s [info] replace ocs/v1.php
    2020-07-28T17:37:55+0000 xtlTZtIM4s [info] replace ocs/v2.php
    2020-07-28T17:37:55+0000 xtlTZtIM4s [info] end of replaceEntryPoints()
    2020-07-28T17:37:55+0000 xtlTZtIM4s [info] endStep("8")
    2020-07-28T17:37:55+0000 xMtbHwofwx [info] request to updater
    2020-07-28T17:37:55+0000 xMtbHwofwx [info] currentStep()
    2020-07-28T17:37:55+0000 xMtbHwofwx [info] Step 8 is in state "end".
    2020-07-28T17:37:55+0000 xMtbHwofwx [info] POST request for step "9"
    2020-07-28T17:37:56+0000 xMtbHwofwx [info] startStep("9")
    2020-07-28T17:37:56+0000 xMtbHwofwx [info] deleteOldFiles()
    2020-07-28T17:37:57+0000 xMtbHwofwx [info] config sample exists
    2020-07-28T17:37:57+0000 xMtbHwofwx [info] themes README exists
    2020-07-28T17:38:00+0000 xMtbHwofwx [error] POST request failed with other exception
    2020-07-28T17:38:00+0000 xMtbHwofwx [error] Exception: Exception
    Message: Could not unlink: /usr/share/nginx/nextcloud/updater/../ocs/v2.php
    Code:0
    Trace:
    #0 /usr/share/nginx/nextcloud/updater/index.php(1354): Updater->deleteOldFiles()
    #1 {main}
    File:/usr/share/nginx/nextcloud/updater/index.php
    Line:976
    
    2020-07-28T17:38:00+0000 xMtbHwofwx [info] rollbackChanges("9")
    2020-07-28T17:38:00+0000 xMtbHwofwx [info] unlink .step
    2020-07-28T17:38:00+0000 xMtbHwofwx [info] rollbackChanges - step >= 7
    2020-07-28T17:38:00+0000 xMtbHwofwx [info] end of  rollbackChanges()
    2020-07-28T17:40:52+0000 3odki7CuBQ [info] request to updater
    2020-07-28T17:40:52+0000 3odki7CuBQ [info] currentStep()
    2020-07-28T17:40:52+0000 3odki7CuBQ [info] POST request for step "9"
    2020-07-28T17:40:52+0000 3odki7CuBQ [info] startStep("9")
    2020-07-28T17:40:52+0000 3odki7CuBQ [info] deleteOldFiles()
    2020-07-28T17:40:55+0000 3odki7CuBQ [error] POST request failed with other exception
    2020-07-28T17:40:55+0000 3odki7CuBQ [error] Exception: Exception
    Message: Could not unlink: /usr/share/nginx/nextcloud/updater/../ocs/v2.php
    Code:0
    Trace:
    #0 /usr/share/nginx/nextcloud/updater/index.php(1354): Updater->deleteOldFiles()
    #1 {main}
    File:/usr/share/nginx/nextcloud/updater/index.php
    Line:976
    
    2020-07-28T17:40:55+0000 3odki7CuBQ [info] rollbackChanges("9")
    2020-07-28T17:40:55+0000 3odki7CuBQ [info] unlink .step
    2020-07-28T17:40:55+0000 3odki7CuBQ [info] rollbackChanges - step >= 7
    2020-07-28T17:40:55+0000 3odki7CuBQ [info] end of  rollbackChanges()

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

PASTE HERE

The output of your Apache/nginx/system log in /var/log/____:

PASTE HERE

Are you hosting it your self or are you using a hosting service?

and could you please provide your nginx system log and nextcloud config?

I am hosting it on my own.

ok, are your file premissons correct?

nextcloud config
‘’’
<?php
$CONFIG = array (
‘config_is_read_only’ => true,
‘instanceid’ => ‘oc45iog74pfu’,
‘passwordsalt’ => ‘xxxxxxxxxx/8zaExWBD0VH88Uf’,
‘secret’ => ‘xxxxxxxxxxxxx/MOu477EXnG/xH+xxxxxxxxxxxxx/’,
‘trusted_domains’ =>
array (
0 => ‘xxxxxxxxxxx’,
),
‘datadirectory’ => ‘/usr/share/nginx/nextcloud/data’,
‘dbtype’ => ‘mysql’,
‘version’ => ‘18.0.6.0’,
‘overwrite.cli.url’ => ‘http://xxxxxxxx’,
‘dbname’ => ‘nextcloud’,
‘dbhost’ => ‘localhost’,
‘dbport’ => ‘’,
‘dbtableprefix’ => ‘oc_’,
‘mysql.utf8mb4’ => true,
‘dbuser’ => ‘xxxxxxxxxx’,
‘dbpassword’ => ‘xxxxxxxxxx.’,
‘installed’ => true,
‘memcache.local’ => ‘\OC\Memcache\APCu’,
‘memcache.distributed’ => ‘\OC\Memcache\Redis’,
‘memcache.locking’ => ‘\OC\Memcache\Redis’,
‘filelocking.enabled’ => true,
‘redis’ =>
array (
‘host’ => ‘/var/run/redis/redis.sock’,
‘port’ => 0,
‘password’ => ‘xxxxxxxxxxxxxxxxxxxxxxxx’,
‘timeout’ => 1.5,
),
‘maintenance’ => true,
‘updater.secret’ => ‘xxxxxxxxxxxxxxxxxxxxxxxxxx’,
‘theme’ => ‘’,
‘loglevel’ => 2,
‘mail_smtpmode’ => ‘smtp’,
‘mail_sendmailmode’ => ‘smtp’,
‘mail_from_address’ => ‘xxx’,
‘mail_domain’ => ‘xxxxxxxxxxx’,
‘mail_smtphost’ => ‘xxxxxxxxxxxx’,
‘mail_smtpport’ => ‘25’,
);
‘’’

File permissions are okay (as far as I could see), user/group is set correctly to nginx:nignix.

are you updating with the web updater or the occ command.

I used the web-based updater. But now I even don’t know how to recover from the update process which is stuck in maintenance mode.

to remove the maintenance mode change

to
‘maintenance’ => false,

try to update with the occ command on CLI

I tried to change the maintenance flag to false, but afterwards by reloading the site the same message is shown ''Update in process."

ok try to update with the occ cli command

https://docs.nextcloud.com/server/18/admin_manual/maintenance/manual_upgrade.html

Manual update with cli command leads to another error message:

sudo -u nginx php occ upgrade
PHP Warning: Module ‘imagick’ already loaded in Unknown on line 0
An unhandled exception has been thrown:
OCP\AppFramework\QueryException: Could not resolve OCA\Settings\AppInfo\Application! Class OCA\Settings\AppInfo\Application does not exist in /usr/share/nginx/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php:106
Stack trace:
#0 /usr/share/nginx/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(115): OC\AppFramework\Utility\SimpleContainer->resolve(‘OCA\Settings\Ap…’)
#1 /usr/share/nginx/nextcloud/lib/private/ServerContainer.php(150): OC\AppFramework\Utility\SimpleContainer->query(‘OCA\Settings\Ap…’, true)
#2 /usr/share/nginx/nextcloud/lib/base.php(735): OC\ServerContainer->query(‘OCA\Settings\Ap…’)
#3 /usr/share/nginx/nextcloud/lib/base.php(1089): OC::init()
#4 /usr/share/nginx/nextcloud/console.php(48): require_once(’/usr/share/ngin…’)
#5 /usr/share/nginx/nextcloud/occ(11): require_once(’/usr/share/ngin…’)
#6 {main}

Have you ever had any issues, not like this, before?

No, not really. I performed an update two times from the web-based updater successfully.

ok, I allows have had trouble with the web updater.

try chainging to
‘config_is_read_only’ => false,

also try running
apt install php7.3-imagick