-
Notifications
You must be signed in to change notification settings - Fork 8
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
No PDF generated, no log #118
Comments
Any help appreciated. |
I have similar setup and got the same problem. I am not sure about the cron.php. Does flow work at all in your case? |
@janikvonrotz yes, flow's working fine for "Block access to a file". We get no other flow setup at the moment. |
Whatever the background jobs method, no PDF is generated with this workflow. Surprising there's no reaction here, apart yours, @janikvonrotz to confirm the problem. Is this feature still supported? |
Well I gave a thumbs up, to support this issue and to show that I'm also affected :) |
Im on the same page here. This dosent seems to work. Also, I did a post on the help forum of nextcloud. |
Alright, thanks @glorenzutti |
For some updates, I did comment on @glorenzutti post in the help forums to be able to figure out the problem. Follow the forum thread in case the fix is found, but I don't really have high hopes. |
I already do that, following this help forum thread... ;-) |
@manu-p back in March I tried to implement this and could not get any action in the log (or PDF in the folder). Following. |
@rcdncn You need to be patient, I found that the cronjob for conversion is executed each 5 minutes not as soon as a file is edited. I did found that I get logs each time it tries to run, but the reasons array is empty since the shell_exec command just doesn't return anything. There might be a bug in the php version used, or just the command. I am not that familiar with PHP though. |
For the devs, here is what I did for testing and searching. It is from the post I commented on the Nextcloud Help forum. I confirmed first that my entry for the Flow was well configured with someone from the community. Since I was using Nextcloud in a docker, I had to install the libreoffice binary into the docker image to have it. I can use the “libreoffice” command anywhere in the image since it is configured to run in the path. I changed a docx file a lot of time to test each changes I could have done. Even restart the docker container for nextcloud. I’ve configures a flow to send messages to Talk to be sure that the flow cron updates did actually worked to be sure I didn’t messed with this feature. It did sent a message into a conversation each time I did something that fits the creteria of the PDF converter, which I copied into my other flow for talk message. I was also curisous to find if it was something else I have done with my installation so I’ve looked at the source code for the extension to convert to PDF and here is what I found. The extension code should be able to detect my libreoffice installation in this method workflow_pdf_converter/lib/BackgroundJobs/Convert.php Lines 130 to 147 in 6951eb1
The first step check if the configuration 'preview_libreoffice_path' => '/usr/bin/libreoffice' is documented which I have, but by default it is not. So normally, the next step check for the binary location with the command shell_exec('command -v libreoffice'); on line 136 of the Convert.php file in the BackgroundJobs folder of the lib directory. I wanted to go further to do some more testing to prove the thing is not working. Here is what I did. Setup: Virtual Machine with
When I update a file, the talk message is well received But when I check to see if there is a PDF generated, nothing is happening. I looked at the logs and this is what is returned. When I setup the config in the config.php, the error show "Could not convert file Test.docx, reason: []". There is no error in the reason array. Nothing is happening. After looking again at the source code, it might just be the exec that always return a non 0 return code and never continues the save process. This might be the reason the array of reason is empty. I could debug the code, but I don’t really want to go that deep since I can reproduce the error with a fresh install of Nexcloud on docker or in a VM. So I don’t know what the issue is really. More debug should be done, but at this point, I think the maintainers could check it out. The problem seems to be on any platform. Even the leaders on the forum told me that their installation stop generating PDFs for a while. Hope this helps |
Think i solved it. The underyling problem is that libreoffice will be run with www-data user and it needs the directory ~/.cache/dconf/ Since the home-directory of www-data usually is /var/www which is owned by root, www-data can´t create the directory and libreoffice fails to convert. So either: sudo mkdir /var/www/.cache/dconf/ OR change the home directory of www-data via passwd to somewhere else and create .cache/dconf/ there. The first method probably has some security impacts whilest the second method probably has some stability impacts for software that relies on www-data home beeing /var/www Maybe someone else knows a better solution? |
Hi, glad to read it works for you (at least). But not for me (1st method). Still no pdf generated (15 min cron job), still nothing in log files (nextcloud and nginx). Maybe related, or not, I sometimes get a error mail from Cron: Seems to be related to the preview generator, but in case... |
Okay, try the following:
"3" is the exact command with the same priviledges that would be used by this app. Now there are 2 possible outcomes: After the command has finished, /tmp/ConverterTest.pdf exists. If this is the case: Second possibilty: The command fails. You get the error which is the cause why the app doesn´t work I think I maybe got the bug in this app which prevents printing something useful into the log: $exec = $command . $clParameters . escapeshellarg($tmpDir) . ' ' . escapeshellarg($tmpPath); should be $exec = $command . $clParameters . escapeshellarg($tmpDir) . ' ' . escapeshellarg($tmpPath).' 2>1&'; That redirects STDERR to STDOUT which is saved to $out. |
Hi, thanks @xDeerStalker for taking care. I used a .odt instead of .docx, don't think it makes a big difference, and here's what the output gives me (sudoed as root):
and when I cd /tmp before:
"2>1&" is just a shell redirection to put stderr (2) to stdout (1). |
Yep, that's the same error i got, just with another home directory for www-data which seems to be /root in your case. please verify with: this should in your case return something like this: usually the home-directory of www-data is not /root but /var/www and the output should look like this: I would suggest changing the home directory, but you have to check if www-data owns something inside /root for whatever reason. To do so, type:
if the command above returns nothing you´re probably good to go.
If you didn´t revert the changes i suggested (creating /var/www/.cache/dconf and changing priviledges with chown) you can just and the bug should be solved. In any case, don´t mess with priviledges for the /root directory and don´t create .cache there. At least that´s my advice.
Yes and exec() in php seems to only print stdout which would be the reason why the exception you get when you run the command manually is not logged. A similar problem can be found here |
Nope!
Exactly what you're showing too. There must be some other issue somewhere...
|
Yea, i´m stupid. I could reproduce your error and it´s no miracle - you got the wrong command from me =/ Ignore this: and replace that step from #118 (comment) with: 4: For whatever reason in this case, sudo -u www-data ; and sudo su www-data; ; don't produce the same output. Usually, any commands that are triggered by the command behind sudo (let´s say a lot of programs in a script) indirectly are run with the same user you sudoed into. This is not the case here. I think as soon as the exception throws and libreoffice exits with code != 0, sudo is considered done. Then, when the actual error gets printed, you are back in the account you started from (root i guess?) and all the relative paths with their nice shortcuts are replaced by absolute paths - but this pathconversion should happen inside libreoffice before it exits and not somewhere else. Probably a bug of libreoffice ; i´m able to reproduce it from multiple accounts. It´s always requesting access to ~, ~/.cache and ~/.cache./dconf where ~ is replaced by the absolute path to the user-home of the user you sudo -u from. Okay, long story short: sudo su directly into www-data and you probably get the exception that you have no access to /var/www. So grant privileges ( Now it gets funny: remove all the given the privileges again which means changing /var/www back to root:root and the same for .cache and .cache/dconf It still works. How? black magic of open source software ;-) I think the permissions for www-data/libreoffice aren´t really needed to get the job done but they are an initial requirement to get it working. |
Hey Guys, NO Luck the Convert Workflow App is still not working. |
@phil16727 While executing that command you don´t get any exception and after the command is finished and
I dont´t think so, maybe our conversation will lead to some "how to" |
Hi, |
Okay, please after that, run if that finishes without an error, verify /tmp/ConverterTest.pdf exists. If the command throws an error, please post it here |
Hey @xDeerStalker |
because that's the only way to get the real cause of the error while the nextcloud log will always say "reason: []". |
OK i will do that, but I have no var/www/nextcloud since the installtion is though snap. |
|
Ok, Sorry for the newbee question how do i figure out thre Systemuser and HomeDrive of Nextcloud |
The problem is snap, i never worked with it. So there may be many more problems now: if he can access libreoffice, you basically have to do everything you've done again as the user which runs the snap / nextcloud. This user will execute the command to convert the pdf. Even if you get all this done - from what i have read it would be probably a better choice considering to install nextcloud directly on a system of your choice or (manually) inside a dockercontainer. Here is why: I did the same thing you try to do ( with 100GB of shared data and 20 Users) 2 weeks ago on a vps with 8 vcores and 16GB of RAM. Nextcloud had a really low performance before tuning (opcache, redis, switching from prefork to php-fpm, http2 and so on). It´s a game changer if you do all these things and edit all those configs. All in all, it was a 2 nights job including the initial data upload without any knowledge about nextcloud, php or redis at all. If you know what you're doing, i guess it can be setup and tuned within 2 hours (without data upload obviously) All the configs, paths and settings are very well known to the internet and every error i encountered was already solved somewhere else. That may not be the case for the snap version. Check this to get a summary of why it´s a bad idea to use snap in the long run. I´m pretty sure you can solve the problem after getting a linux and a snap guru but if you are a newbee it will take forever to figure things out that are not considered "standard". it´s like plesk or all those other admin tools. As long as it works, you´re fine. But as soon as you have to dig into it, things get really confusing because nothing is where it should be. |
@xDeerStalker i started all over without the snap installation. It now works perfectly. thx |
Hi, sorry for the delay, I have now some time to confirm that:
|
Okay, if it works as www-data when doing it by hand, it should work by the app as well. Just to be sure, you can I didn´t have any problems with nextcloud not recognizing the created pdf, but in another case i needed to run You definitly have to wait until cron.php runs, so the conversion is never "instant" (except for the ajax method maybe).
|
Thanks @xDeerStalker I'll be checking all these asap. BTW I don't know why this job is scheduled on a 15' basis, and what is the incidence (side effects for instance) if I reduce the delay to 5'. It's not the topic here, I admit. All I find is this documentation mentioning the way to reduce the delay between runs to 5' (which seems to be acceptable then) and before that:
I guess (but I don't know) that if the next cron.php starts before the current job is not finished, nothing wrong is supposed to happen to the running NC instance, apart maybe a higher CPU and/or I/O load... Thanks again, I'll be posting soon the results I see. |
Hi, nothing has happened to my odt test files, no pdf has appeared in NC aside these files. Everything's working fine when I do the commands manually, as you explained before. |
I gonna contribute a bit here because I too am struggling with this. Right now the ONLY action I know for sure which creates the cron job properly is the When "File renamed" trigger is used as seen below. If I find any other that work, I will mention it but please test the File Renamed trigger (also put the job in your user cron / or run the cron job manually after renaming a file to test. ex. as your webuser or apache user Triggers that do not create the cron or convert the file. |
Is there any update on this issue? I've been able to successfully convert files under the www-data user in the terminal (by changing the ownership of /var/www), but the tag based automatic PDF generation upon change is still not w working. Is there anyone at all for whom it works? |
BTW as some people might feel uneasy about changing the ownership of /var)www, would it be possible to make setting a different home part of the app (script)? By making user of the HOME variable? |
I'd suggest to set the HOME variable to |
I can confirm that file renamed action works but the other actions not. PDF generation works with command line steps described here manually. |
did some more testing: works also in admin flows and also when selecting single actions like file rename or file created...but not with multiple |
Hi,
I set up a PDF conversion flow as follows:
When File created, File updated
and File MIME type matches Office documents
=> Keep original, overwrite existing PDF
I'd expect that when creating a new odt file with Collabora Online Development Edition, or just uploading a new odt file, I would see its corresponding pdf appearing aside, but nothing happens.
And absolutely nothing in the nextcloug log (loglevel : 2).
libreoffice --headless --invisible --norestore --convert-to pdf file.odt
works fine in a terminal.PDF Converter app
PDF Converter app version: 1.3.1
Server configuration
Operating system:
Ubuntu 18.04
Web server:
nginx 1.14.0
Database:
MariaDB 10.1.44
PHP version:
PHP 7.4.6
Nextcloud Version:
18.0.4
LibreOffice 6.0.7
List of activated apps:
Enabled:
Disabled:
Nextcloud configuration:
'enable_previews' => true,
'preview_libreoffice_path' => '/usr/bin/libreoffice',
'preview_office_cl_parameters' => ' --headless --invisible --norestore --convert-to pdf ',
Are you using external storage, if yes which one: local/smb/sftp/...
No
Are you using encryption: yes/no
No
Server log (data/nextcloud.log)
Nothing
The text was updated successfully, but these errors were encountered: