termux / termux-packages

A package build system for Termux.
https://termux.dev
Other
13.33k stars 3.06k forks source link

Can we add Unison and Duplicity? #129

Open gerroon opened 8 years ago

gerroon commented 8 years ago

Hi

It would be great if we have Unison and Duplicity in the repo. This will allow good backup options on Android.

justincase2006 commented 8 years ago

Yes

fornwall commented 8 years ago

The package suggestions have been added to https://termux.com/package-suggestions.html

Neo-Oli commented 8 years ago

Hi, I am reopening this issue. Package requests will now be labeled and tracked as an issue.

ghost commented 8 years ago

+1 for Unison.

tristan-k commented 8 years ago

+1 for Unison

ghost commented 8 years ago

+1 for unison

ghost commented 8 years ago

Just to help a bit

Jens Wagner has compiled a static ARM binary for unison 2.40.102. He is hosting it, as well as instruction for compilation, on his web site http://www.crutzi.info/unison/binary/armel.

sunziping2016 commented 7 years ago

+1 for unison

SapphicCode commented 7 years ago

+1 for Unison

vovcacik commented 7 years ago

I spend whole day on getting unison into my android phone. I've got some notes more or less relevant to this issue.

Getting debugging toolchain for Android:

The SDK Manager and USB driver
The adb.exe and fastboot.exe

Unison binaries

Linux repositories
Crutzi build

Running Unison in Android

broken su --preserve-environment -c ...
Direct ssh commands vs interactive ssh sessions

Unison caveats

vovcacik commented 7 years ago

Android binaries in https://github.com/vovcacik/unison-build-scripts. Can anyone package it?

vovcacik commented 7 years ago

Unison usage notes for Android here https://github.com/vovcacik/unison-build-scripts/blob/master/ANDROID.md

YtvwlD commented 7 years ago

duplicity is already installable:

(This is just a fancy "me too".)

niklasl commented 7 years ago

Until Unison becomes available, I use a crude fallback method:

Not sure about how clever that is, but perhaps it'll help someone.

gerroon commented 7 years ago

@niklasl you can also install syncthing in termux. It was added recently. It is a better syncing solution then bi directional rysnc.

I use rsync to back my whole sd card btw.

YtvwlD commented 7 years ago

You can also install Syncthing as a normal Android app.

gerroon commented 7 years ago

@YtvwlD

I do not recommend the regular syncthing android app, it is super buggy and crashy especially with large shares. The app regularly crashes the syncthing binary and you will never know about it.

Running it under termux much more flexible.

niklasl commented 7 years ago

@gerroon Thanks for the tip! It seems syncthing is configurable in a different manner than Unison, but it seems like an interesting alternative.

SDRausty commented 6 years ago

It appears that both Duplicity and Unison are currently available in Termux through PRoot Arch Linux. This script is designed to install Arch Linux in just a few keystrokes. Tapping this link https://sdrausty.github.io/TermuxArch/setupTermuxArch.sh will transfer setupTermuxArch.sh to your device. Simply run bash ~/storage/downloads/setupTermuxArch.sh to install Arch Linux in Termux. To install Duplicity use pacman -S duplicity. Running pacman -S unison will install Unison on device.

screenshot_20171129-230050

markbil commented 6 years ago

@sdrausty i like your idea. I installed the unison package in termuxarch via "pacman -S unison". now i would like to ssh from my pc (in the same local network) directly into termuxarch to sync files via unison. however "ssh -p 8022 user@192.168.1.xxx>" connects me to the termux environment not termuxarch, so unison commands in termuxarch are not available directly via ssh (e.g. "ssh -p 8022 user@192.168.1.xxx unison -version" results in "command not found"). "ssh -p 22 user@192.168.1.xxx" results into "connection refused" error, even though I have set up an open ssh server in termuxarch. any ideas how I can ssh directly into termuxarch?

SDRausty commented 6 years ago

@markbil I am glad to hear you like the idea. Use a higher numbered port, something like 8222 in TermuxArch for instance.

alexozer commented 6 years ago

I've tried Unison in Arch, but when using -repeat watch to sync instantly on local file changes, after a while of running it seems to stop syncing changes on the phone eventually.

At some point I'll modify a file, and unison will print "Looking for changes" and then just freeze until restarted, when it will then sync the change. No idea how to proceed.

vovcacik commented 6 years ago

@alexozer that's off topic for this thread. I've got some ideas, start new issue so we can discuss it there.

EDIT: see #2412

alexozer commented 6 years ago

@vovcacik Sorry about that, don't know why I thought it was relevant to this thread at the time.

QGB commented 6 years ago

"termux"+ setfacl getfacl

natethern commented 5 years ago

@niklasl I was doing the same thing as you (rsync, then unison, then rsync back). Then I switched to using sshfs to create a local mount of the directory (I don't know if that can be done on windoze - I use debian, among others). My process when I come home is (was)

  1. on android: open termux and start sshd
  2. on linux: run sshfs ... to mount the directory on my android device
  3. on linux: run unison ... to sync
  4. on linux: run fusermount -u ... to unmount

I also wrote it up as an bash script. As an example, for my one 3-way sync the script does this:

  1. Initiate the sshfs mount on device A
  2. Initiate the sshfs mount on device B
  3. Sync device A with the master using unison
  4. Sync device B with the master using unison (propagates any updates from A into B)
  5. Sync device A with the master using unison (propagates any updates from B into A)
  6. unmount A & B

The script checks for empty directories at the mount points (meaning the mount failed) and skips unison if appropriate.

Recently I switched to SimpleSSHD which automatically keeps an sshd server alive on each of my android devices. This, of course, is a non-termux solution.

bitcoinmeetups commented 5 years ago

+1 for Duplicity.

Please just add support for Duplicity, it would be so cool.

hellas2000 commented 4 years ago

I'm going to buy an android phone, but I'm waiting for unison to work in termux, it's very important to me. Please let an expert to help us :)

tulakalbeyo commented 4 years ago

+1 for unison

SDRausty commented 4 years ago

@tulakalbeyo unison is available in Termux through TermuxArch:

$ startarch s user yay unison
Warning: your password will expire in 0 days.
8 aur/unison-232-compat 2.32.52-2 (+0 0.00) (Orphaned)
    File-synchronization tool (legacy 2.32 version). Compatible with parallel installation to other versions of unison binaries (but pay attention to the local user configurations!)
7 aur/unison-git 2.51.3.r257.g22a05df-1 (+1 0.00)
    File-synchronization tool
6 aur/csync2-git 2.0.r22.gce67c55-1 (+1 0.00)
    Asynchronous cluster syncronisation tool based on librsync and inspired by Unison
5 aur/ucm-bin M1m-1 (+2 0.39)
    Unison language code manager
4 aur/unison-240-compat 2.40.128-1 (+3 0.00) (Orphaned)
    File-synchronization tool
3 aur/csync2 2.0-4 (+10 0.00)
    Asynchronous cluster syncronisation tool based on librsync and inspired by Unison
2 aur/soundfont-unison 1.00-3 (+32 0.00)
    A lean and clean GM/GS soundbank
1 extra/unison 2.51.2-9 (1.9 MiB 8.8 MiB)
    File-synchronization tool
==> Packages to install (eg: 1 2 3, 1-3 or ^4)

going to buy an android phone, but I'm waiting for unison to work in termux

[user15:30~]$ unison
Usage: unison [options]
    or unison root1 root2 [options]
    or unison profilename [options]

For a list of options, type "unison -help".
For a tutorial on basic usage, type "unison -doc tutorial".
For other documentation, type "unison -doc topics".

just add support for duplicity, it would be so cool

[user15:34~]$ duplicity -V
duplicity 0.8.15

@bitcoinmeetups both give the impression of working in Termux, and they do need proot.

tulakalbeyo commented 4 years ago

@SDRausty

@tulakalbeyo unison is available in Termux through TermuxArch:

i installed unison in a ubuntu proot-distro. but how do you run only unison with proot?

i tried unset LD_PRELOAD && proot -r /data/data/com.termux/files/usr/var/lib/proot-distro/installed-rootfs/ubuntu/ unison, similar to how it's explained in the official proot documentation here and adding some of what it says on the termux proot wiki page, but no dice:

$
$ unset LD_PRELOAD && proot -r /data/data/com.termux/files/usr/var/lib/proot-distro/installed-rootfs/ubuntu/ unison
proot warning: can't chdir("/data/data/com.termux/files/home/./.") in the guest rootfs: No such file or directory
proot info: default working directory is now "/"
proot error: 'unison' not found (root = /data/data/com.termux/files/usr/var/lib/proot-distro/installed-rootfs/ubuntu, cwd = /, $PATH=/data/data/com.termux/files/usr/bin:/data/data/com.termux/files/usr/bin/applets)
fatal error: see `proot --help`.
$

which of all of these parameters do you need to run it?

ghost commented 4 years ago

which of all of these parameters do you need to run it?

All of them. Termux is not GNU/Linux system so you need to pass some arguments to proot to get mounts & environment be configured correctly.

ghost commented 4 years ago

Well, you can omit some of them, but anyway proot command line should look like

proot \
    --link2symlink \
    --rootfs="/path/to/rootfs" \
    --root-id \
    --cwd=/root \
    --bind=$HOME:/root \
    --bind=/dev \
    --bind=/proc \
    --bind=/sys \
    /usr/bin/env -i \
        "HOME=/root" \
        "LANG=C.UTF-8" \
        "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" \
        "TERM=$TERM" \
        "TMPDIR=/tmp" \
        "unison"
tulakalbeyo commented 4 years ago

IT WORKED!!! :laughing::grin::+1::+1::sparkles:

SDRausty commented 4 years ago

IT WORKED!!! πŸ˜†πŸ˜πŸ‘πŸ‘βœ¨

@tulakalbeyo I am very glad to hear that it is working for you!

how do you run only unison with proot

You might be surprised to hear program unison, along with the slew of other programs are new to me, and I have not really used many of them. When I announced myself to This Crew a couple of years ago I kept hearing people crying, "Help me, help me please!" for programs that people wanted to use, but could not! These crying people included me. That is why I announced myself.

This doesn't work! That doesn't work! Oh no!

I'm very glad to hear that we all have made progress with unison and many other programs that did not used to work in our Android smartphones, tablets and smart TVs, and now do work as expected. Can you please share some good noob primers about unison with us here please?

EDIT

good noob primers

What are the next couple of steps with unison? I know that checking for version and checking help does test if the program really works. What are the next couple of steps with unison to see if it really works; whether I can get some basic functionality out of this program which is at present new to me; Can you share this in just a couple of lines of code please?

tulakalbeyo commented 4 years ago

hey, @SDRausty !

tests

i am just waking up here, and will for the next few hours run all the pertinent unison tests for running it this way.

primer

i will be more than happy to write a primer / howto on unison, at least for my specific usecase. perhaps i will publish it on the termux subreddit. and link it from here.

description

to put it in ordinary language, unison is basically just a dropbox.com for your local directories, in the way it can do bidirectional sync, instead of just one-way sync like rsync does. since it can work through openssh, it will also do bidirectional sync between remote machines.

try it

unison is pretty powerful, and has a wide range of options for all kinds of usecases, but you can start with a simple case of:

unison /testdir1 /testdir2

just plop different files, and/or different versions of the same files into each directory and see how it behaves.

documentation

i think it's important to update the proot wiki article to exhibit and clarify how to run single commands / applications with proot, the way @xeffyr just demonstrated.

tulakalbeyo commented 4 years ago

well. i managed to progress considerably, but i find it difficult to continue, as i am at a loss as to how to troubleshoot.

tldr

  1. a line of commands, containing unison, with all its necessary proot parameters, gets cat'ed into ~/bin/unison and given execute permissions.
  2. a symlink is created in /data/data/com.termux/files/usr/bin/unison that points to this executable ~/bin/unison file.
  3. ~/bin is added to PATH in both .bashrc and .bash_profile.
  4. a symlink is created in ~/ that points to the actual directory to be synchronized, since it is normally not-accessible to unison.
  5. some tests are run.
    1. the local tests are successful βœ….
    2. the remote test is unsuccessful 🚫.

how it went down

#==================================================
# proot unison
#==================================================
#   - - - - - - - - - - - - - - - - - - - - - -
#   NOTE
#   - - - - - - - - - - - - - - - - - - - - - -
<<.
#   .bashrc     = for local non-login shells
#   .bash_profile   = for local or remote login shells
#       ref: https://unix.stackexchange.com/questions/332531/why-does-remote-bash-source-bash-profile-instead-of-bashrc
.

#   - - - - - - - - - - - - - - - - - - - - - -
#   add home/bin to path
#   - - - - - - - - - - - - - - - - - - - - - -
cat >> temp <<'HEREDOC'
    # Allows Executable Files in "~/bin" to be Run Directly
    export PATH="$PATH:$HOME/bin"
    #
HEREDOC
#

#           : : : : : : : : : : : : : :
#           add "temp" to
#           ".bashrc" & ".bash_profile"
#           : : : : : : : : : : : : : :
cat temp >> .bashrc &&
cat temp >> .bash_profile &&
rm temp &&
:
#

#   - - - - - - - - - - - - - - - - - - - - - -
#   create home/bin
#   - - - - - - - - - - - - - - - - - - - - - -
mkdir bin &&
:
#

#   - - - - - - - - - - - - - - - - - - - - - -
#   proot unison with all required arguments
#   -- cat'ed into home/bin
#   - - - - - - - - - - - - - - - - - - - - - -
cat > bin/unison <<'HEREDOC'
    #
    unset LD_PRELOAD &&
    proot \
        --link2symlink \
        --rootfs="/data/data/com.termux/files/usr/var/lib/proot-distro/installed-rootfs/ubuntu" \
        --root-id \
        --cwd=/root \
        --bind=$HOME:/root \
        --bind=/dev \
        --bind=/proc \
        --bind=/sys \
        /usr/bin/env -i \
            "HOME=/root" \
            "LANG=C.UTF-8" \
            "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:" \
            "TERM=$TERM" \
            "TMPDIR=/tmp" \
            \
            \
            "unison" \
            "$@" \
    #
HEREDOC
#

#   - - - - - - - - - - - - - - - - - - - - - -
#   make bin/unison executable
#   - - - - - - - - - - - - - - - - - - - - - -
sudo chmod +x bin/unison &&
:
#

#   - - - - - - - - - - - - - - - - - - - - - -
#   link home/bin/unison to /usr/bin/unison
#   (where remote clients expects it)
#   - - - - - - - - - - - - - - - - - - - - - -
#sudo \
ln -fs "/data/data/com.termux/files/home/bin/unison" "/data/data/com.termux/files/usr/bin/unison"
:
#

#   - - - - - - - - - - - - - - - - - - - - - -
#   link /storage/emulated/0/Desktop/ to ~/
#   (since unison can't write to it)
#   - - - - - - - - - - - - - - - - - - - - - -
ln -fs /storage/emulated/0/Desktop/ ~/Desktop &&
:
#

#   - - - - - - - - - - - - - - - - - - - - - -
#   local tests
#   - - - - - - - - - - - - - - - - - - - - - -
mkdir foo bar && touch foo/foo bar/bar &&
tree foo bar &&
unison -batch foo bar &&
tree foo bar;
rm -R .unison &&
rm -R foo bar &&
:
#

#   - - - - - - - - - - - - - - - - - - - - - -
#   test from client
#   - - - - - - - - - - - - - - - - - - - - - -
unison -testServer ~/Desktop ssh://river//storage/emulated/0/Desktop &&
:
#

test results

the local tests run excellently!! πŸ™‚πŸ‘βœ¨ but the test from client shows this πŸ™„πŸ˜€

tulakal@linux:~$
tulakal@linux:~$ unison -batch ~/Desktop/ ssh://river//Desktop                                                             
Contacting server...
X11 forwarding request failed on channel 0
Connected [//linux//home/tulakal/Desktop -> //localhost//Desktop]
Looking for changes
  Waiting for changes from server
Reconciling changes
new dir  ---->            /
local        : new dir            modified on 2020-08-24 at 11:25:53  size 191026917 rwxr-xr-x
localhost    : absent
Propagating updates
UNISON 2.48.4 started propagating changes at 13:04:15.92 on 27 Aug 2020
[BGN] Copying  from /home/tulakal/Desktop to //localhost//Desktop
Failed: Fatal error during unmarshaling (input_value: ill-formed message),
possibly because client and server have been compiled with differentversions of the OCaml compiler.
Fatal error: Fatal error during unmarshaling (input_value: ill-formed message),
possibly because client and server have been compiled with differentversions of the OCaml compiler.
tulakal@linux:~$

to eliminate the possibility that the symlink to /storage/emulated/0/Desktop/ could be the problem, i also created a test directory on termux's home (mkdir test) and ran unison -batch ~/Desktop/ ssh://river//test. it still resulted in the same Failed: Fatal error during unmarshaling (input_value: ill-formed message) error.

possible solution?

recompile unison with the same OCaml compiler? how to even tell which OCaml compiler was used?

how everything is setup: termux after-installation runbook:

#==================================================
# remote administration
#==================================================
#   - - - - - - - - - - - - - - - - - - - - - -
#   preliminary packages
#   - - - - - - - - - - - - - - - - - - - - - -
pkg upgrade &&
pkg install termux-auth openssh &&
:
#

#   - - - - - - - - - - - - - - - - - - - - - -
#   set password
#   - - - - - - - - - - - - - - - - - - - - - -
passwd &&
:
#

#   - - - - - - - - - - - - - - - - - - - - - -
#   openssh
#   - - - - - - - - - - - - - - - - - - - - - -
#           : : : : : : : : : : : : : :
#           termux: run ssh daemon now
#           : : : : : : : : : : : : : :
sshd &&
:
#

#           : : : : : : : : : : : : : :
#           client: alias
#           : : : : : : : : : : : : : :
cat >> ~/.ssh/config <<'HEREDOC'
#
#
        host termux
        port 8022
        user root
        hostname 192.168.X.X
        protocol 2
        #ciphers blowfish
HEREDOC
#

#           : : : : : : : : : : : : : :
#           termux: run ssh daemon on termux startup
#           : : : : : : : : : : : : : :
cat >> .bashrc <<'HEREDOC'
    #
    # Run OpenSSH daemon on Termux launch
    sshd
    #
HEREDOC
#

#==================================================
# gain acess to external storage
#==================================================
# your milage may vary, but this worked like a charm the last time
termux-setup-storage &&
:
#

#==================================================
# additional packages
#==================================================
pkg upgrade &&
pkg install tsu htop tree micro rsync proot-distro &&
:
#

#==================================================
# grant root privileges
#==================================================
sudo echo &&
:
#

#==================================================
# proot ubuntu & packages
#==================================================
#proot-distro list &&

#   - - - - - - - - - - - - - - - - - - - - - -
#   install ubuntu
#   - - - - - - - - - - - - - - - - - - - - - -
#proot-distro reset ubuntu && # clean re-install
proot-distro install ubuntu &&
:
#

#   - - - - - - - - - - - - - - - - - - - - - -
#   login to ubuntu
#   - - - - - - - - - - - - - - - - - - - - - -
proot-distro login ubuntu &&
:
#

#   - - - - - - - - - - - - - - - - - - - - - -
#   packages
#   - - - - - - - - - - - - - - - - - - - - - -
#           : : : : : : : : : : : : : :
#           update
#           : : : : : : : : : : : : : :
apt update &&
:
#

#           : : : : : : : : : : : : : :
#           install
#           : : : : : : : : : : : : : :
apt-get install -y unison &&
:
#

#   - - - - - - - - - - - - - - - - - - - - - -
#   back to termux
#   - - - - - - - - - - - - - - - - - - - - - -
exit &&
:
#

#==================================================
# ascertain storage layout
#==================================================
ls storage &&
:
#
sergey1369 commented 4 years ago

Hi, guys.

May be I do something wrong, but proot --link2symlink doesn't play well with unison.

Here is unison-static: http://gael-varoquaux.info/misc/unison-248-binaries-for-arm.html

It works great under proot (synced d1/f1), but not proot --link2symlink (failed d1/f2).

image

UPDATE: Unison works on K10 with manually compiled proot, But this proot fails on newer droids ("bad syscall" errors). No reason to play with static version.

# Walkaround proot-distro install unison-18.04 proot-distro login ubuntu-18.04 apt update apt install unison # works fine for me

kokoko3k commented 3 years ago

I'm on android 10 on samsung s10, downloaded this: https://apkpure.com/it/unison/net.danielroggen.unison/download?from=details extracted binaries and copied them into termux, i'm using this: unison-2.48.3-pie, it is statically linked and works fine even with remote connections. Syncing a lot of data right now for the first time.

stale[bot] commented 2 years ago

This issue/PR has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

xtkoba commented 2 years ago

Package requests should not be tagged as wontfix by Stale bot.

aa755 commented 2 years ago

Then I switched to using sshfs to create a local mount of the directory (I don't know if that can be done on windoze - I use debian, among others). My process when I come home is (was)

  1. on android: open termux and start sshd
  2. on linux: run sshfs ... to mount the directory on my android device
  3. on linux: run unison ... to sync
  4. on linux: run fusermount -u ... to unmount

This is a great workaround. I have been visiting this page several times per year for several years and somehow missed this wonderful post. I just want to add that you don't really need to be home to use this method. If your desktop has a public IP or its router has it and you can do port forwarding, you can set up your phone to create a reverse tunnel when you ssh to your desktop from your phone. Then, from anywhere in the world that your phone has internet connectivity (no public IP needed), you can ssh to your desktop and run unison on your desktop to sync your phone with the desktop. On my desktop, I have a single sshfs config that expects the phone's sshd to be accessible at 127.0.0.1:8022. when I am away from home, I achieve this using reverse ssh tunneling. When I am at home and have a usb cable and want fast sync, I do adb forward tcp:8022 tcp:8022

sergey1369 commented 1 year ago

The static binary seems to work for me.

Setup.

  1. Termux (Tested on OnePlus 5T/Android 10)
    unzip /sdcard/Download/unison-aarch64.zip
    chmod 755 unison-2.51-aarch64
    cp unison-2.51-aarch64 ../usr/bin/unison
  2. Ubuntu 22.04
    apt install -y unison
    ln -s /usr/bin/unison-2.51+4.13.1 /usr/bin/unison-2.51

    unison-aarch64.zip

elwint commented 1 year ago

You can also compile a static binary yourself in Termux. I was first using the sshfs workaround, but it was too slow for very large folders. I ended up doing the following steps to get the latest unison version (which also has backward/forward compatibility) so that I can directly use unison with ssh. The binary also works outside proot:

hellas2000 commented 1 year ago

You can also compile a static binary yourself in Termux. I was first using the sshfs workaround, but it was too slow for very large folders. I ended up doing the following steps to get the latest unison version (which also has backward/forward compatibility) so that I can directly use unison with ssh. It also works without proot:

* Install a proot distro, e.g. alpine:
  `proot-distro install alpine`

* `proot-distro login alpine`

* `apk update && apk add ocaml musl-dev`

* Download the latest release source code, e.g.:
  `wget https://github.com/bcpierce00/unison/archive/refs/tags/v2.53.0.tar.gz`

* `tar -xvf v2.53.0.tar.gz`

* `cd unison-2.53.0`

* Compile a static binary using:
  `make UISTYLE=text NATIVE=true STATIC=true`

* Move the binary to the bin folder of Termux:
  `mv src/unison /data/data/com.termux/files/usr/bin/unison`

Note that outside the distro environment unison only works with the -ignorelocks flag for some reason.

This is perfect solution. The last bit, we can start unison with the -ignorelocks flag, or we can add ignorelocks = true to prf file.

mvglasow commented 1 year ago

Do I need to build the Unison binary on the device itself, or would it work if I built on a Linux system for the same ABI?

I have built 2.52.1 on Debian in a foreign chroot, and it starts up with no issues. However, when I run it from an Android app (not Termux but an app I built myself) and try to sync (over SSH, for which I use MagiskSSH), the process connects to the server successfully but exits after a few seconds with code 159, indicating it was killed with signal 31. If Android uses the same signals as standard Linux, this would be SIGSYS, which may be sent when a process passes an invalid argument to a system call, or when it violates seccomp rules. Android introduced seccomp-bpf in version 8 (the device runs Android 11).

On the other hand, a static binary built on x86_64 Linux runs fine (including sync with an SSH server) on Anbox, which is based on Android 7.

Has anyone else come across this behavior? Is that an issue with my build of the binary? Or does Unison perform operations which violate seccomp-bpf policies? If so, does Termux have any mechanism to allow apps running inside it greater freedom?

sylirre commented 1 year ago

@mvglasow Certain system calls used by GNU libc are not allowed by seccomp policy on Android. The binary should be either built for Android using the NDK or be executed under proot which hooks restricted system calls.

mvglasow commented 1 year ago

@elwint

Note that outside the distro environment unison only works with the -ignorelocks flag for some reason.

Without the flag, what is the exit code? 159? Or anything else above 128 (indicating abnormal termination)? See my post above. I should add that for my use case -ignorelocks does not help.

mvglasow commented 1 year ago

@sylirre Where would the problematic system calls get generated – by the compiler or by the linker? The big challenge with Unison is that it is written in OCaml. There used to be two OCaml toolchains for Android, but they have been unmaintained since 2014 and 2018, respectively. If the calls are generated by the linker, then maybe there’s a way to swap it for the NDK linker; for the compiler that won’t work.

sylirre commented 1 year ago

System calls are neither generated by compiler nor by the linker. They just a low-level request for performing a certain operation by kernel. For example C functions puts(), printf() or fwrite() are all implemented through the write system call.

Changing the compiler or linker won't help there as underlying base will remain the same.

Run your program under strace (strace -fv -o strace-log.txt your-program) and post log here. This will give a hint what exactly is going on.