unoconv not converting documents

unoconv not converting documents

by Scott Christy -
Number of replies: 84

I'm having issues with the Annotate PDF feature. It works fine if the student uploads a PDF file assignment, but if they upload a different document type (ie .docx) the page loads into the annotate PDF windows as a blank page. 

When I run the test script for unoconv that is included as part of Moodle admin panel, it says it runs correctly but when I download the test PDF it is blank. The test script for ghostwriter works fine.

I tried doing a document conversion on the server using the command line option (unoconv -f pdf _________.docx) to see if it would work and it performs the conversion just fine.

I am running Moodle 3.2 on a Windows Server 2012 RS, PHP version 5.6.29, and mysql for the dbase. LibreOffice is version 5 and unoconv is v.7.

Anyone have any suggestions where I should start looking to figure out what's going wrong?

Thanks!

Average of ratings: -
In reply to Scott Christy

Re: unoconv not converting documents

by Scott Christy -

Additional info....

Using unoconv from the command line converts pretty much any file type perfectly -  .odt,  .doc, .docx, .xls, .xlsx, etc files fine.

In Moodle uploaded assignments, regardless of the format uploaded doesn't convert and you get a blank document in the grading screen.

In reply to Scott Christy

Re: unoconv not converting documents

by Scott Christy -

Still haven't solved this issue. Does anyone have any suggestions?

In reply to Scott Christy

Re: unoconv not converting documents

by Dave Balch -

One problem I encountered was a PHP warning corrupting the PDF. Once I turned off "Display debug messages", the PDF was shown.

HTH,
Dave.

Average of ratings: Useful (1)
In reply to Dave Balch

Re: unoconv not converting documents

by Scott Christy -

Ugh. I was hoping it would be that simple.... Turned off debugging, still doesn't work.....


In reply to Scott Christy

Re: unoconv not converting documents

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

I wish I could help but I have no idea what's involved in running this on Windows. I'm not sure if many will have. 

I strongly recommend reading the notes at https://github.com/dagwieers/unoconv *very* carefully. And then read them again. There's a few 'gotchas' in there that aren't especially obvious. It took me a few goes to get it all working. Getting all the permissions correct for all the temporary files and such is tricky. I don't really know how logs work on Windows, but I would certainly attempt to find if any of this stuff is throwing errors or similar. 

Average of ratings: Useful (2)
In reply to Howard Miller

Re: unoconv not converting documents

by Scott Christy -

Yeah, I much prefer running this on a 'nix server like we've done in the past but this time around our IT folks are trying to standardize all of our servers so Windows it is....

Shot in the dark here, but any idea what folders unoconv uses in the process? Like you said, I'm wondering if there's a permissions problem somewhere. That's the only thing that makes sense as unoconv works perfectly if I do a document conversion from the CLI.

In reply to Scott Christy

Re: unoconv not converting documents

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

That makes sense. I can only speak about Linux but it might give you a clue. 

When running from within Moodle it will be running as the web-server user (or whatever you run cron as if running the conversion from the scheduled task). On Linux temporary directories are created in the web server user's home directory. On Ubuntu, for example, that's /var/www which the web server user does not have write access to by default. 

I imaging something similar must go on using Windows.

In reply to Scott Christy

Re: unoconv not converting documents

by Nick Varney -

I'm in exactly the same boat as you Scott trying to get this work. Raised it as an issue here

Windows server 2008 R2, php 5.6.10, mysql 5.6.x running Moodle 3.1

PDFs are created fine when running unoconv in the command line.

Did you get as far as running a unoconver listener? Without the Windows instructions in the documentation I wouldn't know where to start.

When you request a test PDF in Moodle (in the Test unoconv path screen) do you get a PDF? I end up with a PHP file to download?!

Hope you can get yours sorted.

I find it disappointing that a critical feature such as grading in core Moodle is so problematic to get running, on Windows at least. 

In reply to Nick Varney

Re: unoconv not converting documents

by Scott Christy -

You're right Nick. We are in EXACTLY the same situation.

To answer some of your questions:

Did you get as far as running a unoconver listener? 
Nope. There's nothing in the directions about it for Windows. I would have no idea how to create a Windows listener. If I was running this on a 'nix box that would be a different story but I'm not and don't have an option to use 'nix instead. If the listener is the problem then I need some documentation about how to do it.

When you request a test PDF in Moodle (in the Test unoconv path screen) do you get a PDF? I end up with a PHP file to download?!

Nope. The test says the path is fine but no download. I get the PHP file just like you do.


This is probably not the right place to vent my frustrations but I'm really getting frustrated with Moodle. I get it that it's open source but features that are touted as being central to the feature set such as the grading feature should just work when I install Moodle. 

I've been running a Moodle server for my school district for over 5 years. Over 200 teachers use it to deliver over 1300 classes each year. A year ago our district started on a path to transition to a different LMS. After much discussion and one failed attempt to implement a different, and costly, LMS our committee finally agreed with me that with Moodle, "if it ain't broke, don't fix it," and finally agreed to allow me to fully implement Moodle for our district (over 2000 teachers) but I had to agree to run it on a Windows server as that's what our district's standard is. So that's where we stand and I've had nothing but problems. You'll notice I have another thread in this forum where I can't get it to do a course restore for larger classes either. I know my way around Moodle. I've been administering Moodle servers since the 1.X years and getting v3.2 up and running on a Windows server has taken me three times as many HR hours as the earlier editions. I'm hoping that all of these hassles are simply because of the fact that I have to use a Windows server because if I don't get this running all of my work convincing our school to use Moodle will have been for nothing.

In reply to Nick Varney

Re: unoconv not converting documents

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

I know it doesn't help much but I can at least sympathise. Even on Linux this feature can be flaky and I don't think there has been enough thought about "what if it goes wrong?". In your case, it may not have been tried and certainly hasn't been documented on a supported platform. 

At one time this would have been in the "experimental feature" category. I think it's been released as mainstream too soon. 

I have it running on a big clustered Linux system and, to be fair, it mostly works. But when it doesn't it leaves hung processes that have to be manually stopped. We've had to stop the background scheduled conversion completely because it hangs the cron job every few days. You'll have that to look forward to if you get it running wink

Average of ratings: Useful (1)
In reply to Howard Miller

Re: unoconv not converting documents

by Scott Christy -

Oh, great.... just what I needed to hear.....   mixed

And of course this exact feature was one of the key factors I used to convince our district that Moodle would be just as good as the other LMS they wanted to purchase.

I guess worst case scenario we can make students upload everything as PDF's like we currently do in our Moodle 2.6 environment.  angry

In reply to Scott Christy

Re: unoconv not converting documents

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

I would imagine that the "other" LMS would be exactly the same. 

Nearly all these processes (that I have seen), and this includes stuff like plagiarism detection services, use headless LibreOffice in the background to do the conversion. When you think about it, it's a big ask for it to convert *anything* from a proprietary format like Office uses to something else - every single time. 

I have to emphasise that it nearly always works. However, unfortunately, if it goes wrong it tends not to fail nicely. The fault/responsibility is all down the line. "It works 99.9% of the time" is only fine if you can *guarantee* a helpful error message the other 0.1%

In reply to Scott Christy

Re: unoconv not converting documents

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Another thing... I don't know if you know, but if the process fails and a blank page is created as the PDF then Moodle will never try to convert that page again. It thinks the blank page is the proper document. This can confuse testing when things aren't going well no end.

See MDL-56122 and a variety of linked issues. 

In reply to Howard Miller

Re: unoconv not converting documents

by Scott Christy -

Yeah, I knew about that. I'll cross that bridge when i get there. For now, I'm trying to get the test to run. WAIT, now that I think about it, would this problem affect the unoconv test in the admin panel as well? I'm thinking probably not as it's throwing an error and not actually creating a PDF file. Instead I'm getting some ____.php file with an error.

What is the file path where the finished files get stored from the conversion process - specifically the one from the unoconv test?

Thinking down the road, does this "never converts the page again" problem also happen if, for example:

  1. A student uploads say, a word document
  2. The teacher opens it to grade and realizes the student didn't finish the assignment
  3. Teacher puts the assignment back to draft mode and asks student to resubmit
  4. Student uploads the completed version of the assignment to Moodle for grading - assignment has the same file name

Under this circumstance would unoconv make a new copy of the uploaded assignment?


In reply to Scott Christy

Re: unoconv not converting documents

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

While not absolutely true... the files get put in Moodle's file system which is as good as impossible to find. The name is hashed and it's put in a numeric directory structure. Basically, you need to find it in mdl_files and then work out where the file is. Good luck!

For your second question, Moodle *would* realise it was a different document. Files are identified based on their contents, not their name. So even one character different would make the file different in the underlying file system. The "real" name is only stored in the database table. 

In reply to Howard Miller

Re: unoconv not converting documents

by Ken Task -
Picture of Particularly helpful Moodlers

Just to add 2 more cents to the confusion ... have had a 3.1 on a CentOS 6 box working.   Went back to it and visited to find out the 'test pdf' file no longer displayed.   Soooooo ... off into yet another venture in Moodle La-La Land. :\

CentOS Linux 6.8
PHP 5.5.38
unoconv 0.7
Written by Dag Wieers <dag@wieers.com>
Homepage at http://dag.wieers.com/home-made/unoconv/

platform posix/linux2
python 2.6.6 (r266:84292, Aug 18 2016, 15:13:37)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-17)]
LibreOffice 4.3.7.2

Had to re-do the listener ... saw some errors in logs:

Error: Unable to connect or start own listener. Aborting.

[root@visdmoodle unotest]# /usr/bin/unoconv -vvv -f pdf unoconvtest.docx
Verbosity set to level 3
Using office base path: /usr/lib64/libreoffice
Using office binary path: /usr/lib64/libreoffice/program
DEBUG: Connection type: socket,host=127.0.0.1,port=2002,tcpNoDelay=1;urp;StarOffice.ComponentContext
DEBUG: Existing listener not found.
DEBUG: Launching our own listener using /usr/lib64/libreoffice/program/soffice.bin.
LibreOffice listener successfully started. (pid=913)
Input file: unoconvtest.docx
Selected output format: Portable Document Format [.pdf]
Selected office filter: writer_pdf_Export
Used doctype: document
Output file: file:///root/unotest/unoconvtest.pdf
DEBUG: Terminating LibreOffice instance.
DEBUG: Waiting for LibreOffice instance to exit.

Tracked down to the listener ... not working.

Got that fixed - thanks to docs on Moodle.org for setting up a listener for CentOS 6 ... did have to change a path to where the listener was to find the version of LibreOffice being used.

But ... managed to get it working again and this time created a test course, test student with assignments asking for an ODT and a DOCX to see if the system converted for Teacher to annotate.

Grumble, grumble, grumble ... won't share what I really said to myself sad

Not working ...

Well, 5 hours later ...

Command line test checked out:

[root@visdmoodle unotest]# unoconv -vvv -f pdf hp-unoconvtest.docx
Verbosity set to level 3
Using office base path: /usr/lib64/libreoffice
Using office binary path: /usr/lib64/libreoffice/program
DEBUG: Connection type: socket,host=127.0.0.1,port=2002,tcpNoDelay=1;urp;StarOffice.ComponentContext
Input file: hp-unoconvtest.docx
Selected output format: Portable Document Format [.pdf]
Selected office filter: writer_pdf_Export
Used doctype: document
Output file: file:///var/www/html/moodle31/unotest/hp-unoconvtest.pdf

An older version of libreoffice used on this box but it converts via command line just fine.

Test button for test PDF nada/zip/blank pdf ... and no rendering for Teacher to annotate.

More GRUMBLE GRUMBLE!

When it wasn't working the files that had been submitted were draft.

DB query:

select contenthash,filename,component,filearea from `mdl_files` where `filename` like "%unoconv%";

showed that.

The test file is in filedir:

Row in my DB:

7b31b67545a1288f9545bfce904a7efb72795e94     348a9e14124c26f685e3abd37dca286016a685fc     1     core     documentconversion     0     /pdf/     6faee9e044dcb1d3629e270a5f34e77b1ed620f9    
    24680     application/pdf     0

Note area is core and the file name is a hash ... nothing humanly recognizable ... of course they say in the PDF (when/if you get to see it) you shouldn't use it.

It won't be found using the: Download the converted pdf test file.

Did something one shouldn't do ... I removed a row in the DB ... but NOT in filedir.

Well, I'll be dang!  Logged on as student using a different browser.
Resubmitted the file - this time added one line to the file/doc.

In another browser as teacher/admin of system could see the submitted file ... an .odt.
AND THIS TIME ... annotation works!  I can see the .odt converted in the grading window and  can annotate.

Hmmmm ...
There is a task for converting submissions ...


Execute scheduled task: Prepare submissions for annotation (assignfeedback_editpdf\task\convert_submissions)
... started 18:49:06. Current memory use 87.2MB.
Convert 1 submission attempt(s) for assignment 1
Convert 1 submission attempt(s) for assignment 2
Conversion failed with error:storedfilecannotread

That last line was the row in the DB I deleted manually from DB but NOT from filedir.

So, here's a question ... cron job running?  Do you see a "prepare submissions for annotation' like above when cron is run?

Now also this begs the question ... will it stay?   Continue to work ... or will it flake out again. :\

For today ... am putting this on to bed and me to the couch.   Have had all the 'fun' I can handle for one day!

'spirit of sharing', Ken


Average of ratings: Useful (3)
In reply to Ken Task

Re: unoconv not converting documents

by Ken Task -
Picture of Particularly helpful Moodlers

Adding some more ... this is turning into a saga! :\

Checked this AM ... same server that worked yesterday ...

This boxen a CentOS 6 ...

Think the 'test' link is a little buggy still in producing a PDF test file.

In apache error logs:


[Sat Jan 14 08:11:45 2017] [error] [client IP address] PHP   5. touch() /var
/www/html/moodle31/lib/filestorage/file_storage.php:390, referer: http://site/moodle31/mod/assign/feedback/editpdf/testunoconv.php

Also seen in same log:

mkstemp("/var/www/.execooow40HAG") failed: Permission denied

Appears unoconv even if set to global ugo execute is being called by the web server user ... which, under CentOS 5/6/7 is  the user 'apache'.   Apache 'home' is /var/www/  Nothing should be able to write to that directory unless defined in apache config.

Hmmmmm ... after digging around DagWeers pages ...

https://github.com/dagwieers/unoconv/issues/87

found this:

------------------------------------------------------------------------------

hermannkm commented on Jul 11, 2016 • edited

Having had the same problems and studying these discussions I decided trying to hardcode HOME to /tmp at about line 1216 in /usr/bin/unoconv:

### Main entrance
    ...
    os.environ['HOME'] = '/tmp'

which made everything work instantly (calling unoconv with apache user via moodle 3.1).
Working with Ubuntu 16.04 LTS, unoconv installed via apt-get (0.7-1.1; again, after trying the latest github-clone which had the same problems).

------------------------------------------------------------------------

So I tried that (really don't like editing the unoconv script itself and hope that I'll remember what was done IF unoconv needs an update).

The test PDF still doesn't work but command line test works ok as apache user:

Command line test (this on a CentOS box whose web server user is 'apache'):

sudo -u apache unoconv

If that responds with:
unoconv: you have to provide a filename or url as argument
Try `unoconv -h' for more information.

Then the 'apache' user can execute unoconv

Then try to convert a doc as the apache user:

sudo -u apache unoconv -vvv -f pdf unoconvtestd.docx
Verbosity set to level 3
Using office base path: /usr/lib64/libreoffice
Using office binary path: /usr/lib64/libreoffice/program
DEBUG: Connection type: socket,host=127.0.0.1,port=2002,tcpNoDelay=1;urp;StarOffice.ComponentContext
Input file: unoconvtestd.docx
Selected output format: Portable Document Format [.pdf]
Selected office filter: writer_pdf_Export
Used doctype: document
Output file: file:///var/www/html/moodle31/unotest/unoconvtestd.pdf

So the listener is still working and the conversion does work when executing as apache user from the command line.

In the Moodle UI, Annotation still works ... tested again by submitting an assignment as student, then accessed as Admin level to see if the .docx would be converted to PDF and allow.

Me thinks the 'test' button and the pdf file it tries to create is the culprit.   That might fail but the annotation works.

Here's reference in the apache error logs:

[Sat Jan 14 10:01:54 2017] [error] PHP Warning:  touch(): Utime failed: Permission denied in /var/www/html/moodle31/lib/filestorage/file_storage.php on line 390
[Sat Jan 14 10:01:54 2017] [error] PHP Stack trace:
[Sat Jan 14 10:01:54 2017] [error] PHP   1. {main}() /var/www/html/moodle31/mod/assign/feedback/editpdf/testunoconv.php:0
[Sat Jan 14 10:01:54 2017] [error] PHP   2. file_storage::send_test_pdf() /var/www/html/moodle31/mod/assign/feedback/editpdf/testunoconv.php:47
[Sat Jan 14 10:01:54 2017] [error] PHP   3. file_storage->get_converted_document() /var/www/html/moodle31/lib/filestorage/file_storage.php:290
[Sat Jan 14 10:01:54 2017] [error] PHP   4. file_storage->create_converted_document() /var/www/html/moodle31/lib/filestorage/file_storage.php:197
[Sat Jan 14 10:01:54 2017] [error] PHP   5. touch() /var/www/html/moodle31/lib/filestorage/file_storage.php:390

Sorry I can't translate this into Windows-ese for that platform, but least this info might provide info enough for someone who knows their way around that platform with where to look.

'spirit of sharing', Ken




Average of ratings: Useful (4)
In reply to Ken Task

Re: unoconv not converting documents

by AL Rachels -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

One step forward, two steps back. I finally thought to go check my moodledata folder again. In the temp folder, lo-and-behold, there was now an assignfeedback_editpdf folder WITH pdfs of student submissions.

So, in my 3.2 DEV site I now have unoconv working, just can't see the results in Moodle as I only see the spinning load icon. Even when the submission is a PDF.

Grumble, grumble.

NOTHING in the apache error log since I fixed one about SELinux and port 2002 yesterday.

Finally went to my 3.1 production site. IT"S WORKING! Like it is supposed to. So, in my dev site...maybe a permission problem still. Dunno...anyway, way past lunch time...taking a break.


In reply to Ken Task

Re: unoconv not converting documents

by Ajay Goyal -

Hi I'm quite new to moodle with not-technical background. I use moodle hosted on godaddy to supplement my classroom teaching activities. Please pardon me if I haven't added any more tech details for this query (because I don't know that). 

I having the same problem 

Using moodle 3.2.1 on linux 

Ref - Group Assignment activity

I can't pdf display for annotation in the display screen. 

I've pdf feedback installed with ghost script and unoconv also installed.

While testing the system path to the unoconv I get the following message  

The unoconv path does not point to the unoconv program. Please review your path settings.


Can anyone suggest edit in my present system path to unoconv  - /usr/bin/unoconv


Attached screenshots of problem as I face 

Thanks in Advance




In reply to Ajay Goyal

Re: unoconv not converting documents

by AL Rachels -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

Hi Ajay,

Have you actually looked on your server in the /usr/bin folder to see if unoconv is actually there?

Average of ratings: Useful (1)
In reply to AL Rachels

Re: unoconv not converting documents

by Ajay Goyal -

Hello Rachel,

Thanks, I checked and it's actually not there.   In fact I only noticed now that it was never installed .. while trying to install it's giving the messages  -

"Unable to detect the plugin type. Please choose the plugin type manually."

"Make sure the plugin type root location is writable by the web server process"


Any further leads from here - hw to get this installed.


Regards

Ajay

In reply to Ajay Goyal

Re: unoconv not converting documents

by AL Rachels -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

Hi Ajay,

From what you wrote it seems like you are trying to install unoconv as a plugin in Moodle, which is wrong. In a previous post you mention using Linux. Which distro of Linux are you using? You need to install unoconv in a Linux terminal window. The actual command depends on which distribution of Linux you are using.

AL

In reply to Ken Task

Re: unoconv not converting documents

by AL Rachels -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

Hi Ken,

I've played around off-and-on trying to get unconv to work on my Linux server. On a few occasions, I have had it so that it worked from a terminal window, but have never been able get it to work in Moodle. With debug set to developer, I have never had any debug messages regarding unoconv.

I have it now so that it's working in terminal, but downloading the test pdf gives a blank, and trying to grade an online text assignment just gives a never ending spinning load indicator.

I am especially interested in how you are running the scheduled tasks mentioned here:

Hmmmm ...
There is a task for converting submissions ...


Execute scheduled task: Prepare submissions for annotation (assignfeedback_editpdf\task\convert_submissions)
... started 18:49:06. Current memory use 87.2MB.
Convert 1 submission attempt(s) for assignment 1
Convert 1 submission attempt(s) for assignment 2
Conversion failed with error:storedfilecannotread

That last line was the row in the DB I deleted manually from DB but NOT from filedir.

Running cron in a terminal window, I've never been able to get a "Convert 1 submission attempt(s) for assignment 1" even when I change the schedule from 15 minutes to every minute. The only thing I have ever been able to see is similar to this:

Execute scheduled task: Prepare submissions for annotation (assignfeedback_editpdf\task\convert_submissions)
... started 12:49:01. Current memory use 15MB.
... used 1 dbqueries
... used 0.066791772842407 seconds
Scheduled task complete: Prepare submissions for annotation (assignfeedback_editpdf\task\convert_submissions)

In reply to AL Rachels

Re: unoconv not converting documents

by Ken Task -
Picture of Particularly helpful Moodlers

Sorry ... I, like you, have been all over chasin' this rabbit so it's no wonder my last post may not have made any sense at all! :\

I too had debug up to developer and nothing ever showed while in the grading of assignments that were uploaded.  (cept one time when I purposely removed a row in the mdl_files table that was for one of the two assignments turned in by my hpotter student user.    Did that on purpose trying to get something/anything to show me what was going on while grading since developer settings weren't showing anything!)    Would recommend that to anyone.

Anyhoo ... cd moodlecode/admin/tool/task/cli/

php schedule_task.php
will pull up the help for that CLI script.

First one in the listing:

\assignfeedback_editpdf\task\convert_submissions
Run like this:

php schedule_task.php --execute=\\assignfeedback_editpdf\\task\\convert_submissions
Those 'double' slashes are required in linux.

Am guessing, but If there are any documents that need to be converted, it will - if unoconv issues have been resolved.

Was working on CentOS 6 box ... had to use the listener for init.d ... letting unoconv find it's own listener wasn't working in the Moodle GUI.

Forgot who share it before via forums (thanks again to whomever you are!) ... there's a doc for it:

https://docs.moodle.org/31/en/Installing_unoconv#Run_a_unoconv_listener

(there's a doc on Windows also!!!)

For running a listener not permanent:

https://github.com/dagwieers/unoconv

Section entitled: Start your own unoconv listener

Then there was the issue of what appeared to be unoconv attempting to use /var/www/ to create a temp file.   That posting referenced/mentoned what was added to unoconv - the poster, BTW, specifically working with a Moodle 3.1.

Been working on CentOS 7 box today and so far the command line conversions work.  Now get a listener going and create test course to see about the Moodle UI.

Feel like am gaining on this rabbit ... but, we'll see! :|

'spirit of sharing', Ken


In reply to Ken Task

Re: unoconv not converting documents

by Ken Task -
Picture of Particularly helpful Moodlers

Well, call me 'Elmer Fudd' ... that 'wascal wabbit' has once again, alluded me! :\

Am getting no PDF conversion in the annotate window ... just white in that frame.   Feel close, but no cigar yet! :|

select * from `mdl_files` where `mimetype` like "%pdf%"

is showing me two entries ... under component and filearea now and both have:


assignfeedback_editpdf combined

So am kinda confused.   Need to go compare that CentOS 6 DB to see what's different in the mdl_files table.   Nothing in the moodledata/temp/ that's a PDF that I can find.

But, did get apache solr installed today and search is working!

'spirit of sharing', Ken

In reply to Ken Task

Re: unoconv not converting documents

by Ken Task -
Picture of Particularly helpful Moodlers

As long as I started this 'saga', may as well finish it here!

Success!!!   Have Annotation and Search in 3.2.latest working on CentOS 7.

Where one host makes a difference.   Some of the issues I had were a result of the image provided by Google for CentOS 7 in Google Engine.   They give you a minimal build ... just like Amazon and Rackspace, but they also have their own ideas about what and they have their own repos.  Once I un-installed some stuff and re-installed manually via rpms or third party repos, it finally all came together.  The hack of unoconv to make it work on CentOS 6 not needed in CentOS 7.

Now the task at hand will be to write it all up ... reminders to self as well as potentially sharing via forums, etc. for anyone who starts to host Moodle on Google's Compute Engine be glad to share what has been learned.

'spirit of sharing', Ken



In reply to Ken Task

Re: unoconv not converting documents

by AL Rachels -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
Yeah! Glad to hear you got it working. Is it with or without SELinux set to Enforcing?


In reply to AL Rachels

Re: unoconv not converting documents

by Ken Task -
Picture of Particularly helpful Moodlers

SELinux set to permissive right now.   Been watching messages log and could adjust selinux if it complains. ;)   That's one major difference with a Google Compute image and a Rackspace virtual that I've seen.    Google has some additional security_compute commands that interact with seLinux.   So far, I've not seen seLinux complain in messages log.

Probably should ask if you know of anything that I probably overlooked?

On a side track ... have you ever heard of anyone providing a Google Compute Image with pre-installed Moodle CentOS 7 or Ubuntu LTS offered for free (to keep in the 'spirit of things')?

'spirit of sharing', Ken

In reply to Ken Task

Re: unoconv not converting documents

by AL Rachels -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

I like to keep SELinux in enforcing as to me, permissive is sort of like living in a high crime area with security bars on all the windows of a house, but one, and trusting the fact that it is closed and locked, is good enough. Maybe okay for a while, but eventually a burglar will make his way through that one window by finding it unlocked, breaking the glass, or jimmying the lock, and rob you blind. In this case when working on getting unocov to work, I kept an eye on the notifications in the SELinux Troubleshooter. It spotted and told me what to do to appease SELinux and let the apache user run it as well as telling me what to do for port 2002. In hindsight I realized I forgot to write down some notes, as after running the fixes, the notifications were cleared from the troubleshooter. I'm too reluctant  to remove everything and start over so I guess I'll try to build a new server and keep better notes. My current server has been running continuously since Centos 7 was released with only a reboot once or twice a year so it's due for replacement/upgraded equipment anyway.

As for a Google Compute Image - Never heard of it until you mentioned it. I've been lucky that my internet cable service lets me run a server in-house that can be publicly accessed, so I have always, (relying on much of the Linux pointers you've provided over the years), ran my own Linux server here at home for the past eleven years.

In reply to AL Rachels

Re: unoconv not converting documents

by Ken Task -
Picture of Particularly helpful Moodlers

I'll look into SELinux some more.  The issue I see with solr is that the GUI interface (an 8xxx) port that helps set up the index to be used for Moodle (can and probably should be done from command line only).   Once set up that port and access to the GUI for solr config should be blocked as it doesn't (right out of the shrink wrap) setup users with access levels.

Like many who remotely host, prefer to keep those without access to GUI desktop of the server ... thus usually install Webmin to help - can setup access control list etc. with Webmin.

Used to run a BBS system at home off one phone line (personal for which I paid the bill).   Had to shut it down ... folks dialing into it in the wee hours of the AM which would awaken me from a sound sleep.    Did a little hosting like you at home but electric bill shot up + had noisy servers whose constant humming also disturbed what should be a refuge from the 'outside world'. ;)

Remotely hosted now is much easier ... but, then again, in such systems, even the providers are still finding catch 22's and gotcha's.  New attack vectors for those who would abuse/misuse. :\

With a shared pre-built image, however, those little un-known until maybe too late things have been expertly dealt with in advance.   But, they do take a certain level of understanding (Google or Amazon) just to get them up and running.

Anyhooo ... thanks for sharing.

We've kinda hijacked this thread!

@Scott ... you still here?   Any of this helping?

'spirit of sharing', Ken


In reply to Ken Task

Re: unoconv not converting documents

by Scott Christy -

Ha! Thanks for remembering me Ken.

Nope, not helping at all. I'm using a Windows server and have no other option.

Does anyone know of ANYONE that got unoconv to work on Moodle with a Windows server?

In reply to Scott Christy

Re: unoconv not converting documents

by Ken Task -
Picture of Particularly helpful Moodlers

I take it you've seen/read/tried:

https://docs.moodle.org/31/en/Installing_unoconv#Installing_unoconv_on_Windows

How good are you in translating Window-ese to Linux CentOS quickie?

The item I did not see in docs for any platform was how to get a 'moodle' index started in solr.    Finally, in reading the readme that came with the tar.gz that was un-gzipped and moved to a location to be able to use it (in my case: /opt/solr/)

There's a README.txt in there that I copied out to web root to be able to see it with the browser:

cp README.txt /var/www/html/solrreadme.txt

Then with browser: http://yoursite/solrreadme.txt (you can remove it later).

From that readme, found how to start solr and build the index (with nothing yet in it (for moodle) .... that step had been very troubling.

in /opt/solr:

bin/solr start
bin/solr create -c moodle

If I change into bin first and tried issuing solr start (that would work) but the solr create -c moodle (the search index for Moole) would not work.   Guess the solr bin needed to be executed at the root of it's files.

After setting up a listener - that's shared in the Moodle docs, logged onto the Moodle and stepped through the configuration of Solr.

After that ... things worked. ;)

Know what I've shared is really Linux, but maybe it might help if you can translate to Windows. ;)

On thing easily missed in docs ... solr uses port 2002 for accessing the localhost (127.0.0.1) java instance of solr.   Firewall on Windows?   On linux box it wasn't an issue - localhost.

'spirit of sharing', Ken


In reply to Ken Task

This forum post has been removed

The content of this forum post has been removed and can no longer be accessed.
In reply to Deleted user

Re: unoconv not converting documents

by Ken Task -
Picture of Particularly helpful Moodlers

@Jon .. Glad you are on your way to resolution ...

First, CentOS is my chosen poison ... not Ubuntu ... was doing this on a VBox sandbox
in Ubuntu 16.04 to assist Jon  (weekend issues tend to have to wait until Monday AM)... and learning Ubuntu along the way.

So this is a 'for what it's worth' sorta thing.

Observation and a way to check if the unoconv service/listener is properly
installed ....

In setting up a CentOS 7 server with full features Moodle 3.2.x got to the point
of setting up unoconv and rather than from command line used Webmin to set that up.
After creating the unoconv listener as Moodle docs suggested and running it the first time via Webmin, Webmin showed something I had not seen via command line ....
the creation of yet more files related to the listener/service.

So on a CentOS 7 server, if the listener is properly configured and running
as expected, use this to see if those other related files to a service/listener
are there:

find / -name unoconv.service

Output should show:

/sys/fs/cgroup/systemd/system.slice/unoconv.service
/etc/systemd/system/multi-user.target.wants/unoconv.service
/etc/systemd/system/unoconv.service

Doing same for Ubuntu 16.04 dev box and following directions for installing
unoconv, libreoffice then getting to the setup of a listener:

https://docs.moodle.org/31/en/mod/assign/feedback/editpdf/testunoconv/upstart

Get to the step about starting unovonv:
start unoconv

in the comments of the unoconv.conf file it says:

Install to /etc/init/ folder and start with "sudo service unoconv start"

If I use service unoconv start it gets:
Failed to start unoconv.service: Unit unoconv.service not found

In chasing' that rabbit ...
Found this:
https://www.digitalocean.com/community/tutorials/how-to-use-systemctl-to-manage-systemd-services-and-units

Systemd is an init system and system manager that is widely becoming the new standard for Linux machines.

So went back to the CentOS 7 box to see ...

[root@sos ~]# systemctl status unoconv.service
● unoconv.service - Unoconv listener for document conversions
   Loaded: loaded (/etc/systemd/system/unoconv.service; enabled; vendor preset: disabled)
   Active: active (running) since Tue 2017-04-11 08:42:35 CDT; 35s ago
     Docs: https://github.com/dagwieers/unoconv
 Main PID: 26803 (python)
   CGroup: /system.slice/unoconv.service
           ├─26803 python /usr/bin/unoconv --listener
           └─26805 /usr/lib64/libreoffice/program/soffice.bin --headless --in...

Apr 11 08:42:35 sos.tcea.org systemd[1]: Started Unoconv listener for docume....
Apr 11 08:42:35 sos.tcea.org systemd[1]: Starting Unoconv listener for docum....
Hint: Some lines were ellipsized, use -l to show in full.

That's what one should see in Ubuntu as well.

in Ubuntu

root@ubuntu1604:/lib/systemd/system# systemctl status unoconv.service
● unoconv.service
   Loaded: not-found (Reason: No such file or directory)
   Active: inactive (dead)

So, took the CentOS 7 directions and used them in Ubuntu 16.04
Yes, I know ... shouldn't do that ... however ...

In /etc/systemd/system/unoconv.service

[Unit]
Description=Unoconv listener for document conversions
Documentation=https://github.com/dagwieers/unoconv
After=network.target remote-fs.target nss-lookup.target

[Service]
Type=simple
Environment="UNO_PATH=/opt/libreoffice5.2/program"
ExecStart=/usr/local/bin/unoconv --listener

[Install]
WantedBy=multi-user.target

Adjusted

ExecStart=/usr/local/bin/unoconv --listener
to
ExecStart=/usr/bin/unoconv --listener

and
Environment="UNO_PATH=/opt/libreoffice5.2/program"
to
Environment="UNO_PATH=/usr/lib/libreoffice/program"


root@ubuntu1604:/lib/systemd/system# systemctl enable unoconv.service
Created symlink from /etc/systemd/system/multi-user.target.wants/unoconv.service to /etc/systemd/system/unoconv.service.

Note that above it created symlinks from other files needed to setup a service in systemd.

Then issued:
root@ubuntu1604:/lib/systemd/system# systemctl start unoconv.service
no complaints

However ....

root@ubuntu1604:/lib/systemd/system# systemctl status unoconv.service
● unoconv.service - Unoconv listener for document conversions
   Loaded: loaded (/etc/systemd/system/unoconv.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Tue 2017-04-11 08:55:30 CDT; 1min 15s ago
     Docs: https://github.com/dagwieers/unoconv
  Process: 4347 ExecStart=/usr/bin/unoconv --listener (code=exited, status=1/FAILURE)
 Main PID: 4347 (code=exited, status=1/FAILURE)

Apr 11 08:55:30 ubuntu1604 systemd[1]: Started Unoconv listener for document conversions
Apr 11 08:55:30 ubuntu1604 unoconv[4347]: unoconv: Cannot find a suitable office install
Apr 11 08:55:30 ubuntu1604 unoconv[4347]: ERROR: Please locate your office installation
Apr 11 08:55:30 ubuntu1604 unoconv[4347]:        http://github.com/dagwieers/unoconv/iss
Apr 11 08:55:30 ubuntu1604 systemd[1]: unoconv.service: Main process exited, code=exited
Apr 11 08:55:30 ubuntu1604 systemd[1]: unoconv.service: Unit entered failed state.
Apr 11 08:55:30 ubuntu1604 systemd[1]: unoconv.service: Failed with result 'exit-code'

Ok, it failed but we're getting closer!!!

lsb_release -a
No LSB modules are available.
Distributor ID:    Ubuntu
Description:    Ubuntu 16.04.2 LTS
Release:    16.04
Codename:    xenial

root@ubuntu1604:/lib/systemd/system# find / -name soffice.bin
/usr/lib/libreoffice/program/soffice.bin

Changed the path in the listener/service setup ...

Reloaded systemctl config

Reissued start no complaints
Checking status:

root@ubuntu1604:/lib/systemd/system# systemctl status unoconv.service
● unoconv.service - Unoconv listener for document conversions
   Loaded: loaded (/etc/systemd/system/unoconv.service; enabled; vendor preset: enabled)
   Active: active (running) since Tue 2017-04-11 09:14:27 CDT; 6s ago
     Docs: https://github.com/dagwieers/unoconv
 Main PID: 4624 (python3)
    Tasks: 7
   Memory: 119.2M
      CPU: 464ms
   CGroup: /system.slice/unoconv.service
           ├─4624 python3 /usr/bin/unoconv --listener
           └─4635 /usr/lib/libreoffice/program/soffice.bin --headless --invisible --nocr

Apr 11 09:14:27 ubuntu1604 systemd[1]: Started Unoconv listener for document conversions

*** success!!!! ***

spirit of sharing', Ken

Average of ratings: Useful (2)
In reply to Ken Task

This forum post has been removed

The content of this forum post has been removed and can no longer be accessed.
In reply to Deleted user

Re: unoconv not converting documents

by Ken Task -
Picture of Particularly helpful Moodlers

Good for me ... sandbox isn't production! :\   Not necessarily good for you. sad  But do hope it is! smile

But ... may have hit upon why things ... that were working ... all of sudden ... weren't with your server.   Am aware that with Ubuntu one could do an in-place upgrade.  Maybe former admin did that ... which may have left some old 14.0x stuff around on your server.   Some update to your 16.04 server 'fixed it' ... or 'broke it' ... we'll probably never know for sure.

Anyhoo ... maybe ... just maybe ... this thread/discussion/cussion will help someone else who runs into 'strangeness'.

Oh, yeah ... feel free to rate anything that did help as useful.

'spirit of sharing', Ken


In reply to Ken Task

Re: unoconv not converting documents

by Rick Jerz -
Picture of Particularly helpful Moodlers Picture of Testers

Ken, great work.  In fact, you inspired me so much that I am going to try to set up a CentOS 7 sandbox this summer and experiment.  Thanks much.

I do have two questions.

1) When I go to the CentOS website, they have a very easy "Download" button.  But I am not sure if this is the server version of the software that you have used.  The file name is CentOS-7-x86_64-Everything-1611.iso.  Is this what you are using, or do you use something else?

2) (You are going to hate this question...) Your path to success was very thorough.  If you had to repeat this process knowing what you now know, what would be your steps to success (in CentOS 7)?

In reply to Rick Jerz

Re: unoconv not converting documents

by Ken Task -
Picture of Particularly helpful Moodlers

Nah ... don't hate the question at all.   Glad to share ... but will be brief ...

With CentOS 7, choose minimal.   Yes, that means one has to build more, but the reason for that is simple.  One ... you learn to admin the system cause you built it.   And, two,  won't have to un-install the lower versioned PHP to get PHP 7.0 or 7.1 from 3rd party repos   CentOS is RHEL with no RHEL eye-candy.   They also, like RHEL, want you to use MariaDB .. not MySQL.  Haven't seen anything in Moodle (nor WordPress, nor Joomla) that might be taking advantage of the things MariaDB doing now .. so 'stick with what works' ... MySQL.  Can always change you mind later and get MariaDB (at least one can right now).

Install Webmin ... that would be really the first step to the building.   Does give an open sourced cPanel like interface into the OS.  Apache, MySQL, PHP tweaks, easily done there.    Webmin can update itself from within Webmin.   Webmin can schedule OS updates to automagically install any security updates or all updates without human interaction.   Have set some ISD servers up that way knowing full well that to them it's a black box ... none inside the ISD touch it.   Only time anyone should do something ... kernel upgrade requires reboot.

In the last 15 years that setup has had issues only once ... easily fixed ... directions were sent via EMail.

One of the other things I do now is change the 'standard' port 22 for ssh to something else.  In less than 2 minutes today new servers get their first pokes and probes at the ssh port - not that they can guess a secure password easily ... they never stop ... annoying ... sooooo take away

Then one can acquire Moodle via git (install git first) so that installations can be done via command line ... no issues with infinite loops.   And it can, from that time forward, be easily updated or upgraded.  Zero day flaws .. fixed/patched in a matter of minutes ... as soon as Moodle HQ releases them.

Then there's the additional handy stuff ... mysqlTuner, OS tools dns-utils, iptraf, alpine, zip and unzip etc. and as one needs/discovers one needs, install other.

Not long ago, there was a sys admin ... new, just taken over, etc..  Had Scientific Linux.   Couldn't allow remote assitance .. so http://sos.tcea.org/moodle32/  CentOS 7 with Apache Solr search working, Annotation working ... and a course for Installing Moodle Solr SLinux 6 or CentOS 6 or CentOS 7 - self-enrol ...   patterened after what was done with a BC, CA user running Ubutnu 16.04 ... that had Moodle Partner backups to restore but assistance to do so, didn't finish, etc.   Was truely an old-time course by 'correpondence course' via EMail with txt file attachments that had 'copy and paste' commands.

Uhhh .. have now earned an 'omicron badge' twice over, me thinks! smile

'spirit of sharing', Ken

In reply to Ken Task

Re: unoconv not converting documents

by Rick Jerz -
Picture of Particularly helpful Moodlers Picture of Testers

Ken, I was thinking the same way, choose minimal so that I can learn more along the way.

Here are a few more questions:

1) I am setting up this CentOS as a sandbox using VMWare.  In this local install, will it be accessible by my normal browser?  For example, in my MAMP installation, I can do http://localhost, in order to interact with it?  Will the sandbox CentOS had the equivalent of a "local" access mode? (sorry for this very basic question)

2) For the production Moodles that you help administer, are they running CentOS?

3) Are you yet moving to php 7?

4) You imply that this local sandbox is accessible to the world (change ssh port).  I didn't know this?  But maybe this is related to my first question.

Yes, I plan to stick with MySQL for now.

Thanks for the reference to sos.tcea.org/moodle32.

In reply to Rick Jerz

Re: unoconv not converting documents

by Ken Task -
Picture of Particularly helpful Moodlers

I wonder if we couldn't impose upon the moderator of this forum and ask that this jabberwalk be moved to it's own thread - dunno which forum fits.  We are piggy-backing here.

'spirit of sharing', Ken

In reply to Ken Task

Re: unoconv not converting documents

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

I would if I could figure out where to split it... without reading it all sad

In reply to Howard Miller

Re: unoconv not converting documents

by Ken Task -
Picture of Particularly helpful Moodlers

Point taken smile ... how about with Rick's question?

https://moodle.org/mod/forum/discuss.php?d=345337#p1415384

Jon had two going at the same time ... dunno about his.

'spirit of sharing', Ken


In reply to Ken Task

Re: unoconv not converting documents

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

I'm inclined to leave it because Rick's question doesn't really stand on its own.

In reply to Howard Miller

Re: unoconv not converting documents

by Rick Jerz -
Picture of Particularly helpful Moodlers Picture of Testers

Yep, I know what both of you mean.  In the post that Ken mentions, I am asking a question about the original topic "unoconv" and then I ask a second question based upon something I saw (CentOS) in Ken's post.

Hmmm, for now maybe I can end it and wait for another more proper time and place to ask Ken these questions.  My questions are shifting to "server administration" questions.

(Sorry about this.)

In reply to Rick Jerz

Re: unoconv not converting documents

by Ken Task -
Picture of Particularly helpful Moodlers

@Rick ... 'another more proper time' could be just like this thread.

So start a posting ... don't have to specifically address to me.   There are others that run CentOS ... am not alone ... and am not the foremost expert ... for sure.   I'll be happy to provide my 2 cents.

'spirit of sharing', Ken


In reply to Ken Task

This forum post has been removed

The content of this forum post has been removed and can no longer be accessed.
In reply to Rick Jerz

Re: unoconv not converting documents

by Ken Task -
Picture of Particularly helpful Moodlers

@Rick ... appears everyone is too busy to move this discussion to another thread of it's own, so start one ... and will repond there.

'spirit of sharing', Ken


In reply to Deleted user

This forum post has been removed

The content of this forum post has been removed and can no longer be accessed.
In reply to Deleted user

This forum post has been removed

The content of this forum post has been removed and can no longer be accessed.
In reply to AL Rachels

Re: unoconv not converting documents

by Ken Task -
Picture of Particularly helpful Moodlers

Since you've mentioned Google Compute Engine ... have almost determined that it's not for Moodle ... have a customer representative that is talking with technical about some issues.   With a hosting thing that large ... 5 biz days is quick! :\

Now here's the skinny .... billing is based upon usage ... cpu cycles etc..   I've never shared with anyone the URL to it, yet it's scanned and 'searched' by guess who?   Google of course!   The scans appear to be a bot looking for vulnerable PHPMyAdmin's ... sometimes 25 times for each possible location in the bot script ... there are about 30 alternative locations one might have installed PHPMyAdmin ... PMA, pma, p/m/a, etc. etc. (depends upon which popular blog you did your install from - *** there's a hint!!! ***.

Those hits count on billing ... what was extremely affordable for a true sandbox (latest and greatest everything) has turned into an 'expensive' jaunt into GCE ... that needs 'fixin' IMHO.

Know that ISD's (that I still support) can't do variable billing.   Blows the heck out of a small and very  limited budget.  Biz manager, the State of Texas Auditors or whomever watches that sort of stuff would flag and have a hard time justifying the cost (me thinks).

As we know, a Moodle could sit pretty dormant during the school year .... from 5:00 PM till next school day AM .. 7?8?   And pretty much 'dead', on vacations/breaks, etc..  That, however, won't make up for the heavy hit bot scan days with 'regular usage' (whatever that is for an ISD).

Now if a School had Goolge For Education ... it might be different.   Got one of those ... collaborating with an ISD that is interested.   Head of Tech in that school is also the Biz Manager.

Amazon Web Services, even though 'more expenive' are looking better and better.

From investigation one can get CentOS 6 or 7 Ubuntu 16.14 ... (some Bitnami) others you pick decided yourself.   Spin one up in really a matter of minutes.   Hmmmm ... if a package like that could be shared ... no cost ... be darn simple to get up and running with a Moodle - latest and greatest with unoconv working with listener working with ibreoffice pre-installed with Apache Solr also pre-installed + index for one site - etc.

Yes, there are also now other ways ... vagrant?

Whole picture is changing ... those that change with it will be around for a while (good or bad) ... those that don't may soon find themselves scratchin' head, looking around, and wondering what the heck happended!

Don't me wrong ... Amazon and other virtual providers are finding new stuff that needs fixin' all the time.   So anyone reading this, tread slowly ... carefully! ;)

'spirit of sharing', Ken


In reply to Ken Task

Re: unoconv not converting documents

by Scott Christy -

This is all great.... now if I only could get unoconv working on a Windows server.......  angry

In reply to Scott Christy

Re: unoconv not converting documents

by Ken Task -
Picture of Particularly helpful Moodlers

Sorry, Scott.  As the original poster in this thread ... it's jabberwalked away from your specific platform/issue.   That's the reason for request to move the jabberwalk to an appropriate forum and thread of it's own.

But, are you seeing anything that might give you cause to look at the issue from a different angle?

'spirit of sharing', Ken

In reply to Scott Christy

Re: unoconv not converting documents

by Ken Task -
Picture of Particularly helpful Moodlers

Doesn't appear there are Windows specific experts responding.   Maybe you could PM @Usman and ask specifically.

https://moodle.org/user/view.php?id=1183102&course=5

Gonna throw this out as well ... cause don't think the unoconvert test can be performed on Windows ... the -vvv switch an example.   So ... considering adding (after researching) some additional functionality in Windows ...

https://www.gnu.org/software/bash/bash.html
http://www.cygwin.com/
http://win-bash.sourceforge.net/

Might want to test those on a non-production server ... just in case.

'spirit of sharing', Ken


In reply to Scott Christy

Re: unoconv not converting documents

by Ken Task -
Picture of Particularly helpful Moodlers

Ok, am back again ... and the following isn't a direct solution to the problem ... more FYI which might lead to a solution and, at the same time, 'future proof' one's choice of poison.

Here goes:

Microsoft is moving forward with an MSSQL for Linux.   PowerShell has now been opened sourced and I"ve read that has led to Windows Server admins running powershell the ability to run bash shell scripts.   That last one alone might come into play here.

In the documentation to unoconv there is mentioned running a dedicated server just for conversions.    That server could be a Linux server dedicated to just that purpose and supposedly return converted docs back to Moodle on Windows.

Here's the FYI resource:

http://searchsqlserver.techtarget.com/tip/What-SQL-Server-for-Linux-says-about-Microsofts-future-plans

Hope it leads to resolution!!!

'spirit of sharing', Ken

In reply to Ken Task

Re: unoconv not converting documents

by Mary Cooch -
Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators

If and when you are able to upgrade to Moodle 3.3 you could set up OAuth 2 services for Google and use the Google Drive converter. (More info on release)

In reply to Mary Cooch

Re: unoconv not converting documents

by Scott Christy -

Just upgraded to 3.3.  The Google OAUTH approach is MUCH BETTER. Hit a few stumbles on the setup but once I sorted that out I was able to get everything working in the Site Admin and the test conversion worked. Now I have to figure out why it's not working in my test course.....taking a look at that next.

Word of advice....
If you're using UNOCONV on a Windows server, or any kind of server for that matter, save yourself the headache and upgrade to Moodle 3.3 with the Google Document Converter option instead.

Average of ratings: Useful (3)
In reply to Scott Christy

Re: unoconv not converting documents

by Mary Cooch -
Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators

Good to hear smile Please let us know how you get on with getting it to work in your course  -and what the issue was, so others may benefit.

In reply to Mary Cooch

Re: unoconv not converting documents

by Scott Christy -

Looks like it was a false positive.

The assignment in question was what I was using when I was trying to get UNOCONV to work under version 3.2 of Moodle. I tried deleting the upload in the assignment in question and uploaded a different MS Word document - didn't work. Next I created a new assignment and tried everything over again and this time it worked. Must have been something from the previously failed UNOCONV conversion process that was causing it to not convert even with the newer Google Document Converter plugin.

It has been a long frustrating process but FINALLY our new Moodle server is ready for prime time. And with almost 2 weeks to spare before the go live date no less!  big grin   Heck, I still have time to mess something else up!

Thank you to the team who developed this plugin as part of v3.3. It's definitely an improvement.

In reply to Scott Christy

Re: unoconv not converting documents

by Ken Task -
Picture of Particularly helpful Moodlers

HOOORAH!!!!   Glad to hear it!

'spirit of sharing', Ken


In reply to Scott Christy

Re: unoconv not converting documents

by Christopher Murad -

Since this seems to be the proper place I thought I would chime in with my experience as of late with this.

We have been upgrading our various sites throughout the year and as they are being upgraded to 3.1 or 3.2 I have been enabling the Annotation feature, I feel I have been able to create a good instruction set to follow when implementing and can consistently get it setup working in our various RH7 Environments.

With a recent upgrade to one of our bigger / more used sites we were getting reports of the "storedfilenotcreated"  for some assignments - after googling and digging through the tracker I was able to get it resolved ( MDL-55859 ) - but after teachers started using it - unoconv would hang and take CPU power and cause issues with the site.

I appreciate this discussion and seem to concur with Mr. Miller that this was rushed and should have been an "experimental feature"

Some of the other sites we have are still using it but If i see this occur we will just disable it until this is more stable.

Thanks for letting vent.

In reply to Christopher Murad

Re: unoconv not converting documents

by Scott Christy -

My advice, take it for what it's worth....

Upgrade to version 3.3 of Moodle, ditch the UNOCONV option and set up the Google Document Converter plugin option instead. It works flawlessly, seems to be WAY more stable, and you'll have this solved in no time.

In reply to Scott Christy

Re: unoconv not converting documents

by Christopher Murad -
Does each user have to have a google account in order to use their converter ?
In reply to Christopher Murad

Re: unoconv not converting documents

by Damyon Wiese -

No - there is one google account used by Moodle as a "System Account" to do the conversions.

In reply to Christopher Murad

Re: unoconv not converting documents

by Scott Christy -

Right, as Damyon said, you need an account that acts as a Moodle admin account for setting up the API in the Google API Console. This account also needs to match up with a user in Moodle.

The one thing I missed in the set up directions is to make sure in the OAuth 2 services screen (site admin --> server --> OAuth 2 services) that you put the account you registered with Google in the "System Account Connected" box. Simple mistake. Not sure how I missed that.

On a separate but related topic...

At the risk of sounding like Captain Obvious, if students are uploading documents from Google Apps for assignments they  log in to their own Google Drive account in the upload screen in order to access their documents on Google.  The Google Document Converter set up is separate from that.

In reply to Scott Christy

Re: unoconv not converting documents

by Jari Vilkman -

Hello,

I'm having problems with Unoconv after upgrading Moodle 3.1 sites to Moodle 3.3. 


1. Test unoconv path -page says "The unoconv path appears to be properly configured." but when I press "Download the converted pdf test file." I get an error;

"Coding error detected. It must be fixed by a programmer. id is required to delete".

2. Also no PDF is generated for the student submissions in the grading window in assingment from any file (PDF, ODT, DOCX)

This happens in Moodles that have been updated from 3.1 to 3.3, they are all on the same server as are some other Moodle 3.1 installations and in these Unoconv works fine. So it seems 3.3 upgrade is the fault.

Do anyone else have similar problems? Please comment here;

https://tracker.moodle.org/browse/MDLSITE-4616



In reply to Scott Christy

Re: unoconv not converting documents

by Valery Fremaux -
Picture of Plugin developers

Getting here for some help as i face also severe and durable issues with the grader :

I was assuming this was a bad setup of unoconv on my systems (Debian Jessie). And probably it is, but i do even no rach to load the pdf editor when the submission is a pdf already. Do unoconv has something to do with pdf sumitted files ?

there are two undefinitely loading gifs turning round with no replacement : the pdf editor. and the pdf feedbacl list.

Also when i click on Lauch Pdf Editor on, the grader form, absolutely nothing happens (no event is bound to the button).

I tried digging deeper in the code (i'm quite good now in usual case), but the grader construction is far too opaque.... and several wxeeks are passed now without the single point of an idea...

Some key receipe point i might follow to get that solved out . I have around 500.000 students waiting for it being working... sad

On another system (running RHEL 7) things are even worse : i am facing jquery complains about a strange syntax error (on a ''}")

all platforms are running moodle 3.1 with an essential derivated theme.

If unoconv is mandatory for all this being working fine...  some kind of installer facilitation should be great. I guess many moodle admins do have common knowledge of Unix as i have, but no Unix guru knowledge by the way...

In reply to Valery Fremaux

Re: unoconv not converting documents

by Scott Christy -

Go with the Google drive document converter instead. It works flawlessly. I wish it would convert documents a little faster, but overall it's a big improvement over trying to get UNOCONV to work.

See:

https://docs.moodle.org/33/en/Google_Drive_converter


In reply to Scott Christy

Re: unoconv not converting documents

by Rafael Mota -

Friends I saw the topic many similar things but my problem, but I did not find anything similar to my symptom. I use CentOS 7 and Moodle 3.3.2+, I can not use Google to do the conversions of my pdfs, so I use unoconv, but in some cases cases the files in word simply crash in mysql and do not suffer the conversion to pdf and with that the bank simply stops and converts neither the current nor the next. When deleting the one that is locking the mysql the others return to work.

In reply to Valery Fremaux

Re: unoconv not converting documents

by Aaron Stanley -

I've been trying to work out our issue with unoconv on a Jessie install (Moodle 3.2+, Apache2.4, PHP 5.6) as well. I have had positive results with a few different options. 

  •  Place an environment change in the /usr/bin/unoconv script around line #1206:
    • ### Main entrance
    • os.environ['HOME'] = '/tmp'                <------- Added this line
    • if __name__ == '__main__':
Changing the HOME variable to /tmp from the default of /root works for us but maybe changing that fariable in the unoconv script is not a best practice since the script will undergo an update at some point and scrub the change.


Another option:

  • Place a line in /etc/apache2/envvars about line #5 or so (then restart Apache)
    • # this won't be correct after changing uid
    • unset HOME
    • export HOME=/tmp                     <------- Added this line
Adding the envvars line changes the HOME variable for the Apache user I believe while still keeping the system HOME as /root. I do not know if this is a wise thing to do (simply because I am not an Apache expert, barely a novice).


Last option which may be a good one:

  •  add a putenv("HOME=/tmp"); in the Moodle config.php file.


In our case each of these has resulted in the unoconv tool working properly. I get the feeling that setting the HOME variable in the config fill will provide the safest results as it would then limit the effects to just the Moodle application.

As it turns out, changing the owner of /var/www to the www-data user also works.

In reply to Aaron Stanley

Re: unoconv not converting documents

by Rafael Mota -

Thank you very much,

I'm going to run the tests here on my machine and hope that I notice the defect I'm facing.

In reply to Scott Christy

Re: unoconv not converting documents

by Louisa van der Linden -

Thanks Scott for stating you missed the "System Account Connected" box. It solved my setup 100% and it was quite smooth sailing.

In reply to Scott Christy

Re: unoconv not converting documents

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Just to add (if nobody was listening previously). Unoconv is not fit for purpose. It has all sorts of problems but the biggest one is that it is single-threaded. So if it fails, which it will, it locks up until you restart it. I appreciate that it is not all unoconv's fault but that is no comfort if you have users shouting at you. 

Use Google's document converter. We have been using it on a very large site and - so far - no problems at all. I'm just waiting for Google to catch onto this and it no longer be free but that's another matter. See Google_Drive_converter

Average of ratings: Useful (1)
In reply to Howard Miller

Re: unoconv not converting documents

by Jari Vilkman -

Google Drive Converter isn't a good option in Europe since upcoming GDPR-law;


https://en.wikipedia.org/wiki/General_Data_Protection_Regulation


We don't know  to where the files are uploaded from Moodle, Google won't tell us where the servers are located physically.

In reply to Jari Vilkman

Re: unoconv not converting documents

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

True - but, if you can find away around that, it actually works. Which is nice wink

In reply to Howard Miller

Re: unoconv not converting documents

by Nadav Kavalerchik -
Picture of Core developers Picture of Plugin developers Picture of Testers Picture of Translators

There are several OS level hacks to make it restart if it fails, or get into 100% cpu load (as it sometime does)

In reply to Nadav Kavalerchik

Re: unoconv not converting documents

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Very true... we spent a load of time building "hacks" to keep the thing going. 

In reply to Nadav Kavalerchik

Re: unoconv not converting documents

by Jari Vilkman -

Hello,


Can you share any of these hacks? So everyone else would know how to do them.

In reply to Jari Vilkman

Re: unoconv not converting documents

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

I'm not sure there's a helpful answer. It's a matter of monitoring tasks on your server which you should probably be doing anyway. There are lots of options for this. If you identify the libreoffice and/or unoconv tasks as having 'stuck' you can kill and restart them. 

In reply to Scott Christy

Re: unoconv not converting documents

by Jason Touw -

Hi Scott,  

I was reading your posts with getting the Annotate PDF converter to work and wondered where you are at with it?  (This was a very long thread)  We run moodle 3.3 on Windows with no success on this... and YES, our school is also required to use Windows 2012R2 Servers.

Thank you,

Jason

In reply to Jason Touw

Re: unoconv not converting documents

by Alain Raap -
Picture of Particularly helpful Moodlers

I had some problems too to get unoconv working on our environment (Red Hat 7, Moodle 3.1.5+). Our problem was caused by the SELinux security policies.
For unoconv you have to add this policy setsebool -P httpd_execmem on, after this change we got the document converter working. Just a tip for Linux Red Hat 7 users.

In reply to Jason Touw

Re: unoconv not converting documents

by John Banner -

I could not get this to work either, it was always generating a blank PDF but I finally got it working! Windows Server 2016 with Apache and PHP 7.0.

Not sure which change did it, but here is what I did,

Set path to bat file with forward slashes instead,

C:/software/moodle/unoconv/unoconv.bat

AND WHAT was probably the issue and I never noticed, the setting to enable/disable the document converter was actually disabled but with boost theme it actually looked enabled but wasn't! So I enabled it and viola, it is now converting files to be graded into pdf's

John

In reply to John Banner

Re: unoconv not converting documents

by Rick Nickle -

I followed this thread after having similar symptoms, but I had a different solution.

In our case, we are migrating from 3.1 to 3.5, and unoconv seemed to be configured and working perfectly, just as it had in our old environment, but the documents in the new 3.5 environment were being rendered blank in the grading application.

The unoconv path that used to be set in System Paths, was now an item in the admin/settings.php?section=managefileconverterplugins menu that needed to be enbled or disabled.  Since we jumped a couple of versions, we needed to explicitly enable that plugin.