Debian on Android Hi guys,
So in this tutorial i’m gonna teach how to run Debian on your mobile device or on a tablet with a graphical interface.
NOTE : This should work with ubuntu too ;)
What you will need :
1. A debian box (It can be without a Graphical Interface and on a VM)
2. Internet Connection.
3. These two files on your debian box .
1 . qemu-arm-static ( for x86 and amd64 systems )
2.  qemu-kvm-extras ( for x86 and amd64 systems)
4. A kernel that support ext2 (or your desired filesystem)
5. Root access to your phone.
6. Busybox on your android phone.
So let’s get started !
1. Turn on your debian box and go to the terminal (if you are without the graphical interface your terminal is already open)
2. Install these packages using aptitude : apititude install debootstrap binfmt-support qemu-user (if you are a regular user use sudo)
3. Now once you downloaded the packages. Proceed to the files that you downloaded. First install qemu-kvm-extras-static then install the qemu-arm-static
So dpkg -i packagename .
4.Now you will need to create a blank .img file. The recommended size is 2gb but if you want you can make it bigger.
The command is : dd if=/dev/zero of=debian.img bs=1024 count=1950000
5. Next we need to set up a filesystem on that .img file. It’s recommended ext2 but you can choose your own.
So : mkfs.ext2 -F debian.img (again if you are a regular user use sudo.)
6. Now execute this : tune2fs -c0 debian.img . I believe this removes the mount counter so that it wouldn’t check the filesystem automaticly.
7. Now create a directory called debian and mount the debian.img on it.
Do : mount -o loop debian.img debian/
8. Now starts the long part. Actually the time depends on your network speed. You need to download all the files you need for the system to work.
So to do that you need to execute : build-arm-chroot –verbose –arch=armel –foreign wheezy http://ftp.de.debian.org/debian .
9. Once done create a mount point for the sdcard. So let’s do : mkdir debian/sdcard
10. You need to mount a few things like proc sysfs and dev. Execute this :
1. mount -t proc none debian/proc/
2. mount -t sysfs sysfs debian/sys/
3. mount -t devpts devpts debian/dev/pts
11. Now chrooting time! Do a : chroot debian/ /bin/bash
12. Now you need to set some variables :
export HOME=/root
export USER=root
export LC_ALL=C
13. Now it’s time to add Package Repositories to our debian install do :
echo ‘deb http://ftp.de.debian.org/debian main contrib non-free’ > /etc/apt/sources.list
14. Now it’s time to get all the repo info and other stuff, so:
aptitude update
15. Now download xorg, do a : aptitude install xorg.
16. Once done i recommend to install the minimal lxde and a vnc server, the command is :
aptitude install –without-recommends lxde tightvncserver xfonts-base
17. Once done I recommend installing these packages : openssh-client openssh-server git psmisc nmap
So: aptitude install openssh-server openssh-client git psmisc nmap
18. Now clean up a little! Do a : aptitude clean
19. Now let’s add a hostname i suggest localhost so : echo localhost > /etc/hostname
20. And a DNS :D : echo ‘nameserver 4.2.2.2′ > /etc/resolv.conf
21. Now it’s time to do a little bit of config :
1. Now let’s create the config files : vncserver -geometry 800×600 . After : killall Xtightvnc .
2. Let’s set a password to the vncserver : vncpasswd . It will prompt you for a password. And then it will ask about a view-only password just press ‘n’
3. So you have make vnc start lxde when vncserver is started, so : sed -i ‘s/\/etc\/X11\/Xsession/lxsession/’ /root/.vnc/xstartup . This will remove the preset Xsession to lxsession.
22. Now shutdown everything, do :
1. killall qemu-arm-static
2. exit
3. umount debian/proc
4. umount debian/dev/pts
5. umount debian/sys
6. umount debian/
23. Now create one folder:
1. Create a folder in the root fo your sdcard called debian
24. Now copy the debian.img file to your debian folder on your sdcard.
25. Download these file (this and this) and put in your android /system/bin/ (requires root)
26. Now once on android terminal execute :
1. su
2. startdeb
3. lxde
This will chroot you to debian.img file and start the vnc server with lxde environment!
NOTE : Do Not Exit out of the terminal just press the home button!
27. Configure your vnc client on your android device. I used this one : https://market.android.com/details?id=android.androidVNC.
So the configuration :
1. Nickname : (set anything you want)
2. Password : (this is the one that you set using vncpasswd)
3. Address : localhost
4. Port : 5900
5. Username : leave this blank
6. Color format : 24-bit color (4 bpp)
7. Leave the “Local mouse pointer” unchecked.
28. once you want to exit out of debian. Close the vnc app get back on the terminal from the status bar. Enter:
1. klxde
2. exit
3. stopdeb
That’s it!. Hope you liked it guys :) Happy Androiding :D
Surprise! Now for all you lazy pants or for you guys who don’t have ubuntu or debian here are 4GB (link) and 2GB (link) images of debian. (Just don’t forget to set the vnc password as mentioned in step 21 – 2 .). They are in 7z format. So don’t forget unzipping it :)
And so that you know. Me and Motafoca are gonna work on this and create several distro like the server version and etc.
So wait for updates!