Home > Android > Ubuntu on Samsung Galaxy S (Android)

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
exit

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:

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

Step 4:
To exit just run:

exit
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.

Share
  1. Unimaginative
    August 17th, 2010 at 20:37 | #1

    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
    August 18th, 2010 at 00:57 | #2

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

  3. Scrizz
    August 18th, 2010 at 01:00 | #3

    @Unimaginative

    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
    August 18th, 2010 at 10:34 | #4

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

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

  5. igor
    August 19th, 2010 at 14:47 | #5

    niceeeee!!!going to try it right away

  6. Lance
    August 19th, 2010 at 15:12 | #6

    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. Gagga
    August 20th, 2010 at 08:25 | #7

    @Lance

    Flash sucks on linux anyways, so I wouldn’t hold my breath getting it for ARM.

  8. admin
    August 20th, 2010 at 08:50 | #8

    @Lance
    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.

  9. h711
    August 26th, 2010 at 05:26 | #9

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

  10. h711
    August 26th, 2010 at 05:36 | #10

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

  11. damian
    October 2nd, 2010 at 02:41 | #11

    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
    October 2nd, 2010 at 02:45 | #12

    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
    October 4th, 2010 at 13:27 | #13

    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
    October 6th, 2010 at 11:56 | #14

    @damian
    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
    October 6th, 2010 at 11:57 | #15

    @bhavish
    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
    October 18th, 2010 at 15:06 | #16

    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
    October 20th, 2010 at 09:36 | #17

    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
    /data/local/mnt
    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
    October 24th, 2010 at 07:58 | #18

    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. admin
    October 25th, 2010 at 04:38 | #19

    @AlCaTrAz
    Not sure what the problem is, you could try to create an second loop device.

    @gurulan
    not sure that they have arm based packages

  20. Joel
    November 3rd, 2010 at 15:48 | #20

    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?

  21. Joel
    November 3rd, 2010 at 15:52 | #21

    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?

  22. admin
    November 4th, 2010 at 08:42 | #22

    @Joel
    Have you installed busybox on your phone?

  23. agung
    November 4th, 2010 at 15:01 | #23

    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

  24. erni
    November 7th, 2010 at 04:25 | #24

    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?

  25. admin
    November 8th, 2010 at 10:59 | #25

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

  26. nemo
    November 8th, 2010 at 22:03 | #26

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

    #!/bin/bash
    #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" == "" ] ;
    then
    echo “You need to specify the img file!”
    exit 9;
    fi

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

    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

  27. admin
    November 11th, 2010 at 07:49 | #27

    @nemo
    Looks good to me :)

  28. Mirel
    January 30th, 2011 at 11:02 | #28

    …for me not working :( …output:

    /data/local/mnt
    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?

  29. admin
    February 2nd, 2011 at 11:31 | #29

    @Mirel
    Do you have busybox tools

  30. Mirel
    February 12th, 2011 at 18:29 | #30

    @admin
    YES!

  31. est_cap
    February 14th, 2011 at 01:32 | #31

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

  32. marco
    February 16th, 2011 at 17:04 | #32

    …also for me not working :( …output:

    /data/local/mnt
    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?

  33. admin
    February 17th, 2011 at 13:13 | #33

    @Mirel
    @marco

    Try creating a second loop device with: mknod /dev/loop2 b 7 0

  34. est_cap
    February 18th, 2011 at 18:11 | #34

    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…

    Esteban

  35. admin
    February 19th, 2011 at 07:53 | #35

    @est_cap

    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.

  36. est_cap
    March 14th, 2011 at 15:35 | #36

    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..

  37. est_cap
    March 15th, 2011 at 13:44 | #37

    . . . 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
    su
    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,
    write:

    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

  38. Ek5
    March 20th, 2011 at 10:01 | #38

    For everyone having problems with VNC password:

    After chrooting type: vncpasswd

    and set a new password! ^_^

  39. est_cap
    March 21st, 2011 at 13:37 | #39

    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?

  40. admin
    March 22nd, 2011 at 12:48 | #40

    @est_cap
    What is the problem?

  41. est_cap
    March 23rd, 2011 at 12:09 | #41

    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
    /data/local/mnt
    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!

  42. est_cap
    March 26th, 2011 at 23:58 | #42

    @est_cap
    No one knows? =’( xD

  43. March 28th, 2011 at 14:31 | #43

    What are the steps required to mount the external storage (SD+card) of Samsung Galaxy S from a chroot shell
    http://stackoverflow.com/q/5462837/331168

  44. admin
    March 30th, 2011 at 11:57 | #44

    @est_cap
    Sorry can’t help you on that one.

    @avri
    Don’t know didn’t try that

  45. est_cap
    March 31st, 2011 at 13:54 | #45

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

  46. admin
    April 7th, 2011 at 03:31 | #46

    @est_cap
    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.

  47. est_cap
    April 7th, 2011 at 14:54 | #47

    @admin
    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

  48. guy
    May 13th, 2011 at 09:00 | #48

    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

    ?????????????????????

  49. Asheesh Agrawal
    June 19th, 2011 at 17:00 | #49

    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

  50. debernardis
    June 27th, 2011 at 06:18 | #50

    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!

Comment pages
1 2 349
  1. August 19th, 2010 at 14:34 | #1
  2. August 23rd, 2010 at 14:54 | #2
  3. February 14th, 2011 at 09:17 | #3
  4. August 25th, 2011 at 06:43 | #4
  5. February 18th, 2012 at 17:28 | #5
  6. March 9th, 2012 at 01:11 | #6