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:
- Unpack the tarfile on your arm64 host / the docker host under /opt
- Check the install.sh script and adjust settings
- Run install.sh from /opt/onlyoffice-wrapper/
- 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