Updating/Adding distros to GNURoot for Android (Fedora 22 ARMV7L)
Update!
http://nmilosev.svbtle.com/fedora-on-nonrooted-android-phones-2016-update
If you haven’t tried the fantastic app for Android called GNURoot, i strongly urge you to. In a nutshell, if you wanted Linux on your Android phone via chroot, you had to root your phone. This app doesn’t need root to work because it uses [PRoot](proot.me) - chroot clone which doesn’t require root. So you get a full linux environment without rooting your phone/tablet which is really great. Also, there are virtually no performance hits.
So, if you download GNURoot, you immediately have several options to install Linux on your phone/tablet. There is Debian Wheezy (with or without X server), a relatively fresh Gentoo snapshot (which I will be using later), Fedora 17 (sad face), and Aboriginal, which wasn’t available in my country. Now, you can see immediately why I wanted to write this article. While there is a nice number of options, I wanted more. Also, with the way Fedora (still my go-to distro) updates work, you would have to go 17 to 18, then 18 to 19 and so on which I can guarantee you will not work.
Now, If you want Debian, you are in luck, because there is another version on GNURoot, called GNURoot Debian which is open-source and more up to date. If you want a stable and fully supported Linux environment on your Android device, I strongly urge you to download GNURoot Debian and forget this guide. If you do want something more, do continue.
So here I will show you how to update (actually make a new install) Fedora to version 22. This guide is really simple, and doesn’t require any special tools. Also, it is really the same for any Linux distro, and obviously it is a really good idea to install a rolling release one inside GNURoot like Arch so you don’t have to upgrade it all the time. So lets start.
- Download GNURoot from the Play Store and install it if you haven’t already.
- Download a GNURoot rootfs from the Play Store, you can choose any one you like. Aboriginal is smallest, wheezy is small too. I used gentoo because before figuring out how to install a new distribution I actually wanted to update it and use it. (top tip: gentoo is great, but compiling xfce4 on a phone isn’t loads of fun)
- Find a rootfs (packed file system of a Linux distribution) for your distro. You will need arm rootfs, obviously. You can find loads of them here, and you can find Arch Linux here (armv7 multi-platform). Good source of sources in on the official PRoot site in the Downloads section. Also, google is your friend, just search if you want another distro, and be careful since you are only looking for rootfses which are compiled for arm. When you find the rootfs, download it on your device and save it anywhere you want, or just leave it in your download folder. The file must be an archive which tar can unpack, usually tar.gz or tar.xz.
- Start GNURoot and create new rootfs with the package you downloaded from the Play Store. We need one working rootfs to setup the others. After it installs, start it with the fake root option.
- This is where magic begins. You are inside proot already which is started by activity/process of application “champion.gnuroot”. So you can access a very specific folder which usually isn’t accessible. Type:
cd /host-rootfs/data/data/champion.gnuroot/app_install
Here, there are three folders
- roots: where rootfs are
- support: where proot and busybox are
- versions: where downloaded packages (of rootfses) are
To add a new distro you need to create two folders, one in support and one in roots. They have to be called the same. Type:
mkdir ./roots/fedora22 ./support/fedora22
After this, we will setup the support folder. We need proot and busybox there, so we will just copy them from a working distro:
cp ./support/gentoo/* ./support/fedora22/
Replace gentoo with the name of distro you downloaded, if you didn’t download gentoo.
If you encounter a permission denied just run:
chmod 777 ./support/fedora22
After that, we need to unpack the actual rootfs which you previously downloaded. Firstly:
cd ./roots/fedora22
Then, its really simple:
tar xvf /host-rootfs/[path]
where path is the absolute path to your downloaded archive, for example:
tar xvf /host-rootfs/sdcard/Download/Fedora22-armv7.tar.xz
Wait for the unpacking to be done. At this point, if you exit the terminal and restart GNURoot, a new installed rootfs called “fedora22” will be detected and you will be able to run it. But while we are here, lets do a few more things. GNURoot is already configured to bind your actual root folder to host-rootfs folder. For that it needs an empty folder:
mkdir host-rootfs
Run:
chmod 777 .
if you get a permission denied error.
Also, if you were to start the newly created rootfs, you would see that there is no network because the DNS config isn’t there.
cp ../gentoo/etc/resolv.conf ./etc/
will fix it. Again, replace gentoo with the name of distro you downloaded.
After this you are good to go. You can run your new fedora22 rootfs and play with it. You can delete the “helper” distro, but you don’t have to.
So what about Arch, you may ask. It’s the same really, just download the appropriate rootfs, and use it. Simple as that. Obviously name your roots and support folder “arch”.
What about a desktop environment, you also may ask. Download XServer XSDL from the Play Store, install your DE of choice, and run it like this (LXDE):
env DISPLAY=127.0.0.1:0 startlxde
after starting the XServer XSDL app.
I was really impressed by the speed and general responsiveness of the system.
Hope this works for you, and write to me if it doesn’t. Good luck!
Thanks to Corbin Champion for creating GNURoot, and also to the creators of PRoot. Lastly, thanks to Sony for making a phone, which survived this three day torture test.