Hello,
I’m trying to generate preview files.
When running the command:
occ preview:generate-all -vvv
It generates it for a few files and then crash:
2023-11-12T09:57:57+01:00 In File.php line 56:
2023-11-12T09:57:57+01:00
2023-11-12T09:57:57+01:00 [OCP\Files\GenericFileException]
2023-11-12T09:57:57+01:00
2023-11-12T09:57:57+01:00
2023-11-12T09:57:57+01:00 Exception trace:
2023-11-12T09:57:57+01:00 at /var/www/nextcloud.private.local/lib/private/Files/Node/File.php:56
2023-11-12T09:57:57+01:00 OC\Files\Node\File->getContent() at /var/www/nextcloud.private.local/lib/private/Files/SimpleFS/SimpleFile.php:74
2023-11-12T09:57:57+01:00 OC\Files\SimpleFS\SimpleFile->getContent() at /var/www/nextcloud.private.local/lib/private/Preview/GeneratorHelper.php:73
2023-11-12T09:57:57+01:00 OC\Preview\GeneratorHelper->getImage() at /var/www/nextcloud.private.local/lib/private/Preview/Generator.php:196
2023-11-12T09:57:57+01:00 OC\Preview\Generator->generatePreviews() at /var/www/nextcloud.private.local/lib/private/PreviewManager.php:212
2023-11-12T09:57:57+01:00 OC\PreviewManager->generatePreviews() at /var/www/nextcloud.private.local/apps/previewgenerator/lib/Command/Generate.php:230
2023-11-12T09:57:57+01:00 OCA\PreviewGenerator\Command\Generate->parseFile() at /var/www/nextcloud.private.local/apps/previewgenerator/lib/Command/Generate.php:212
2023-11-12T09:57:57+01:00 OCA\PreviewGenerator\Command\Generate->parseFolder() at /var/www/nextcloud.private.local/apps/previewgenerator/lib/Command/Generate.php:210
2023-11-12T09:57:57+01:00 OCA\PreviewGenerator\Command\Generate->parseFolder() at /var/www/nextcloud.private.local/apps/previewgenerator/lib/Command/Generate.php:190
2023-11-12T09:57:57+01:00 OCA\PreviewGenerator\Command\Generate->generateUserPreviews() at /var/www/nextcloud.private.local/apps/previewgenerator/lib/Command/Generate.php:136
2023-11-12T09:57:57+01:00 OCA\PreviewGenerator\Command\Generate->OCA\PreviewGenerator\Command\{closure}() at /var/www/nextcloud.private.local/lib/private/User/Manager.php:632
2023-11-12T09:57:57+01:00 OC\User\Manager->callForSeenUsers() at /var/www/nextcloud.private.local/apps/previewgenerator/lib/Command/Generate.php:137
2023-11-12T09:57:57+01:00 OCA\PreviewGenerator\Command\Generate->execute() at /var/www/nextcloud.private.local/3rdparty/symfony/console/Command/Command.php:298
2023-11-12T09:57:57+01:00 Symfony\Component\Console\Command\Command->run() at /var/www/nextcloud.private.local/3rdparty/symfony/console/Application.php:1040
2023-11-12T09:57:57+01:00 Symfony\Component\Console\Application->doRunCommand() at /var/www/nextcloud.private.local/3rdparty/symfony/console/Application.php:301
2023-11-12T09:57:57+01:00 Symfony\Component\Console\Application->doRun() at /var/www/nextcloud.private.local/3rdparty/symfony/console/Application.php:171
2023-11-12T09:57:57+01:00 Symfony\Component\Console\Application->run() at /var/www/nextcloud.private.local/lib/private/Console/Application.php:211
2023-11-12T09:57:57+01:00 OC\Console\Application->run() at /var/www/nextcloud.private.local/console.php:100
2023-11-12T09:57:57+01:00 require_once() at /var/www/nextcloud.private.local/occ:11
2023-11-12T09:57:57+01:00
2023-11-12T09:57:57+01:00 preview:generate-all [-p|--path [PATH]] [--] [<user_id>...]
2023-11-12T09:57:57+01:00
Checking my log:
{"reqId":"randomstring","level":3,"time":"2023-11-12T09:57:57+01:00","remoteAddr":"","user":"--","app":"PHP","method":"","url":"--","message":"file_get_contents(/var/www/nextcloud.private.local/data/appdata_oc0815/preview/4/f/f/e/6/e/5/112805/750-1334-max.png): Failed to open stream: No such file or directory at /var/www/nextcloud.private.local/lib/private/Files/Storage/Local.php#305","userAgent":"--","version":"27.1.3.2","data":{"app":"PHP"}}
I checked an its correct, there is no file or folder with that name.
Also 750-1334-max.png is a bit strange because I have set a while ago:
‘preview_max_x’ => 1024,
‘preview_max_y’ => 1024,
in config.php. So it must be an old leftover.
So I deleted all subfolders of the preview folder and did:
occ files:scan-app-data
took a couple of hours but the error is still there… so the path must be somewhere in the database and scan-app-data seems not to delete it
All files that are not found have a higher resolution then what is configured
4032-3024-max.jpg
3024-4032-max.jpg
2576-1932-max.jpg
750-1334-max.png
and its always the -max.jpg preview
creating the path and a 0byte file is a workaround, but i did that for more then 300 pictures this weekend… so its not a solution
Database is mysql
Support intro
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
Nextcloud version (eg, 20.0.5): 27.1.3
Operating system and version (eg, Ubuntu 20.04): Ubuntu 22.04
Apache or nginx version (eg, Apache 2.4.25): nginx/1.24.0
PHP version (eg, 7.4): 8.1
The issue you are facing:
Is this the first time you’ve seen this error? (Y/N): Y
Steps to replicate it:
- run occ preview:generate-all -vvv
The output of your Nextcloud log in Admin > Logging:
file_get_contents(/var/www/nextcloud.private.local/data/appdata_oc0815/preview/4/f/f/e/6/e/5/112805/750-1334-max.png): Failed to open stream: No such file or directory at /var/www/nextcloud.private.local/lib/private/Files/Storage/Local.php#305
The output of your config.php file in /path/to/nextcloud
(make sure you remove any identifiable information!):
'enable_previews' => true,
'preview_max_x' => 1024,
'preview_max_y' => 1024,
'enabledPreviewProviders' => [
'OC\Preview\BMP',
'OC\Preview\GIF',
'OC\Preview\JPEG',
'OC\Preview\Krita',
'OC\Preview\MarkDown',
'OC\Preview\MP3',
'OC\Preview\OpenDocument',
'OC\Preview\PNG',
'OC\Preview\TXT',
'OC\Preview\XBitmap',
'OC\Preview\HEIC',
'OC\Preview\Movie',
],