Unable to update to 21.0.1 "Create Backup" error

Hi all

Cannot upgrade through browser updater, keeps stopping at “Create Backup”

Current working setup:
Nginx 1.18
Data folder located @ /mnt/nextcloud/

Changed permissions chown -R www-data:www-data /mnt/nextcloud/

Trying to upgrade to 21.0.1.

EDIT: I just tried “sudo -u www-data php occ upgrade” and it says that “Nextcloud is already latest version”? Now I am baffled

you may try this command from a terminal on your NC Server

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

after upgrade has finished, you can complete with

sudo -u www-data php /location-of-your-nextcloud/occ upgrade

don’t forget to update columns and indices of your database.

Hi I am getting errors:

root@webserv:/var/www/nextcloud# sudo -u www-data php updater/updater.phar
Nextcloud Updater - version: v20.0.0beta4-11-g68fa0d4

Current version is 21.0.0.

Update to Nextcloud 21.0.1 available. (channel: "stable")
Following file will be downloaded automatically: https://download.nextcloud.com/server/releases/nextcloud-21.0.1.zip
Open changelog ↗

Steps that will be executed:
[ ] Check for expected files
[ ] Check for write permissions
[ ] Create backup
[ ] Downloading
[ ] Verify integrity
[ ] Extracting
[ ] Enable maintenance mode
[ ] Replace entry points
[ ] Delete old files
[ ] Move new files in place
[ ] Done

Start update? [y/N] y

Info: Pressing Ctrl-C will finish the currently running step and then stops the updater.

[✔] Check for expected files
[✔] Check for write permissions
[ ] Create backup ...PHP Warning:  copy(/var/www/nextcloud/config/config.php.bak): Failed to open stream: Permission denied in phar:///var/www/nextcloud/updater/updater.phar/lib/Updater.php on line 395
[✘] Create backup failed
Could not copy "/var/www/nextcloud/config/config.php.bak" to "/mnt/nextcloud/updater-ocgy2wtg640w/backups/nextcloud-". Source /var/www/nextcloud/config/config.php.bak is not readable. Destination /mnt/nextcloud/updater-ocgy2wtg640w/backups/nextcloud- is not writable

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

How do I get around this?
Thank you for your help

Failed to open stream: Permission denied in

So, before you start your update, have you checked your directory permissions of nextcloud folders?
For the updater to work i ususally set my folders beneath /var/www/nextcloud
chown -R www-data:www-data so that the updater is owner of the files that have to be overwritten.

Maybe your data folder also should be in ownership of your www user → check were you have placed your data folder in config.php.

The backups will be placed in a subfolder of your data folder, so it looks like your data folder is not writable by your www user in the moment when the updater starts the backup.

→ /mnt/nextcloud/…

check sudo su - and after that ls -la /mnt/nextcloud/... if all folders are owned by www user (www-data)

if there is one folder not in ownership of www-data:www-data then retry

sudo chown -R www-data:www-data /mnt/nextcloud

That will set recursive (incl. subfolders) every folder and file in ownership to www-data

after that retry the updater …

1 Like

Great News Thank you, that worked…

and don’t forget to re-secure your installation!


mine problem was in file config.php.back owned by root so updater was unable to make backup of config file, after taken ownership of this file to www-data it update worked.


Perfect, thansk you

worked for me !