Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Error while sharing - error" when trying to share a file or directory on owncloud 7.0.4 #13908

Closed
tarator opened this issue Feb 4, 2015 · 24 comments
Labels
Milestone

Comments

@tarator
Copy link

tarator commented Feb 4, 2015

Steps to reproduce

  1. Login webinterface
  2. Choose file, click on share
  3. Select checkbox "Share link"
  • Error appears on every file/directory and with every user.
  • Previously shared links are still working.

Expected behaviour

Menu for shared link should appear.

Actual behaviour

Error pops up "Error while sharing"!

This feature worked fine before (previous version!?)

Screenshot of error message

Server configuration

  • Operating system: openSUSE 13.2
  • Web server: Apache
  • Database: MySQL
  • PHP version: 5.6.1
  • ownCloud version: 7.0.4
  • Updated from an older ownCloud or fresh install: Updated

config.php

<?php
$CONFIG = array (
  'datadirectory' => '/some/dir/owncloud/data',
  'dbtype' => 'mysql',
  'version' => '7.0.4.2',
  'installedat' => '1331491351.1509',
  'lastupdatedat' => '1331492839.8863',
  'dbname' => 'xxx',
  'dbhost' => 'xxx',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'xxx',
  'dbpassword' => 'xxx',
  'installed' => true,
  'loglevel' => '3',
  'instanceid' => 'xxx',
  'maintenance' => false,
  'theme' => '',
  'trusted_domains' => 
  array (
    0 => 'mydomain.com',
  ),
  'mail_from_address' => 'bla',
  'mail_smtpmode' => 'smtp',
  'mail_domain' => 'foo.com',
  'secret' => 'xxx',
  'mail_smtpauthtype' => 'LOGIN',
  'mail_smtpauth' => 1,
  'mail_smtphost' => 'smtp.example.com',
  'mail_smtpname' => 'xxx',
  'mail_smtppassword' => 'xxx',
);
  • Are you using external storage, if yes which one: had some enabled, but disabled them for testing this bug
  • Are you using encryption: no

Client configuration

  • Browser: Firefox
  • Operating system: Kubuntu 14.10

Logs

Web Server Logs:

nothing special

owncloud.log

nothing, when I press the "Share link" checkbox.

But sometimes this appears:

{"app":"PHP","message":"Invalid argument supplied for foreach() at \/some\/path\/onserver\/public_html\/owncloud\/lib\/private\/files\/cache\/scanner.php#216","level":3,"time":"2015-02-04T20:56:26+00:00"}
{"app":"PHP","message":"PHP Startup: apc: Unable to initialize module\nModule compiled with module API=20100525\nPHP    compiled with module API=20131226\nThese options need to match\n at Unknown#0","level":3,"time":"2015-02-04T20:57:35+00:00"}
{"app":"files_sharing","message":"Unable to get mount for shared storage '8' user 'some_username'","level":3,"time":"2015-02-04T20:58:30+00:00"} 
{"app":"files_sharing","message":"Unable to get mount for shared storage '8' user 'some_username'","level":3,"time":"2015-02-04T20:58:30+00:00"}
{"app":"files_sharing","message":"Unable to get mount for shared storage '8' user 'some_username'","level":3,"time":"2015-02-04T20:58:30+00:00"}
{"app":"files_sharing","message":"Unable to get mount for shared storage '8' user 'some_username'","level":3,"time":"2015-02-04T20:58:30+00:00"} 
{"app":"files_sharing","message":"Unable to get mount for shared storage '8' user 'some_username'","level":3,"time":"2015-02-04T20:58:30+00:00"}  
{"app":"files_sharing","message":"Unable to get mount for shared storage '8' user 'some_username'","level":3,"time":"2015-02-04T20:58:30+00:00"}  
{"app":"files_sharing","message":"Unable to get mount for shared storage '8' user 'some_username'","level":3,"time":"2015-02-04T20:58:30+00:00"}
{"app":"files_sharing","message":"Unable to get mount for shared storage '8' user 'some_username'","level":3,"time":"2015-02-04T20:58:30+00:00"}
{"app":"files_sharing","message":"Unable to get mount for shared storage '8' user 'some_username'","level":3,"time":"2015-02-04T20:58:30+00:00"}
{"app":"files_sharing","message":"Unable to get mount for shared storage '8' user 'some_username'","level":3,"time":"2015-02-04T20:58:30+00:00"}  
{"app":"files_sharing","message":"Unable to get mount for shared storage '8' user 'some_username'","level":3,"time":"2015-02-04T20:58:30+00:00"}
{"app":"files_sharing","message":"Unable to get mount for shared storage '8' user 'some_username'","level":3,"time":"2015-02-04T20:58:30+00:00"}
{"app":"files_sharing","message":"Unable to get mount for shared storage '8' user 'some_username'","level":3,"time":"2015-02-04T20:58:30+00:00"}
{"app":"files_sharing","message":"Unable to get mount for shared storage '8' user 'some_username'","level":3,"time":"2015-02-04T20:58:30+00:00"}
{"app":"files_sharing","message":"Unable to get mount for shared storage '8' user 'some_username'","level":3,"time":"2015-02-04T20:58:30+00:00"}
@DeepDiver1975
Copy link
Member

{"app":"files_sharing","message":"Unable to get mount for shared storage '8' user 'some_username'","level":3,"time":"2015-02-04T20:58:30+00:00"}

hmmm - doesn't look that good - @PVince81 @icewind1991 can I ask you to have a look? THX

@DeepDiver1975
Copy link
Member

scheduling for 8.1 for analysis

@DeepDiver1975 DeepDiver1975 added this to the 8.1-next milestone Feb 4, 2015
@PVince81
Copy link
Contributor

PVince81 commented Feb 5, 2015

Do you use LDAP ?
Did you move the "data" directory recently ?

If not, please try the following queries:

  1. Orphaned shares: select * from oc_share where item_source not in (select fileid from oc_filecache)
  2. Check select * from oc_storages whether there are entries like "local::$datadir/$user" and where $datadir is the path to your data dir (or a wrong path).
  3. Also check the storage 8: select * from oc_storages where numeric_id=8 and its contents select * from oc_filecache where storage=8.

@tarator
Copy link
Author

tarator commented Feb 5, 2015

@PVince81 :

  • No, I don't use LDAP
  • I didn't move the data directory recently, I did before, but that's more than one year ago.
  • The query select * from oc_share where item_source not in (select fileid from oc_filecache) returns an empty result.
  • I have eaxactly one result for the query select * from oc_storages which starts with local::/some/dir/owncloud/data/some_username/ and the directory looks like the directory structure from my old server (which is not valid anymore). But I don't think this causes the problem, since I have the problem with very user and this is only one users entry, isn't it!?
  • The value of the column id for numeric_id=8 looks something like this: 351234563d4678abc12345a0fd123456
  • There are some other lines in the table.
    • Some look like this: 351234563d4678abc12345a0fd123456
    • Some like this: dropbox::afj498vnq43huvj3haevhu/
    • And for each user: home::some_username

Can I safely change the path to the correct one for the wrong local:: entry?

@tarator
Copy link
Author

tarator commented Feb 5, 2015

@PVince81 : I solved the problem with the missing share 8
Now, the following error message is not appering anymore.

{"app":"files_sharing","message":"Unable to get mount for shared storage '8' user 'some_username'","level":3,"time":"2015-02-04T20:58:30+00:00"} 

The problem was, that the webserver-user had no writing permissions to the folder: /some/dir/owncloud/data/some_username/lucene_index

However, the Sharing problem is still NOT fixed.

@PVince81
Copy link
Contributor

PVince81 commented Feb 5, 2015

Ok, that sharing error might be something else.
Please try setting "loglevel" to 0 (debug) and try sharing again.
I hope something will pop up in the owncloud.log with more infos.

You could also check the web browser's network console and see what response is coming back from the ajax call to "share.php".

@tarator
Copy link
Author

tarator commented Feb 5, 2015

Request when clicking on the share checkbox:

Request Header:

Host: myowncloud-domain.com
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:35.0) Gecko/20100101 Firefox/35.0
Accept: */*
Accept-Language: de-at,de-de;q=0.8,de;q=0.7,en-gb;q=0.5,en-us;q=0.3,en;q=0.2
Accept-Encoding: gzip, deflate
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
requesttoken: 3fhwnwghpow98ph47gv
X-Requested-With: XMLHttpRequest
Referer: https://myowncloud-domain.com/index.php/apps/files/?dir=%2FBilder%2F12_04_05_Some_Filename
Content-Length: 136
Cookie: 508j3f48ßzmg9n8uu93hpri8bekpu1g0; oc_username=some_username; oc_token=d680uti6fglgzuftzidx65787t9redcfjg444; oc_remember_login=1
Connection: keep-alive
Pragma: no-cache
Cache-Control: no-cache

Request-Body

action=share&itemType=file&itemSource=100721&shareType=3&shareWith=&permissions=1&itemSourceName=2012-04-05+15.01.10.jpg&expirationDate=

Request-Answer:

one empty line, no data or error-message

Problem:

in the file core/ajax/share.php on line 30 the following condition makes the problem:

if (isset($_POST['shareType']) && isset($_POST['shareWith']) && isset($_POST['permissions'])) {
 ....
}

when I remove the second condition (isset($_POST['shareWith'])), the request works well.
As you can see above the parameter shareWith= is empty in my request. Maybe my PHP version handles isset differently?

Now i just realised, that there is the same problem when unsharing. Maybe the same condition.

@PVince81
Copy link
Contributor

PVince81 commented Feb 5, 2015

Hmm... ownCloud should work fine with PHP 5.6 (sharing does work on my dev env on PHP 5.6.4).

I believe that shareWith is empty because you are creating a link share, is that correct ?

@schiesbn any idea why shareWith is empty and whether it is correct ?

@tarator
Copy link
Author

tarator commented Feb 5, 2015

Yes, I was sharing a link. Maybe the code was only tested, when the file was already shared for another user before?

But I don't think so...
As I can see, the code from share.php is not new! And I'm sure, the feature worked for me before! I can't tell you, if there has been an PHP update on my server lately, but maybe this is an PHP flaw? Maybe empty params from the request are not set in the _POST variable?

@transistor91
Copy link

I had a similiar problem described in this issue: github.com//issues/13720. Perhaps you can check your /var/log/message if you have suhosin errors?

@tarator
Copy link
Author

tarator commented Feb 6, 2015

@transistor91 This is possible, since I activated suhosin on my server shortly. I checked already the log files, but didn't find anything. Nothing changes when i disable suhosin. The problem still remains.

@fbassas
Copy link

fbassas commented Feb 9, 2015

HI, I have had a similar problem this weekend.
We have owncloud 7.0.4 in a ubuntu 14.04 server. One of my users send o big copy of files from a local server to owncoud. I taked so long and at midnight our mysql and ldap stopped for backup. After that, in log file appeared:

{"app":"files_sharing","message":"Unable to get mount for shared storage '81' user '6332d98a-7f3e-102a-8c7d-fdcd95ab32a5'","level":3,"time":"2015-02-07T01:28:25+00:00"}

And the share info was lost.
I have made the queries PVince81 suggested, and I have seen two "local::$datadir/$user" records, one with obsolete info about an old server with different datadir. I've remove it and it the log now I get:

{"app":"webdav","message":"Sabre\DAV\Exception\Conflict: Parent node does not exist","level":4,"time":"2015-02-09T10:27:06+00:00"}

Should I create it again?

I've done a "occ files:scan" over user datadir and it seems share info has recovered. Does it have any sense?

But "Unable to get mount..." message still remains. What can I do?

Thanks in advance.

Frank

@fbassas
Copy link

fbassas commented Feb 11, 2015

Hi again,
iI've got this on the log file:

{"app":"hook","message":"error while running hook (OCA\Files_Versions\Hooks::write_hook): An exception occurred while executing 'INSERT INTO oc_filecache (mimepart, mimetype, mtime, size, etag, storage_mtime, permissions, parent, path_hash, path, name, storage) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)':\n\nSQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '89-f5131d6bbd6ed754ccf5712adc1c384d' for key 'fs_storage_path_hash'","level":3,"time":"2015-02-11T10:18:34+00:00"}

What's the problem? Can it be related to "Unable to get mount" message?

Thnaks,

Frank

@MorrisJobke MorrisJobke added triage and removed triage labels Feb 27, 2015
@shoelzle
Copy link

shoelzle commented May 2, 2015

Hello,

Same issue here: Sharing via links is not working for any files or folders.
Nothing suspicious in the logs, not even with loglevel set to 0 (debug).

Owncloud: 8.0.2
PHP: 5.6.1
Webserver: Apache
Operating System: openSUSE 13.2
Database: MySQL

I can provide more information if necessary. Any help is appreciated.

@tarator
Copy link
Author

tarator commented May 3, 2015

@shoelzle Do you have suhosin enabled? In my case the problem was, that suhosin (with pretty much default settings) filters requestparams which don't have a value. In PHP then the check with issset(param_name) returns false when suhosin is enabled. If you disable suhosin the same PHP-Directive returns true since the param is simply null but not filtered-out.

@owncloud-Developers: What do you think about that issue? I think this affects more code-parts in the application. Maybe you should make a guideline on how parameters are checked...

@karlitschek karlitschek modified the milestones: 8.2-next, 8.1-current May 4, 2015
@shoelzle
Copy link

@tarator suhosin is enabled. I tried disabling suhosin for testing, however I did not succeed.
I tried two ways:

  • setting "php_flag suhosin.simulation On" in .htaccess in owncloud folder
  • setting "suhosin.simulation = On" in /etc/php5/conf.d/suhosin.ini

After restarting apache2 suhosin was still enabled. How did you disable it ?

@shoelzle
Copy link

I managed to disable suhosin by setting "php_flag suhosin.simulation On" in the vhost.conf for the owncloud.
I can confirm that sharing by link works with suhosin disabled.

@rbahassine
Copy link

Hi All,

I have same issue here. Owncloud 7.0.4 on "PHP 5.3.10-1ubuntu3.10 with Suhosin-Patch (cli) (built: Feb 28 2014 23:14:25)"

"Unable to get mount for shared storage '7' user 'some_username'

I have USER1 that's shares a folder FOLDER1 with 30 others users, and since yesterday all share lost (but files still on the server)
NOT USING SHARING BY LINK (so not related with SUHOSIN)

@PVince81 :

I tried all your SELECT and I got this results :

  1. Orphaned shares:
select * from oc_share where item_source not in (select fileid from oc_filecache)

I got 9 orphans.

  1. Check
 select * from oc_storages

whether there are entries like "local::$datadir/$user" and where $datadir is the path to your data dir (or a wrong path)

I have one local::$datadir/$user but the path is right and $user is the username who shares the "unmounted shared storage N°7"

  1. Also check the storage 7 :
select * from oc_storages where numeric_id=7 

returns one row : home::USERNAME

and its contents

select * from oc_filecache where storage=7.

got 8000 lines...

@tarator : checked the permissions of the lucene_folder all is ok.

Seems to be a little different of all what I read on github...

@PVince81
Copy link
Contributor

PVince81 commented Jun 5, 2015

Can you confirm that you do not have any entry "home::$user" that would be the same user as "local::$datadir/$user" ?

@rbahassine
Copy link

I confirm.
I made a mistake on my previous post, the entry which begins with "local::" does not contains any user id, its patterns looks like "local::$datadir". >> there is no $user inside the value.

local::/files/owncloud/data/

And all other entries looks like home::$user and there is no double entries.

May I add the related $user at the end of string local::/files/owncloud/data/ ?

@PVince81
Copy link
Contributor

PVince81 commented Jun 5, 2015

No, do not modify that entry, it is not related. Just ignore it.
It seems your storage entries are fine.

You could try deleting the orphaned shares, it might make the issue disappear because then it will not try to resolve them any more. Or you could try upgrading to 7.0.5 which might contain a fix for this, not sure. I just remember that OC 8.0.x should properly ignore orphaned shares.

@rbahassine
Copy link

Thank you PVince.
I deleted orphans but the folder still not appears.
I will try to upgrade to 7.0.5 or 8.0.x

@PVince81
Copy link
Contributor

@rbahassine did you have any more luck with 7.0.6, 8.0.6 or 8.1.1 ?

@PVince81
Copy link
Contributor

Please reopen if the issue persists in these versions.
Thanks.

@lock lock bot locked as resolved and limited conversation to collaborators Aug 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

9 participants