External hdd not detected by filescan

[/details]

Nextcloud version (eg, 12.0.2): 18.0.0
Operating system and version (eg, Ubuntu 17.04): 18.04
Apache or nginx version (eg, Apache 2.4.25): 2.4.41
PHP version (eg, 7.1): 7.4.4

The issue you are facing:

Is this the first time you’ve seen this error? (Y/N):N

Steps to replicate it:

  1. Fresh installation of NC 18
  2. Everything is fine
  3. Mounted 2 Tb external hdd in /etc/fstab
  4. sudo -u www-data php /var/www/nextcloud/occ files:scan --all throws error

The output of your Nextcloud log in Admin > Logging:

[PHP] Error: Trying to access array offset on value of type null at /var/www/nextcloud/3rdparty/leafo/scssphp/src/Compiler.php#5230

GET /settings/user
from 192.168.178.32 by Matthias at 2020-03-29T12:17:36+00:00

The output of your config.php file:


<?php
$CONFIG = array (
  'instanceid' => '',
  'passwordsalt' => '',
  'secret' => '',
  'trusted_domains' =>
  array (
    0 => '192.168.178.68:880',
  ),
  'datadirectory' => '/media/sda1/nextcloud/nc_data/Matthias/files',
  'dbtype' => 'mysql',
  'version' => '18.0.0.10',
  'overwrite.cli.url' => 'http://192.168.178.68:880/',
  'htaccess.RewriteBase' => '/',
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' =>
      array (
        'host' => '/var/run/redis/redis-server.sock',
        'port' => 0,
        'timeout' => 0.0,
   ),
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'Matthias',
  'dbpassword' => '',
  'installed' => true,
);

Do I have to change the fstab options? I can write into the datadirectory as user www-data nonetheless. Permissions are all set accordingly. What am I missing here? No additional apps are installed.

fstab is currently like UUId = ... /media/sda1 ext4 defaults 0 0

Does it exist:

ls -l /media/sda1/nextcloud/nc_data/Matthias/files

Owner is www-data?

I think the error log does not match to the command.

It does exist. The datadirectory was already working in another instance. I was forced to set it up again.

    ls -l /media/sda1/nextcloud/nc_data/Matthias/files
    total 6864
    drwxr-xr-x  9 www-data www-data    4096 Mar 29 12:50  appdata_ocf0c0u9c657
    drwxr-x---  2 www-data www-data    4096 Jan  9 17:46  Audio
    drwxr-x--- 15 www-data www-data    4096 Mar 23 13:57  Dokumente
    drwxrwxr-x  2 www-data www-data    4096 Mar 27 16:02  files_external
    drwxr-xr-x  7 www-data www-data    4096 Mar 29 16:10  Matthias
    drwxr-x--- 22 www-data www-data    4096 Jan 19 20:18  Musik
    -rw-r-----  1 www-data www-data  192063 Mar 29 19:06  nextcloud.log
    -rwxr-x---  1 www-data www-data 6747640 Nov 10 21:00 'Nextcloud Manual.pdf'
    -rwxr-x---  1 www-data www-data   37042 Nov 10 21:00  Nextcloud.png
    drwxr-xr-x  2 www-data www-data    4096 Mar  4 15:32  Notes
    drwxr-x--- 18 www-data www-data    4096 Feb 25 17:29  Photos
    drwxr-x---  8 www-data www-data    4096 Feb 18 21:06  Videos
    drwxr-x---  7 www-data www-data    4096 Dec 24 14:11 'Zeig und Glump'

There aren´t any other errors in the logfile, too.

Perhaps a bug. Read

Ah ok. Thanks. Fixing php.ini did the trick I think. What is also strange that I wasn´t able to install the maps app. Following error did appear:
GuzzleHttp\Exception\ConnectException: cURL error 28: Operation timed out after 30000 milliseconds with 10461771 out of 16218720 bytes received (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)

30 seconds is a short time … increase the value.

How do I do that? I uploaded a file as a test into NC and it works fine. What puzzles me is that the filescan doesn´t work.

No real idea. Is there direct an error after command line for scan?
Perhaps you can test the scan with a test dir direct on the system like /var/www/nextcloud/data

Strangely, now works the filescan. But it detects only like 64 NC files, not my data files.

If I delete them, the scan throws errors again:

Starting scan for user 1 out of 1 (Matthias)
Home storage for user Matthias not writable
Make sure you're running the scan command only as the user the web server runs as

Maybe I´ll do it the hard way and reupload everything.

Is all set to www-data? Run with sudo for www-data:
sudo -u www-data php /var/www/nextcloud/occ files:scan --all

Please post command and direct the errors and not only the errors. Thanks.

Exactly what I did.

sudo -u www-data php /var/www/nextcloud/occ files:scan --all
Starting scan for user 1 out of 1 (Matthias)
Home storage for user Matthias not writable
Make sure you're running the scan command only as the user the web server runs as
+---------+-------+--------------+
| Folders | Files | Elapsed time |
+---------+-------+--------------+
| 0       | 0     | 00:00:00     |
+---------+-------+--------------+

“datadirectory” in config/config.php?
all rights correct?

Yes.
'datadirectory' => '/media/sda1/nextcloud/nc_data/Matthias/files',

Can you copy all to /var/www/nextcloud/data or simmilar path, change config an rescan? Perhaps it is the mount point or the length of the path.

Ok I will try this.

So putting test files into /var/www/nextcloud/data … works seamlessy. I´ll try switching back now.