NC + OnlyOffice on ARM64 using qemu

During COVID-19 I decided to set up a local cloud and chose Nextcloud. I had a X96 mini device with 2GB RAM where I had recently put Armbian linux on. Using docker on Armbian made it very easy to spin up Nextcloud. Everything was perfect until I found out that OnlyOffice does not run on arm64 processors. The binaries provided are compiled for x86_64.

By accident I stumbled over qemu (https://www.qemu.org/). Using qemu I managed to run OnlyOffice on arm64.

DISCLAIMER:
Instructions may contain errors or may not work on your specific environment. Use a test environment before applying scripts in production. Do a backup of your installation. Check the scripts and adjust them to your environment.
NOTE:
Consider uninstalling the setup before updating documentserver or onlyoffice, and reapply the configuration. I have not yet tested what happens when upgrading documentserver/onlyoffice.

Qemu userspace tools allow to run linux binaries built for other processor architectures (like x86_64) to be run on another processor architecture (like arm64). All you need is the matching qemu tool (qemu-x86_64) and the dynamic libraries your specific binary depends on. With the help of these, you can write a wrapper script that executes the x86_64 binary on a arm64 host. On your arm64 host, make sure that qemu tools are installed:

apt install qemu-user

The documentserver addon for OnlyOffice comes with 4 x86_64 binaries (x2t, …). You will need to copy them to a x86_64 machine and use ldd to determin which dynamic libraries the binaries depend on. For my setup these were:

lib/x86_64-linux-gnu/libc.so.6
lib/x86_64-linux-gnu/libgcc_s.so.1
lib/x86_64-linux-gnu/libselinux.so.1
lib/x86_64-linux-gnu/libpcre.so.3
lib/x86_64-linux-gnu/libm.so.6
lib/x86_64-linux-gnu/libpthread.so.0
lib/x86_64-linux-gnu/libstdc++.so.6
lib/x86_64-linux-gnu/libdl.so.2
lib/x86_64-linux-gnu/libstdc++.so.6.0.21
lib64/ld-linux-x86-64.so.2

Now you need to collect the libraries and transfer them to the arm64 host.
The basic idea is to move the binaries in the documentserver installation aside and create scripts with the same name that call the binaries using qemu and the libraries identified. Example:

qemu-x86_64 -L /opt/onlyoffice-wrapper/qemu-x86-libs ./x2t.bin

My setup is a little more complex, because I am using the stock nextcloud:stable image, which does not contain the qemu-user package. So I also had to copy the qemu-x86_64 binary from the docker host to the docker machine running NC.

To make things easier, I have provided my setup on Github: https://github.com/mbcon/nextcloud-onlyoffice-arm64-qemu

Instruction:

  1. Unpack the tarfile on your arm64 host / the docker host under /opt
  2. Check the install.sh script and adjust settings
  3. Run install.sh from /opt/onlyoffice-wrapper/
  4. Check the wrapper.sh script and adjust settings (logging, …)

There is also an uninstall.sh script that tries to rollback the changes.

The scripts are far from being perfect … Shell gurus are welcome to fork and enhance the repository!

I am now able to use OnlyOffice on arm64. For some documents the process still crashes and in the log I see messages like “The futex facility returned an unexpected error code.”. But this might be related to qemu version, NC version, OnlyOffice version, Armbian, qemu config, …

Cheers,
mbcon

7 Likes

Sounds complicated, but promising. Will have a look at it, maybe your GitHub project might speed up things a bit.

But: does the process differ when NOT using docket? I have Nextcloud and everything else set up directly. Before spending another few hours for this attempt that answer would be good to get :slight_smile:

Hi e-raser,
no, things should be easier when not using docker. You have qemu installed directly on the machine that runs NC+OO. The wrapper.sh script should honor this and use the local qemu binary and not the one provided in the wrapper package on Github.

The scripts currently assume that you have your NC data under /var/www/html. If this is not the case, please check the install.sh script.

May the force be with you :wink:

Thank you for this. I have a doubt related with onlyoffice and this installation. I read that this App needs a big amount of RAM and free disk space. Your hardware data are pretty similar to mines. Then, how is the performance on your machine?

Thank you.

Hello jbarrio,
With the device setup we share, we both know that this is not suitable to serve a high number of users. But it works good in terms of speed and resource consumption for a small workgroup or a family.
See screenshots of Armbian login and top output, just before converting a ODP presentation of 4 MB size. The memory usage went up to 420 MB. Disk is not an issue. CPU could be faster, opening a document takes about 15 seconds.


What makes it all bad is the fact that OO bundled with NC (on arm64 and also on x86_64) does not properly sync edited content back to NC. There are several posts on that issue. So if you have a client syncing files to your local disk for editing, and also users that are editing the same files in NC via a web browser, you will experience that issue.

But if your users are mostly editing via web, OO on NC is a nice gadget :wink:

well great if this works
Dear
I would likw your guidance for install it on my rpi4 with 4gb ram (ubuntu 20.04 64 bit for rpi4)
(Ubuntu 20.04 LTS (GNU/Linux 5.3.0-1014-raspi2 aarch64))

i have installed nextcloud normal way.
and i would like to install this on my rpi
i found than no qemu is installed on my rpi.
Dear, please guide me how to install.
thanks.

Hi earth,
just try “sudo apt install qemu-user” on your RPi.

Enjoy,
mbcon

1 Like

i am getting this error
chmod: cannot access ‘/var/www/custom_apps/documentserver_community/3rdparty/onlyoffice/documentserver/server/tools/allthemesgen’: No such file or directory

i have installed documentserver in nextcloud/apps/
but not enabled.
should i enable document server?
should i change custom_apps to apps in install.sh?
please guide
thanks

edit
i chaged custom_apps to apps
after installing install.sh

when i tried to create or open .ods file i am getting this error

ONLYOFFICE cannot be reached. Please contact admin

qemu.log

/usr/bin/qemu-x86_64 -cpu max -d unimp,guest_errors -L /opt/onlyoffice-wrapper/qemu-x86-libs ./allfontsgen.bin --input=../../../core-fonts --input=/var/next/data/appdata_oc8nthfb5pre/documentserver_community/fonts --allfonts-web=../../../sdkjs/common/AllFonts.js --allfonts=AllFonts.js --images=../../../sdkjs/common/Images --output-web=../../../fonts --selection=font_selection.bin
/usr/bin/qemu-x86_64 -cpu max -d unimp,guest_errors -L /opt/onlyoffice-wrapper/qemu-x86-libs ./x2t.bin
./x2t.bin: error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory
/usr/bin/qemu-x86_64 -cpu max -d unimp,guest_errors -L /opt/onlyoffice-wrapper/qemu-x86-libs ./x2t.bin
./x2t.bin: error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory
/usr/bin/qemu-x86_64 -cpu max -d unimp,guest_errors -L /opt/onlyoffice-wrapper/qemu-x86-libs ./x2t.bin
./x2t.bin: error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory
/usr/bin/qemu-x86_64 -cpu max -d unimp,guest_errors -L /opt/onlyoffice-wrapper/qemu-x86-libs ./x2t.bin
./x2t.bin: error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory
/usr/bin/qemu-x86_64 -cpu max -d unimp,guest_errors -L /opt/onlyoffice-wrapper/qemu-x86-libs ./x2t.bin
./x2t.bin: error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory
/usr/bin/qemu-x86_64 -cpu max -d unimp,guest_errors -L /opt/onlyoffice-wrapper/qemu-x86-libs ./x2t.bin
./x2t.bin: error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory
/usr/bin/qemu-x86_64 -cpu max -d unimp,guest_errors -L /opt/onlyoffice-wrapper/qemu-x86-libs ./x2t.bin
./x2t.bin: error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory
/usr/bin/qemu-x86_64 -cpu max -d unimp,guest_errors -L /opt/onlyoffice-wrapper/qemu-x86-libs ./x2t.bin
./x2t.bin: error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory
/usr/bin/qemu-x86_64 -cpu max -d unimp,guest_errors -L /opt/onlyoffice-wrapper/qemu-x86-libs ./x2t.bin
./x2t.bin: error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory
/usr/bin/qemu-x86_64 -cpu max -d unimp,guest_errors -L /opt/onlyoffice-wrapper/qemu-x86-libs ./x2t.bin
./x2t.bin: error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory

edit:

i rename the file and its workign, but havent checked much.

libstdc++.so.6.0.21 to libstdc++.so.6

i still see this error:

/usr/bin/qemu-x86_64 -cpu max -d unimp,guest_errors -L /opt/onlyoffice-wrapper/qemu-x86-libs ./allfontsgen.bin --input=../../../core-fonts --input=/var/next/data/appdata_oc8nthfb5pre/documentserver_community/fonts --allfonts-web=../../../sdkjs/common/AllFonts.js --allfonts=AllFonts.js --images=../../../sdkjs/common/Images --output-web=../../../fonts --selection=font_selection.bin
/usr/bin/qemu-x86_64 -cpu max -d unimp,guest_errors -L /opt/onlyoffice-wrapper/qemu-x86-libs ./x2t.bin
/usr/bin/qemu-x86_64 -cpu max -d unimp,guest_errors -L /opt/onlyoffice-wrapper/qemu-x86-libs ./x2t.bin /tmp/oc_tmp_V4vD49-.xml

what should be done in order to use documentserver from local net without using internet.
thanks

Hello earth,

good to see you made progress.

  • I found this solution on my ARM device using docker. Maybe the setup is a little different. My OO files are under “custom_apps”.
  • The libstdc++ had a symlink from 6.0.21 to 6 in the zip file I posted on GitHub already. For some reason this did not seem to work on your side.
  • When I see the log output, things look ok for me now. But I do not know the exact steps you took. I had OO (documentserver + OO) already active and was experiencing the error message “OO cannot be reached”. Then I unpacked the zip, customized the scripts and ran the install.sh. From that on I had OO working.
  • OO runs locally, but I do not know if some of the components of OO need internet access for some reason. Do you have outgoing traffic completely blocked?

Regards,
mbcon

Hello mbcon,
as right now OO is working, thats good for me, and thanks for providing details of your work, so everyone can try, and get OO working on Pi’s.

I changed it to custom_apps to apps, as i have nextcloud installed manually.

I did the same exact way as per above.

no i havent blocked it from internet.

Regards,
Earth

1 Like

Hi earth, thanks for taking the time to give me this feedback. Good to hear that this solution also works for somebody else.

Best,
mbcon

1 Like

@mbcon
Dear,
I would like to know can we use local ip, to be set with OO,
work with it locally when i am on same local network, (without connecting to internet)
Regards,
Kiran

Hi earth,
Not sure if i understand your question. Let my try to answer:

You have NC + OO running on your RPi. The RPi has a single IP address, fx. 192.168.1.62. If you are accessing NC via your browser, you will use the URL http://192.168.1.62/. In your browser you will also edit documents using OO. So it is always the same IP. You will have this IP in the configuration of the ONLYOFFICE app as a service address:

http://192.168.1.62/apps/documentserver_community/

Or are you asking if you can use the “local IP” 127.0.0.1? This would only be possible if you have logged on your RPi, started the browser locally. If you want to use OO in that setup, then you will have to configure the ONLYOFFICE app service address in NC accordingly.

But then you should not be able to use OO from another device - not really sure about that. But you could try this out easily! Change the service address and see if it works!

Curious if your question and my answer fit together :slight_smile:

Cheers,
mbcon

This is my case,
I can’t set localip in OO config.
When trying to set local ip settings
(Error host violates local address rules ) appears

When I use Nextcloud with local IP,
I am unable to open any documents.
Some error of blocked by X-frame options policy appears.

Look at this: Nextcloud 19 Onlyoffice 4.30 error:Host violates local access rules

I am affected as well … now I will try to downgrade my NC/OO :nauseated_face:

1 Like

Dear mbcon,
if you find any way, that works,
please share here.
Regards,
Earth

Hello earth,
for me things work again after adding these lines to config.php right before the closing “);”

  'allow_local_remote_servers' => true,
  'onlyoffice' =>
   array (
     'verify_peer_off' => true,
  )

Found the details here: Can't connect to OnlyOffice document server after update to NC19

Hope you are good to go with this as well.

Cheers,
mbcon

2 Likes

Dear mbcon

after adding above mentioned “allow_local_remote_servers’= true”

i am getting this error
To protect your security, my.domain will not allow Firefox to display the page if another site has embedded it. To see this page, you need to open it in a new window
after clicking on it ,loading onlyoffice page appers and get stucked, nothing happens further.

in my settings if i changed
https://192.168.1.2/apps/documentserver_community/
thank onlyoffice works on local network with nextcloud logged in with local ip.
but when i tried to open files with my.domain than it error appears, onlyoffice cant be reached.

what should be my settings for onlyoffice to work as expected from internet as well as local network?

regards,
earth

Hi earth,

The error is displayed in Firefox when you access NC from the internet, ok.
I think this is some form of cross-site-scripting protection Firefox in combination with NC.

Two questions:

  • Why don’t you just run NC with my.domain instead of your local IP?
  • Regarding OO getting stuck when loading, do you see anything in the logs?

Please post some more information (NC setup, screenshots, logs, …) so maybe somebody else here in the forum is able to help.

Cheers,
mbcon

Dear mbcon,
these are the only logs for onlyoffice inmy nextcloud.log file.

{“reqId”:“ZHP3rF4BXsogR25xaNDk”,“level”:0,“time”:“2020-07-09T02:49:02+00:00”,“remoteAddr”:“192.168.11.3”,“user”:“xyz”,“app”:“serverDI”,“method”:“GET”,“url”:“/apps/onlyoffice/ajax/settings”,“message”:“The requested alias "PreviewManager" is depreacted. Please request "OCP\IPreview" directly. This alias will be removed in a future Nextcloud version.”,“userAgent”:“Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0”,“version”:“19.0.0.12”}
{“reqId”:“yqakMAztn8uj85tlZ13l”,“level”:0,“time”:“2020-07-09T02:49:08+00:00”,“remoteAddr”:“192.168.11.3”,“user”:“xyz”,“app”:“serverDI”,“method”:“GET”,“url”:“/apps/onlyoffice/2084071?filePath=%2FDocument.docx&inframe=true”,“message”:“The requested alias "PreviewManager" is depreacted. Please request "OCP\IPreview" directly. This alias will be removed in a future Nextcloud version.”,“userAgent”:“Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0”,“version”:“19.0.0.12”}
{“reqId”:“yqakMAztn8uj85tlZ13l”,“level”:0,“time”:“2020-07-09T02:49:09+00:00”,“remoteAddr”:“192.168.11.3”,“user”:“xyz”,“app”:“onlyoffice”,“method”:“GET”,“url”:“/apps/onlyoffice/2084071?filePath=%2FDocument.docx&inframe=true”,“message”:“Open: 2084071 /Document.docx”,“userAgent”:“Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0”,“version”:“19.0.0.12”}
{“reqId”:“pO1ROkbmvsgTlyvvXNi1”,“level”:0,“time”:“2020-07-09T02:49:10+00:00”,“remoteAddr”:“192.168.11.3”,“user”:“xyz”,“app”:“serverDI”,“method”:“GET”,“url”:“/apps/onlyoffice/ajax/config/2084071?filePath=%2FDocument.docx&inframe=2”,“message”:“The requested alias "PreviewManager" is depreacted. Please request "OCP\IPreview" directly. This alias will be removed in a future Nextcloud version.”,“userAgent”:“Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0”,“version”:“19.0.0.12”}
{“reqId”:“pO1ROkbmvsgTlyvvXNi1”,“level”:0,“time”:“2020-07-09T02:49:10+00:00”,“remoteAddr”:“192.168.11.3”,“user”:“xyz”,“app”:“workflowengine”,“method”:“GET”,“url”:“/apps/onlyoffice/ajax/config/2084071?filePath=%2FDocument.docx&inframe=2”,“message”:“Flow activation: rules were requested for operation Block access to a file”,“userAgent”:“Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0”,“version”:“19.0.0.12”}
{“reqId”:“pO1ROkbmvsgTlyvvXNi1”,“level”:0,“time”:“2020-07-09T02:49:10+00:00”,“remoteAddr”:“192.168.11.3”,“user”:“xyz”,“app”:“workflowengine”,“method”:“GET”,“url”:“/apps/onlyoffice/ajax/config/2084071?filePath=%2FDocument.docx&inframe=2”,“message”:“No flow configurations is going to run Block access to a file”,“userAgent”:“Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0”,“version”:“19.0.0.12”}
{“reqId”:“pO1ROkbmvsgTlyvvXNi1”,“level”:0,“time”:“2020-07-09T02:49:10+00:00”,“remoteAddr”:“192.168.11.3”,“user”:“xyz”,“app”:“onlyoffice”,“method”:“GET”,“url”:“/apps/onlyoffice/ajax/config/2084071?filePath=%2FDocument.docx&inframe=2”,“message”:“Config is generated for: 2084071 with key 165863524”,“userAgent”:“Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0”,“version”:“19.0.0.12”}
{“reqId”:“4acRb1f7xbY0bHijGUuz”,“level”:0,“time”:“2020-07-09T02:49:14+00:00”,“remoteAddr”:“my.static.ip”,“user”:“–”,“app”:“serverDI”,“method”:“GET”,“url”:“/apps/documentserver_community/3rdparty/onlyoffice/documentserver/web-apps/apps/documenteditor/main/locale/en.json”,“message”:“The requested alias "PreviewManager" is depreacted. Please request "OCP\IPreview" directly. This alias will be removed in a future Nextcloud version.”,“userAgent”:“Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0”,“version”:“19.0.0.12”}