Monday, February 28, 2011

Ubuntu and Debian on HTC Incredible

I have recently, successfully installed bot Ubuntu and Debian on my HTC/Droid Incredible. The speed is good, (for a phone) and all in all it works great, however it took the use of multiple guides to get this to work. As far as I know this guide is HTC incredible specific, however i imagine it would not be difficult to implement on many different devices. So now for what you are all waiting for THE GUIDE:

1. Find a Computer running Ubuntu
2. open Terminal
3. copy and paste the following text into terminal

sudo -s
apt-get install debootstrap
dd if=/dev/zero of=debian.img seek=838860800 bs=1 count=1
mke2fs -F debian.img
mkdir debian
mount -o loop debian.img debian/
debootstrap --verbose --arch armel --foreign lenny debian
umount debian/
rm -r debian/
4. Open up a text editor and name it "" (without the quotes)
5. now copy and paste the following text into your new file

if [[ $EUID -ne 0 ]]
echo "Becoming ROOT!"
su -c bootdebian
exit 1

echo "Mounting system as R/W"
mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system

echo "Setting some stuff up.."
export bin=/system/bin
export img=/mnt/sdcard/debian.img
export mnt=/data/local/debian
export PATH=$bin:/usr/bin:/usr/sbin:/bin:$PATH
export TERM=linux
export HOME=/root
if [ ! -d $mnt ]
mkdir $mnt

echo "Mounting the Linux Image"
mknod /dev/block/loop5 b 7 0 #may already exist
losetup /dev/block/loop5 $img
mount -t ext2 -o noatime,nodiratime /dev/block/loop5 $mnt
mount -t devpts devpts $mnt/dev/pts
mount -t proc proc $mnt/proc
mount -t sysfs sysfs $mnt/sys

echo "Setting Up Networking"
sysctl -w net.ipv4.ip_forward=1
echo "nameserver" > $mnt/etc/resolv.conf
echo "nameserver" >> $mnt/etc/resolv.conf
echo " localhost" > $mnt/etc/hosts

echo "Mounting sdcard and emmc in /mnt"
if [ ! -d $mnt/mnt/emmc ]
mkdir $mnt/mnt/emmc
busybox mount --bind /mnt/emmc/ $mnt/mnt/emmc
if [ ! -d $mnt/mnt/sdcard ]
mkdir $mnt/mnt/sdcard
busybox mount --bind /mnt/sdcard/ $mnt/mnt/sdcard

echo "Entering CHROOT "
echo " "
chroot $mnt /bin/bash

echo " "
echo "Shutting down CHROOT"
umount $mnt/mnt/emmc
umount $mnt/mnt/sdcard
sysctl -w net.ipv4.ip_forward=0
umount $mnt/dev/pts
umount $mnt/proc
umount $mnt/sys
umount $mnt
losetup -d /dev/block/loop5
mount -o remount,ro -t yaffs2 /dev/block/mtdblock3 /system
6. now save and close that file
7. copy and debian.img (created in step 3) to the root of your sdcard
8. Now we are switching to the phone side of this process. You are gonna need some sort of terminal app, i use terminal emulator (this could also be done from adb shell)
9. input the following text into your terminal LINE BY LINE do not copy and paste their is not guarantee of copy and paste working here, so just dont even bother (make sure to do a nandroid backup before doing this step)
mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system
cat /sdcard/ > /system/xbin/
rm /sdcard/
chmod 777 /system/xbin/
/debootstrap/debootstrap --second-stage
echo 'deb lenny main' >/etc/apt/sources.list
apt-get autoclean
apt-get update
10. Now debian is installed! whenever you want to start it again, just type "" (without the quotes).
11. Now for the hard part.......getting the GUI. start debian
12. do this part on the phone terminal not adb shell. type in the following text line by line, (this part will take a while)
apt-get update
apt-get install tighvncserver
apt-get install lxde
export USER=root
vncserver –geometry 1024x800
13. After typing the last command you will be asked for a password (make it at least 8 characters). If you wanted to you could now use a vnc viewer ON YOUR PHONE to view the GUI. However you will have to type the last 2 lines of the above command everytime you want to start the GUI.
14. To make it permanent using your phone terminal or adb input the following text
cat > /root/.vnc/xstartup
xrdb $HOME/.Xresources
xsetroot -solid grey
icewm &
15. Press “CTRL+D” twice after the last line of the command
16. now input this next set of text
cat > front
export USER=root
cd /
rm -r -f tmp
mkdir tmp
cd /
vncserver -geometry 1024×800
17. Press “CTRL+D” twice after the last line of the command
18. Now enter the following text
cat front /root/.bashrc > temp
cp temp /root/.bashrc
19. DONE!!!. Now all you have to do is type "" (without the quotes) and it will start debian as well as the
gui automatically, so you could now go into Android vnc (the vnc viewer I use) or whatever viewer you choose to use and enter into the Gui.
I am not responsible for anything that may happen to your device during, before, or as a result of this process. If you have any questions what so ever, post a comment and i will answer
to the best of my ability. I will probably post the ubuntu tutorial, some time next week. THANK YOU!
Sources:  ;

Thursday, February 17, 2011


Welcome to G-Space, Here we will do our best to help with any of your tech based needs. We do not take responsibility for anything that may happen to go wrong during one of our tutorials. Please feel free to ask any questions, and we will do our best to accurately respond.