Unable to update automatically

Hello there,

I would like some help please, I have been trying to get Nextcloud to work for the past 4-5 months but I cannot figure out what is happening with the updater.

I’d like to use the updater so I can update Nextcloud automatically.

I have been trying to get help on Reddit, however I haven’t had any luck.

This is the issue I keep getting when running the updater.phar file:

[ ] Delete old files ...PHP Warning:  rmdir(/var/www/html/updater/../ocs): Permission denied in phar:///var/www/html/updater/updater.phar/lib/Updater.php on line 871
[✘] Delete old files failed
Could not rmdir: /var/www/html/updater/../ocs

Update failed. To resume or retry just execute the updater again.

I have everything in /var/www/html owned by www-data.

drwxr-xr-x 41 www-data www-data 4.0K Aug 26 18:52 3rdparty
drwxr-xr-x  5 www-data www-data 4.0K Sep 20 05:02 apps
-rw-r--r--  1 www-data www-data  17K Aug 26 18:50 AUTHORS
drwxr-xr-x  2 www-data www-data 4.0K Sep 20 05:02 config
-rw-r--r--  1 www-data www-data 3.9K Aug 26 18:50 console.php
-rw-r--r--  1 www-data www-data  34K Aug 26 18:50 COPYING
drwxr-xr-x 23 www-data www-data 4.0K Aug 26 18:52 core
-rwxr-xr-x  1 www-data www-data 5.1K Aug 26 18:50 cron.php
-rw-r--r--  1 www-data www-data 3.1K Sep 20 01:38 .htaccess
-rw-r--r--  1 www-data www-data  156 Aug 26 18:50 index.html
-rw-r--r--  1 www-data www-data   57 Sep 20 05:13 index.php
drwxr-xr-x  6 www-data www-data 4.0K Aug 26 18:50 lib
-rw-r--r--  1 www-data www-data  283 Aug 26 18:50 occ
drwxr-xr-x  2 www-data www-data 4.0K Aug 26 18:50 ocm-provider
drwxr-xr-x  2 www-data www-data 4.0K Sep 20 05:13 ocs
drwxr-xr-x  2 www-data www-data 4.0K Aug 26 18:50 ocs-provider
-rw-r--r--  1 www-data www-data   57 Sep 20 05:13 public.php
-rw-r--r--  1 www-data www-data   57 Sep 20 05:13 remote.php
drwxr-xr-x  4 www-data www-data 4.0K Aug 26 18:50 resources
-rw-r--r--  1 www-data www-data   26 Aug 26 18:50 robots.txt
-rw-r--r--  1 www-data www-data   57 Sep 20 05:13 status.php
drwxr-xr-x  2 www-data www-data 4.0K Sep 20 05:02 themes
drwxr-xr-x  2 www-data www-data 4.0K Aug 26 18:51 updater
-rw-r--r--  1 www-data www-data  101 Aug 26 18:50 .user.ini
-rw-r--r--  1 www-data www-data  362 Aug 26 18:52 version.php

Also I have checked the folder updater and it also has the correct permissions.

However, the files it’s trying to delete “/var/www/html/updater/…/ocs”… there’s nothing but 2 files within /var/www/html/updater … the index.php and the updater.phar file… so I am not sure what it’s trying to do here…

total 660K
drwxr-xr-x  2 www-data www-data 4.0K Aug 26 18:51 .
drwxr-xr-x 13 root     root     4.0K Sep 20 01:31 ..
-rw-r--r--  1 www-data www-data  63K Aug 26 18:51 index.php
-rwxrwx---  1 www-data www-data 587K Aug 26 18:51 updater.phar

My data folder is outside of the default directory and that also is owned by www-data.

I have reviewed all the documention and I have documented all the commands I use to setup the server, you can see my SOP here: SOP - Nextcloud installation

Is there something I’m doing wrong with my installation?

I am using Debian 10.5.

I use Apache:

Server version: Apache/2.4.38 (Debian)

I use PHP:

PHP 7.3.19-1~deb10u1 (cli) (built: Jul 5 2020 06:46:45) ( NTS )

I use MariaDB:

10.3.23-MariaDB-0+deb10u1 Debian 10

I am not sure what else I can do, does anyone have any ideas what I am doing wrong?

1 Like

Can you check the permissions of files within this folder:

ls -lisa /var/www/html/updater/../ocs

Also make sure to run the update process with the webserver permissions:
sudo -u www-data php updater/updater.phar

Similar topics:

and in the bug tracker:
https://github.com/nextcloud/updater/issues/158

Have you start the updater with the user www-data:

sudo -u www-data php updater/updater.phar

Hi there,

I have done the following command: sudo -u www-data php updater/updater.phar

… and I got the same error

I changed the permissions: sudo chown www-data:www-data /var/www/html/updater/…/ocs

Then tried again, but still getting the same error:

[ ] Delete old files …PHP Warning: rmdir(/var/www/html/updater/…/ocs): Permission denied in phar:///var/www/html/updater/updater.phar/lib/Updater.php on line 871
[✘] Delete old files failed
Could not rmdir: /var/www/html/updater/…/ocs

Update failed. To resume or retry just execute the updater again.

So I looked at the permissions on /var/www/html, it was owned by Root, so I changed the owner and group to www-data.

Re-ran the update script again and now it WORKS!! omg thank you so much! :slight_smile: thank you both @devnull and @tflidd for helping me! you cannot imagine how long i’ve been trying to figure this out haha… this is going on my SOP now… :smiley:

1 Like

@chrisappleyard

You my saver!
Thanks alot!

I had the exact same issues after a webupdate the updater got stuck…

  • after finding a second php.ini in the php8/fpm folder I could higher the memory limit.
  • after fixing that I got a lot of permission issues that I could fix thanks to this thread.
  • the update succeeded

but I’m still seeing this message: “Update in process.”

this is the updater output: (I see no errors and disabled maintenance mode)

Update of code successful.

Should the "occ upgrade" command be executed? [Y/n] y
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: Repair SQLite autoincrement
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
Repair step: Repair MySQL collation
Repair info: All tables already have the correct collation -> nothing to do
Repair step: Repair mime types
Repair step: Clean tags and favorites
Repair info: 0 tags of deleted users have been removed.
Repair info: 0 tags for delete files have been removed.
Repair info: 0 tag entries for deleted tags have been removed.
Repair info: 0 tags with no entries have been removed.
Repair step: Repair invalid shares
Repair step: Move .step file of updater to backup location
Repair info: .step file exists
Repair info: .step file moved to .step-previous-update
Repair step: Add move avatar background job
Repair info: Repair step already executed
Repair step: Add preview cleanup background jobs
Repair step: Migrate oauth2_clients table to nextcloud schema
Repair info: Update the oauth2_access_tokens table schema.
Repair info: Update the oauth2_clients table schema.
Repair step: Fix potential broken mount points
Repair info: No mounts updated
Repair step: Repair language codes
Repair step: Add log rotate job
Repair step: Clear frontend caches
Repair info: Image cache cleared
Repair info: JS cache cleared
Repair step: Clear every generated avatar on major updates
Repair step: Add preview background cleanup job
Repair step: Queue a one-time job to cleanup old backups of the updater
Repair step: Cleanup invalid photocache files for carddav
Repair step: Add background job to cleanup login flow v2 tokens
Repair step: Remove potentially over exposing share links
Repair info: No need to remove link shares.
Repair step: Clear access cache of projects
Repair step: Reset generated avatar flag
Repair step: Keep legacy encryption enabled
Repair step: Check encryption key format
Repair step: Remove old dashboard app config data
Repair step: Add job to cleanup the bruteforce entries
Repair step: Queue a one-time job to check for user uploaded certificates
Repair step: Repair DAV shares
Repair step: Add background job to set the lookup server share state for users
Repair step: Add token cleanup job
Repair step: Clean up abandoned apps
Repair step: Add possibly missing system config
Starting code integrity check...
Finished code integrity check
Update successful
Maintenance mode is kept active
Resetting log level

Keep maintenance mode active? [y/N] n
Maintenance mode disabled

Why I am still seeing this message on the web?
“Update in process.”