Nextcloud update fails at Delete old file

Nextcloud version: 25.0.3.2
Operating system and version: Ubuntu-18.04
Apache or nginx version: Apache/2.4.29
PHP version: PHP 8.2.4

The issue you are facing:
When updating Nextcloud the update gets stuck on stage: Delete old file

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

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 => '192.168.1.124',
    1 => '*',
    2 => '*',
  ),
  'datadirectory' => '/mnt/d/data/',
  'dbtype' => 'mysql',
  'version' => '25.0.3.2',
  'overwrite.cli.url' => '*',
  'overwriteprotocol' => 'https',
  'htaccess.RewriteBase' => '/',
  'dbname' => 'nextdb',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'usr',
  'dbpassword' => '*',
  'installed' => true,
  'memcache.local' => '\\OC\\Memcache\\Redis',
  'redis' => 
  array (
    'host' => 'localhost',
    'port' => *,
  ),
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'default_phone_region' => '*',
  'allow_local_remote_servers' => true,
  'check_data_directory_permissions' => false,
  'mail_smtpmode' => 'smtp',
  'mail_smtpauthtype' => 'LOGIN',
  'mail_sendmailmode' => 'smtp',
  'mail_smtpauth' => 1,
  'mail_smtpsecure' => 'ssl',
  'mail_from_address' => 'noreply',
  'mail_domain' => '*',
  'mail_smtphost' => '*',
  'mail_smtpport' => '*',
  'mail_smtpname' => '*',
  'mail_smtppassword' => '*',
  'maintenance' => true,
  'theme' => '',
  'loglevel' => 2,
  'app_install_overwrite' => 
  array (
    0 => 'hancomoffice',
    1 => 'googledocsredirect',
  ),
  'updater.secret' => '*',
);

The update command line error:

[✘] Delete old files failed
core/shipped.json is not available

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

Here are some errors that occur before the error (it spits out more than I pasted here):


PHP Warning:  ZipArchive::extractTo(/mnt/d/data//updater-ocnir00z6m7w/downloads/nextcloud/3rdparty/microsoft/azure-storage-blob/src/Blob/Models/ContainerProperties.php): Operation failed: Operation not permitted in phar:///var/www/html/nextcloud/updater/updater.phar/lib/Updater.php on line 701
PHP Warning:  ZipArchive::extractTo(/mnt/d/data//updater-ocnir00z6m7w/downloads/nextcloud/3rdparty/microsoft/azure-storage-blob/src/Blob/Models/ListBlobBlocksResult.php): Operation failed: Operation not permitted in phar:///var/www/html/nextcloud/updater/updater.phar/lib/Updater.php on line 701
PHP Warning:  ZipArchive::extractTo(/mnt/d/data//updater-ocnir00z6m7w/downloads/nextcloud/3rdparty/microsoft/azure-storage-blob/src/Blob/BlobSharedAccessSignatureHelper.php): Operation failed: Operation not permitted in phar:///var/www/html/nextcloud/updater/updater.phar/lib/Updater.php on line 701
PHP Warning:  ZipArchive::extractTo(/mnt/d/data//updater-ocnir00z6m7w/downloads/nextcloud/3rdparty/microsoft/azure-storage-blob/src/Blob/BlobRestProxy.php): Operation failed: Operation not permitted in phar:///var/www/html/nextcloud/updater/updater.phar/lib/Updater.php on line 701
PHP Warning:  ZipArchive::extractTo(/mnt/d/data//updater-ocnir00z6m7w/downloads/nextcloud/3rdparty/microsoft/azure-storage-blob/BreakingChanges.md): Operation failed: Operation not permitted in phar:///var/www/html/nextcloud/updater/updater.phar/lib/Updater.php on line 701
PHP Warning:  ZipArchive::extractTo(/mnt/d/data//updater-ocnir00z6m7w/downloads/nextcloud/3rdparty/microsoft/azure-storage-blob/CONTRIBUTING.md): Operation failed: Operation not permitted in phar:///var/www/html/nextcloud/updater/updater.phar/lib/Updater.php on line 701
PHP Warning:  ZipArchive::extractTo(/mnt/d/data//updater-ocnir00z6m7w/downloads/nextcloud/3rdparty/microsoft/azure-storage-blob/ChangeLog.md): Operation failed: Operation not permitted in phar:///var/www/html/nextcloud/updater/updater.phar/lib/Updater.php on line 701
PHP Warning:  ZipArchive::extractTo(/mnt/d/data//updater-ocnir00z6m7w/downloads/nextcloud/3rdparty/microsoft/azure-storage-blob/composer.json): Operation failed: Operation not permitted in phar:///var/www/html/nextcloud/updater/updater.phar/lib/Updater.php on line 701
PHP Warning:  ZipArchive::extractTo(/mnt/d/data//updater-ocnir00z6m7w/downloads/nextcloud/3rdparty/microsoft/azure-storage-blob/LICENSE): Operation failed: Operation not permitted in phar:///var/www/html/nextcloud/updater/updater.phar/lib/Updater.php on line 701
PHP Warning:  ZipArchive::extractTo(/mnt/d/data//updater-ocnir00z6m7w/downloads/nextcloud/3rdparty/microsoft/azure-storage-blob/README.md): Operation failed: Operation not permitted in phar:///var/www/html/nextcloud/updater/updater.phar/lib/Updater.php on line 701
PHP Warning:  ZipArchive::extractTo(/mnt/d/data//updater-ocnir00z6m7w/downloads/nextcloud/COPYING): Operation failed: Operation not permitted in phar:///var/www/html/nextcloud/updater/updater.phar/lib/Updater.php on line 701
PHP Warning:  ZipArchive::extractTo(/mnt/d/data//updater-ocnir00z6m7w/downloads/nextcloud/config/CAN_INSTALL): Operation failed: Operation not permitted in phar:///var/www/html/nextcloud/updater/updater.phar/lib/Updater.php on line 701
PHP Warning:  ZipArchive::extractTo(/mnt/d/data//updater-ocnir00z6m7w/downloads/nextcloud/config/config.sample.php): Operation failed: Operation not permitted in phar:///var/www/html/nextcloud/updater/updater.phar/lib/Updater.php on line 701

What should I do? I have my data folder in a different drive, I tried to temporarily moving the data folder inside Nextcloud where it is located by default but it resulted in the same error.

The server must have write permissions in the data directory, since the temporary files for the update procedure are written in there.

what happened to that file? Strange that it is missing. That file does not disappear from itself.

These errors indicate that the server does not have full write permissions in the data directory. Does the directory belong to the web server user?

I am not very pro at Ubuntu, could you suggest any commands I should run in order to get this issue fixed and permissions corrected?

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

Assuming of course that /mnt/d/data is on a POSIX file system.
With NTFS and FAT file systems you have to proceed differently.

Not exactly the same issue. But, I was trying to delete files from my nextcloud instance and recently realised that the files were in the trash folder. I’ve deleted them finally with the GUI of the hosting instance.

However, how can I purge my instance from their server or obsolutely purge my data from my instance? What would you recomend. Once this is done, I’ll set up a new instance. Thanks,

That is really off topic.

Yes, I have already tried that command, it does not help, my file system is NTFS, how do I need to approach that?

That was exactly my suspicion.

So now I need to know, how your drive is mounted. By /etc/fstab?

If so, you could as a first step change the mount options, to make your webserver user the owner of the drive

$DEVICE  /mnt/d/data   ntfs-3g defaults,uid=33,gid=33,permissions  0  0

but there are other posibilities as well, using a POSIX-Overlay filesystem, that makes the ntfs drive behave like a nativ POSIX filesystem but it writes a lot of extra files on the drive, that you would see only if you connect the drive without posixovl or on a windows machine:

sudo apt-get install fuse-posixovl

with

mount.posixovl /mnt/d/data

you then have got a posix directory. You can now chown and chmod inside that directory as if it was a native POSIX directory.
/mnt/d/data must not be the mountpoint of the underlying ntfs drive, it can (or should) be a folder inside of the drive.

but be carefull, you can mount.posixovl multiple times. With

mount | grep posixovl

you can control, if you did so, then you can unmount /mnt/d/data to remove the excess mounts.

You must mount it after every reboot, the best way to do so is to create a systemd service unit for that.

I will try some possible ways to do so and post them here after I tested them thoroughly.

I am pretty sure it is mounted by /etc/fstab

When I added the line
$DEVICE /mnt/d/data ntfs-3g defaults,uid=33,gid=33,permissions 0 0

Now when I started it said:

An error occurred mounting one of your file systems. Please run ‘dmesg’ for more details.

You should of course replace “$DEVICE” with the right device path, name, UUID or LABEL.

Please post the echo from

blkid

and

mount | grep /mnt

then I can say you how.

I ran the commands, when I ran the blkid command it outputted nothing, and after mount | grep /mnt the output was:

C:\ on /mnt/c type drvfs (rw,noatime,uid=1000,gid=1000,case=off)
D:\ on /mnt/d type drvfs (rw,noatime,uid=1000,gid=1000,case=off)

Why didn’t you tell that you are on WSL?

My advice: set up a decent Linux server and get rid of such crappy hybrid OS. That is nice for playing around a bit but not for a server.
(My personal opinion)

I’m sorry,

so there is no way to have it working on wsl?

There is, but you need skills. I am tired with it.

Follow my advice with posixovl and get it up and running.

That removed the PHP Warnings and now it just yields

[✘] Delete old files failed
core/shipped.json is not available

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

I just downloaded a copy of the files from here Index of /server/releases and copied the shipped.json and the signature.json and put it into the /core folder and the update seemed to have worked fine

1 Like

hello… sorry for my bad english and my intrusion.
i have the same problem on the hosted domain…
i can help to update the process by manually deleting the old files and directories, but i don’t know where to find the list of flies to delete.
Is there a list of files and folders (old files) to delete?
It is not a file permissions problem because nextcloud is regularly working. I am updating from 29.0.2.2 to 29.0.4.
NB also for version 29.0.3 there was the same problem. Thanks.