Cannot delete file from external local drive. Permissions error

Nextcloud version: Nextcloud AIO V7.0.0 (Nextcloud 27.0.2)
Operating system and version: Ubuntu 22.04.2
Docker version: 24.0.5

The issue you are facing:

I cannot delete files from my external local storage.
When I try I get the following error in the log

[PHP] Error: unlink(/mnt/storage/pool/Photos/2023/08/PXL_20230827_224307658.jpg): Permission denied at /var/www/html/lib/private/Files/Storage/Local.php#322

DELETE /remote.php/dav/files/v/POOL/Photos/2023/08/PXL_20230827_224307658.jpg
from 192.168.20.108 by v at 2023-08-27T23:21:55+00:00

Steps to replicate it:

  1. Navigate to the file through nextcloud web interface
  2. Select delete

Things I have tried:

  1. Change permissions for the files on the external drive to 777 or 775
  2. Login to the nextcloud container (docker exec -it nextcloud-aio-nextcloud bash) and change the permissions to the file to 777 (or 775) from within the container also
  3. Run file rescan (files:scan --path=“/v/files/POOL/Photos/2023/08”)

You say external, but you just mean it’s a physically an external drive, correct? You’re not talking about Local via Nextcloud’s External Storage mode, correct?

https://docs.nextcloud.com/server/latest/admin_manual/configuration_files/external_storage_configuration_gui.html

Can you post your Docker Compose?

This is using the external storage module with local storage. Here is the docker compose:

version: "3.8"

volumes:
  nextcloud_aio_mastercontainer:
    name: nextcloud_aio_mastercontainer

services:
  nextcloud:
    image: nextcloud/all-in-one:latest
    restart: unless-stopped
    container_name: nextcloud-aio-mastercontainer
    volumes:
      - nextcloud_aio_mastercontainer:/mnt/docker-aio-config
      - /var/run/docker.sock:/var/run/docker.sock:ro
    ports:
      - 8080:8080
    environment:
      - APACHE_PORT=11000
      - NEXTCLOUD_DATADIR=/mnt/ncdata
      - APACHE_IP_BINDING=0.0.0.0 
      - NEXTCLOUD_DATADIR=/mnt/scratch/ncdata
      - NEXTCLOUD_MOUNT=/mnt/storage/pool/
      - NEXTCLOUD_ENABLE_DRI_DEVICE=true
      - NEXTCLOUD_ADDITIONAL_PHP_EXTENSIONS=imagick 
      - NEXTCLOUD_ADDITIONAL_APKS=libva-utils libva-vdpau-driver libva-intel-driver intel-media-driver mesa-va-gallium # List of packages from https://memories.gallery/hw-transcoding/#va-api

This is using nextclouds external storage module with local storage.