Skip to content
This repository has been archived by the owner on Jul 24, 2018. It is now read-only.

[7.0 beta 1] What about .doc and .docx files? Don´t work. #291

Closed
enoch85 opened this issue Jun 28, 2014 · 69 comments
Closed

[7.0 beta 1] What about .doc and .docx files? Don´t work. #291

enoch85 opened this issue Jun 28, 2014 · 69 comments

Comments

@enoch85
Copy link

enoch85 commented Jun 28, 2014

Just spent like 3 hours trying to get .docx and .doc files to work. I have installed LibreOffice 4.2 on my Ubuntu Server 12.04 and made the correct changes according to the documentation, setting 'preview_libreoffice_path' => '/usr/bin/libreoffice/', in config.php, and I also tried without that line.

Owncloud.log:


Warning documents Starting a session failed. Reason: Empty conversion output 2014-06-28T16:35:44+00:00
Warning documents Empty conversion output 2014-06-28T16:35:44+00:00
Error PHP file_get_contents(/tmp/7896d1c467daf2046f0f1a920c8d45fb//5b376c6997adc7e36becf2ed5f949db2.odt): failed to open stream: No such file or directory at /var/www/owncloud/apps/documents/lib/converter.php#56 2014-06-28T16:35:44+00:00
Warning documents Starting a session failed. Reason: Empty conversion output


I have tried to search for an external solution regarding the file-format-server to see if it had something to do with my install of LibreOffice but I didn´t find any. As you already know it says http://localhost:16080 in the admin settings as an external address, and just to confirm: that address has no function at all, right? And I also wonder if you guys know any server I can use for that purpose? Don´t think I should need it though as I have a fresh install och both LibreOffice 4.2 and oC 7 beta 1, right? Anyway, I can see previews from both .doc and .docx so my LibreOffice install should work.

Another thing I saw when I Googled for soulutions was this: https://github.com/owncloud/format-filter-server What is this? Are you planning on writing your own filter-server? In that case it means that .doc and .docx isn´t supported fully yet, or am I wrong?

When I try to open a docx or doc document in Web UI I usually get two errors, one or the other, plus the log of course.

  1. "Failed to load this document. Please check if it can be opened with an external odt editor. This might also mean it has been unshared or deleted recently."

namnls

And I have also seen a bunch of these:

  1. Format filter server is down or misconfigured (Can I install a Format-filter-server in Ubuntu or is that the function that LibreOffice gets me?)

Many questions, I hope I (and other users) can get some answers soon.

Expected behavior

No problems, issues, or glitches with the documents app regarding .doc and .docx

Actual behavior

Can´t open Office documents at all. I can see the previews though.

Server configuration

Ubuntu Server 12.04 (latest updates)
oC 7 Beta 1
MySQL & PHP (latest updates)

Browser

Chrome (latest)
I also tried with IE, same thing there.

@enoch85
Copy link
Author

enoch85 commented Jun 28, 2014

Here is the assertion failure mentioned: #245

@enoch85
Copy link
Author

enoch85 commented Jun 28, 2014

Just tested https://github.com/owncloud/format-filter-server.git and it didn´t work for me.

@enoch85 enoch85 changed the title [7.0 beta 1] What about .doc and .docx files? Don´t work! [7.0 beta 1] What about .doc and .docx files? Don´t work. Jun 30, 2014
@VicDeo
Copy link
Contributor

VicDeo commented Jul 1, 2014

@enoch85
Current master works for me just fine. doc/docx is supported via headless openoffice/libreoffice binary execution. As soon as previews are working it should be possible to edit documents too.

What is the current state of MS Word support (requires openOffice/libreOffice) switch position at the admin page?

@enoch85
Copy link
Author

enoch85 commented Jul 1, 2014

@VicDeo I have tried both the external and the local (on server) option. And both is failing with current master. What should I do?

@enoch85
Copy link
Author

enoch85 commented Jul 1, 2014

image

The text means something like "Failed to download this document. Please try to open it with an external text editor that supports ODT. This fault may be because the document has been recently stopped awarded or was deleted."

All documents in the picture is .docx and doc.

@enoch85
Copy link
Author

enoch85 commented Jul 4, 2014

@enoch85
Copy link
Author

enoch85 commented Jul 4, 2014

Just made a fresh install on Ubuntu 12.04 with the latest Daily Build and also installed latest LibreOffice (4.2) on my server. I run Chrome Version 35.0.1916.153 m and I have also tried IE11.

I can see the previews but it fails when I try to open the files, .docx and .doc.
image

When I hoover the files the address is:
image

And when I press the .docx file I get this for ~0.5 sec:
image

And then it fails:
image

Now, I need some help @VicDeo :)

Edit:

If I open the "link" in a new tab, the file gets downloaded.

@enoch85
Copy link
Author

enoch85 commented Jul 4, 2014

Just found this line in the code: https://github.com/owncloud/documents/blob/master/lib/converter.php#L39
It says "OpenOffice". I run LibreOffice, but that shouldn´t make any change, or does it?

Maybe @PVince81 has an anwser to my questions?

@PVince81
Copy link
Contributor

PVince81 commented Jul 4, 2014

@VicDeo can you help ?

@ghost
Copy link

ghost commented Jul 5, 2014

@enoch85
Copy link
Author

enoch85 commented Jul 5, 2014

@RealRancor Ok, thanks for the confirmation. I have set 'preview_libreoffice_path' => '/usr/bin/libreoffice/' as described in the documentation but that don´t help. :/

@VicDeo
Copy link
Contributor

VicDeo commented Jul 7, 2014

@enoch85 'preview_libreoffice_path' => '/usr/bin/libreoffice/' is a path to directory
you need 'preview_libreoffice_path' => '/usr/bin/libreoffice' (without a trailing slash)

@enoch85
Copy link
Author

enoch85 commented Jul 7, 2014

@VicDeo That don´t work either :/

@brantje
Copy link

brantje commented Jul 7, 2014

Have the same.
Stable7 branch.
When i open a doc, nothing happens but it does generate a preview.
Log: http://pastebin.com/gmLyuLkL

First ajax call is returns nothing

Second & third one:

Empty conversion output
#0 /var/www/core/apps/documents/lib/filter/office.php(69): OCA\Documents\Converter::convert('???????????????...', 'odt:writer8', 'odt')#1 [internal function]: OCA\Documents\Filter_Office->read(Array)#2 /var/www/core/apps/documents/lib/filter.php(35): call_user_func(Array, Array)#3 /var/www/core/apps/documents/lib/download/simple.php(30): OCA\Documents\Filter::read('???????????????...', 'application/msw...')#4 /var/www/core/apps/documents/lib/download.php(68): OCA\Documents\Download_Simple->sendResponse()#5 /var/www/core/apps/documents/ajax/download.php(21): OCA\Documents\Download->sendResponse()#6 /var/www/core/lib/base.php(809): require_once('/var/www/core/a...')#7 [internal function]: OC::loadAppScriptFile(Array)#8 /var/www/core/lib/private/route/router.php(227): call_user_func(Array, Array)#9 /var/www/core/lib/base.php(709): OC\Route\Router->match('/apps/documents...')#10 /var/www/core/index.php(28): OC::handleRequest()#11 {main

@karlitschek
Copy link

@VicDeo Can you help here?

@VicDeo
Copy link
Contributor

VicDeo commented Jul 8, 2014

@enoch85 @brantje please upload https://gist.github.com/VicDeo/871a95fe2003dcbacfb2 as apps/documents/convtest.php, run it from browser as http://yourOC/index.php/apps/documents/convtest.php and post the output here.

@brantje
Copy link

brantje commented Jul 8, 2014

Conversion result:string(132) "[Java framework] Error in function createSettingsDocument (elements.cxx). javaldx failed! Warning: failed to read path from javaldx " 

Output file is not created

So java isn't installed?

sander@dev-ownCloud:/var/www/core/apps/documents$ sudo apt-get install openjdk 
openjdk-7-jre is already the newest version.
sander@dev-ownCloud:/var/www/core/apps/documents$ libreoffice --version
LibreOffice 4.1.3.2 410m0(Build:2)

Distributor ID: Ubuntu
Description: Ubuntu 13.10
Release: 13.10
Codename: saucy

@VicDeo
Copy link
Contributor

VicDeo commented Jul 8, 2014

@brantje google says your www-data user can't create .config directory for libreoffice
save this script as setup.sh and run it as a root

#!/bin/bash

# run as root
# OO/LO needs a writable ~/.config directory
# www-data user has non-writable /var/www as a home by default

WEBHOME=$(grep www-data /etc/passwd | cut -d ":" -f6)
mkdir $WEBHOME/.config
chown www-data:www-data $WEBHOME/.config

@brantje
Copy link

brantje commented Jul 8, 2014

Done, and ran the file again.
Output:

Conversion result:string(261) "mkstemp("/var/www/.execooogJyaBf") failed: Permission denied mkstemp("/var/www/.execoooBE4K17") failed: Permission denied convert /tmp/8576c4b69a6d2dde24fe43bfaf5a5686 -> /tmp/78b6743d84c4c0a3cd2f85ae9d56c389//8576c4b69a6d2dde24fe43bfaf5a5686.odt using writer8 " 

Output file is created

More info, the ajax responses when i open a doc contain now binary code, however the screen stays blank.

@VicDeo
Copy link
Contributor

VicDeo commented Jul 8, 2014

@brantje try edit any *.doc(x) in Documents now.

@brantje
Copy link

brantje commented Jul 8, 2014

It works =D thanks.
Only when i click on edit, when i click the name i get a white screen.

@enoch85
Copy link
Author

enoch85 commented Jul 8, 2014

@VicDeo

  1. Got this:
    image
  2. Installed java:
    #sudo apt-get default-jdk
  3. Ran setup.sh and was able to open and edit .doc and .docx

But, exactly as @brantje mentioend I get as white screen when I click on the name in the documents folder. So it works, but not perfect. Thanks anyway.

Is there a fix for this problem?

@VicDeo
Copy link
Contributor

VicDeo commented Jul 8, 2014

@enoch85 I bet @brantje means that clicking on the document in Files app shows empty screen with close button.
Edit link opens it in editor, while clicking somewhere else opens it in viewer (and viewer is broken for doc files now, fixing it in progress).

@enoch85
Copy link
Author

enoch85 commented Jul 8, 2014

@VicDeo Yes, that´s what I mean as well. :)

But the fact remains, should every user have to do this, or could the things you showed @brantje and me be implemented in the code an executed automatically?

@brantje
Copy link

brantje commented Jul 8, 2014

Indeed thats what i met.

I think its something for the wiki

@VicDeo
Copy link
Contributor

VicDeo commented Jul 8, 2014

@enoch85 @brantje can you test #303?

if you are unfamiliar with git you need to replace documents/ajax/download.php with
https://github.com/owncloud/documents/blob/view-doc/ajax/download.php

@enoch85
Copy link
Author

enoch85 commented Jul 8, 2014

@VicDeo Yes, now it works in the files app as well. Thank you!

But still, how about the setup? Should every user that wants to view .doc. and .docx files have to follow the steps manually as described in this ticket, or will you make a fix for that also?

@enoch85
Copy link
Author

enoch85 commented Jul 8, 2014

This script should be setup in /owncloud/documents/.config and pre-installed when using the documents app for the first time (or something like that)

Maybe also check if the /.config folder exists? Just an idea.

WEBHOME=$(grep www-data /etc/passwd | cut -d ":" -f6)
mkdir $WEBHOME/.config
chown www-data:www-data $WEBHOME/.config

@VicDeo
Copy link
Contributor

VicDeo commented Jul 14, 2014

@josh4trunks cool, thanks for your investigation.
According to http://ask.libreoffice.org/en/question/1686/how-to-not-connect-to-a-running-instance/
tmp file is good enough

@enoch85
Copy link
Author

enoch85 commented Jul 14, 2014

@josh4trunks Do you make a PR then? :)

@josh4trunks
Copy link
Contributor

if VicDeo doesn't I'll make one tonight when I get home from work

@enoch85
Copy link
Author

enoch85 commented Jul 14, 2014

if VicDeo doesn't I'll make one tonight when I get home from work

cc @VicDeo

@enoch85
Copy link
Author

enoch85 commented Jul 15, 2014

@VicDeo Just noticed a strange thing.

Did a completely fresh install of oC7RC2 in a fresh Ubuntu Server system just to test the experience for new users.

With @josh4trunks fix the conversion works with both .doc and .docx files /but/ there is an error message when you press "apply and test" that says "Conversion fail, check log for details" and the log says: "Warning documents Conversion failed. Raw output:"

What is this? Is it due to a missing /.config folder? The conversion works anyway and I´m able to open .docx. and .doc files in WebUI.

@josh4trunks
Copy link
Contributor

@enoch85
in guessing the conversion test beds the added line as well

@enoch85
Copy link
Author

enoch85 commented Jul 15, 2014

Yes, with #311 everything works as expected! 👍

@semirke
Copy link

semirke commented Aug 8, 2014

Hi,
centos (tested with 6) will need libreoffice-headless package, too:
yum install libreoffice-headless

(ref: http://diegolamonica.info/how-to-make-libreoffice-headless-to-work-on-centos-6-3/)

@enoch85
Copy link
Author

enoch85 commented Aug 9, 2014

centos (tested with 6) will need libreoffice-headless package, too:
yum install libreoffice-headless

@josh4trunks @VicDeo Is this something that could be included in the installation of documents?

@josh4trunks
Copy link
Contributor

@enoch85
I don't think so. I have no idea how you would pre-package specific binaries for specific OS with this plugin.

@semirke
Copy link

semirke commented Aug 9, 2014

I think he meant to include it in the installation guides/documentation.

@josh4trunks
Copy link
Contributor

ahh I see, my bad =P

@enoch85
Copy link
Author

enoch85 commented Aug 9, 2014

Sorry, bad english. :)

@oparoz
Copy link
Contributor

oparoz commented Sep 2, 2014

I've just found a problem with the current implementation, specifically this commit which sets the user profile in /tmp:
fb85b0f

Assuming all users on a server are using /tmp, IF the user dir is created, the libreoffice conversion will only work for the first user. All other users will not have access to the folder and file conversion will fail.

I've tried to play with
'preview_office_cl_parameters' => '-env:UserInstallation=file:///path/to/where/the/config/should/be/created',
Using OC's data folder, but it does not prevent the "user" folder from being created in /tmp

@josh4trunks
Copy link
Contributor

@oparoz
why could different 'owncloud users' not use the same temp dir? owncloud users have no affect on the 'OS user' executing libreoffice, usually www or www-data. (maybe there are some cases of this when using LDAP, I don't much about that).

if this is a real bug please post more detail in a new issue. thanks

@oparoz
Copy link
Contributor

oparoz commented Sep 2, 2014

OK, I'll file in a new report. I'm talking about UNIX users.
/tmp/user will be owned by user1 and user2 won't be able to do something it needs to do with that folder. Not sure what. If you chmod -R to 777, then all users can convert office documents, but you might encounter a race condition at some point.

@josh4trunks
Copy link
Contributor

@oparoz
is user1 an owncloud user or user on the operating system?

@oparoz
Copy link
Contributor

oparoz commented Sep 2, 2014

/tmp/user is the Libreoffice configuration folder
user1 and user2 are unix users

@josh4trunks
Copy link
Contributor

how is a single owncloud instance running as multiple Unix users?

@oparoz
Copy link
Contributor

oparoz commented Sep 2, 2014

It's not a single instance, it's multiple instances on one server. That's what's causing the problem.

@josh4trunks
Copy link
Contributor

Ok, makes sense. a different issue thread is definitely in order, feel free to CC me.

@oparoz
Copy link
Contributor

oparoz commented Sep 2, 2014

For people landing here from G**gle, this PR has been created to solve the problem for people running multiple instances on one server:
#353

@amirzargaran
Copy link

@VicDeo
dear
i upoad this https://gist.github.com/VicDeo/871a95fe2003dcbacfb2 to mentioned path and output of my browser is :

Conversion result:string(353) "[Java framework] Error in function createSettingsDocument (elements.cxx). javaldx failed! Warning: failed to read path from javaldx /usr/lib64/libreoffice/program/soffice.bin X11 error: Can't open display: Set DISPLAY environment variable, use -display option or check permissions of your X-Server (See "man X" resp. "man xhost" for details) "

Output file is not created

please help me what can i do?
i am need to can preview the docx , xls and xlsx!!!

@denysvitali
Copy link

Had a similar problem.
That was caused by a directive of php.ini (php_admin_value of apache in my case) which excluded some functions, particularly shell_exec, escapeshellcmd, escapeshellarg, exec

Obviously fixed by removing them.
Just sharing here because I've lost too much time finding out and testing what was the problem. Hope it could help someone!

@ghost
Copy link

ghost commented Mar 24, 2015

@denysvitali
Yepp, those are needed to get LibreOffice to work but are not really documented anywhere. :-/

I had reported this some weeks ago at owncloud/core#14092

@danielberlin
Copy link

Only escapeshellarg and shell_exec, there are other prerequisites though: https://doc.owncloud.org/server/7.0/admin_manual/configuration/collaborative_documents_configuration.html

I'm having the same problem, too. .odt works, but not .docx.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.