When trying to update your Nextcloud VM using the updater in the GUI the following error might be shown:
-
Check for write permissions
The following places can not be written to:- /var/www/nextcloud/updater/../cron.php
- /var/www/nextcloud/updater/../version.php
- /var/www/nextcloud/updater/../console.php
- /var/www/nextcloud/updater/../public.php
- /var/www/nextcloud/updater/../robots.txt
- /var/www/nextcloud/updater/../status.php
- /var/www/nextcloud/updater/../.htaccess
- /var/www/nextcloud/updater/../COPYING
- /var/www/nextcloud/updater/../occ
- /var/www/nextcloud/updater/../remote.php
- /var/www/nextcloud/updater/../index.php
- /var/www/nextcloud/updater/../index.html
- /var/www/nextcloud/updater/../AUTHORS
- /var/www/nextcloud/updater/../.user.ini
That might be due to the usage of the "set strong permissions" script, which sets permissions to root:www-data instead of www-data:www-data. You can check that using:
root@lin:~#
root@lin:~# ll /var/www/nextcloud/
total 172
drwxr-x--- 14 root www-data 4096 Sep 21 14:07 ./
drwxr-xr-x 4 root root 4096 Sep 21 14:07 ../
drwxr-x--- 41 root www-data 4096 Sep 9 13:44 3rdparty/
drwxr-x--- 46 www-data www-data 4096 Sep 21 14:07 apps/
-rw-r----- 1 root www-data 16522 Sep 9 13:41 AUTHORS
drwxr-x--- 2 www-data www-data 4096 Sep 21 14:07 config/
-rw-r----- 1 root www-data 3967 Sep 9 13:41 console.php
-rw-r----- 1 root www-data 34520 Sep 9 13:41 COPYING
drwxr-x--- 23 root www-data 4096 Sep 9 13:44 core/
-rw-r----- 1 root www-data 5140 Sep 9 13:41 cron.php
drwxr-x--- 2 root www-data 4096 Sep 21 14:07 data/
-rw-r--r-- 1 root www-data 4400 Sep 21 14:08 .htaccess
-rw-r----- 1 root www-data 156 Sep 9 13:41 index.html
-rw-r----- 1 root www-data 2960 Sep 9 13:41 index.php
drwxr-x--- 6 root www-data 4096 Sep 9 13:41 lib/
-rwxr-x--x 1 root www-data 283 Sep 9 13:41 occ*
drwxr-x--- 2 root www-data 4096 Sep 9 13:41 ocm-provider/
drwxr-x--- 2 root www-data 4096 Sep 9 13:41 ocs/
drwxr-x--- 2 root www-data 4096 Sep 9 13:41 ocs-provider/
-rw-r----- 1 root www-data 3102 Sep 9 13:41 public.php
-rw-r----- 1 root www-data 5332 Sep 9 13:41 remote.php
drwxr-x--- 4 root www-data 4096 Sep 9 13:41 resources/
-rw-r----- 1 root www-data 26 Sep 9 13:41 robots.txt
-rw-r----- 1 root www-data 2379 Sep 9 13:41 status.php
drwxr-x--- 3 www-data www-data 4096 Sep 9 13:41 themes/
drwxr-x--- 2 www-data www-data 4096 Sep 9 13:42 updater/
-rw-r----- 1 root www-data 101 Sep 9 13:41 .user.ini
-rw-r----- 1 root www-data 362 Sep 9 13:44 version.php
root@lin:~#
root@lin:~#
Cause and solution
That is why the GUI updater of nextcloud is blocked because the permissions isn’t as safe as with root:www-data. In the Nextcloud VM this is solved that using an own script for it: https://github.com/nextcloud/vm/blob/master/nextcloud_update.sh.
đŸ‘‰Instead of using that script, run sudo bash /var/scripts/update.sh instead.