The concept of sharing the same Linux kernel for running multiple systems natively via chroot isn’t new, and the same applies to Android. The potential to become a full-fledged Linux machine was obvious right off the bat, and over the years there have been many applications trying to make it as simple as possible.
I have tried close to a dozen now, and can say with a decent amount of confidence that Linux Deploy is the best app for running chroot (and even PRoot!) on Android.
A rooted device is required, and while there are other options for non-rooted devices using PRoot, I don’t find them to be as easy and complete as Linux Deploy.
Android’s great, so why do I need this anyway?
Everyone has their own circumstances and reasons for wanting to run Linux on top of Android. At first I was hoping to get a program called SyncPlay to run with an actual graphic interface (did I mention that this whole setup can have an X server going on?), because I don’t have any other options to use it on Android (and don’t mention this. Just don’t).
In the end, I found that the most use I can make out of these old Android devices I have lying around is by having them plugged-in to the wall with Linux running in the background, the screen turned off and accessing them via SSH to do all sort of things like (or exactly like) a remote machine. One possible thing that runs well is mining cryptocurrencies such as Magi Coin. But then again, we have a full Linux machine at our disposal, so the sky’s the limit!
Going step-by-step
1. Get the app!
The app can be obtained from Google Play Store or as an APK file directly from Linux Deploy’s Github repository.
2. Understanding the interface
While being the best at its category, Linux Deploy still manages to maintain a somewhat clumsy user interface, so it’s best to get accustomed to it first.
On the left menu, there’s an option to manage profiles. This is extremely important, since each profile can be configured to run an entirely different system. The default profile is simply called “linux”.
On the main screen, the icon (not to mix with Settings) is used for configuring the chroot environment. and are used for mounting and unmounting the system respectively, and the menu is used for executing one-time pre-configured commands.
3. Configuring a new system
At this point, the reason for this whole setup should be very clear. But even if not so, here’s a general explanation with some recommendations.
Via the icon:
Containerization Method
→ Will probably be good to stick withchroot
.Distribution
andDistribution suite
→ My go-to here areDebian
andstretch
(which are also the default).Architecture
→ Most devices will bearmhf
orarm64
for 32-bit and 64-bit ARM chipsets accordingly.Installation type
→ This one is tricky. The compatibility for this varies between devices and custom Android skins. Some will not like the way a whole system is mounted from a single file and will eventually crash, while others may not like other options. The safest way is to go with theDirectory
option, but I recommend to check out if theFile
option works first.Partition
,RAM
andCustom
should be used with caution by advanced users who know what they’re doing.Installation path
→ The path prefix can be determined by a global variable${EXTERNAL_STORAGE}
for/sdcard
and${ENV_DIR}
for theENV directory
(in Settings default is/data/data/com.meefik.linuxdeploy/env
). I personally prefer the${ENV_DIR}
as an installation path since it’s tied to the app and in case I want to remove it, everything wipes out in a single tap.File System
→ According to Linux Deploy’s GitHub page it’s good to stick withext4
here. Note that choosingDirectory
inInstallation type
will inherit Android’s file system.User name
andUser password
→ I usually update this to match my usual setup. These credentials will be used to create the default user for logging into the system.Privileged users
→ I always edit this with my username instead or alongroot
like so:root,USERNAME
.Localization
→ Users who plan to login via SSH from a UTF-8 locale system will be greeted with an error message each time they log in to the system (it’s annoying but doesn’t affect anything), so for those systems it’s advisable to specify an option. Otherwise (mostly American users), this option should be left atPOSIX
, however it might be a good idea to go withen_US.UTF-8
just in case.INIT
→ Enables running scripts on system start. I personally found this option to be buggy, so it should be used with that in mind by those who know what they’re doing. By the way, no systemd support in chroot for you, Debian fans.Mounts
→ Allows sharing folders from Android back to the system.SSH
→ This one we definitely want to use! Note that depending on the device model and Android skin, using the default port 22 for SSH may not work. If an error pops up, simply change it to a different one (preferably 8000+).GUI
→ This option is the most tricky of all and while I managed to get it working a couple of times, I simply cannot recommend it and won’t cover it in this post.
4. Install it!
Once all the settings are set, we go back (no need to save anything), and press the menu → Install → OK.
Note: At this point the app will probably ask for root permissions ;)
A script that automates downloading, installing and configuring a system image it going to run, and although there’s no progress bar, the progress can be observed from the app console.
For reference, on OnePlus One Snapdragon 801 with EMMC 5.1 drive and a decent internet connection this took exactly 10 minutes to run.
The process ends with a <<< deploy
message.
5. OPTIONAL: Correcting errors and/or exploring new options
One nice thing about Linux Deploy is that it enables the user to make changes to the system image even after the initial setup by simply running Configure
from the menu. This should work well for changing the username, localization or add features such as mounts or GUI, but I didn’t try and do not recommend to go ahead and change the whole distribution. For that I’d simply create a new profile.
6. Simply run it
All is left to do is simply pressing the Start button and watch the magic happen.
For convenience, the IP of the device is located right at the top-left corner, next to the profile name (for long-time use it’s recommended to use a static IP).
Even though clumsy, it’s possible to SSH to the system directly from the device itself using an SSH client app (like Termius) and navigating to the localhost ip address 127.0.0.1
.
7. OPTIONAL: Finishing touches
In the app Settings menu turning on Lock screen
, Lock Wi-Fi
, Wake lock
will enable the system to keep functioning and be accessed even when the device is left with the screen off for a long time (shouldn’t forget to constantly plug it in).
Autostart
is also a great option for maintaining the system even if the device crashes and reboots.
One amazing feature that’s pretty much buried in the menu is the HTTP
feature under “Management” which gives a remote access to the app itself for managing profiles and any other option via the browser with a command-line interface. Here’s some very basic instructions on how to use the app via command-line.
Final thoughts
Linux Deploy is a great app that can put old unused Android devices into practical use for all sorts of tasks. I’d love to hear what other people are using this app for in the comments below :)