nextcloud / previewgenerator

Nextcloud app to do preview generation in the background.
https://apps.nextcloud.com/apps/previewgenerator
GNU Affero General Public License v3.0
450 stars 56 forks source link

OCP\AutoloadNotAllowedException: Autoload path not allowed: globalstoragesservice.php in autoloader.php #333

Closed BerentM closed 1 year ago

BerentM commented 1 year ago

Hello, i run Nextcloud inside official docker container

After adding Preview Generator app via Nextcloud interface i tried to run: docker exec nextcloud ./occ preview:generate-all -vvv It ends with an error that I have not been able to find online. I am looking for some guidance on this.

An unhandled exception has been thrown:
OCP\AutoloadNotAllowedException: Autoload path not allowed: /var/www/html/apps/files_external/lib/service/globalstoragesservice.php in /var/www/html/lib/autoloader.php:141
Stack trace:
#0 /var/www/html/lib/autoloader.php(166): OC\Autoloader->isValidPath('/var/www/html/a...')
#1 [internal function]: OC\Autoloader->load('OCA\\Files_Exter...')
#2 /var/www/html/lib/private/AppFramework/Utility/SimpleContainer.php(114): ReflectionClass->__construct('OCA\\Files_Exter...')
#3 /var/www/html/lib/private/AppFramework/Utility/SimpleContainer.php(133): OC\AppFramework\Utility\SimpleContainer->resolve('OCA\\Files_Exter...')
#4 /var/www/html/lib/private/ServerContainer.php(161): OC\AppFramework\Utility\SimpleContainer->query('OCA\\Files_Exter...', true)
#5 /var/www/html/lib/private/AppFramework/DependencyInjection/DIContainer.php(440): OC\ServerContainer->query('OCA\\Files_Exter...', true)
#6 /var/www/html/lib/private/AppFramework/Utility/SimpleContainer.php(57): OC\AppFramework\DependencyInjection\DIContainer->query('OCA\\Files_Exter...')
#7 /var/www/html/custom_apps/previewgenerator/lib/Command/Generate.php(79): OC\AppFramework\Utility\SimpleContainer->get('OCA\\Files_Exter...')
#8 [internal function]: OCA\PreviewGenerator\Command\Generate->__construct(Object(OC\Files\Node\LazyRoot), Object(OC\User\Manager), Object(OC\PreviewManager), Object(OC\AllConfig), Object(OC\Encryption\Manager), Object(OC\AppFramework\DependencyInjection\DIContainer))
#9 /var/www/html/lib/private/AppFramework/Utility/SimpleContainer.php(108): ReflectionClass->newInstanceArgs(Array)
#10 /var/www/html/lib/private/AppFramework/Utility/SimpleContainer.php(116): OC\AppFramework\Utility\SimpleContainer->buildClass(Object(ReflectionClass))
#11 /var/www/html/lib/private/AppFramework/Utility/SimpleContainer.php(133): OC\AppFramework\Utility\SimpleContainer->resolve('OCA\\PreviewGene...')
#12 /var/www/html/lib/private/AppFramework/DependencyInjection/DIContainer.php(465): OC\AppFramework\Utility\SimpleContainer->query('OCA\\PreviewGene...')
#13 /var/www/html/lib/private/ServerContainer.php(145): OC\AppFramework\DependencyInjection\DIContainer->queryNoFallback('OCA\\PreviewGene...')
#14 /var/www/html/lib/private/Console/Application.php(219): OC\ServerContainer->query('OCA\\PreviewGene...')
#15 /var/www/html/lib/private/Console/Application.php(130): OC\Console\Application->loadCommandsFromInfoXml(Array)
#16 /var/www/html/console.php(99): OC\Console\Application->loadCommands(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#17 /var/www/html/occ(11): require_once('/var/www/html/c...')
#18 {main}
st3iny commented 1 year ago

What version of Nextcloud are you running? Are you making use of the files_external app?

BerentM commented 1 year ago

Nextcloud is on version 25.0.2 ~No, i don't use files_external app, i checked that via Nextcloud GUI.~

While looking for tool to get list of all installed apps, i found another ./occ command that ends with similar error. docker exec nextcloud ./occ app:list

So there might be more general problem with my instance, that is not related to preview generator.

EDIT: i found file called files_external inside apps folder

docker exec nextcloud ls apps | grep exter
files_external
st3iny commented 1 year ago

Something weird is going on with your instance or your file system. May I ask on which file system your instance (/var/www/html/) is stored?

It seems like all file names and paths are lower cased and that is breaking the autoloader. E.g. /var/www/html/apps/files_external/lib/service/globalstoragesservice.php should be /var/www/html/apps/files_external/lib/Service/GlobalStoragesService.php

BerentM commented 1 year ago

I run Nextcloud on Raspbery Pi 4B with plugged external SSD disc. I mount it with fstab: UUID=B278-A8E7 /mnt/data exfat defaults,uid=1000,gid=1000,dmask=007 0 0 And then i additionaly run sudo bindfs -u 1000 -g 1000 /mnt/data/ /home/mateo/docker/nextcloud_data/ because i had issues with starting nextcloud, if it tried to store data in /mnt/data.

Maybe logger messes up with paths, they look legit on my instance

I have no name!@6365085dc379:/var/www/html/apps/files_external/lib/Service$ ls -la
total 1408
drwxrwx---  2 1000 1000 131072 Dec 18 12:14 .
drwxrwx--- 12 1000 1000 131072 Dec 18 12:14 ..
-rwxr-xr-x  1 1000 1000  10082 Dec 18 12:14 BackendService.php
-rwxr-xr-x  1 1000 1000  18780 Dec 18 12:14 DBConfigService.php
-rwxr-xr-x  1 1000 1000   6095 Dec 18 12:14 GlobalStoragesService.php
-rwxr-xr-x  1 1000 1000   1294 Dec 18 12:14 ImportLegacyStoragesService.php
-rwxr-xr-x  1 1000 1000   7745 Dec 18 12:14 LegacyStoragesService.php
-rwxr-xr-x  1 1000 1000  16447 Dec 18 12:14 StoragesService.php
-rwxr-xr-x  1 1000 1000   6446 Dec 18 12:14 UserGlobalStoragesService.php
-rwxr-xr-x  1 1000 1000   4616 Dec 18 12:14 UserStoragesService.php
-rwxr-xr-x  1 1000 1000   1658 Dec 18 12:14 UserTrait.php
I have no name!@6365085dc379:/var/www/html/apps/files_external/lib/Service$ pwd
/var/www/html/apps/files_external/lib/Service
BerentM commented 1 year ago

It's strange, but after renaming/deleting the apps/files_external folder, the occ commands started working 😄 Your first comment about files_external + this one directed me to this fix. I don't understand why it started to work, but it works for now.

st3iny commented 1 year ago

That is great to hear! I'll close the issue.

zhangzhy2000 commented 10 months ago

Got with the same issue. Seems like I ran docker on a case insensitive file system (MAC OS APFS), and the Preview Generator app cause the same trouble.