Android and Linux: Putting Linux on my phone – Debian Kit Setup

Yesterday I posted about putting Linux on my Android 2.2 phone, but I didn’t get a chance to finish the story, so here we have the rest of the tale. Backing up a bit from yesterday, for continuity:

” Now it was time to get the pertinent file onto the phone. The Debian Kit .shar file, which the app will show you where to download, or you can get it on the above sourceforge page. So on the computer:

#adb push debian-kit-1-6.shar /sdcard/installed/scripts/

Once it downloaded from the computer to the phone, an odd thing happened, which Sven said could happen: the file changed from .shar to .jpg, making it seem like a picture which you cannot view. That’s okay, because the command still worked on the Android terminal.

$su
[Granting Terminal app Super User permissions]
#sh /sdcard/installed/scripts/debian-kit-1-6.jpg

Which launches the Debian kit installer. Sven’s website does not appear to be up, which explained this portion in more detail, so I will create another post in the next day or so to outline the next steps as well.

Sven’s website: http://sven-ola.dyndns.org/repo/debian-kit-en.html

Linux – keep it simple.”

When you start the shell script for Debian Kit, you will be asked to confirm if you want to install it, press y for yes or it will not continue. A laundry list of items that are needed to get all of the files you need are installed. Be sure that your phone is plugged in or that the battery is at least fully charged. I also recommend that you utilize a wifi connection somewhere, as this is going to download a lot of files, which will take a lot longer on cell phone bandwidth (mine was 3G) and it is going to cost you if you pay for data. I had unlimited data and time to kill, so I have done it on the cellular signal, but it takes a lot longer that way.

After many scrolling files are downloaded and unpacked, it will then present you with a menu prompt. It looks SIMILAR to this, but not exactly, as this is from memory:

0 Small 512 MB
1 Medium 1024 MB
2 Large 2048 MB
s Debian Squeeze
l Ubuntu Lucid
p Ubuntu Precise

Press a number and a letter (E.G. 0s for a small Debian installation):

I chose 2s for a large Debian Squeeze installation. It then proceeds to download (using apt-get) from the standard Linux repositories. In either event, you will be waiting for quite some time, limited processing power and internet speeds will dictate your wait.

Now it will ask you if you wish to delete the Debian Kit files or retain them for future use. You don’t need them and you can always run the shell script again, as it will not be deleted.

When it is done, it will inform you that you can start your Debian by typing deb in the terminal app. This gives you several options actually:

deb ?: help, display this help text
deb u: umount, remove symlinks and unmount Debian disk
deb k: kill, kill (-KILL) programs, then unmount Debian disk
deb r: reboot, mount Debian readonly and reboot (last resort)
deb c: clean, clean symlinks to Android root from Debian disk
deb s: sshd, start the openssh server
deb S: sshd-stop, stop the openssh server
deb x: xrdp, start the xrdp server
deb X: xrdp-stop, stop the xrdp server

So, in your terminal app, if you type:

$deb

You will start Debian. It will automatically bind mount your /sdcard/debian.img file and give you the appropriate prompt:

root@localhost:/#

And you are in. Now, you should get your system up to date:

#apt-get update
#apt-get upgrade

And I recommend installing Sven’s handy packages that add the proper priveleges to your users, you don’t have to, but you will need to add them by hand if you don’t use this:

#apt-get install andromize
#apt-get install andromize-lxde

Now your system is ready. I personally recommend installing openssh server also. The “andromize-lxde” package installs LXDE and XRDP already set up for you to use. It is pretty handy, but you can install those things manually also, which I have done before. If you do install them manually, be sure to install openssh and XRDP so that the deb s and deb x scripts will start them for you automatically.

To simplify startup, and since I wanted Linux running any time the phone is on, I went back to my BusyBox app and added the following script to autorun when Android boots:

#!/system/bin/sh

deb s
deb x

Now Android will automatically start BusyBox on boot up, which will automatically start Debian! So, now that we have this super wham-a-dine system, how do we use it?

Well, in the terminal app, you can simply type deb, which will put you at the command prompt:

root@localhost:/#

And you can proceed as normal from the command line.

Another option is to finish setting up your openssh server and installing an ssh Android app. Which will bring you to the same place once you log in, but does give you options when you are on the wifi to connect from your computer.

root@localhost:/#

You can also install an app like “Remote RDP Lite” and access your phone via XRDP and have a full GUI. At this point your only installed GUI is LXDE. I personally prefer JWM, and changed mine to load this instead, but this is a matter of taste vs. functionality. On my Motorola Flipside MB508 phone, Gnome and XFCE are too heavy. LXDE is a bit of a burden memory-wise, and I have tried several Light Weight Desktop Environments/Windows Managers, such as OpenBox and MatchBox, which work much better. When I look at the memory usage, the Android OS is usually using about 350 MB of my 512 MB of phone RAM, so I decided the lighter, the better for the window manager. That is a decision you will have to make on your own.

I personally recommend that you make a new user account and give them sudo permissions (for example) or edit sudoers with visudo:

#adduser USERNAME
#adduser USERNAME sudo

Now you can log in on your phone from 127.0.0.1:3389 in your RDP app, or if you are on a wifi network, from your computer with:

$rdesktop -g 800×600 -u USERNAME 192.168.xxx.xxx

To which you will be greeted by a login prompt for the password and then the screen will load. Now it is up to you to customize to suite your needs!

Linux – keep it simple.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s