redmine_preview_office
redmine_preview_office copied to clipboard
Creating preview with libreoffice failed
I have redmine in docker.
I added a libreoffice to the Dockerfile
RUN apt-get install -y libreoffice
My redmine info:
But the view does not work. My log:
Creating preview with libreoffice failed (pid 634 exit 1):
Command: cd /tmp/d20180831-1-nxd6mg; 'soffice' --convert-to pdf '/usr/src/redmine/files/2018/08/180830154150_dedc5ec0c47931e83a68b9a978520280.xlsx'; mv '180830154150_dedc5ec0c47931e83a68b9a978520280.pdf' '/usr/src/redmine/tmp/thumbnails/25_1a1a0a4c73bd0cc43d03aec8fb2bee7ae03eb5a3811c39409c35d164281c893b.pdf'
Completed 404 Not Found in 173ms (ActiveRecord: 3.6ms)
I executed next commands inside the container and all works:
> mkdir /tmp/d20180831-1-nxd6mg
>'soffice' --convert-to pdf '/usr/src/redmine/files/2018/08/180830154150_dedc5ec0c47931e83a68b9a978520280.xlsx'; mv '180830154150_dedc5ec0c47931e83a68b9a978520280.pdf' '/usr/src/redmine/tmp/thumbnails/25_1a1a0a4c73bd0cc43d03aec8fb2bee7ae03eb5a3811c39409c35d164281c893b.pdf'
What could be the problem?
https://github.com/dagwieers/unoconv/issues/359#issuecomment-335514650
User www-data cannot write to /var/www Just change rights
I have same situation. And after changing rights, the problem still happen.
Started GET "/attachments/preview_office/17640" for 103.23.147.162 at 2018-10-21 09:53:47 +0000 Processing by AttachmentsController#preview_office as */* Parameters: {"id"=>"17640"} Current user: admin (id=1) Creating preview with libreoffice failed (pid 1702 exit 1): Command: cd /tmp/d20181021-1286-ctpvlp; 'soffice' --convert-to pdf '/var/www/redmine/files/181019164940_b1798d88acba4b3f2f0553677f beccda.xlsx'; mv '181019164940_b1798d88acba4b3f2f0553677fbeccda.pdf' '/var/www/redmine/tmp/thumbnails/17640_2d6d00591b49db6cecc1a1 3eee055077.pdf' Completed 404 Not Found in 132ms (ActiveRecord: 2.4ms)
Do you know any other solutions?
the same issue, but using nginx instead of apache
I have the same issue and I tested I can use the sudo to run each command and succesed to view the pdf in Redmine except the cd /tmp/d20181130-xxxx-xxxx because the folder is not exist !
Any one know the solutions ?
My Redmine Information :
Environment:
Redmine version 3.4.6.stable
Ruby version 2.3.1-p112 (2016-04-26) [x86_64-linux-gnu]
Rails version 4.2.8
Environment production
Database adapter Mysql2
SCM:
Filesystem
Redmine plugins:
clipboard_image_paste 1.13
redmine_dmsf 1.6.1
redmine_preview_office 1.0.3
Hi , same problem. It look like webserver do not use same "tmp" folder as plugin expect.
- redmine log file:
E, [2018-12-12T14:38:30.739733 #53181] ERROR -- : Creating preview with libreoffice failed (pid 53263 exit 1):
Command: cd /tmp/d20181212-53181-1ltaek0; 'soffice' --convert-to pdf '/usr/local/redmine/production/files/2018/10/181012134440_55d4b7f8b1f55dcaeb35c657424b2eb4.DOCX'; mv '181012134440_55d4b7f8b1f55dcaeb35c657424b2eb4.pdf' '/usr/local/redmine/v-3.4.7/tmp/thumbnails/14626_65fc307d2dea0b05a281aaecc48e380d.pdf'
I, [2018-12-12T14:38:30.740219 #53181] INFO -- : Completed 404 Not Found in 183ms (ActiveRecord: 0.7ms)
- filesystem:
[root@redmine-test production]# inotifywatch -r /tmp
Establishing watches...
Finished establishing watches, now collecting statistics.
^X^Ctotal close_nowrite open create delete delete_self filename
8 2 2 2 2 0 /tmp/systemd-private-1059ef6846ac40048e9fa7f68e7ae1eb-httpd.service-LGe6p3/tmp/
4 1 1 0 0 1 /tmp/systemd-private-1059ef6846ac40048e9fa7f68e7ae1eb-httpd.service-LGe6p3/tmp/d20181212-53181-1ltaek0/
- Command: cd /tmp/d20181212-53181-1ltaek0 ....
- /tmp/systemd-private-1059ef6846ac40048e9fa7f68e7ae1eb-httpd.service-LGe6p3/tmp/d20181212-53181-1ltaek0/
Please refer to https://github.com/unoconv/unoconv/issues/359, add parameter "-env:UserInstallation=file:///tmp/" in ./lib/redmine_preview_office/patches/thumbnail_patch.rb source file, just like: cmd = "cd #{tmpdir}; #{shell_quote @REDMINE_PREVIEW_OFFICE_CONVERT_BIN} -env:UserInstallation=file:///tmp/ --convert-to pdf #{shell_quote source}; mv #{shell_quote File.basename(source, File.extname(source)) + ".pdf"} #{shell_quote target}" this works for me!