Command line upgrade from Nextcloud 26 to 27 cannot create .step file permission denied PHP error

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, 20.0.5): 26.0.2
Operating system and version (eg, Ubuntu 20.04): Ubuntu 22.04.2 LTS x86_64
Apache or nginx version (eg, Apache 2.4.25): Apache/2.4.52 (Ubuntu)
PHP version (eg, 7.4): PHP 8.1.2-1ubuntu2.11 (cli) (built: Feb 22 2023 22:56:18) (NTS)

The issue you are facing:
I am trying to upgrade my nextcloud installation from version 26 to 27 via the command line but get the following output on the first line after executing this command:
sudo -u www-data php /var/www/html/nextcloud/updater/updater.phar

Nextcloud Updater - version: v26.0.0beta2-9-g64e2e4c dirty
Current version is 26.0.2.

When I select y in order to start the update I get the following error:

Check for expected files …PHP Warning: touch(): Unable to create file /mnt/nc-data/updater-oc6tun5nmw51/.step because Permission denied in phar:///var/www/html/nextcloud/updater/updater.phar/lib/Updater.php on line 1019
[✘] Check for expected files failed
Could not create .step

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

I cannot see how to resolve this problem as it has always upgraded flawlessly in the past.

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

Steps to replicate it:

  1. Run the updater from the command line
  2. Select ‘Y’ to start the upgrade
  3. Receive the warning of failer above

The output of your Nextcloud log in Admin > Logging:

No logs generated specific to running the update command

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

<?php
$CONFIG = array (
  'instanceid' => '*********',
  'passwordsalt' => '*********',
  'secret' => '**************',
  'trusted_domains' =>
  array (
    0 => 'localhost',
    1 => '*********.co.uk',
    2 => '***.***.***.5',
    3 => '2a02:8010:****:****:****',
  ),
  'datadirectory' => '/mnt/nc-data',
  'dbtype' => 'pgsql',
  'version' => '26.0.2.1',
  'overwrite.cli.url' => 'https://*******.co.uk',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost:5432',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'dbuser' => '*****',
  'dbpassword' => '**********',
  'installed' => true,
  'maintenance' => false,
  'integrity.check.disabled' => false,
  'htaccess.RewriteBase' => '/',
  'activity_expire_days' => 14,
  'knowledgebaseenabled' => false,
  'logfile' => '/var/log/nextcloud/nextcloud.log',
  'loglevel' => '2',
  'logtimezone' => 'Europe/London',
  'log_rotate_size' => '104857600',
  'redis' =>
  array (
    'host' => '/var/run/redis/redis-server.sock',
    'port' => 0,
    'timeout' => 0.5,
    'dbindex' => 1,
  ),
  'default_phone_region' => 'GB',
  'mail_smtpmode' => 'sendmail',
  'mail_sendmailmode' => 'smtp',
  'mail_from_address' => '*****',
  'mail_domain' => '******.co.uk',
  'allow_local_remote_servers' => true,
  'auth.bruteforce.protection.enabled' => true,
  'blacklisted_files' =>
  array (
    0 => '.htaccess',
    1 => 'Thumbs.db',
    2 => 'thumbs.db',
  ),
  'cron_log' => true,
  'defaultapp' => 'files,dashboard',
  'enable_previews' => true,
  'enabledPreviewProviders' =>
  array (
    0 => 'OC\\Preview\\PNG',
    1 => 'OC\\Preview\\JPEG',
    2 => 'OC\\Preview\\GIF',
    3 => 'OC\\Preview\\BMP',
    4 => 'OC\\Preview\\XBitmap',
    5 => 'OC\\Preview\\Movie',
    6 => 'OC\\Preview\\PDF',
    7 => 'OC\\Preview\\MP3',
    8 => 'OC\\Preview\\TXT',
    9 => 'OC\\Preview\\MarkDown',
  ),
  'filesystem_check_changes' => 0,
  'filelocking.enabled' => 'true',
  'maintenance_window_start' => 1,
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'overwriteprotocol' => 'https',
  'preview_max_x' => 1024,
  'preview_max_y' => 768,
  'preview_max_scale_factor' => 1,
  'profile.enabled' => false,
  'quota_include_external_storage' => false,
  'skeletondirectory' => '',
  'trashbin_retention_obligation' => 'auto, 7',
  'updater.release.channel' => 'stable',
);

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

Nothing relevant in error.log

Nothing relevant in access.log


Output errors in nextcloud.log in /var/www/ or as admin user in top right menu, filtering for errors. Use a pastebin service if necessary.

Having cleared the nextcloud log file and run the update command, the file shows nothing.

I’d have expected the permissions error to pop up just before where you’re seeing it… When the updater-oc6tun5nmw51 (in your case) folder gets created rather than the .step file within it.

I suspect you already have the directory and that it’s owned by the wrong user. Maybe from an old install or a prior run of the updater as root or something…

What are the ownership / permissions on /mnt/nc-data/? (An ls -ld /mnt/nc-data should be sufficient).

Also does the folder /mnt/nc-data/updater-oc6tun5nmw51/ already exist by chance? If so, what are it’s permissions?

Hello jtr

Thank you for taking the time to give some feedback to my query, I really appreciate it.
Here is the output from your requested command:

ls -ld /mnt/nc-data
drwxrwx--- 2 www-data www-data 0 Jun 14 07:00 /mnt/nc-data

and here are the permissions for the directory structure of the data directory more fully:

ls /mnt/nc-data
total 204K
drwxrwx--- 2 www-data www-data    0 Jun 14 07:00 .
drwxr-xr-x 3 root     root     4.0K May 25  2022 ..
drwxrwx--- 2 www-data www-data    0 Jun 14 06:09 appdata_oc6tun5nmw51
drwxrwx--- 2 www-data www-data    0 Jun 14 06:09 xxxxxxxx - username
drwxrwx--- 2 www-data www-data    0 Jun 14 06:40 xxxxxxxx - username
drwxrwx--- 2 www-data www-data    0 Jun 14 06:51 files_external
-rw-rw---- 1 www-data www-data  542 May 26 08:14 .htaccess
-rw-rw---- 1 www-data www-data    0 May 26 08:14 index.html
-rw-rw---- 1 www-data www-data    0 May 26 08:14 .ocdata
dr-xr-x--- 2 www-data www-data    0 Jun 14 06:04 @Recently-Snapshot
-rw-rw---- 1 www-data www-data 191K Jun 22 08:18 updater.log
drwxrwx--- 2 www-data www-data    0 Jun 14 06:51 updater-oc6tun5nmw51

The directory permissions look good to me as the installation is able to access the data directory to read and write the file syncronisation as expected albeit as version 26.0.2.

The good news is that after your suspicions about the integrity of the updater-oc6tun5nmw51 directory, I was prompted to initially rename the updater-oc6tun5nmw51 directory to updater-oc6tun5nmw51-old and ran the update again. This resulted in a successful update execution process. The data directory now has a newly created directory of updater-oc6tun5nmw51 and after ensuring all was working correctly, I have removed the updater-oc6tun5nmw51-old directory and its contents from the system.

Thanks again for responding and pointing me in the right direction.

1 Like