-
-
Notifications
You must be signed in to change notification settings - Fork 742
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
port to Android #1155
Comments
I didn't try either yet, but I'ld like to point out that borg is not quite the easiest python-project port to android, because it's not just Python (3.4+), but also extensions in C (built with the help of Cython). Also, it needs quite some resources to run and root permissions. It has been run on Raspberry Pi 2/3 under Linux though, so at least there is no issue with non-x86 CPUs. |
Yes, it's fairly portable now, having been tested successfully on Linux (x64+86, powerpc, arm7), OSX, the BSDs, Solaris, ... |
Any news on this? Borg on Android sounds like it could be a great solution for backing up one's data in a hassle-free way (daily and without thinking about it) and restoring. I understand this is neither the original goal of the project nor and easy job to port Borg to Android, but I think it could be extremely useful. Thanks! |
no volunteer stepped up ^^ it might help to just be the one that volunteers it |
I have gotten Borg to successfully backup all of my data through Linux Deploy (Gentoo) with no issue. I installed Gentoo, emerged borgbackup, added /storage/emulated/0 as a mountpoint and ran Not a good permanent solution though because the Linux image takes up 4GB on my phone. |
@stonewareslord still, pretty neat experiment i wonder if we can find someone to crosscompile directly |
kivy/python-for-android could be useful. Without the Cython part it should be easy to create an App with borg code. No idea how hard it is to compile Cython with the NDK. |
Cython can be built without a C compiler afaik, but the Cython compiler won't work as fast then. To build cythonized code however a C compiler is required, so building Borg always requires a C compiler. |
I got borg to run with a debian armhf pyinstaller build that also ships debian’s glibc. See #1727 Also this is of course backup only. Trying to restore a system backup with this is likely going to break horribly. At least without deep enough android knowledge to do a partial restore and fixup the file permissions after doing it. |
maybe maintain this in a android branch until it is really usable? |
sure, although it mostly only adds 2 "script" files. Primarily is needs testing, before we can even say that it works on enough phones/tablets to be useful. |
I'd just throw this in master, it doesn't really touch the code (yet?) so I don't see a need for a separate branch. |
Well, it doesn't touch the code now but as far as i understood, it is not really usable yet. That's why I was suggesting a branch. |
I didn’t run any tests, but when I used it with lzma and keyfile encryption, it worked perfectly fine and it's what I use currently for backup of my android. |
Whats the current state of this? I found @textshell 's two scripts. Can I already use them to produce a standalone binary, or what's their intended usage? |
The state is a bit mixed. It worked for me when i needed phone backups in a pinch. But for some reason it seems only to work when used from the adb (root) shell not from a shell started from connectbot. The scripts should be able to produce a working arm standalone binary distribution that uses a bundled libc. But more test result would be very helpful. I don’t have the laptop where i did this on around at the moment. I build the binaries using qemu on a debian jessie image. I used full system emulation, but user space emulation only should be easier. |
I was wondering if Borg could be packaged as a package for termux, an advanced terminal emulator. That might be an option. |
@axelsimon Is it possible to package that as a package for termux, and still wrap and use it in a regular android app? |
I think here are the instructions for getting a built there.
Yes, I think so. An app could just run the borg binary provided it fins its path and it is readable. But packaging it in Termux would be the first big step to do. |
Also the app/borg binary should be able to run in root mode, so it can backup really everything, and in non-root mode to only backup documents/pictures or so… |
Some feedback about whether #1727 is useful would be nice. As it does not touch the main code, I am positive about merging this, if it is useful. Guess some of the comments above should also go into some sort of README for it. So, who tried it? Did it work? Do you somehow "use it in production"? |
I got borg 1.0.11 (39f8762) to work on Android 7.1.2 (aarch64, Nexus6p) with termux (https://termux.com/, version 0.53). I have only tested backing up the device via ssh since that is the most likely scenario: |
@ravenschade interesting. did you use the code from PR #1727 or start from scratch? |
I started from scratch. The necessary modifications are very small. Basically just some adjusted paths and some workarounds for stuff that is missing in android. I am building everything directly on the android device. |
You can find the build-scripts at https://github.com/ravenschade/borgbackup_on_android. Feedback and tests on other devices are very welcome. |
@ravenschade Does your borg output the following error?
It appears for me on my OnePlus3T whenever I run borg (even borg -h).
|
Yes, but it is not an error according to https://stackoverflow.com/questions/33206409/unused-dt-entry-type-0x1d-arg. |
I've made another try(targeting android 4.1+), this time using the ndk (like proper android software should). The commit hashes are just for pinning to the current version when i tested this to make this more reproducable (it's not fully pinned). If should be possible to use newer versions (or remove the checkout by commit hash). |
I'm trying to make it work as termux package (ndk) as work from Neo-Oli here: termux/termux-packages#557 My try: At the moment there is some issue to cross compile cython extensions. Borg compiles with gcc x86_64 instead of aarch64 (see paste https://pastebin.com/KEbgfQcN) |
did you have a look at my comment? I used |
Yup, I think termux wants a clean package. At the moment borgbackup 1.1.8 with borgmatic works on my phone 🎉 |
@bpereto since borg 1.1.10 msgpack (0.5.6, which is latest supported version) is part of borg and gets built as part of borg build. |
Currently thinking about how nice it would be to have borg on android. |
An awesome idea would also be to use the new backup app/feature, where you can use the usual Android backup menu. (See this thread on how it works/looks like.) |
I have ported @bpereto code to the updated code of termux-packages. Also bumped borgbackup to 1.1.10. However, I have not yet tested it. But the package has been built successfully. Here are the instructions to build it: git clone git@github.com:amaramrahul/termux-packages.git |
I have been successfully able to run this on my android phone. You need to copy the borgackup and libacl debs from debs directory to your andoid phone and then install them using dpkg command. There will be a few missing dependencies which you can then install using "apt-get -f install". While running borg, I got libc.so.6 file missing error thrown by /data/data/com.termux/files/usr/lib/python3.7/site-packages/borgbackup-1.1.10-py3.7-linux-x86_64.egg/borg/xattr.py. I simply symlinked libc++_shared.so in /data/data/com.termux/files/usr/lib to libc.so.6. I don't think this was the right thing to do and might cause issues if xattr attributes are backed up. However, I didn't face any issue probably because I was not backing up files with xattr attributes. |
WOW, managed to get borgmatic up&running on the phone. |
Raised a PR to package into Termux: termux/termux-packages#4644 |
The package has been merged to termux master: termux/termux-packages@fc6b158#diff-2fc9e51174a78dd5bfc57e8e368590b3 Also, borg can be installed via pip as below.
|
You guys are heros! Thanks a million. Works great |
Issue solved? 🤔 |
Not really. Would be nice to have borgbackup run natively, without all the Termux cruft... ;) (Ideal would be integrated into LineageOS/other ROMs so it can run as root even on unrooted phones) |
Getting
as per
|
BTW just FYI, if you want a quite good integrated backup solution for Android, consider using Seedvault. It needs to be integrated into the OS, but on the other hand this is also an advantage, because it uses the same mechanisms like Googles backup solution + one thing it recently got is a beta feature for backing up arbitrary directories on your phone. |
@rugk, I can't agree to that after a trial today. For example, they still have these weird issues, seedvault-app/seedvault#81 and seedvault-app/seedvault#165, which are a showstopper for me. Having a proper "full" backup of a mobile device, by taking advantage of rooting it, is a must I'd say in order to save yourself the hassle of either precise restoration or quick hardware migration. I ended up going with Swift Backup, which does all of that (it also already includes compression and encryption). Since I don't trust most cloud providers and Google, there is an option to use it anonymously without registering an account and therefore forfeiting the possibility to upload backups directly to supported clouds. As a result, you can still back up locally on internal storage, but afterwards, you're on your own. Hence, I'm looking forward to learn how to set up Borg on Android to do that incremental heavy-lifting and upload archives of Swift Backup to my own cloud. |
Well… fine, if that works for you no problem and it certainly has advantages, but if you do not have root and e.g. you can dismiss the limitations Google's backup solution imposes (like that apps need to opt-in into backups and Anyway, that's kinda off-topic anyway. Just wanted to provide a hint/help for users, who may still following this issue here. 🙃 |
@Alexander-Shukaev The termux package still exists: https://github.com/termux/termux-packages/tree/master/packages/borgbackup. You might get better help with your error in a termux support forum. |
My Termux didn't see the borgbackup package either... until I stumbled upon a notice that Termux from Google Play is no longer supported! Removing it and reinstalling from F-Droid got me access to borgbackup, which seems to be working nicely now. |
@luke-jr, boss answer, thanks a lot! |
Hi,
have anybody tried to run borg on Android?
Or with Jython?
I can create GUI app for Borg that would trigger borg to start backup, but I have no experience with Python on Android...
The text was updated successfully, but these errors were encountered: