Preview generation broken - finfo::finfo() function error

Hello Nextclouders!

I need your help. After a week or so banging my head against the table, i managed to get Nextcloud up and running on Odroid N2 - 64bit ARM board with some incredible specs, but i am still getting some errors, mainly preview seems to be broken and I did not find a solution to it.

First and foremost I am not very used to work with Linux so i may have missed something, but after a lot of trials and errors and TONS of tutorials and how-tos it all seems to work except this ->

The problem
Cannot generate previews. Browsing folders produces errors in the nextcloud.log:

[…] app":“index”,“method”:“GET”,“url”:"/nextcloud/index.php/core/preview?fileId=23&c=62f475973f5fcd9057be97b4b6c75750&x=250&y=250&forceIcon=0",“message”:{“Exception”:“Exception”,“Message”:“finfo::finfo(): Failed to load magic database at ‘(null)’.”,“Code”:0,“Trace”:[{“file”:"/storage/.opt/share/www/nextcloud/lib/private/legacy/OC_Image.php",“line”:87 […]

[…] “app”:“PHP”,“method”:“GET”,“url”:"/nextcloud/index.php/core/preview?fileId=10&x=32&y=32",“message”:“imagettftext(): Problem doing text layout at /storage/.opt/share/www/nextcloud/lib/private/Preview/TXT.php#92”[…]

When i try to manually run the Preview Generator with preview:generate-all -vvv, OCC web console outputs this:

2020-08-02T08:26:10+00:00 In OC_Image.php line 87:
2020-08-02T08:26:10+00:00 [Exception ]
2020-08-02T08:26:10+00:00 finfo::finfo(): Failed to load magic database at ‘(null)’.
Exception trace:
2020-08-02T08:26:10+00:00 at /storage/.opt/share/www/nextcloud/lib/private/legacy/OC_Image.php:87
2020-08-02T08:26:10+00:00 finfo->finfo() at /storage/.opt/share/www/nextcloud/lib/private/legacy/OC_Image.php:87

If i disable preview generation in the config.php. No errors appear in the log and i can even open images in the web interface (Latest Firefox on Win10). With preview generation enabled, i get these errors and i cannot open images at all. I can only see “Error loading .jpg” instead of the image.

System details

  • device: Odroid N2 4GB RAM, 6 core ARM 64bit CPU.
  • OS: CoreELEC KODI - JeOS based on ArchLinux?
  • Nextcloud v19.0.1
  • PHP7 - 7.4.6-1 with all of these packages activated:

php7 - 7.4.6-1
php7-cgi - 7.4.6-1
php7-cli - 7.4.6-1
php7-mod-bcmath - 7.4.6-1
php7-mod-ctype - 7.4.6-1
php7-mod-curl - 7.4.6-1
php7-mod-dom - 7.4.6-1
php7-mod-fileinfo - 7.4.6-1
php7-mod-filter - 7.4.6-1
php7-mod-gd - 7.4.6-1
php7-mod-gmp - 7.4.6-1
php7-mod-iconv - 7.4.6-1
php7-mod-intl - 7.4.6-1
php7-mod-json - 7.4.6-1
php7-mod-mbstring - 7.4.6-1
php7-mod-mysqli - 7.4.6-1
php7-mod-mysqlnd - 7.4.6-1
php7-mod-opcache - 7.4.6-1
php7-mod-openssl - 7.4.6-1
php7-mod-pcntl - 7.4.6-1
php7-mod-pdo - 7.4.6-1
php7-mod-pdo-mysql - 7.4.6-1
php7-mod-pdo-sqlite - 7.4.6-1
php7-mod-session - 7.4.6-1
php7-mod-simplexml - 7.4.6-1
php7-mod-sqlite3 - 7.4.6-1
php7-mod-xml - 7.4.6-1
php7-mod-xmlreader - 7.4.6-1
php7-mod-xmlwriter - 7.4.6-1
php7-mod-zip - 7.4.6-1

MySQL works, LightTPD seems to be ok too (no errors in the log), but something is rotten in the PHP or in the Nextcloud. Nextcloud also complains about missing imagick in the Settings/Overview, but Entware repo dropped support for it.

CoreELEC’s limitation is that only user root is present, without any option to add other user, so i have chown’ed /temp, /data and /nextcloud to root. It seems to work as i could not download files before but after chown’ing the /temp it works ok, so i dont think it is caused by permissions.

Thanks for any assistance :).