Saturday, April 5, 2014

Linux on Android using Complete Linux Installer: Hiccup and Fix!

The benefit of having a full linux distribution running on android device, such as Asus transformer Prime/Infinity, is up to who you are. For me as a developer, it's really a great platform for me to play around with new language, practice new skill and, experiment with new tools without mass up with my work notebook. For sys admin, it's quite a nice to have a full bowl linux to work on ... And I think Complete Linux Installer does a good job helping me to setup a linux distribution on android device.

Nothing perfect thou. There are a few hiccup ... a few annoying issues which may or may not have a fix for it. Keep in mind, the app allow to have a full linux running on android by chroot to a linux image, and connect to it with vnc or ssh. There will be some issues that there is no solution for it (or there is but I don't know :p)

Where is my eth0?

First hiccup after boot the system is this error message:
If connecting from a different mach ... android device use the address below:
eth0: error fetching interface information: Device not found

This is a simply the /root/init.sh expect the network interface to be "eth0". Unfortunately, that is not always true. To find out which interface you have, use "ifconfig". In my case, it is "wlan0".

To fix this, simply edit /root/init.sh script. Change "eth0" to "wlan0", in my case, and you will be done.




How much disk space I have?, "df" issue

This is quite annoy when simple command like "df" (diskfree) doesn't work at all. It's not report any thing. This is because the "df" command can not read file table which provide this information. Fortunately, there are easy solution for issue if all you want is to see how much disk space available.

By simply alias "df" to take which file system to report on, it's solve the problem. This time you edit /root/.bashrc script to add alias, as shown. This fix is only report disk space on "/" and "/sdcard", and it's not useful for other system tools which require to have device information.


Where is my external sdcard?

Like me, you probably have external microsd card install with the system. Is the "/sdcard" refer to this external sdcard? ... No it's not. It's the internal sdcard that come with the prime tablet.

Sorry to say, I don't know the answer to this question because the external sd card is mount on "/Removable/SD" which can not be access in the chroot system. There might be a way to allow access to /Removeable/SD from the chroot system, but I do not know now. If you know, please comment below. :)

Can I create normal account? What do I need to know?

Obviously, running the system as root is not a good idea. First thing, create a user using command
$ adduser new_user

What you need to do after that is adding the new_user to the following groups:
This will allow new_user to use network and also access both read and write to internal sdcard.

I also recommand to add new_user to group: sudo, users, ssh, and crontab if you plan to use it.

However, it's still booting directly to root! Obviously, you can just type

$ su -l new_user

And you will be right at home. However, it's an extra step to do after boot, which kinda annoying.
However, we can do this automatically but edit "/root/init.sh" once again.


The line "/bin/bash -i" is responsible for spwan a shell. We just has to replace that line with
"/bin/su -l new_user" and the system will boot directly to the new_user.

That's it! for today. See you next post ... which I will try to get more memory to the system by enabling swap image. :)