Skip to content

Document server fails with "./x2t: Permission denied" #10

Closed

Description

@Chownio

Hey, all. I have updated my Nextcloud instance from 16 to 18. I uninstalled the OnlyOffice app, then reinstalled it. After doing that, I installed the Community Document Server app. Whenever I click on a .doc or .docx file, I get the error stated in the subject.

Please let me know if you need me to pull any logs and I will gladly do so.

Activity

  1. florian-obradovic commented on Jan 17, 2020

    @florian-obradovic

    Same here, updated from 17>18
    image

  2. tgurr commented on Jan 18, 2020

    @tgurr

    I got the same error and for me it was a permission problem, installed the app from within Nextcloud, I had the following in the logs:

    Error documentserver_community OCA\DocumentServer\Document\DocumentConversionException: sh: ./x2t: Permission denied

    Which was fixed by:

    $ cd /var/www/vhost.server.domain/htdocs/apps/documentserver_community/3rdparty/onlyoffice/documentserver/server/FileConverter/bin/
    $ chmod u+x docbuilder x2t
    
  3. poVoq commented on Jan 18, 2020

    @poVoq

    Same with the official 18.0.0RC2-apache Docker image.

    I also just now upgraded from 17 to 18.

  4. HackintoshHD commented on Jan 18, 2020

    @HackintoshHD

    Thank you, @tgurr - I had similar errors in my logs when I tried to launch a newly installed OnlyOffice Community Edition of Nextcloud 18 and I can confirm a chmod u+x docbuilder x2t in apps/documentserver_community/3rdparty/onlyoffice/documentserver/server/FileConverter/bin/ fixes that.

  5. Chownio commented on Jan 18, 2020

    @Chownio
    Author

    @tgurr Thank you, this got me closer to a solution.

    However, when I input this, it switched from a "Permission Denied" error to an "x2t not found" error.. Strangest thing. I am running my installation through docker, which may be the difference.

  6. florian-obradovic commented on Jan 18, 2020

    @florian-obradovic

    cd /var/www/nextcloud/apps/documentserver_community/3rdparty/onlyoffice/documentserver/server/FileConverter/bin/ chmod u+x docbuilder x2t
    fixes the error "OCA\DocumentServer\Document\DocumentConversionException: sh: 1: ./x2t: Permission denied"
    image

    But it doesn't fix the main issue "Community document server is not supported for this instance, please setup and configure an external document server"

  7. xorbital commented on Jan 18, 2020

    @xorbital

    I fixed it by:

    1. Deactivating and uninstalling OnlyOffice and the document server
    2. Reinstalling OnlyOffice
    3. Reinstalling Document Server
    4. Applying the chmod fix by @tgurr
  8. emasty commented on Jan 18, 2020

    @emasty

    It fixed the permission denied log-entry but not the the "not supported" issue.
    I also tried the solution @xorbital suggested.

    I am running the official nextcloud:latest docker container behind a reverse proxy. Could that be an issue? There is a entry in the onlyoffice settings called "Service address" for the documentserver. The reverse proxy does forward that address to the docker container but I don't know if the docker image handles that correctly. On the other hand, the "permission denied" log entry shouldn't occur if the documentserver could not be accessed...

  9. molle100 commented on Jan 18, 2020

    @molle100

    Thanks, but how can I realize the fix if my NC is running with a Webhoster: Where do I have to go and enter this?
    $ cd/var/www/vhost.server.domain/htdocs/apps/documentserver_community/3rdparty/onlyoffice/documentserver/server/FileConverter/bin/
    $ chmod u+x docbuilder x2t

    Is it likely that there will be an update vor the apps that solve the problem without manually fixing it?

  10. autoize commented on Jan 18, 2020

    @autoize
  11. Marcwa19197 commented on Jan 18, 2020

    @Marcwa19197

    I got exactly the same issue.
    I updated manually (Downloading ZIP, copying old config.php and run occ upgrade) from NC 17 (latest patchlevel) to NC 18.

    I installed the Community Document Server App (which i did not found in any officlal documentation) and installed ONLYOFFICE-App.

    I even tried the permission fix by @tgurr without success. I'm still getting the errormessage "Community document server is not supported for this instance, please setup and configure an external document server"

    Edit: Using Ubuntu 16.04 here.

  12. OnyxSky commented on Jan 18, 2020

    @OnyxSky

    $ cd /var/www/vhost.server.domain/htdocs/apps/documentserver_community/3rdparty/onlyoffice/documentserver/server/FileConverter/bin/
    $ chmod u+x docbuilder x2t

    For CentOS, RedHat & selinux distro do as root in addition to above

    setsebool -P httpd_unified 1
    ausearch -c 'x2t' --raw | audit2allow -M my-x2t
    semodule -i my-x2t.pp

  13. NiTRoeSE commented on Jan 18, 2020

    @NiTRoeSE

    Same problem here.. the "chmod fix" fixes only the error message but not the "Community document server is not supported for this instance, please setup and configure an external document server"
    message.

    I also deleted and reinstalled both apps, but it didnt help. Same config runs fine in NC18 RC2..thats strange. I also have done a manual upgrade from NC18 RC2 to NC18.

    OS: Centos7 x64

  14. edwardscaleb9 commented on Jan 19, 2020

    @edwardscaleb9

    Same issue here. I manually upgraded from 17.0.1 to 18.0.0, installed ONLYOFFICE then Community Document Server, ran the chmod fix. I'm running NextCloud on Ubuntu 18.04 behind a Citrix Netscaler doing SSL offloading.

  15. 42 remaining items

  16. gfiasco commented on Mar 16, 2020

    @gfiasco

    I have tried everything in here but nothing seem to work around this

    I'm using nextcloud:stable with mysql as db.

    even fresh installation suffers of this

  17. unpinned this issue on Mar 17, 2020
  18. oucil commented on Jul 28, 2020

    @oucil

    setsebool -P httpd_unified 1

    If anyone read this above with reference to CentOS and is serious about using SELinux properly, DO NOT do this, as it essentially tells SELinux to stop enforcing anything for httpd effectively giving it all permissions for any resources assigned to the Apache user. Do a little more work and figure out what specific contexts / boolean permissions you need and enable them, and only them. If you're using php_fpm, you can further isolate your permissions using sub-contexts, and different apache child users.

  19. zynexiz commented on Aug 7, 2020

    @zynexiz

    As stated above, don't disable selniux to enforce it's policy's. I just had the same problem and solved it by adding a policy to selinux. The sever needs to execute the binary, so instead add the following (might have to change the path to your installation folder) for CentOS;

    semanage fcontext -a -t httpd_sys_script_exec_t '/var/www/html/nextcloud/apps/documentserver_community/3rdparty/onlyoffice/documentserver(/.*)?'
    restorecon -R -v /var/www/html/nextcloud
    
  20. yardbro commented on Oct 14, 2020

    @yardbro

    Old thread but to anyone still experiencing this issue, ensure that you use -R when applying chown (chown -R www-data:www-data documentserver_community/) if you installed the Community Document Server app manually. I had this exact issue and realized that I had only been changing ownership of the main directory, not the sub-directories. Hope this helps someone

  21. deajan commented on Oct 14, 2020

    @deajan

    For whoever might be concerned about the more recent problems with x2t and onlyoffice, eg OCA\DocumentServer\Document\DocumentConversionException: ./x2t: error while loading shared libraries: libgraphics.so: cannot open shared object file: No such file or directory

    Check if your problem is SELinux related, eg disable selinux with setenforce 0 and try again.
    If so, re-enable selinux with setenforce 1 and proceed to create the following Selinux policy:

    Create file /root/my-onlyoffice.te containing

    
    module my-onlyoffice 1.0;
    
    require {
            type httpd_sys_script_exec_t;
            type httpd_t;
            type ld_so_t;
            type configfs_t;
            class file { execute_no_trans setattr };
            class dir { getattr };
    }
    
    #============= httpd_sys_script_exec_t ==============
    allow httpd_t httpd_sys_script_exec_t:file setattr;
    allow httpd_t ld_so_t:file execute_no_trans;
    allow httpd_t configfs_t:dir getattr;
    

    Now proceed to create a module from that file with command

    checkmodule -M -m -o /root/my-onlyoffice.mod /root/my-onlyoffice.te
    

    Now create a selinux loadable policy

    semodule_package -o /root/my-onlyoffice.pp -m /root/my-onlyoffice.mod
    

    Load the policy with cd /root && semodule -i my-onlyoffice.pp

    Now it's time to label your nextcloud + onlyoffice setup (of course, adapt paths to your virtualhost)

    # php specific session, tmp and opcache dirs
    semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/nextcloud/tmp(/.*)?'
    semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/nextcloud/sessions(/.*)?'
    semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/nextcloud/opcache(/.*)?'
    # nextcloud data dir
    semanage fcontext -a -t httpd_sys_rw_content_t '/data(/.*)?'
    # nextcloud app
    semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/nextcloud/ftp/www/config(/.*)?'
    semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/nextcloud/ftp/www/apps(/.*)?'
    semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/nextcloud/ftp/www/.htaccess'
    semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/nextcloud/ftp/www/.user.ini'
    semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/nextcloud/ftp/www/3rdparty/aws/aws-sdk-php/src/data/logs(/.*)?'
    # onlyoffice specific
    semanage fcontext -a -t httpd_sys_script_exec_t '/var/www/nextcloud/ftp/www/apps/documentserver_community/3rdparty/onlyoffice/documentserver(/.*)?'
    semanage fcontext -a -t ld_so_t '/var/www/nextcloud/ftp/www/apps/documentserver_community/3rdparty/onlyoffice/documentserver/server/FileConverter/bin/.*\.so.*'
    # apply above contexts
    restorecon -Rv '/var/www/nextcloud/'
    restorecon -Rv '/data'
    

    Should work ;)

  22. Wotisrv commented on Nov 20, 2020

    @Wotisrv

    I was running OnlyOffice fine since it was included in Nextcloud 19. I needed to adjust the SELinux permissions as described here to get it work.
    Now for a couple of days I figured out that I got back the x2t permission denied error. The solution from @deajan fixed the error.
    Furthermore I needed to issue chmod u+x docbuilder since this one lost its permissions.
    After all that, I can run OnlyOffice inside Nextcloud but with the mobile app I got still x2t permission denied error.
    Everything works fine with disabled SELinux.
    I upgraded also to Nextcloud 20.0.2 today, but permission error using mobile app still continues.
    No log in SELinux about blocking but in Nextcloud.

    System Fedora-Server 32 Edition, Nextcloud 20.0.2

  23. AndreasDekiert commented on Mar 7, 2021

    @AndreasDekiert

    Even after applying @deajan 's SELinux module and contexts I still cannot get OnlyOffice to run. Checking the SELinux audits with ausearch -c 'x2t' I get several results like the following:
    type=ANOM_ABEND msg=audit(1615135507.682:588047): audit=982 uid=982 gid=975 ses=82515 subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 pid=18453 comm="x2t" reason="memory violation" sig=4

    Creating a custom SELinux module with audit2allow is not possible for this "memory violation". Any ideas?

    System CentOS 7, Nextcloud 20.0.8

  24. Wotisrv commented on Mar 8, 2021

    @Wotisrv

    I applied @deajan SELinux module and I get now:
    "SELinux prevents php-fpm from accessing sock_file clamd.sock with write access."
    type=AVC msg=audit(1615235215.940:543): avc: denied { write } for pid=1097 comm="php-fpm" name="clamd.sock" dev="tmpfs" ino=1812 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:antivirus_var_run_t:s0 tclass=sock_file permissive=0

    I do not understand why php-fpm should get write access to clamd.sock file?
    The SELinux policy allow antivirus to can scan system is activated:
    boolean -m -1 antivirus_can_scan_system

    System Fedora 33 Server-Edition, Nextcloud 20.0.8

  25. deajan commented on Mar 13, 2021

    @deajan

    @Wotisrv Looks like you have the antivirus plugin in Nextcloud where nextcloud itself triggers an AV scan. Can you confirm ?

  26. Wotisrv commented on Mar 13, 2021

    @Wotisrv

    @deajan yes that's right.

  27. j3qb commented on May 10, 2021

    @j3qb

    On our server (managed by the provider) the same issue comes up (since yesterday). Error messages:
    "Community document server is not supported for this instance, please setup and configure an external document server✖" and:
    "can't execute x2t binary, ensure php can execute binaries in the app folder✖"
    Running Nextcloud 21.0.1
    Reinstalling both Apps didn't resolve the issue.

    Since I have no admin access to the server itself i can't provide much more information. The provider claims it gives no support for the App but tells me, that other customers experience the same issue.

    Bottonline: Issue is still unresolved and comes up under Nexcloud 21 as well.

  28. sich97 commented on Sep 28, 2021

    @sich97

    Yeah I just got this error as well. I've read about the "chmod u+x docbuilder" solution, but I don't have a file path which corresponds to the where I'm supposed to run that command.
    Under "<nextcloud_root_folder>/apps/documentserver_community/3rdparty/onlyoffice/documentserver/", I only have a folder called "web-apps".
    This should be looked into more, since this was a fresh install. I installed nextcloud manually (not docker), but I installed OnlyOffice and Community Document Server through Nexctloud's App menu. So if I'm missing any dependencies then at least I should have been informed of such in the documentation or after setup. But of course the best thing would be if the app itself was plug and play.

  29. sitoagency commented on Apr 6, 2022

    @sitoagency

    Same issue here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions