A note about CPU support
Ubuntu does not support earlier ARM CPUs like the ones used in the T-Mobile G1 and Motorola Cliq. You need at least an ARMv7 CPU like the kind found in the Motorola Droid, T-Mobile G2 or most newer phones (Hummingbird, Snapdragon, Tegra2, etc.). If you're not sure what your device has, look up your device on http://pdadb.net/, click the link under CPU, and read the line for "Supported Instruction Set(s)".Debian supports the CPU on practically all Android devices, so if you prefer Debian, or you can't run Ubuntu, choose the Debian download below.
Requirements:
You will need to root your device.
Required Files:
Choose one of the following:- linux.ubuntu-natty.tar.bz2 Ubuntu 11.04 (Natty)
- linux.ubuntu-oneiric.tar.bz2 Ubuntu 11.10 (Oneiric)
- linux.debian-squeeze.tar.bz2 Debian 6.0 (Squeeze)
Required Apps:
BusyBox InstallerA terminal emulator like ConnectBot or Terminal Emulator
Optional Apps:
androidVNCConnectBot
Phase 1 - Preinstall:
(Mount the SD card on your computer.)
Extract the .tar.bz2 file you downloaded to your SD card. You should now have a folder named "
linux
" on the root of your card.(Unmount the SD card.)
Open Busybox Installer, and install Busybox.
Phase 2 - Install
Open your terminal emulator. (If using ConnectBot, connect to 'local', not 'ssh'.)
Run the following commands:
su
cd /sdcard/linux
sh install.sh
If you don't see any errors, Linux is now installed.
Phase 3 - Running Ubuntu
Open your terminal emulator.
To start a chroot session
su
linux
To start the SSH server
su
linux ssh
You can then use ConnectBot (SSH: user@localhost) on your device, or any SSH client to connect to your device. See Login Information, below.
To start a VNC session
su
linux vnc
The first time you run VNC, it will prompt you to create a VNC password.
You can then use androidVNC (host: localhost port: 5901), or any VNC client to connect to your device.
Note: The default desktop environment is icewm. If you wish to replace it, for example, with LXDE:
Run the following as root in Linux:
apt-get autoremove icewm- lxde+
Login information:
Please remember to change these passwords if you are planning on using the SSH server. Malicious people can do Very Bad things to your device if you don't.
There are two accounts included in the images:
root
Password:cheesecake
user
Password:dessert
The Scripts
If you would like to try a different distro altogether, you can download just the collection of scripts involved in installing, mounting, and running Linux. Your filesystem image should be
/sdcard/linux/linux.img
. You will need to modify the scripts in linux/root-scripts/
to suit your distro.
hiii...tried installing your ubuntu on my HTC wildfire...
ReplyDeleteit installed properly...
but when i try to configure vnc it throws below error
# ubuntu vnc
ubuntu vnc
Mounting...
[ Done ]
[1] Segmentation fault chroot ${mnt} /r...
#
I say, this is about as useful as not having a laptop with you. When will you not have that?! If i were to carry an extra keyboard just for the droid, I'd carry a laptop, or both... Yet, its cool as beans!
ReplyDeletewon't install for me on my dinc2, just throws up errors on every line of the script. rooted and granted su permissions to the app
ReplyDeleteis this site dead? posted a comment on the older article and got no response.
ReplyDelete@fakiesk8r333
ReplyDelete(I just don't watch the old post anymore)
What device are you using?
Which version of Android is it running?
Which version of Busybox is installed?
Please paste the whole output of
sh install.sh
here. I need to know exactly what's going wrong.
What is power consumption like? Can I choice to not run Ubuntu? How about fully reverting?
ReplyDelete@Drew
ReplyDeleteThe battery cost for the SSH and VNC servers is negligible. Each chroot session is closed when you exit it.
This guide lets Ubuntu applications run in Android. You simply use Ubuntu applications from console (chroot or SSH) or GUI (VNC) as normal.
To uninstall:: Reboot, then delete /sdcard/linux .
I noticed that someone else had had this error too... I'm doing this on an stock Evo 4g but after I get it to work plan on putting it on an incredible. I'm going to try to use my own brain change the permissions my self and perhaps reboot into cm7 (and maybe some sleep would help)... Still, I thought it might be helpful to share.
ReplyDelete$ export PATH=/data/local/bin:$PATH
$ su
# su
# cd /mnt/sdcard/linux
# sh install.sh
mount: No such file or directory
cp: can't create '/system/bin/fsrw': Read-only file system
Unable to chmod /system/bin/fsrw: No such file or directory
cp: can't create '/system/bin/linux': Read-only file system
Unable to chmod /system/bin/linux: No such file or directory
install.sh: /system/bin/linux: not found
install.sh: cannot create /data/local/mnt/etc/resolv.conf: directory nonexistent
install.sh: cannot create /data/local/mnt/etc/resolv.conf: directory nonexistent
mkdir failed for /data/local/mnt/root/scripts, No such file or directory
Unable to chmod /data/local/mnt/root/scripts: No such file or directory
cp: can't create '/data/local/mnt/root/scripts/ssh.sh': No such file or directory
cp: can't create '/data/local/mnt/root/scripts/vnc.sh': No such file or directory
Unable to chmod /data/local/mnt/root/scripts/*: No such file or directory
Install finished
#
@Adam Rabbit
ReplyDeleteThe script is failing to make the /system partition writable. Seeing the output of the command 'mount' will help me fix my script.
Please try running
"mount -t yaffs2 -o remount,rw /dev/block/mtdblock4 /system"
Then install busybox and install Ubuntu.
It looks like the stock ROM for the Evo 4g is NAND locked on /system. Without flashing a custom ROM, you'll have to reinstall busybox and Ubuntu after each reboot. http://forum.xda-developers.com/showthread.php?t=696681
Secret ninja technique:
What happens if you run this:
"sh /sdcard/linux/scripts/linux"
as root?
Hmm... I tried everything but no matter what I did it wouldn't work on my Evo... I'm positive the problem lies in me. Anyway, I got it working on my incredible no problem... which is perfect for me as I'm going through a broke due to life changes phase yet still have to replace a recently decreased laptop. The Evo sports a bluetooth keyboard and mouse, HDMI monitor for a "it will have to do for now" desktop solution. The Ubuntu cm7 htc incredible is wifi tethered to the Evo allowing me to have a Ubuntu vnc session on the Evo... So if I really need to use a "real" app I can do so without bogging the Evo down. hopefully it will work... And if nothing else it's damn fun... So thank you so much for these instructions!
ReplyDeleteI get segmentation fault when trying to launch vnc, I'm chrooted into the system but every command says segmentation fault. any help?
ReplyDeleteatrix on cyanganmod
@Sifu Dylan Kirk
ReplyDeleteHmm... For the Atrix, it would be more appropriate to use the Webtop mods in the Atrix section of xda-developers.
http://forum.xda-developers.com/showthread.php?t=1012684
http://forum.xda-developers.com/showthread.php?t=1119555
Ubuntu 11.10 had relesed, so can I replace the linux.img file with the img inside "ubuntu-11.10-preinstalled-desktop-armel+omap.img.gz" and just follow the other steps above?
ReplyDelete(my phone is moto defy)
@花巴特
ReplyDeleteYou could use a standard Ubuntu image. You will need to modify linux/root-scripts/vnc.sh in order to use VNC.
On the other hand, I have just added downloads for Ubuntu 11.10 and Debian 6.0. See the links above.
can i use an standar puppy linux distro?
DeleteAny Linux distro you want to use needs to have an ARM port (armel or armhf)
DeleteI can't an official build of Puppy Linux for ARM processors. It seems there is one in the works, though: http://puppylinux.org/wikka/PARM
readlink: applet not found
ReplyDeleteDoesn't remount system rw.
failed I5800
@Markoboy
ReplyDeleteBusybox is supposed to come with readlink. It seems like you're using a version which doesn't. I would be very interested in finding out which version of busybox is installed. Please run the command 'busybox' and paste the output in your reply. Which Busybox installer did you use?
Try installing a different version of busybox.
I am getting this error:
ReplyDelete# sh ./install.sh
Remounting /system rw ...
Installing scripts in /system/bin ...
Mounting the Linux image ...
Mounting: Prepwork ...
Mounting: Loopback mount ...
mount: mounting /dev/block/loop254 on /data/local/mnt failed: Invalid argument
Mounting: Setting up chroot environment ...
mount: mounting /dev on /data/local/mnt/dev failed: No such file or directory
mount: mounting devpts on /data/local/mnt/dev/pts failed: No such file or directory
mount: mounting /proc on /data/local/mnt/proc failed: No such file or directory
mount: mounting /sys on /data/local/mnt/sys failed: No such file or directory
mkdir: can't create directory '/data/local/mnt/media/sdcard': No such file or directory
mount: mounting /mnt/sdcard on /data/local/mnt/media/sdcard failed: No such file or directory
[ Done ]
Customizing the image ...
./install.sh: cannot create /data/local/mnt/etc/resolv.conf: directory nonexistent
./install.sh: cannot create /data/local/mnt/etc/resolv.conf: directory nonexistent
Installing root-scripts ...
mkdir: can't create directory '/data/local/mnt/root/scripts': No such file or directory
chmod: /data/local/mnt/root/scripts: No such file or directory
cp: can't create '/data/local/mnt/root/scripts/ssh.sh': No such file or directory
cp: can't create '/data/local/mnt/root/scripts/vnc.sh': No such file or directory
chmod: /data/local/mnt/root/scripts/*: No such file or directory
Install finished
#
what does that invalid argument thing mean?
OG Droid CM 7.1 Busybox:v1.19.1-cm71 bionic
@SuperPichu
ReplyDeleteThe actual command that's erroring out is:
mount -t ext2 -o relatime /dev/block/loop254 /data/local/mnt
The error means that there is a problem with one of pieces of the command above.
Let's troubleshoot:
We'll try testing individual pieces of the command.
Immediately after running the install script (it sets some things up), run the following commands, one at a time, and tell me what happens:
cat /proc/filesystems
losetup /dev/block/loop254
ls -l `which mount`
mount -t ext2 -o relatime /dev/block/loop254 /data/local/mnt
mount -t ext2 /dev/block/loop254 /data/local/mnt
mount -t ext3 /dev/block/loop254 /data/local/mnt
cat/proc/filesystems
ReplyDeletenodev sysfs
nodev rootfs
nodev bdev
nodev proc
nodev cgroup
nodev tmpfs
nodev sockfs
nodev usbfs
nodev pipefs
nodev anon_inodefs
nodev inotifyfs
nodev devpts
nodev ramfs
vfat
yaffs
yaffs2
ext2
losetup /dev/block/loop254
losetup: /dev/block/loop254: No such device or address
ls -l 'which mount'
lrwxrwxrwx 1 0 0 7 Jan 1 1970 /system/xbin/mount -> busybox
mount: mounting /dev/block/loop254 on /data/local/mnt failed: Invalid argument
mount: mounting /dev/block/loop254 on /data/local/mnt failed: Invalid argument
mount: mounting /dev/block/loop254 on /data/local/mnt failed: No such device
Also is it okay that I am doing this through adb shell?
@SuperPichu
ReplyDeleteadb shell is fine.
The loopback device isn't getting created properly.
More troubleshooting:
ls -l /dev/block/loop*
mount | grep sdcard
I will just link to the output so my comments aren't so ridiculously long.
ReplyDeletels
mount
I'm having the same issue as the first comment on this post (which went unanswered, I might add)
ReplyDeleteAny ideas?
@id
ReplyDelete"Segmentation Fault" is the most generic error possible. Does the same error happen if you just use chroot or SSH? Does the same error happen if you try Debian?
If you can, attach a debugger to vncserver and find out what's going wrong.
@SuperPichu Found a typo. Fixed below:
ReplyDeleteYou may have to file a bug report against CyanogenMod.
From a fresh reboot, run the commands:
mount -o remount,dev /mnt/sdcard
mknod /dev/block/loop254 b 7 254
losetup /dev/block/loop254 /mnt/sdcard/linux/linux.img
losetup /dev/block/loop254
What we expect to see from the last command:
/dev/block/loop254: 0 /mnt/sdcard/linux/linux.img
Let me know what you actually see from the last command when you try. If you get anything different, like the error you saw last time, you should file a bug report.
(Droid 1, right?) Also try installing one of ChevyNo1's kernels: http://www.droidforums.net/forum/chevyno1/150712-kernels-5-31-11-froyo-gingerbread.html
Ran those commands. I got the correct output from the last one. I am already using Chevys kernels. Still getting invalid argument though
ReplyDelete@SuperPichu
ReplyDeleteI have updated the scripts, mostly to force using the busybox version of the mount command. That should hopefully fix the issue: http://ohm.nerd65536.com/android-linux/scripts-latest.tar.bz2
I have been following along as well as Superpichu, and am having the same issues on my droid x. Unfortunately the new scripts did not fix the issue, and the error message is still the same. Thanks for all of the help!
ReplyDelete$ export PATH=/data/local/bin:$PATH
ReplyDelete$ su
# cd sdcard
# cd linux
# sh install.sh
Remounting /system rw ...
mount: No such file or directory
Usage: mount [-r] [-w] [-o options] [-t type] device directory
Installing scripts in /system/bin ...
Mounting the Linux image ...
Mounting: Prepwork ...
Usage: mount [-r] [-w] [-o options] [-t type] device directory
Mounting: Loopback mount ...
mount: Invalid argument
Mounting: Setting up chroot environment ...
mount: No such file or directory
mount: No such file or directory
mount: No such file or directory
mount: No such file or directory
mkdir failed for /data/local/mnt/media/sdcard, No such file or directory
mount: No such file or directory
[ Done ]
Customizing the image ...
install.sh: cannot create /data/local/mnt/etc/resolv.conf: directory nonexistent
install.sh: cannot create /data/local/mnt/etc/resolv.conf: directory nonexistent
Installing root-scripts ...
mkdir failed for /data/local/mnt/root/scripts, No such file or directory
Unable to chmod /data/local/mnt/root/scripts: No such file or directory
cp: can't create '/data/local/mnt/root/scripts/ssh.sh': No such file or directory
cp: can't create '/data/local/mnt/root/scripts/vnc.sh': No such file or directory
Unable to chmod /data/local/mnt/root/scripts/*: No such file or directory
Install finished
#
Trying a different ROM. I'm downloading it now. What's the problem here?
Tried a different ROM and got a different set of errors.
ReplyDeletesh-3.2$ export PATH=/data/local/bin:$PATH
sh-3.2$ su
sh-3.2# cd sdcard/linux
sh-3.2# sh install.sh
Remounting /system rw ...
mount: No such file or directory
Usage: mount [-r] [-w] [-o options] [-t type] device directory
Installing scripts in /system/bin ...
cp: can't create '/system/bin/fsrw': Read-only file system
Unable to chmod /system/bin/fsrw: No such file or directory
cp: can't create '/system/bin/linux': Read-only file system
Unable to chmod /system/bin/linux: No such file or directory
Mounting the Linux image ...
install.sh: line 26: /system/bin/linux: No such file or directory
Customizing the image ...
install.sh: line 29: /data/local/mnt/etc/resolv.conf: No such file or directory
install.sh: line 30: /data/local/mnt/etc/resolv.conf: No such file or directory
Installing root-scripts ...
mkdir failed for /data/local/mnt/root/scripts, No such file or directory
Unable to chmod /data/local/mnt/root/scripts: No such file or directory
cp: can't create '/data/local/mnt/root/scripts/ssh.sh': No such file or directory
cp: can't create '/data/local/mnt/root/scripts/vnc.sh': No such file or directory
Unable to chmod /data/local/mnt/root/scripts/*: No such file or directory
Install finished
sh-3.2#
Hey. i got everything installed right and booted and connected with VNC Viewer. BUT terminal inside "ubuntu" does not work. i tried to install chromium, terminal and Unity via ssh, but when i connected with VNC again i did not find the programs anywhere. what the hell is this? strange looks on the ubuntu to. I have a Samsung Galaxy S2 with CyanogenMod 7
ReplyDeleteRequesting answer
ReplyDelete@Cotin
ReplyDeleteNote: The default desktop environment is icewm. If you wish to replace it, for example, with LXDE:
Run the following as root in Ubuntu.
apt-get autoremove icewm- lxde+
Log in via ssh, and replace icewm with lxde.
@super3devo
ReplyDeleteThe same step is failing on both ROMS:
Remounting /system rw ...
mount: No such file or directory
Please download this set of scripts, and update what's on your SD card: http://ohm.nerd65536.com/android-linux/scripts-latest.tar.bz2
Let me know whether that fixes it.
Ok thanks for answer.
ReplyDeletei did sudo apt-get autoremove icewm- lxde+
in the SSH but when i access ubuntu with VNC nothing was changed.
And do i have to do:
su
cd /sdcard/linux
sh install.sh
everytime i want to use ubuntu?
NEVER MIND SORRY. i just had to reboot phone.
ReplyDeleteLXDE works :D
But i am having problems with starting Chromium :( :(
I installed firefox via the terminal.
ReplyDeletebut i get crash report everytime i start firefox.
Do you have a solution for me please?
@Cotin
ReplyDeleteI'm not sure what the problem is with Firefox, but there is a Chromium problem that can be fixed with the latest version of the scripts:
http://ohm.nerd65536.com/android-linux/scripts-latest.tar.bz2
(update what's on the SD card, reboot, then do install.sh)
Thank you very much!! But i'm having major problems with extracting the .tar.bz2 file with the new scripts. Archive manager gives me error and other programs cannotc extract the program either. could you maybe make a simple .zip file ?
ReplyDeletethat would help me very much thank you!! :)
Great write up. I have tried so many other ways with no luck. It was your new scripts http://ohm.nerd65536.com/android-linux/scripts-latest.tar.bz2 that did the trick.
ReplyDeleteI also used the info you provided with links to your page at http://forum.xda-developers.com/showthread.php?p=20181268#post20181268 as long as you don't mind, credit given of course.
Question: Are these builds set up with a swap file enabled, or is there any way you know of to do it on Android? I have a separate ext4 partition on my sd card as well, if it could be used. Thanks again!
@SHM
ReplyDeleteSwap is handled by the Android kernel. You may need to install a custom kernel to enable swap.
Check out "Swapper 2" on the Market for more information.
I can get debian to run fine, but ubuntu just comes up with the Segmentation error.. Any help?
ReplyDeleteI'm running it on a HTC Wildfire
@Owen
ReplyDeleteWhich model HTC Wildfire is it? There are several versions, and most of them are ARMv6. You can only use Ubuntu if you have an ARMv7 or higher.
What does running "uname -m" report as your CPU type?
It outputs: armv61
ReplyDeleteI don't think it has anything to do with the cpu yet though. Unless segmentation means exactly that?
@Owen
ReplyDeleteYou have an ARMv6 CPU. Ubuntu requires at least an ARMv7 CPU. That's the reason for the segfault.
Oh ok. Thank you anyway.
ReplyDeleteAlthough I have a question, would it be possible to get it to run just the ssh? And not the graphical environment? Therefore i could get something out of it. The only reason why I'm asking and so onto ubuntu is that debians openjdj-6-jre fails and throws out an error if i close it forcefully, and cannot be rsolved since its a bug.
@Owen
ReplyDeleteFrom a clean boot, run "linux ssh": That will start only the SSH server.
Ah ok. That is with ubuntu?
ReplyDeleteAlso, Is there a chance I could get an FTP server to run? So I can copy files over etc? I can't seem to connect when i install proftpd fine.
ReplyDeleteI am having difficulty installing. I believe this is because my device is a Superpad III with two sdcard slots named sdcard1 and sdcard2. I attempted to install from sdcard1. Of course, this did not work. How can the scripts be modified to install from /sdcard1/ instead of /sdcard/? Also, on my device, I believe that /sdcard/ is a directory in the internal memory.
ReplyDelete@jay
ReplyDeleteGo ahead and grab the latest version of the scripts: http://ohm.nerd65536.com/android-linux/scripts-latest.tar.bz2
You'll need to edit two files:
linux/install.sh
linux/scripts/linux
At the top of each, there is a line that reads:
sdcard=$(readlink -f /sdcard)
Change it to:
sdcard=$(readlink -f /sdcard1)
@Owen
ReplyDeleteAny services you install will have to be started manually.
/etc/init.d/proftpd start
(Note: SSH comes with a free SFTP server built-in.)
installed successfully but how can i see the graphic enviroment i only see: root@localhost
ReplyDeletesorry muy english im from mexico very nice post!
@Enrique
DeleteYou must follow the VNC instructions.
thanks for the quick response!!
Deletei excute : linux vnc , enter the password but i only got letters but no graphic enviroment, marks me a warning: please check your locale settings:
LANGUAGE = (unset)
LC_ALL = (unset)
LANG = "en_us.utf-8"
Use androidVNC (host: localhost port: 5901), or any VNC client to connect to your device.
Deleteok, sorry i thinked that in the device screen we can look the debian gui , only we can see de gui outside from a pc, laptop or another device with large screen using vnc client? or is a way to see the debian gui in the device (phone) screen?
DeleteUse androidVNC
Deletewhat is your email so i send you a log of my errors
ReplyDeleteThe links are broken
ReplyDeleteThe links should be up now.
Deletehow can i close the (linux so) process? to increase the android performance?
ReplyDeletehow can i change vnc geometry? ie. 1024*768
ReplyDeleteEdit the file on your SD card: linux/root-scripts/vnc.sh , then run install.sh again.
Deletethanks done!!! how can i mount the sdcard inside the linux to get fotos and vids from there?
ReplyDeleteThe sdcard should already be mounted in the chroot as /media/sdcard/ .
Deletethanks, sorry about my multiple questions but in my opinion this is very usefull , have another question see my last one :)
Deletehow can i close the (linux so) process and the vncserver process? because they lock the sd card (if i want to mount it via usb to my pc)
ReplyDeleteI have the same problem and probe set SuperPichu line by line to see where is the problem and it gives me the first error in this lines
ReplyDeletecat/proc/filesystems:not fount
chroot: can't change root directory to /data/local/ubuntu: Operation not permitted
ReplyDeleteMake sure your device is rooted, and that you have run "su" first.
Delete(I use /data/local/linux for my chroot location, not /data/local/ubuntu)
Command sh install.sh is not working. This is what shows in Terminal Emulator
ReplyDeleteapp_33@android / $ su
app_33@android / # cd /sdcard/linus
app_33@android /sdcard/linux # sh install.sh
: not found2]:
: not found6]:
: not found11]:
Remounting /system rw ...
: No such file or directory
: not found15]:
...alling scripts in /system/bin
- No such file or directoryard
install.sh[18]: syntax error: 'do^M' unexpected
Motorola Xoom Wifi rooted with Cyanogenmod9 ISC ROM
Those are some strange looking errors. The presence of '^M' suggests that the install.sh script (and possibly others) was mangled by a conversion from Unix to DOS style line endings. Many text editors and FTP servers can do this.
DeleteTry the install again using the updated scripts, and make sure to copy them using Mass Storage Device mode, if your device supports it.
http://ohm.nerd65536.com/android-linux/scripts-latest.tar.bz2
I install ubuntu and does everything perfect, but at the end it has a line that says Segmentation Fault. When I try and mount it or use a command for it, it says Segmentation Fault. My device has no issues with creating partitions or mounting. I have installed and ran Debian perfectly on my android with no problem.
ReplyDelete