Installing Linux on Android

Share This:

Yes Android is Linux based. However due to it’s design it is limited compared to your average Linux Distro. This is why you may want to consider running Linux on your Android device. The limitations may vary depending on the ROM on your phone. For example on my Samsung Prevail the Stock ROM was extremely limited. I couldn’t even do simple Ping command without installing an additional app, even with a Rooted Samsung Prevail I wasn’t able to achieve this simple goal. However I now have better ROM installed on my phone that does support quite few more features. But still not all of them.

Yeah you could go threw the trouble of installing a whole bunch of apps as you need them. Spending time and money researching which apps are available and what not. And prey that your every day Linux needs can get met. This is time consuming. Of course so is installing Linux on your phone. The difference with installing Linux on your phone is that once you’ve installed it you don’t have to worry about other things. So taking the time to install it can benefit you. Plus it may be time consuming but still much less time consuming then doing the research on all those extra apps.


  • A Rooted Android Device
  • A large SD Card for your Android Device (I used a 32GB card)
  • Android Terminal Emulator
  • A Linux based computer (Only if you plan on trying what I have researched below)
  • A working knowledge of the Linux Terminal
  • Confidence, Courage and the will to take risk at fudging everything up

My Research

I love using Android Terminal emulatator. Mainly because it really lets me get the nitty gritting commands that I need. It also is a great research tool to study the Android system. You can use it on an unrooted phone. However like usual you will still be limited to user level access on it. The same is true with a Rooted device however you can switch to root on Terminal Emulator by typing the su command.

I shortly discovered that SSH wasn’t part of my ROM. Knowing that Android was Linux based, I attempted to go to my Fedora System and obtain the SSH files from it. I then copied them over to my SD card and tried placing them with the correct user permissions and in the equivilant locations on my Android. I had no luck achieving this. Knowing that Android is built off Debian Linux, I may have had better luck, if I fetched the files from a Debian box, or even an Ubuntu Box. However I didn’t have either laying around on hand. I also didn’t feel like having to download a fresh ISO image and installing it on Virtual Box or VMWare just to find out that it didn’t work.

I would like to state that the reason that the above technique didn’t work could be because I didn’t copy all of the SSH dependencies over to the phone. So the above technique might still work. I’m not sure. If you know all of the dependencies of one of your preferred Linux programs and you want to try to get them to work on your Rooted Android phone feel free to do so with what I mentioned up above. And if it works please let me know. Because it will be by far the fastest and most space efficient way to achieve such goals.

What I ended up doing was litterly installing Linux on my phone. Their is a lot documentation online on how to do this. The fastest way to do it though is to simply use the Linux installer found on the Android market.

Also their are several Linux installers on the market. I’ve seen them for Ubuntu, Debian, BackTrack, and several others. I chose a free one. Which also appeared to be the best one for my needs. However this free Linux installer appears not to work on the Samsung Prevail stock ROM. Even if it is a rooted stock ROM. It did work on the custom ROM that I had installed on my phone.

I knew that since I would be installing pretty much an entire Linux system onto my phone I would need quite a bit of storage space. My phones internal storage was very limited as it was. So I knew the next best route would be to use nice sized SD card. I also knew that I would most likely want to partition this SD Card since I will need a Fat32 partition strictly to make Android happy. However the FAT32 File System can’t have files larger then 4GB in size. So I would need to partition this SD Card to have part of it be FAT32 and part of it to be EXT4.

Installing The Beast

The first thing you will need to do is to Partition your SD Card. I did this by putting my SD Card in my Fedora system. Then firing up GParted. I then located my SD Card on GParted and started to create the partitions I needed. I actually created 2 Partitions.  So my SD card had partitions like so.
  • 8GB FAT32 (This is for Android stuff)
  • 24GB EXT4

Of course you can partition your SD card however you want. I must warn you though, you should backup all of your data on your SD Card. Partitioning it can and most likely will destroy your data on it.
Once my SD Card was partitioned to my liking I popped it back into my phone. I then started my phone back up. From here I could start. I went to the Android Market and installed Linux Installer.
Once the Linux installer has been installed onto Android. You just need to launch it. From their it will tell you to use the Menu button then tap the Setup option. When you do this you will be able to configure the Linux for installation on your device. Here is what I chose.
  • Install in a block device = Leave it checked
  • Use Loop File = Leave it Checked
  • Server = None (Unless you know the IP address of the server wish to use)
  • Preferred Distribution Type = Debian (The Ubuntu Option doesn’t work on my phone)
  • Distrobution Version = Stable
  • CPU Architecture = armel
  • Hostname = whaever
  • Domain name = whatever
  • Chroot point = /data/ext2sd
  • Name of chroot launcher script = whatever
  • EXT Version = EXT2 (I tried EXT4 and EXT3 in the config but it didn’t work)
  • Domain = WhatEver
  • Linux Loop Location = /mnt/sdcard/MyLinux.loop
  • Chroot Script = MyLinux
  • Loop Size = 2000MB (The bigger the loop size the longer it will take)
Once you have configured your script according the above you can hit the back button. Your script configuration will be saved. This will bring you back to the first screen of the app. You should see three buttons. That say Create Loop File, Format Loop, Mount Loop. 

The first thing we do from here is obviosly create the Loop file. So if you used the same configuration as I did above you should have told the Linux Installer to create a Loop File of 2000MB which is about 1.94GB in size.  So we tap the button that says Create Loop File. The loop file starts to be made. It takes a while due to the size. And may take longer or less time depending on your chosen size and the speed of your phone. So feel free to make yourself a nice Latte, and pop in your favorite episode of Star Trek.
After the Loop file has been created we will need to format it. To do this we will tap the Format Loop button on the Linux Installer app. This doesn’t take nearly as long. Just wait for it to finish formatting.
After the Loop has been formated. We will need to mount it. To mount it we simply tap the button named Mount Loop. This only takes a breif second. And you wont notice it being mounted. However you will see that the button that said Mount Loop now says Install Distribution To Loop. We now will tap this button. When we do this it will start fetching the files needed to setup Debian from the web on to the Loop file. It will then start to install Debian. This can take some time. So feel free to bust out that bag of chocalate covered potato chips and sit down and watch some Twilight Zone reruns.
Once Debian has been installed onto the Loop file. You will see three new buttons. These buttons are Stop Loop env, Reinstall Distrobution in Loop, and Update chroot Script in Android.
We will ignore the first to buttons. And tap the button that says Update chroot Script in Android. This will create the chroot script that will launch your Debian Linux Distro. The script should be created fairly fast.

Accessing The Beast

Now we can Run the Debian Linux on our Android. To do this we will need some way to issue commands to Android. Below are three methods of doing this.

Method 1

Install the Android SDK onto your computer. The Android SDK comes with the ADB Shell tool which is what would be needed. If you have obtained the ADB Shell tool from some other source you don’t need to use the Android SDK. Then hook your Android device up to your computer and use ADB Shell to access the chroot script that you just made. Yeah seems kind of useless to do it this way since you will need to be physically at your computer to use Linux on your Android device. But it is a method, and one of the methods that Linux installer suggest.

Method 2

Another method that Linux installer suggest to use is to install Connect Bot and run the chroot script from within connect bot. Yeah a lot more reasonable and works very well.

Method 3

Linux installer doesn’t mention using the Android Terminal Emulator app to run the chroot script. However I used it and in my opinion it is the way I would recommend running the script. To run the script we will simply fire up the Terminal Emulator app and type the name of the script. So in the our case we made the script named MyLinux. So the command we will type in Android Terminal Emulator will be as follows.


The above command works fine for me. However if you experience problems you may want to try one of the following commands as well.

sh /MyLinux

sh MyLinux


The above is actually two commands the su command to gain root privilages followed by the MyLinux command to run the script. The followings will assume that you have also typed su to become root user as well.

sh /MyLinux

sh MyLinux

You will know that your using Debian when your Terminal Line changes from $ or # to something like [email protected]:/#. You can also check to see if your running By typing the uname command allow with the a switch like so.

uname -a

Now that your running Debian on your Android you can install Debian packages using the apt-get program or the dpkg program.

2 thoughts on “Installing Linux on Android

  1. I actually do take into consideration each of the aspects you could have introduced on your post. They are extremely effective and can definitely operate. Still, your blogposts have become limited for freshies. May you please lengthen these folks a little out of future time period? Wanted publish.

    • Yeah I haven’t used blogspot for a little over a year. I had announced I was switching to word press. The Last Blogspot Post don’t get me wrong if more readers want me to still use Blog Spot I will continue using it. However I feel I can have a bit more freedom on a self hosted domain name.