Termux is an Android app that can run some Linux software in a terminal.
git-annex is not currently part of the Termux distribution, but it's easy to install it. Paste these commands into Termux:
pkg install git wget tar coreutils proot
termux-setup-storage
cd
wget https://downloads.kitenet.net/git-annex/linux/current/git-annex-standalone-armel.tar.gz
tar zxf git-annex-standalone-armel.tar.gz
rm git-annex-standalone-armel.tar.gz
git-annex.linux/runshell
Now you can set up a git-annex repository or two, to manage your Android files. To avoid typing any more, you can start up the git-annex webapp and set things up in there:
git annex webapp
Or you can continue using git-annex at the command line. Here we'll make a repository for photos:
cd ~/storage/dcim
git init
git annex init
You can go on to set up a ssh remote pointing to a server, and sync your files to and from it.
And so on. Most ways you would use git-annex on a Linux system work fairly well in this Termux environment.
Starting on boot
If you install the Termux:Boot app, git-annex will also integrate with it. Repositories you create with the webapp (or list in ~/.config/git-annex/autostart) will have the assistant started in them on boot, so you don't need to start it manually.
Known limitations
Direct mode
git-annex will probably default to direct mode due to the limitations of Android's /sdcard. You can get around this using v6 unlocked repositories, or by putting the git-annex repository on a better filesystem on the Android device, such as your termux home directory.
This line causes termux to say "Bad System Call"
git-annex.linux/runshell
It also first complained about /bin/sh being missing, but stopped after restarting termux.
@hobbes we're working on that issue, which seems likely to involve arm64, here: https://github.com/termux/termux-packages/issues/420
Found this issue thread:
https://github.com/termux/termux-packages/issues/420
which had the solution to this particular issue! Yay \o/! Needed to call
I'm noticing that the arm builds are missing now (current 403s, autobuild 404s), but maybe that's intentional for now? Either way, I have gotten past the bad system call issue with
runshell
, but now when I try to rungit annex webapp
I get...I ran
pkg install perl
, but I get the same message :(. Either way, I'm glad this seems to be moving forward, and very excited that I might finally be able to put git-annex back on my phone after all these years!@hobbes, that error means Android's system call filter has blocked a system call that's needed to run git-annex, unfortunately.
We now have a workaround that seems to work,
pkg install proot
and use proot to run git-annex. Tomorrrow's daily build of the git-annex standalone bundle will do that automatically.Are the instructions complete/correct? I get an error when following them and trying to execute runshell. Seems to be looking in the wrong place for /bin/sh.
@CandyAngel git-annex.linux/bin/sh is included in the bundle. If proot cannot run it, it seems likely that you have downloaded a build of git-annex that does not match the CPU architecure of your Android device. While most Android devices are arm, some use intel or mips..
I'm experiencing the same issue as CandyAngel on an arm64 tablet (which should be able to execute regular arm code).
Tracing down from the error message:
So it might just be that the different environments disagree which sh is now executable. For contrast, trying a bash (which is not in /bin/):
Ok, /bin/sh is obviously bad influence here.
At first glance this does sound like "Mh, we can't execute 32bit binaries her", but look:
Something in the environment is breaking things. My current stage of drilling is that I can run the variables-expanded version of [[!toggle text=tar id=tarcommand]] [[!toggleable id=tarcommand """
GIT_ANNEX_PROGRAMPATH=tar ./git-annex.linux/exe/tar --library-path /data/data/com.termux/files/home/git-annex.linux//usr/lib/arm-linux-gnueabi/gconv:/data/data/com.termux/files/home/git-annex.linux//usr/lib/arm-linux-gnueabi/audit:/data/data/com.termux/files/home/git-annex.linux//etc/ld.so.conf.d:/data/data/com.termux/files/home/git-annex.linux//lib:/data/data/com.termux/files/home/git-annex.linux//lib/arm-linux-gnueabi:/data/data/com.termux/files/home/git-annex.linux//usr/lib/arm-linux-gnueabi: ./git-annex.linux/shimmed/tar/tar --help
"""]] successfully from the outside but not from within runshell. Will update when I've found more.Setting all the environment variables from inside still did not break the tar execution; last resort was disabling proot in runshell. I still had to keep the termux-fix-shebang workaround.
From a first glance, things appear to be working now. I had to run termux-fix-shebang on the
.git/hooks/*
and set TMPDIR=something-that-actually-exists, but short of that, local adding and committing as well as moving data around.Joey, you mentioned ghc runtime issues when introducing proot. Anything particular I should test?
I followed the instruction to install git-annex on my Lenovo Vibe K4 running Android 6
At first I got the error
/bin/sh/ is missing
, which I worked around with termux-fix-shebang on runshell. Now I am getting this error.proot info: vpid 1: terminated with signal 11
Please advice.
I copied and pasted the instructions, here is my output:
https://pastebin.com/ZVJ7uSeU
Almoços for including my entire session, the relevant error is at the bottom.
I'm fairly certain this device has ARM64 arch.
As I mentioned in Package request: git-annex · Issue #420 · termux/termux-packages just now, I also get:
Some further digging suggests that this is due to the architecture mismatch between my OnePlus 5T which is aarch64, and the linker which is 32-bit:
Running
actually seems to have fixed my installation.
runshell
andwebapp
both execute now, with webapp bringing up the browser.I didn't explicitly mention it in my last comment (only in the issue I linked to), but I had already applied the
termux-fix-shebang
fix. Whilst this helps resolve the other issue, it does not help with the fact that./git-annex.linux/lib/ld-linux.so.3
is a 32-bit binary which crashes with a segfault (SIG11) when run viarunshell
.So this is still broken for me :-( Has anyone else had better luck on aarch64 (ARM v8) ?