Ubuntu on Samsung Galaxy S (Android)

In my previous post I showed you how to create an chroot environment for the arm and run it on your Ubuntu. But it’s much nicer to see it work on a real device or on an Android device like Samsun Galaxy S GT-I9000.

To run Ubuntu on Android/Samsung you need to create an img file using my post, you can also use two of my start and stop scripts from here start stop.

I have also created an img for those that don’t want to or can’t create one: Download

Step 1:
Lets begin by preparing our device by create an folder on android, connect your phone to your computer and do:

sudo adb shell
cd /sdcard
mkdir ubuntu

Step 2:
Now you can upload the img file and if you like you can also upload my start and stop scripts.

sudo adb push ubuntu.img /sdcard/ubuntu
sudo adb push startA_ubuntu.sh /sdcard/ubuntu
sudo adb push stopA_ubuntu.sh /sdcard/ubuntu

Step 3:
Now that you have done all the prep work you can use your ubuntu by doing:

cd /sdcard/ubuntu 
sh startA_ubuntu.sh ubuntu.img

Step 4:
To exit just run:

sh stopA_ubuntu.sh

That’s it, no more no less :)

Oh I have also created two movies, first one shows how to setup and the second one is the prove it works on galaxy S. Have fun watching.

65 thoughts on “Ubuntu on Samsung Galaxy S (Android)

  1. Unimaginative

    So Ubuntu’s working so well on the SGS you need to use a VNC? Is this meant to be an attempt at trolling?

  2. Jzero88

    Great work!
    Have been looking for something like this since I got my Vibrant!!
    Brilliant, bloody brilliant.

  3. Scrizz


    What do you think localhost is?
    It IS running on the Vibrant.

    you should do some research on what localhost means.
    You are the troll my friend.

  4. admin Post author

    I am not trolling and never will. This is a real how to that shows you how to run Ubuntu using chroot.

    Thanks. It’s fun to play with, you should try it out.

  5. Pingback: Ubuntu on Galaxy S | Galaxy Root

  6. Lance

    Does wifi work?

    Does it support adobe flash? I tried googling flash support for “arm” (non-x86) versions of linux, but couldn’t find any info.

  7. admin Post author

    I don’t think you would like to use this in daily base, it’s just fun to play with it. Maybe next year when the CPU/MEM is better on the phones you will be able to use this as an thin client.

  8. Pingback: Ubuntu sur le Samsung Galaxy S i9200 « dvntnz

  9. h711

    nice effort there..got 1 question on VNC..do we need to setup anything in VNC frst?..

  10. h711

    yeah..i can run it now..need to start the vncserver first..btw..u r great!!

  11. damian

    i’m stuck using the command “mount -o loop,noatime /sdcard/ubuntu/ubuntu.img /data/local/mnt” which outputs “mount: mounting ubuntu.img on /data/local/mnt failed: Block device required” if anyone can help me

  12. damian

    and what about running this natively? anyone know much about the bootloader? cant we just run a boot script from within android? other than an xserver video driver, shouldnt most android drivers be compatible? aren’t they just linux kernel modules anyway??

  13. bhavish

    Is there a way that we can do this without harming the old content of the phone ?
    Will that happen and this running just as a client on the andriod ? am a noob at this so help would be great

    thanks in advance

  14. admin Post author

    I am not sure, I am no expert on this so. I can imagine that it could be possible but we need to dig a little bit further in to android to find out.

  15. admin Post author

    You are not harming the content on the phone, what you are doing is placing an Image file on your phone and chroot(starting ubunut next to android).

  16. AlCaTrAz

    Ok … and if we run linux next to android will it be possible to use aircrack ? or do u know if the wi-fi harware is capable of packet injection … i`ve been searching for this since i got my sgs … it would be a dream to really unleash the power of the 1gz proc and test wi-fi networks vulnerabilities ! Man you`r the greatest !! Hope you`ll look into the packet injection problem or if u already know this pls tell me your conclusion !!!! 10x

  17. AlCaTrAz

    I did all the prep work … (just copy/paste on sdcard because I run win7 on my laptop) I started the terminal emulator with SU permission (on sgs)and after I run the command “sh startA_ubuntu.sh ubuntu.img” hire is the error message I got :

    # sh startA_ubuntu.sh ubuntu.img
    ioctl LOOP_SET_FD failed: device or resource busy
    mount : no such file or directory
    mount : no such file or directory
    chroot: can`t execute ‘/bin/bash’: no such file or directory

    What is the problem ?

  18. gurulan

    H i Armin
    are you able to create and image of back track 4 to run on samsung galaxy s or within ubuntu on galaxy s

  19. Joel

    Jag får det inte att fungera.. Jag har original firmware rootat. Detta är mitt terminal-output:
    $ su
    # sh startA_ubuntu.sh
    [: not found
    test: not found
    mkdir failed for /data/local/mnt, File exists
    Usage: mount [-r] [-w] [-o options] [-t type] device directory
    mount: No such file or directory
    mount: No such file or directory
    chroot: not found
    Verkar som att den inte kan montera. Vad ska jag göra?

  20. Joel

    Sorry, I didn’t see this is an english blog xD The terminal output is in the post above. Looks like it has problems mounting something. What should I do?

  21. agung

    I use ubuntu.img…and can login with username : root and then i don’t know your password…can you give me password for ubuntu

  22. erni

    So everything works except when i’m trying to start your script i got an error that the folder /data/local/mnt doesn’t exist and that the resource is busy. What should i do?

  23. admin Post author

    Try creating the /data/local/mnt on your phone and you could try to create an second loop device.

  24. nemo

    I had to make a tiny change. What do you think?

    #Created by Armin Coralic http://blog.coralic.nl
    ln -s /dev/block/loop0 /dev/loop0
    ln -s /dev/block/loop1 /dev/loop1
    ln -s /dev/block/loop2 /dev/loop2
    ln -s /dev/block/loop3 /dev/loop3
    ln -s /dev/block/loop4 /dev/loop4
    ln -s /dev/block/loop5 /dev/loop5
    ln -s /dev/block/loop6 /dev/loop6
    ln -s /dev/block/loop7 /dev/loop7
    if [ "$1" == "" ] ;
    echo “You need to specify the img file!”
    exit 9;

    if `test -d /data/local/mnt` ; then
    echo “/data/local/mnt”
    mkdir /data/local/mnt

    export HOME=/root
    export USER=root
    export PATH=$bin:/usr/bin:/usr/sbin:/bin:$PATH

    mount -o loop,noatime -t ext2 $1 /data/local/mnt
    sleep 3
    mount -t proc proc /data/local/mnt/proc
    mount -t devpts devpts /data/local/mnt/dev/pts
    chroot /data/local/mnt /bin/bash

  25. Mirel

    …for me not working :( …output:

    ioctl LOOP_SET_FD failed: Device or resource busy
    mount: No such file or directory
    mount: No such file or directory
    chroot: can’t execute ‘/bin/bash’: No such file or directory

    …any help?

  26. est_cap

    @admin Wow!!! I’m buying captivate next month… will it work?
    has been any improovment in performance since then?

  27. Pingback: ubuntu su galaxy s - Forum Android Italiano

  28. marco

    …also for me not working :( …output:

    ioctl LOOP_SET_FD failed: Device or resource busy
    mount: No such file or directory
    mount: No such file or directory
    chroot: can’t execute ‘/bin/bash’: No such file or directory

    what do you mean by: try to create a new loopback device?

  29. est_cap

    Is there a way to run it as fast as here? http://www.youtube.com/watch?v=PWI-_iUnPts
    it would be AZOM! :D
    and if not, can you explain me why? =/ … i know about usb host all that.. but,
    I mean.. in the speed of ubuntu..
    and I know it’s winmo.. but c’mon.. android is better =D xD..
    I hope you can answer…


  30. admin Post author


    Only way to be able to be faster is to boot Ubuntu native instead of in a chroot (inside android). Running in chroot is slower because you are inside an another running system (in this case android). To be able to boot ubuntu native there are some big issues to address in witch I am no expert. I do believe it should be possible to run ubuntu native.

  31. est_cap

    I made it.. buuut.. I dont know the password .. or the port it’s runing =S… i guess it’s 5901 … but the pass.. i dunno u.u..

  32. est_cap

    . . . I’m so dumb =) xD . . .
    people: 3 things

    1) when you’re about to start it, the best is to do it from the phone.. so you wont have any problems of root and all..
    2) write
    at the start .. even if you already have # . . . why? so it’s recognized again by superuser (all done from phone) . . .
    3) for some reason, it doesnt start vncservr automatically… so write..

    apt-get install vncserver

    and it’ll download and install it (it it’s not installed… dont have a clue how to know if it already is xD) once done that,

    export USER=root

    and then vncserver -geometry 800×600

    (i pt 800×480 for my Captivate)
    .. open vncserver and connect… THAT worked for me.. dunno xD

  33. Ek5

    For everyone having problems with VNC password:

    After chrooting type: vncpasswd

    and set a new password! ^_^

  34. est_cap

    Imanaged to make it work xD when I had 2.1… now I have 2.2 (Phoenix Ultimate) in my cappy . . . and I can’t use it x(
    does someone know why?

  35. est_cap

    Dumb of me I didnt specify…
    When I had 2.1 … I could make it work with THIS method, and with other I found… now I cant doesnt matter what I try xD… well.. I coppy all, as I did before, in terminal put su (oh! before I managed to make it work.. but from THE PHONES TERMINAL.. the PC gave me error didnt found ubuntu folder.. dunno why) so.. I start from the phones temrinal and write SU.. it says it was givven root privilegies. then..
    #cd /sdcard/ubuntu
    #ls {and it’s correct, it’s there startA_ubuntu.sh}
    so i write this, and happens this:
    #sh startA_ubuntu.sh ubuntu.img
    ioctl LOOP_SET_FD failed: Bad file number
    mount: No such file or directory
    mount: No such file or directory
    chroot: can’t execute ‘/bin/bash’: No such file or directory

    THAT’S what happens xD… I cant understand much of it yet =/ (I’ve just started yesterday Ingeniería en Sistemas de Informacion {dunno propper translation to english…} ) tnx!

  36. est_cap

    Oh. . . . Is there any chance that it’s something to do with my CRom ? or Lagfix maybe? (Phoenix ultimate.. 2.2)

  37. admin Post author

    Don’t think lagfix is the issue, although it depends witch lagfx it is. If it is converting the partitions to ext4, is then that is not a problem. If it is the loopback one then that could be a problem.

  38. est_cap

    I was diggin in the Recovery.. and I nearly undo the lagfix… when I saw it actually said something of converting to ext4 some partitions.. so I sensed it wasnt the problem… it doesnt use loopback apparently.. i have SpeedMod kernel…
    So.. I dont know what to do ¬¬ it gets frustating =S…
    OFF TOPIC: mn.. but I managed to “nearly boot” XP on Bochs and Qemu in my phone… Have a 2gb .IMG made with bochs.. and it only prompts the famous “windows wasnt able to run last time.. chose the configuration” (and select for example safemode or normaly startup.. the normal mode crashes and restarts.. and the safemode loads some elements.. and then crashes the same xD… only to share the experience :P

  39. guy

    where do i rights tha codes

    1234 sudo adb shell cd /sdcardmkdir ubuntu exit

    Step 2:
    Now you can upload the img file and if you like you can also upload my start and stop scripts.

    123 sudo adb push ubuntu.img /sdcard/ubuntusudo adb push startA_ubuntu.sh /sdcard/ubuntusudo adb push stopA_ubuntu.sh /sdcard/ubuntu

    Step 3:
    Now that you have done all the prep work you can use your ubuntu by doing:

    123 sucd /sdcard/ubuntush startA_ubuntu.sh ubuntu.img

    Step 4:
    To exit just run:

    12 exitsh stopA_ubuntu.sh

    That’s it, no more no less


  40. Asheesh Agrawal

    Hi Admin,
    I got the same problem i.e,
    ioctl LOOP_SET_FD failed: Device or resource busy
    I have busy box installed and have also tried creating a second loop device with: mknod /dev/loop2 b 7 0

  41. debernardis

    Nice work :)

    On my Samsung Galaxy Tab I made a separate partition on the sdcard and moved the img content inside that.
    Then, the mount statement became
    mount -t ext2 /dev/block/mmcblk1p2 /data/local/mnt
    No loop device problems for me this way!

  42. dan542

    @Unimaginative No, in order to use android graphics drivers etc. you need to run ubuntu set up as vnc server in chroot and connect by vnc client. That’s why he entered localhost into AndroidVNC.

  43. Pingback: Ubuntu porté sur le Samsung Galaxy S | Le Libriste

  44. JoeDrD

    Great work dude!… its awesome… Your scrips will run in the SGS vibrant 4G? cuz i really want to use ubuntu in my phone…

    What are the minimum requirements to run ubuntu?
    sdC. space

  45. daniel


    I used the above ubuntu image and script files. but it is throwing error as “segmentation fault chroot /data/local/mnt /bin/bash”. I am using samsung galaxy fit (GT-S5670) and Gingerbread OS, I need your help to resolve this

  46. maximelian

    Ty man. It is so cool using ubuntu on Galaxy S. I have one big question : virtual ubuntu have only about 100 Mb free space, so how I can resize it to lets say 1Gb?

  47. Pingback: CyanogenMod and Ubuntu on my Samsung Galaxy S | Richi's Blog

  48. Pingback: Como Instalar ubuntu en samsung galaxy s | Blog Darkcrizt - Tutoriales ubuntu Programacion

  49. Pingback: Como Instalar ubuntu en samsung galaxy s | Android Mania

Comments are closed.