An Android Phone Makes A Better Server Than You’d Think

There was a time a few years ago when the first Android phones made it to market, that they seemed full of promise as general purpose computers. Android is sort of Linux, right, or so the story went, so of course you must be able to run Linux on an Android phone and do all sorts of cool stuff with it.

As anyone who tried to root an Android phone from 2010 will tell you, it was a painful and unrewarding process. There was normally a convoluted rooting process followed by somehow squeezing your own Linux filesystem tree onto the device, then chroot-ing into it. You’d then have to set up a VNC server and VNC into it, and eventually you’d feel immensely proud of your very slow tiny-screen Linux desktop that you’d slaved over creating. It was one of those things that’s simple in theory, but extremely convoluted in practice.

But six years have passed since those days, phones have gotten much faster and so has the software for tasks such as rooting, so maybe it’s time to return to the topic of Linux on an Android device. [Pete Scargill] gave it a try when a friend gave him a Chinese quad-core Android phone with a broken screen. He proceeded to put a Debian installation on it, upon which he runs his collection of server processes.

Rooting the phone was straightforward process using the KingRoot app, a sideloaded version as it seems there’s a bogus copy on the Play Store. Then bringing a Linux system to it could be achieved with the LinuxDeploy app. The result is surprisingly useful, after some installation steps upon which he goes into detail.

You might ask what would be the point of this exercise, given that you can do the same thing much more easily with a single board computer such as a Raspberry Pi. But to buy a Pi, SD card, screen, and UPS, as he points out you’d have to spend a lot more than you would for a second-hand phone from eBay — or a free, slightly broken, one from friends or family.

If getting more from your Android phone is your thing, perhaps you’d like to know about installing Busybox on it. We’ve also advocated for using old Android phones for ARM dev.

52 thoughts on “An Android Phone Makes A Better Server Than You’d Think

  1. We were talking about this last night at OlyMEGA makerspace. Many of us have smartphones left over from upgrades. I moved cell carriers and now have four Sprint-only quad core smart phones. I’ve used desktop computers with a fraction of the power of these “old” cell phones.

    1. Does “Sprint” use special hardware variants? Normally it is easy to remove a provider lock once you have rooted the device. I did this with my galaxy S2 and this was very practical when I was in Thailand to use a local SIM card. The Galaxy S5 then was bought without lock anyway, so no issue with a foreign SIM.It is just nice when you can use internet and voice for local rates instead of roaming in countries like Thailand or India.

    1. KingRoot is a chinese app, and really smells fishy. I have tried it for my older phone (which was made by a local brand in Turkey). Although the phone was quite new to market that time, the app achieved the root. But installed tons of different chinese app.

      To overcome this situation, there is also an app “SuperSU-Me” (i believe i found on xda-devs) which deletes all the kingroot apps and installs known SuperSU instead. I have used that phone nearly 2 years and never had a problem.

  2. There’s an app called GnuRootDebian on the play store that is a regular non root (and not rooting) app that install apt (with regular debian jessie armhf repos), coreutils and the rest.
    It is not a virtual machine or anything, you can read the raw ADC voltage from the ADC in /sys (which is very useful if you swapped your toy battery with a real man’s 6.4 Ah one without controller), play with netcat, use vim, ssh…
    It seems like you can’t manage network interfaces with it, thou.
    It also supports Xorg, apparently, but I never tried it.

    https://play.google.com/store/apps/details?id=com.gnuroot.debian

  3. I prefer using old phones (and other hardware) as thin clients and remote controls instead of servers. My 2011 Android phone is now a remote control for my old Pi 1 running OSMC (I use Kodi’s official remote app). Most older pre-Android phones can run Java applets, so they’re hackable too. However the main problem with them is the lack of connectivity as they don’t have WiFi and the only way to access the internet is using the cellular connection.

    I also have an old Nintendo DS which I use as an SSH client with DSLinux. Its resistive touchscreen with stylus is bigger and easier to use with the on-screen keyboard than a phone’s small capacitive screen, and it looks like a small laptop too. DSLinux has its limitations (needs slot-1 and extra RAM cartridges, doesn’t work on DSi and 3DS, no out-of-the-box support for WPA encryption, limited programs), but it works well as a thin client.

  4. The biggest problem though is that the battery will bloat in several months when being constantly at 100% charge and you have to watch so that it won’t burst. I have the same ‘server’ tethering internets in my country house and the latter is real PITA ;)

    1. I wonder if the terminal charge voltage could be lowered once the phone is rooted? Keeping the battery at a lower voltage like 3.9V or 4V should reduce that problem considerably.

      Modern cell phones charge even higher than the previous limit of 4.2V for 100%, because talk time is more important than battery lifetime in that use.

        1. One of those timers for the outlet is a super cheap way to cycle power charging/battery discharge. Agreed with above, old batteries are the biggest problem with these fun old devices. Had a box of them I had picked up randomly along the way (10 bux or less each) that I recently sold due to that fact. Kept my OG Droid though lol- that and cockroaches will survive the apocalypse ;)

      1. That would be a good solution, as most wear on the battery happens above 4,1V (for a 4,2V nominal battery). I don’t know the comparable level for newer batteries which charge normally to 4,3 or 4,4V. I guess with improvements in chemistry the deterioration is lower too.

      1. Most (i.e. all the phones I’ve pulled the battery on) won’t run without a battery, even if plugged in. Although I could imagine some hack involving a resistor or something across the battery pins to simulate a charging battery, or lowering the charger voltage to the battery voltage and plugging into the empty battery socket.

    1. Eeh, more like a set-top box chip iirc which is why the GPU is given a massive priority over the CPU. GPU’s there to do the work, CPU’s there to tie GPU functions together into something useful.

  5. That is a great idea. I have an old 10 inch Android tablet with WiFi and an Ethernet port built in but an ageing battery which looks like a good candidate for this hack. It would make a good IoT hub and or message broker that could be wall mounted. Fortunately I had the house wired for a gigabit LAN and put many of the dual port panels near power outlets.

  6. It’s like you are being purposely obtuse with your terminology. You mean userland right (probably busybox +/- some GNU utils)?? Why do you keep saying “Linux”.

    This article makes 0 sense, run Linux on android? The android kernel is based on LTS Linux kernels.

    What’s a Linux filesystem? How does it differ from Debian? Why are you even calling it Linux? Do you mean an initramfs?

    As far as I can tell anything that has ever been near a Linux distribution is Linux as far as you know?

    1. Android uses Yaffs, which isnt exclusive to Linux but the kernel is still there and its an easy transition for most linux users.

      On a side note, I would recommend the application “servers ultimate” for those who dont feel like bothering with installation of some of the gnu corelibs or busy box.

  7. Is anyone else a trifle queasy at the prospect of building a ‘server’ on top of something that is almost invariably not getting any sort of remotely useful updates; often came out of the box with a rather…boisterous…collection of software courtesy of Android OEMs; and has then been rooted(which implies the existence of a known, unfixed, privilege escalation vulnerability) often with an opaque binary rooting utility that does god-knows-what-else besides?

    It’s a pity, since the hardware is often abundantly capable; but android device firmware is usually a ghastly nightmare; 3rd party support built partly on cobbled-together binary blobs and bits is uneven; and “here’s how you install debian ARM/build Yocto for it” counts as a minor miracle for most models.

    Maybe this is just me; but I don’t have too many openings for servers that I can’t even pretend to have a decent reason to trust. If I give them the level of trust they deserve, I end up spending more time walling them off and controlling them at the router/IDS/firewall level than I do actually making whatever service I want served happen. If I just whistle innocently, odds are good that I’m unleashing a little IoT-grade security upon the world.

    I’d love to have better support for nuking and paving old phones and such, and turning them into respectable computers; but given the hostility, or absence, of anything resembling mainline kernel support or basic GPL compliance; and the low cost of better behaved hardware, it’s had to get enthusiastic about the idea(especially when models churn so fast, and the period between ‘new and expensive’ and ‘dwindling used stocks’ is so short that it’s hard to identify good candidates for detailed reverse engineering, since that’s a lot of time to sink into a given hardware configuration; and only viable if you’ll be able to get that model easily, cheaply, and for a reasonably long period of time.

    1. Installing e.g. LineageOS (if it supports the phone) gets rid of all the OEM-crap and you don’t have to even install any Google-apps on it, so that helps a bunch with the software-landscape. And, obviously, you can just use it as a server for local network — no need for it to be accessible from the Internet, if it’s e.g. serving as a streaming camera for your 3D-printer.

      1. LineageOS(forked cyanogen) works great, just go to the f-Droid website and install their ‘store’ .apk and you have a great FOSS only software repository regularly updated. I grab the remaining non-free apps I have to have using apk-dl .

  8. can anyone reccomend a good OS REPLACEMENT for (insert brand here) android phone? ive been dreaming of a native replacement for years (no CHROOT BS). id be in heaven with a debian variant natively humming along on my phone with all of those sensors and radios. mmmm mmmm mmmm. ubuntu phone was close – but the roms ive tried usually dont work or arent supported anymore (broken links, scattered forum posts, bricked attempts, meh). youd be my hero if you could reccomend a solution.

    1. This is why I still use a Maemo5 Linux Nokia N900, apt-get, x11, QT, and all. I hear that there are some Tizen phones but they have not attracted the same quality community(IMHO) as Maemo dev did.

    2. while while i cant promise itll be what you are looking for but SailfishOS is available for a good amount of android devices and there were as i remember a few native versions of kali for some older samsung and nexus devices loaded through a special recovery, i did try it out on a samsung tablet a few years back and it seemed to run pretty well, sadly i cant seem to find it anymore

      1. i dont know anything about sailfish – but ill check it out. im in the same boat with kali…plenty of forum posts – but difficult to find working inages. thanks for the reply!

  9. Booting android just to then chroot into a userland before VNC-ing into the chroot userspace is like running a virtual-machine like virtual box but without the BIOS/EFI, reusing the host kernel and being stuck in some limited sandbox that sorta has more capability as long as the kernel version is supported.

    The problem with placing a REAL Linux distro onto android phones is due mostly in part that chip(set) manufacturers won’t release source code for their chips without an NDA or only send out binary blobs merely compatible with say Linux-kernel 1.x (Because they felt like it and only via NDA).

    Also if the code is released, the GPU enhancement code isn’t available except as binary-blob/NDA thus killing acceleration.

    Then, most android has no KEXEC support in kernel, this is along the bootloader fastboot locks etc. Essentially people purchase these merely to fill land masses!

    .

    Further info (mostly my experience):

    Texas Instruments OMAP series in my experience is bad for their NDA issues: I researched into trying to add GPU support for their OMAP3 series used in some Archos Portable Media Player. This was because there was unaccelerated native linux support for the thing: busybox and a cut down X would of sped things up a bit, but I wanted to try to be the first to get XP running atop DOSBOX (an x86 emulator ported to ARM devices)

    The XP on DOSBOX worked but very slow due to lacking full GPU support:

    Dosbox boots DOS 7.x in an image and grub4dos chainloads NTLDR that boots XP. gave up waiting for the initial graphical install (as opposed to the two text based installs: the DOS phase WINNT.EXE and the NT32 stage setups).
    It booted into safemode with command-prompt so I could run the explorer process and smile at XP on an ARM device.

    1. Yes I totally agree. People should demand proper GNU/Linux support including drivers on these devices. But most people don’t understand technology so they are buying anything which “looks cool”. They don’t care it’s obsolete after 3 years, no updates, no nothing. Sad.

  10. Mine runs windows 8.1

    My old zenfone 2 is running debian using linux deploy, with a 32-bit windows 8.1 qemu vm running on top with 2gb of ram allocated to it

    So 2.5ghz quad-core with 2gb of ram and a 50gb raw disk image

    I also forwarded the rdp port through my network and into the vm :)

  11. If we look into the present market android still the leader among others. People preferring android more than any other.There are apps available in the market where you can deploy linux on android device the process is very simple and easily acceptable.

Leave a Reply to ScriptGiddyCancel reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.