Core: home storage not writable

Created on 10 Aug 2016  Â·  40Comments  Â·  Source: owncloud/core

Steps to reproduce

  1. Start file scan with ooc sudo -u www-data php occ files:scan --all

    Expected behaviour

No error message.

Actual behaviour

For some user i got an error message:

root@uplink:/var/www/owncloud# sudo -u www-data php occ files:scan --all

Scanning files for 5 users
Starting scan for user 1 out of 5 (Bianca)
Home storage for user Bianca not writable
Make sure you're running the scan command only as the user the web server runs as
Starting scan for user 2 out of 5 (Christian)
Starting scan for user 3 out of 5 (Nico)
Home storage for user Nico not writable
Make sure you're running the scan command only as the user the web server runs as
Starting scan for user 4 out of 5 (Sissy)
Starting scan for user 5 out of 5 (TESTUSER)

+---------+-------+--------------+
| Folders | Files | Elapsed time |
+---------+-------+--------------+
| 9013    | 33447 | 00:04:38     |
+---------+-------+--------------+

Server configuration

Operating system: Ubuntu 16.04

Web server: Apache/2.4.18 (Ubuntu)

Database: mysql Ver 14.14 Distrib 5.7.13, for Linux (x86_64) using EditLine wrapper

PHP version: PHP 7.0.8-0ubuntu0.16.04.2

ownCloud version: 9.1.0 stable
**Updated from an older ownCloud or fresh install: updated from 8.x

Where did you install ownCloud from: Ubuntu Repro

Signing status (ownCloud 9.0 and above):

No errors have been found.

List of activated apps:

root@uplink:/var/www/owncloud# sudo -u www-data php occ app:list
Enabled:
  - activity: 2.3.2
  - comments: 0.3.0
  - dav: 0.2.5
  - federatedfilesharing: 0.3.0
  - files: 1.5.1
  - files_external: 0.6.0
  - files_pdfviewer: 0.8.1
  - files_sharing: 0.10.0
  - files_texteditor: 2.1
  - files_trashbin: 0.9.0
  - files_versions: 1.3.0
  - files_videoplayer: 0.9.8
  - firstrunwizard: 1.1
  - gallery: 15.0.0
  - notifications: 0.3.0
  - provisioning_api: 0.5.0
  - systemtags: 0.3.0
  - templateeditor: 0.1
  - updatenotification: 0.2.1
Disabled:
  - encryption
  - external
  - federation
  - files_antivirus
  - notes
  - passwords
  - registration
  - user_external
  - user_ldap

The content of config/config.php:

root@uplink:/var/www/owncloud# sudo -u www-data php occ config:list system
{
    "system": {
        "instanceid": "ocs19kglaiqz",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "192.168.1.210",
            "uplink.spdns.eu"
        ],
        "datadirectory": "\/var\/www\/owncloud\/data",
        "overwrite.cli.url": "https:\/\/uxxxxxxxxxxu\/",
        "dbtype": "mysql",
        "version": "9.1.0.15",
        "logtimezone": "Europe\/Vienna",
        "installed": true,
        "dbname": "owncloud",
        "dbhost": "localhost",
        "dbtableprefix": "oc_",
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "mail_from_address": "sxxxxxxxxxr.cs",
        "mail_smtpmode": "sendmail",
        "mail_domain": "gmail.com",
        "memcache.local": "\\OC\\Memcache\\APCu",
        "maintenance": false,
        "mail_smtpauthtype": "LOGIN",
        "mail_smtpauth": 1,
        "mail_smtphost": "smtp.gmail.com",
        "mail_smtpport": "587",
        "mail_smtpname": "***REMOVED SENSITIVE VALUE***",
        "mail_smtppassword": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpsecure": "tls",
        "loglevel": 2,
        "appstore.experimental.enabled": true,
        "updatechecker": false,
        "theme": "",
        "data-fingerprint": "d5e948xxxxxxxxxxxxxxxx018b695"
    }
}

Are you using external storage, if yes which one: local/smb/sftp/...
Yes: 1 external hosted owncloud share

Are you using encryption: yes/no
No

Are you using an external user-backend, if yes which one: LDAP/ActiveDirectory/Webdav/...
No

Client configuration

**Browser: Chrome

**Operating system:
Win10

Logs

ownCloud log (data/owncloud.log)

no entry in the log during file scan

additional note:

I checked the files permission and i see no difference between user Christian und Bianca

Bug filesystem

Most helpful comment

If you moved the data folder, please check oc_accounts, it has a home folder column and might require updating.

All 40 comments

Ok thanks for the details.

Will have to find out where in the code this error is displayed to understand how the permissions check is done.

It seems the message is triggered by any ForbiddenException, not only permission issues, so maybe for these users something is triggering that exception for a different reason.

Can you add this line:

            $output->writeln('<error>Exception while scanning: ' . $e->getMessage() . "\n" . $e->getTraceAsString() . '</error>');

below this row https://github.com/owncloud/core/blob/v9.1.0/apps/files/lib/Command/Scan.php#L158 ?

I added the line below Scan.php#L158 and run the scan again:
New error message is:


root@uplink:/var/www/owncloud# sudo -u www-data php occ files:scan --all

Scanning files for 5 users
Starting scan for user 1 out of 5 (Bianca)
Home storage for user Bianca not writable
Exception while scanning:
#0 /media/500_1/owncloud/apps/files/lib/Command/Scan.php(155): OC\Files\Utils\Scanner->scan('/Bianca')
#1 /media/500_1/owncloud/apps/files/lib/Command/Scan.php(224): OCA\Files\Command\Scan->scanFiles('Bianca', '/Bianca', false, Object(Symfony\Component\Console\Output\ConsoleOutput), false)
#2 /media/500_1/owncloud/3rdparty/symfony/console/Command/Command.php(259): OCA\Files\Command\Scan->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#3 /media/500_1/owncloud/core/Command/Base.php(158): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#4 /media/500_1/owncloud/3rdparty/symfony/console/Application.php(844): OC\Core\Command\Base->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#5 /media/500_1/owncloud/3rdparty/symfony/console/Application.php(192): Symfony\Component\Console\Application->doRunCommand(Object(OCA\Files\Command\Scan), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#6 /media/500_1/owncloud/3rdparty/symfony/console/Application.php(123): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#7 /media/500_1/owncloud/lib/private/Console/Application.php(146): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#8 /media/500_1/owncloud/console.php(94): OC\Console\Application->run()
#9 /media/500_1/owncloud/occ(11): require_once('/media/500_1/ow...')
#10 {main}
Make sure you're running the scan command only as the user the web server runs as
Starting scan for user 2 out of 5 (Christian)
Starting scan for user 3 out of 5 (Nico)
Home storage for user Nico not writable
Exception while scanning:
#0 /media/500_1/owncloud/apps/files/lib/Command/Scan.php(155): OC\Files\Utils\Scanner->scan('/Nico')
#1 /media/500_1/owncloud/apps/files/lib/Command/Scan.php(224): OCA\Files\Command\Scan->scanFiles('Nico', '/Nico', false, Object(Symfony\Component\Console\Output\ConsoleOutput), false)
#2 /media/500_1/owncloud/3rdparty/symfony/console/Command/Command.php(259): OCA\Files\Command\Scan->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#3 /media/500_1/owncloud/core/Command/Base.php(158): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#4 /media/500_1/owncloud/3rdparty/symfony/console/Application.php(844): OC\Core\Command\Base->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#5 /media/500_1/owncloud/3rdparty/symfony/console/Application.php(192): Symfony\Component\Console\Application->doRunCommand(Object(OCA\Files\Command\Scan), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#6 /media/500_1/owncloud/3rdparty/symfony/console/Application.php(123): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#7 /media/500_1/owncloud/lib/private/Console/Application.php(146): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#8 /media/500_1/owncloud/console.php(94): OC\Console\Application->run()
#9 /media/500_1/owncloud/occ(11): require_once('/media/500_1/ow...')
#10 {main}
Make sure you're running the scan command only as the user the web server runs as
Starting scan for user 4 out of 5 (Sissy)
Starting scan for user 5 out of 5 (TESTUSER)

+---------+-------+--------------+
| Folders | Files | Elapsed time |
+---------+-------+--------------+
| 9013    | 33447 | 00:04:38     |
+---------+-------+--------------+
root@uplink:/var/www/owncloud#

I suspect that this is the one you're getting: https://github.com/owncloud/core/blob/v9.1.0/lib/private/Files/Utils/Scanner.php#L166

But if you say that the permissions are all correct and the web server user is allowed to write everywhere in the data folder, then it should be fine.

You might want to do a chown -R wwwrun:www data/ (replace username and group accordingly) just to be sure permissions are the same everywhere.

You might want to do a chown -R wwwrun:www data/ (replace username and group accordingly) just to be sure permissions are the same everywhere.

Done but the error message remains
Please see also http://uplink.spdns.eu/file_report.log
I think the permissions are correct.

Hmmm indeed, they look correct. So maybe PHP is having trouble correctly checking for creatability.

Strange...
If i remove all shared files for Nico... it works

root@uplink:/media/500_1/owncloud# sudo -u www-data php occ files:scan --path=Nico
Starting scan for user 1 out of 1 (Nico)

+---------+-------+--------------+
| Folders | Files | Elapsed time |
+---------+-------+--------------+
| 23      | 38    | 00:00:00     |
+---------+-------+--------------+
root@uplink:/media/500_1/owncloud#

If i share a file with Nico... the error reappears

root@uplink:/media/500_1/owncloud# sudo -u www-data php occ files:scan --path=Nico
Starting scan for user 1 out of 1 (Nico)
Home storage for user Nico not writable
Exception while scanning:
#0 /media/500_1/owncloud/apps/files/lib/Command/Scan.php(155): OC\Files\Utils\Scanner->scan('/Nico')
#1 /media/500_1/owncloud/apps/files/lib/Command/Scan.php(224): OCA\Files\Command\Scan->scanFiles('Nico', '/Nico', false, Object(Symfony\Component\Console\Output\ConsoleOutput), false)
#2 /media/500_1/owncloud/3rdparty/symfony/console/Command/Command.php(259): OCA\Files\Command\Scan->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#3 /media/500_1/owncloud/core/Command/Base.php(158): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#4 /media/500_1/owncloud/3rdparty/symfony/console/Application.php(844): OC\Core\Command\Base->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#5 /media/500_1/owncloud/3rdparty/symfony/console/Application.php(192): Symfony\Component\Console\Application->doRunCommand(Object(OCA\Files\Command\Scan), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#6 /media/500_1/owncloud/3rdparty/symfony/console/Application.php(123): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#7 /media/500_1/owncloud/lib/private/Console/Application.php(146): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#8 /media/500_1/owncloud/console.php(94): OC\Console\Application->run()
#9 /media/500_1/owncloud/occ(11): require_once('/media/500_1/ow...')
#10 {main}
Make sure you're running the scan command only as the user the web server runs as

+---------+-------+--------------+
| Folders | Files | Elapsed time |
+---------+-------+--------------+
| 23      | 38    | 00:00:00     |
+---------+-------+--------------+
root@uplink:/media/500_1/owncloud#

Okay, that's an interesting clue. So the ForbiddenException might be happening when it finds the shared storage. I wonder if it's somehow related to the bogus shared storage entries https://github.com/owncloud/core/issues/24106

I'll see if I can reproduce this somehow locally.

Hi,
I get the same after applying the patch from ticket 25506.
However, it looks it only happenes for users that

sudo -u apache php occ files:scan --all

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

Happens only for some users. Here is what I found out.

I checked the users and these are users that belong to a group to which a folter is shared too . I have a group called "Education", everyone that was assigned to this group had the error. I removed the share for this group and it works without problem now.
However, as soon I activate the share to the group back, the issue happens again for the users that are assigned to this group. If I share to a user direct, all works fine. So only seems to happen if shared to groups.

Best wishes,
Thomas

@Thomanji thanks for the details, I'll see if I can reproduce the issue locally with a similar sharing scenario

Hmm, I couldn't reproduce the issue.

My steps:

  1. Create three users "user1", "user2" and "user3", all in the group "group1"
  2. As admin, create a folder "test"
  3. Upload some files
  4. Share "test" with "group1"
  5. occ files:scan --all

Regardless whether the share is read-write or read-only, the scan goes through without errors.

@Thomanji is the EDUCATION folder shared read-only ?

@PVince81
This is my way to get the error:

All actions are done in the webinterface:

  1. Create TEST1 User wihtout group
  2. Create TEST2 User without group
  3. Login to TEST1 and i create a new txt file.
  4. I share the new file with TEST2 (can share, can modify)
  5. I login to the TEST2 User to verify the file is shared.
  6. I run the file scan...
root@uplink:/var/www/owncloud# sudo -u www-data php occ files:scan -p TEST2
5Starting scan for user 1 out of 1 (TEST2)
Home storage for user TEST2 not writable
Exception while scanning:
#0 /media/500_1/owncloud/apps/files/lib/Command/Scan.php(155): OC\Files\Utils\Scanner->scan('/TEST2')
#1 /media/500_1/owncloud/apps/files/lib/Command/Scan.php(224): OCA\Files\Command\Scan->scanFiles('TEST2', '/TEST2', false, Object(Symfony\Component\Console\Output\ConsoleOutput), false)
#2 /media/500_1/owncloud/3rdparty/symfony/console/Command/Command.php(259): OCA\Files\Command\Scan->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#3 /media/500_1/owncloud/core/Command/Base.php(158): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#4 /media/500_1/owncloud/3rdparty/symfony/console/Application.php(844): OC\Core\Command\Base->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#5 /media/500_1/owncloud/3rdparty/symfony/console/Application.php(192): Symfony\Component\Console\Application->doRunCommand(Object(OCA\Files\Command\Scan), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#6 /media/500_1/owncloud/3rdparty/symfony/console/Application.php(123): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#7 /media/500_1/owncloud/lib/private/Console/Application.php(146): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#8 /media/500_1/owncloud/console.php(94): OC\Console\Application->run()
#9 /media/500_1/owncloud/occ(11): require_once('/media/500_1/ow...')
#10 {main}
Make sure you're running the scan command only as the user the web server runs as

+---------+-------+--------------+
| Folders | Files | Elapsed time |
+---------+-------+--------------+
| 7       | 7     | 00:00:00     |
+---------+-------+--------------+
root@uplink:/var/www/owncloud# 5

@schnello thanks, now I got it. Could be because it's a file, not a folder.

The problem is:
Some files works... some not. The same with folders. Some folders are ok to share... some not.

Okay, I found that the problem is already fixed on the stable9.1 branch, through https://github.com/owncloud/core/pull/25675/commits/6f4ba321613ddf406fa0fcbb1228e89ca35e8425 (from PR https://github.com/owncloud/core/pull/25675)

You might be able to apply the commit as patch: https://github.com/owncloud/core/commit/6f4ba321613ddf406fa0fcbb1228e89ca35e8425.patch

OK, sorry but there is a followup.
I just did go ahead and shared this to 3 users direct and got the same error on 2 of them. Than I checked and I see that the 2 users that it happened to, did not have "Edit" rights. As soon I shitch on the edit rights the error for the 2 users goes away. Same for the "education" group. if I share with "edit" rights all is fine. If edit rights are off the error happens.

I am going to apply the patch and see.
Thank you very much @PVince81 for the help.

Thanks @PVince81

I was not able to apply the patch but it works fine if i add the lines manually.

root@uplink:/var/www/owncloud# sudo -u www-data php occ files:scan --all

Scanning files for 8 users
Starting scan for user 1 out of 8 (Bianca)
Starting scan for user 2 out of 8 (Christian)
Starting scan for user 3 out of 8 (Nico)
Starting scan for user 4 out of 8 (Sissy)
Starting scan for user 5 out of 8 (TEST1)
Starting scan for user 6 out of 8 (TEST2)
Starting scan for user 7 out of 8 (TESTUSER)
Starting scan for user 8 out of 8 (TESTUSER2)

+---------+-------+--------------+
| Folders | Files | Elapsed time |
+---------+-------+--------------+
| 9196    | 34047 | 00:06:06     |
+---------+-------+--------------+

Great to hear. Yeah, I had a conflict too locally.

Yes, solved it for me too.
Patch did not apply but after adding the patch manually to apps/files_sharing/lib/sharedstorage.php all seems to work.

Before:
sudo -u apache php occ files:scan bernhard
Starting scan for user 1 out of 1 (bernhard)
Home storage for user bernhard not writable
Make sure you're running the scan command only as the user the web server runs as
+---------+-------+--------------+
| Folders | Files | Elapsed time |
+---------+-------+--------------+
| 112 | 176 | 00:00:06 |
+---------+-------+--------------+

After patch:
sudo -u apache php occ files:scan bernhard
Starting scan for user 1 out of 1 (bernhard)
+---------+-------+--------------+
| Folders | Files | Elapsed time |
+---------+-------+--------------+
| 112 | 176 | 00:04:54 |
+---------+-------+--------------+

Sorry to re-open this, but I've got the exact same error on ownCloud 10 with, of course, the patch already applied

@foux can you also post the stack trace in case there are subtle differences ?

@PVince81 sorry, I went back to 9.1 (because of issues with the Contacts app), but the stack trace looked the same.

Sorry I didn't save it :/

Hi,
This is happening with me on a new stable installation of 10.0.2, I just tried moving my old data/ folder and rescanning. I've been getting the same errors all day, exactly as above.
Now I'm stuck on


Starting scan for user 2 out of 3 (avanish)
Exception during scan: Undefined index: size
#0 /home2/y/public_html/x.com/hosting/lib/private/Files/Cache/Scanner.php(416): OCA\Files\Command\Scan->exceptionErrorHandler(8, 'Undefined index...', '/home2/y/...', 416, Array)
#1 /home2/y/public_html/x.com/hosting/lib/private/Files/Cache/Scanner.php(377): OC\Files\Cache\Scanner->handleChildren('files/InstantUp...', true, 3, '1896', true, 6471562706)
#2 /home2/y/public_html/x.com/hosting/lib/private/Files/Cache/Scanner.php(380): OC\Files\Cache\Scanner->scanChildren('files/InstantUp...', true, 3, '1896', true)
#3 /home2/y/public_html/x.com/hosting/lib/private/Files/Cache/Scanner.php(380): OC\Files\Cache\Scanner->scanChildren('files', true, 3, '3', true)
#4 /home2/y/public_html/x.com/hosting/lib/private/Files/Cache/Scanner.php(311): OC\Files\Cache\Scanner->scanChildren('', true, 3, 1, true)
#5 /home2/y/public_html/x.com/hosting/lib/private/Files/Utils/Scanner.php(235): OC\Files\Cache\Scanner->scan('', true, 3)
#6 /home2/y/public_html/x.com/hosting/apps/files/lib/Command/Scan.php(159): OC\Files\Utils\Scanner->scan('/avanish')
#7 /home2/y/public_html/x.com/hosting/apps/files/lib/Command/Scan.php(228): OCA\Files\Command\Scan->scanFiles('avanish', '/avanish', false, Object(Symfony\Component\Console\Output\ConsoleOutput), false)
#8 /home2/y/public_html/x.com/hosting/lib/composer/symfony/console/Command/Command.php(262): OCA\Files\Command\Scan->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#9 /home2/y/public_html/x.com/hosting/core/Command/Base.php(158): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#10 /home2/y/public_html/x.com/hosting/lib/composer/symfony/console/Application.php(826): OC\Core\Command\Base->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#11 /home2/y/public_html/x.com/hosting/lib/composer/symfony/console/Application.php(189): Symfony\Component\Console\Application->doRunCommand(Object(OCA\Files\Command\Scan), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#12 /home2/y/public_html/x.com/hosting/lib/composer/symfony/console/Application.php(120): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#13 /home2/y/public_html/x.com/hosting/lib/private/Console/Application.php(160): Symfony\Component\Console\Application->run(NULL, NULL)
#14 /home2/y/public_html/x.com/hosting/console.php(99): OC\Console\Application->run()
#15 /home2/y/public_html/x.com/hosting/occ(11): require_once('/home2/y/...')

Hi,
same issue after moving my old data/ folder into a new 10.0.2, using docker-fpm setup.
Trace:

Home storage for user christian not writable
Exception while scanning: 
#0 /var/www/html/apps/files/lib/Command/Scan.php(159): OC\Files\Utils\Scanner->scan('/christian')
#1 /var/www/html/apps/files/lib/Command/Scan.php(229): OCA\Files\Command\Scan->scanFiles('christian', '/christian', false, Object(Symfony\Component\Console\Output\ConsoleOutput), false)
#2 /var/www/html/lib/composer/symfony/console/Command/Command.php(262): OCA\Files\Command\Scan->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#3 /var/www/html/core/Command/Base.php(158): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#4 /var/www/html/lib/composer/symfony/console/Application.php(826): OC\Core\Command\Base->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#5 /var/www/html/lib/composer/symfony/console/Application.php(189): Symfony\Component\Console\Application->doRunCommand(Object(OCA\Files\Command\Scan), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#6 /var/www/html/lib/composer/symfony/console/Application.php(120): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#7 /var/www/html/lib/private/Console/Application.php(160): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#8 /var/www/html/console.php(99): OC\Console\Application->run()
#9 /var/www/html/occ(11): require_once('/var/www/html/c...')
#10 {main}

18.07: Is anyone still monitoring this thread?

After upgrading to ownCloud 10.0.2 I had the same issue. For me this worked fine:

Sync the user database:

sudo -u www-data php occ user:sync "OCA\User_LDAP\User_Proxy"
sudo -u www-data php occ user:sync "OC\User\Database"

Now scan all files:

sudo -u www-data php occ files:scan --all

Im having the same problem. For me the reason for the error was that I wanted to store the data of one user to another partition and i simply tried to mount the extra space to ./nextcloud/data/USER/ , which is probably not the right way of doing this.

I had also this problem only with users that had as home directory an external storage mounted as "/".
Finally I managed to solve it by creating a folder named "files" to the local user directory.
For example, for a user named "_user1_" navigate to:

/var/ncdata/_user1_

and check if there is a folder named "files". If not create a folder named "files" (/var/ncdata/_user1_/files) and give rights 755 to user www-data.

After doing this on all my users that had this problem the problem resolved.

I think the script first searches the local folder ("files") and stops if it doesn't find it, no matter if there is nothing in there.

thanks rvdmeij you save me !

Same problem, homes not writable, after updating

sudo -u www-data php occ user:sync "OC\User\Database"

That line from @rvdmeij saved the day, thanks !

If you moved the data folder, please check oc_accounts, it has a home folder column and might require updating.

Hey, this issue has been closed because the label status/STALE is set and there were no updates for 7 days. Feel free to reopen this issue if you deem it appropriate.

(This is an automated comment from GitMate.io.)

Same issue for me on 10.0.4. @rvdmeij's soulution solved it.

Same issue on 10.0.4. Tried @rvdmeij's solution:

php occ user:sync "OC\User\Database"
If unknown users are found, what do you want to do with their accounts? (removing the account will also remove its data)
Analyse unknown users ...
   37 [============================]

>No unknown users have been detected.
>Insert new and update existing users ...
> 37/37 [============================] 100%

Still getting the same output on file:scan --all and on the specific user

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

I had the same issue with NC 13. I guess the problem was the following for me:
I created user A and mounted an external storage (local) to / before the user logged in the first time. Obviously in this case the 'files' directory under /A/ is not added in this case (probably 'A' is added on first login!?).

For 'debugging' this issue I temporary removed the external storage at '/' of user A with the result, that I could not login at all (execption...; the log says something like "OCP\Files\NotFoundException: /var/www/nextcloud/apps/files/lib/Controller/ViewController.php - line 131: OC_Helper getStorageInfo('/', false)" etc.). I added this folder manually then and re-mounted the external storage to '/' and afterwards the scan worked for me.

Hello,

I wish to reactivate this bug… I have 9 users (out of 33) that have the same problem :
Starting scan for user 30 out of 33 (admin)
Home storage for user admin not writable

Using owncloud 10.0.9.

The only solution I've found is to delete the user and recreate it : a new sync starts again, but that is long and complicated !!

Any other solution ?

Thanks

Peter

Experiencing this issue too after moving the /data directory.
Tried my luck by using @rvdmeij solution but it seems doesn't work.

Same thing here after moving /data after upgrade to 10.0.10. But, i found that the users in the oc_account table never logged in and additional the last login time stamp is set as zero there. In a second step i proof the users home and there it doesn't exist the files dir described like above.
Following works for me:

  1. Make the "files" dir in the usershome-data
  2. chown : usershome-data/files
  3. rescan the files for the user, like descriped in the posts above.

Check, all is running for me.

I just had the same issue.
Owncloud 10.0.10.

I fixed it after some hints (which I will now describe to maybe help others).
I had some users in an owncloud 9.0.x and decided to go for a new installation.
I recreated all existing users (only 3) manually and then changed the data directory in the config/config.php file.

The scan did not work :-(
Some users had the problem with "home directory not writeable", but for all users the existing files were found, not scanned and therefore not visible in owncloud.

The issue was that the home directory of the user is stored in the database (mariadb in my case)!
Changing the data directory (in the config.php) after the user were created had no effect on their home directory in the database.

I manually updated the database by changing the values for the users in the table "oc_accounts" column "home" and then the scan worked!

Good luck to everyone haveing troubles with this issue!

I just had the same issue.
Owncloud 10.0.10.

I fixed it after some hints (which I will now describe to maybe help others).
I had some users in an owncloud 9.0.x and decided to go for a new installation.
I recreated all existing users (only 3) manually and then changed the data directory in the config/config.php file.

The scan did not work :-(
Some users had the problem with "home directory not writeable", but for all users the existing files were found, not scanned and therefore not visible in owncloud.

The issue was that the home directory of the user is stored in the database (mariadb in my case)!
Changing the data directory (in the config.php) after the user were created had no effect on their home directory in the database.

I manually updated the database by changing the values for the users in the table "oc_accounts" column "home" and then the scan worked!

Good luck to everyone haveing troubles with this issue!

This worked for us. We didn't even move our data directory and new files would write to random directories within the data dir. Upon checking the home column in the oc_accounts table, we found that it had assigned random characters as the user directories within the data directory. I corrected them all, scanned, and had users login. Worked like a charm!

OwnCloud Version 10.4.1.3 dated Apr-2020

https://github.com/owncloud/core/issues/25755#issuecomment-453190855
This worked for me too... was struggling after migrating an OC 10.0 instance to a new server where the "paths" changed. The PHP-fpm's CPU would go 80-90% when trying to login as super admin and the owncloud.log would go crazy 1GB in 30 seconds.

Struggled for an hour or so and stumbled upon the cli scan
sudo -u docs php7.3 occ files:scan --all
which gave me Home storage for user xxx not writable while all necessary file permissions were correct. So digging into database table oc_accounts I saw the user's path was from the old server. Fixed path directly in DB and voila !!! all works smooth.

Hope this helps anyone else migrating their OCs.

Also it would be great to rather have "relative" path stored in the DB per user rather than an absolute path. That's what exactly the constant 'datadirectory' in config is for. The relative path in DB should be derived from 'datadirectory'+user's directory. Jut my 2 cents

Regards.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

f-s picture f-s  Â·  4Comments

photodude picture photodude  Â·  3Comments

HLeemans picture HLeemans  Â·  4Comments

rehoehle picture rehoehle  Â·  4Comments

tommis picture tommis  Â·  5Comments