Unable to download any files on the cloud : 404 error

Hello,

One of my installation of Nextcloud (latest version) on my dedicated server (who’s managed by cpanel and softaculous in order to install multiple nextcloud installation, so this is finally a shared server) is broken. I mean one of the nextcloud user is unable to delete folders but he is able to delete files. Other users in the same nextcloud can do everything without any issue. You can see the other topic that I’ve closed about this issue : A user can’t delete folders

I’ve found a solution to fix the deleting issue, by doing a TRUNCABLE table on oc_filecache table in the nextcloud’s database.

But, after that, now the user is unable to download any file on the nextcloud: 404 error.

Perhaps this is because the files are encrypted, so when I flush the oc_filecache table, the cache is recreated without encryption, so the files can’t be read by the browser ?
Perhaps I’m wrong, but when I do a php occ files:scan username, I can see that encrypted folders are scanned in the user folders.

Any idea on this issue please ?

Note: I have ssh access and I’m root admin of the server

Thank you so much for your help,

Bruno

  1. Encryption only makes sense on external storage.
  2. Encryption module uses database information to sign the encrypted files. If you flush the filecache table this doesn’t work any more
  3. If you manage to run Nextcloud properly on cPanel/softaculous, write a howto for other users. There are constantly users coming but without detailed knowledge about the cPanel-system it is difficult to help.

Not sure if you can run virtual machines without cPanel, so you could install Nextcloud on a plain Linux system. These admin-panels do a lot of work for you but if you need a special configuration like for Nextcloud you should know how to work around this. I would try to search a bit on the forum in combination with cPanel…

Hello and thanks a lot for your reply tflidd

I’ve decrypted all the files (I’ve unchecked the checkbox in the encryption admin menu in the concerned Nextcloud).
I’ve deleted again the content of the oc_filecache table, then the cache has been recreated automatically.
I’ve ran the php occ files:scan username and this command has created double in the oc_filecache.

I’ve restored the backup and tried again the decrypt the files and flush the oc_filecache table, without running the occ files:scan command. The result is that I’m still unable to download a lot of files. Some files can be downloaded but not all… I don’t understand why. Perhaps the decryption has failed.
If I try to download the files from the FTP directly, the files is corrupted.

Finally, I’ve done a restore again and now the user will stay with the original issue: he is able to delete files but he can’t delete folders.
If you have a solution for this issue we can forgot this topic. This encryption issue has been created by my solution for trying to fix the deletion issue. :slight_smile:

Regarding cPanel and Softaculous, it is hard to know how Nextcloud is managed by those softwares.

I would like to know where to check and modify the folders permissions for a nextcloud username. If this deletion issue is caused by a permission issue, of course, and not caused by an oc_filecache data table issue.

I would like to add that nothing appears in the logs when I have this error “Cannot delete the files “folder_name””.
The only thing in the error log and not related to the timestamp of the error is :slight_smile:[01-Feb-2017 17:24:53 UTC] PHP Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 11 bytes) in /home/yyyy/public_html/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php on line 104

Finally, this memory size error is related to the error “cannot delete the file xxxxx” when I try to delete a folder from the webUI with this user.

I can delete files with this user, but not folders. Very strange!

I can delete folders with the others users on the same cloud (but not for the same files, of course).

I’ve increased the memory_limit to 4096M without any success. I have 16GB ram of this server.
I’ve tried memory_limit = -1 without any success, same error.
I’m stuck. :frowning:

EDIT:
This error in the PDOstatement.php file on line 104 is related to this code :

        if ($fetchMode === null && $cursorOrientation === null && $cursorOffset === null) {
            return parent::fetch();
        } 

If the variable are null, I guess this means that the folder has no name, no properties, no location, etc…
However the folders exists on the filesystem. And in the oc_filecache too.

I’ve ran the strong permissions script.
I still have the memory size error in the log and still cannot delete any folers.

Then
I’ve added :

set_time_limit(6000);
ini_set(“memory_limit”, -1);

in the PDOStatement.php file concerned by the error.

I don’t have this error anymore, but I still cannot delete any folders…

Could be related to this bug report:

I’ve already tried this fix but didn’t worked.
However, this time I ran a fsck of my /dev/sda and that fixed a lot of errors.
Next, still unable to delete folders but in the error log we can the now that the folder is locked.
I’ve put the maintenance mode and flushed the oc_filelock table

The issue is now… FIXED ! :slight_smile:

Thanks a lot !!! very nice to spend your time to help me. I appreciate really.
Cheers