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:

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:

@chrisappleyard

You my saver!
Thanks alot!