How to run Ubuntu on the Droid Incredible


Last Updated:

  1. pez252

    pez252 Member This Topic's Starter

    Joined:
    Jul 12, 2010
    Messages:
    17
    Likes Received:
    0
    I managed to get Ubuntu running on my Incredible earlier today. As far as i know this is the first successful attempt on an Incredible. Below the proof-of-concept video is a basic how to.


    http://www.youtube.com/watch?v=MiuThOzaAIQ
    Less crappy video than my first one. It's a bit long though as it starts from installing the kernel. Watch it on youtube and see the description for links to specific, significant points of the video.


    First you must have the following:
    • Rooted Incredible
    • ClockworkMod Recovery
    • Nandroid backup (very important)
    • Kernel that supports loop devices
    • busybox
    • Disk image of ARM Ubuntu

    Here is a zip file with the kernel, Ubuntu image, and the below script: http://www.megaupload.com/?d=WO094E5Q


    Setup

    You will probably need to install a new kernel as neither the stock kernel, nor the hydra kernels (as of this post) support loopback devices.


    1. Unzip the incredible_ubuntu.zip file and place the three file in a folder called ubuntu on the root of your sd card.
    2. Boot into Recovery
    3. Select "install zip from sdcard"
    4. Select "choose zip from sdcard
    5. Select "ubuntu/"
    6. Select "kupdate-signed.zip"
    7. When complete, reboot

    Once you have an appropriate kernel, run the ubuntu.sh script.

    1. Open a terminal session (either using adb shell or a terminal emulator downloaded from the android market)
    2. su
    3. run "sh /sdcard/ubuntu/ubuntu.sh"

    That's it! if you see "root@localhost:/#" it worked. Try "cat /etc/issue" to see the version of ubuntu the image is based on.

    If you're interested in how it's done read through ubuntu.sh, it is really simple.


    Getting a GUI

    If you want a graphical environment you will need to install vncserver in ubuntu and use androidVNC to connect to the localhost. Use the following commands from within ubuntu

    1. apt-get update
    2. apt-get install tightvncserver
    3. apt-get install lxde
    4. vncserver
    You can now use androidVNC to connect to localhost on port 5901.

    Known Issues

    If you come up with a fix for any of the below issues, post a reply.

    • It's slow. Deal with it...
    • when you type exit in the chroot'd environment processes may still be running. Restart your phone to kill everything.
    • The keyboard isn't mapped properly (at least for me) when connecting via VNC.
    Thanks
    I would like say thanks to samwathegreat from the xda-developers forum for the kernel compiled with CONFIG_BLK_DEV_LOOP=y. I was stuck at mounting the ubuntu image until I found his post.

    Also to the nexusonehacks.net page on how to install ubuntu on your nexus one. The ubuntu image is right from their zip file, and reading through their scripts was very helpful, though it turned out to be much easier on the incredible.


    ##### BEGIN ubuntu.sh #####
    export kit=/sdcard/ubuntu
    export bin=/system/bin
    export mnt=/data/local/ubuntu
    export PATH=$bin:/usr/bin:/usr/sbin:/bin:$PATH
    export TERM=linux
    export HOME=/root
    export USER=root

    mkdir /data/local/ubuntu

    mount -o rw,loop -t ext2 $kit/ubuntu.img $mnt

    busybox mount --bind /dev/pts $mnt/dev/pts
    busybox mount --bind /proc $mnt/proc
    busybox mount --bind /sys $mnt/sys

    sysctl -w net.ipv4.ip_forward=1

    echo waiting for things to settle...
    sleep 5

    echo Running ubuntu!
    chroot $mnt /bin/bash

    #After exit, cleanup
    umount $mnt/dev/pts
    umount $mnt/proc
    umount $mnt/sys
    umount $mnt
    #####END ubuntu.sh#####
     

    Advertisement
  2. 8andsand

    8andsand Well-Known Member

    Joined:
    Dec 24, 2009
    Messages:
    114
    Likes Received:
    13
    Hmmm very interesting. Do you have any video of this running on your phone? Im still trying to get my phone rooted. I have had no luck getting it to connect in recovery to my computer running Linux Mint 9.
     
  3. pez252

    pez252 Member This Topic's Starter

    Joined:
    Jul 12, 2010
    Messages:
    17
    Likes Received:
    0
    I did record a video. A crappy crappy video. Here is the link since you're interested:

    http://www.megaupload.com/?d=AO5P114F

    I disabled wifi and the cellular data connection to show I wasn't just connecting to a remote machine. That's why i open the browser first, to show the error message about no connection. I then connect to localhost with androidVNC.

    With the mobile network connected, i was able to do a test google search in firefox.


    Also, I know there are tons of root tips out there, but maybe i can help... I rooted my phone the first try using method 2 of the 10 minute video. I later reverted to stock and couldnt reroot. I tried every method and failed at all of them until I found this one: Yet another I did it, and think I have the answer thread - xda-developers

    it's basically the same as the others, but it takes a methodical approach to finding the timing for inserting the SD card. I found that inserting the SD card 7.5 seconds (use a stop watch on another device) after selecting the recovery menu option I was able to get ADB running in recovery reliably (6 times in a row).

    Also for what it's worth I was using ubuntu to root the phone. Use while true; do ./adb shell; done if you want, though its not needed as once ADB is running in recovery it's not like it quits if you don't connect fast enough...
     
  4. crackers8199

    crackers8199 Well-Known Member

    Joined:
    Apr 12, 2010
    Messages:
    548
    Likes Received:
    59
    just a heads up, avg detects a virus threat as soon as i try to download the video...

    on edit: now it seems to be working, but it definitely popped up with a threat the first time.
     
  5. pez252

    pez252 Member This Topic's Starter

    Joined:
    Jul 12, 2010
    Messages:
    17
    Likes Received:
    0
    interesting... I recorded it on my BB 9700, though it did go through a windows machine before being uploaded... To alleviate any fears, here is a youtube version I just uploaded.

    YouTube - ubuntu on incredible

    I'd appreciate if someone else was able to replicate my success and post a better video.

    Also for what it's worth the incredible_ubuntu.zip file never touched a windows machine before getting uploaded.
     
  6. ArmlessRifleman

    ArmlessRifleman Well-Known Member

    Joined:
    Jun 23, 2010
    Messages:
    61
    Likes Received:
    8
    I followed your instructions to the letter and have all of the requirements, but when i run ubuntu.sh i get this output:

    sh /sdcard/ubuntu/ubuntu.sh
    : not found
    , File existsfor /data/local/ubuntu
    : not found
    ioctl LOOP_SET_FD failed: Device or resource busy
    : not found
    busybox: not found
    busybox: not found
    busybox: not found
    : not found
    sysctl: not found
    : not found
    waiting for things to settle...
    : not found
    Running ubuntu!
    chroot: not found
    : not found
    failed.
    failed.
    failed.
    failed.
    #

    Any ideas as to why this is happening?
     
  7. dvdivx

    dvdivx Well-Known Member

    Joined:
    Mar 21, 2010
    Messages:
    257
    Likes Received:
    59
    Since Unrevoked hasn't released a full nand unlock it makes booting into linux or anything else difficult and slow. With a true nand unlock, a snapdragon optimized kernel (with nand support) and drivers for the gsm modem it would leave only a decent keyboard as the missing link.
     
  8. pez252

    pez252 Member This Topic's Starter

    Joined:
    Jul 12, 2010
    Messages:
    17
    Likes Received:
    0
    I'm trying to connect those errors to the commands that generated them, and it looks like you were not root when you ran it. Can you confirm you ran su first?

    If that doesn't fix it, can you run each command one at a time from adb shell and let me know what you get.

    The first one that really matters is:
    mount -o rw,loop -t ext2 /sdcard/ubuntu/ubuntu.img /data/local/ubuntu

    This will fail if it cant find /sdcard/ubuntu/ubuntu.img or if you don't have a loopback enabled kernel. The error "ioctl LOOP_SET_FD failed: Device or resource busy" could be no loopback kernel or just not root when run.

    I also noticed in my testing (i wiped my phone and recreated my process) that sometimes when the phone first booted it didnt mount the sdcard. Connecting it as a drive to your computer and then disconnecting it fixed that.
     
  9. pez252

    pez252 Member This Topic's Starter

    Joined:
    Jul 12, 2010
    Messages:
    17
    Likes Received:
    0
    I've heard this a few places, but I don't see how nand unlock would help. The only advantage that I see is that replacing the kernel would be easier.
     
  10. ArmlessRifleman

    ArmlessRifleman Well-Known Member

    Joined:
    Jun 23, 2010
    Messages:
    61
    Likes Received:
    8
    Sure. I am about to head out at the moment but I will post my results with the individual commands once I return.
     
  11. pez252

    pez252 Member This Topic's Starter

    Joined:
    Jul 12, 2010
    Messages:
    17
    Likes Received:
    0
    Here is the console output from running each command manually to give you an idea of what to expect. I restarted my phone prior to running this.

    (Note: I'm adding a couple notes like this below. They are not part of the copy paste from the adb shell)


    # export kit=/sdcard/ubuntu
    # export bin=/system/bin
    # export mnt=/data/local/ubuntu
    # export PATH=$bin:/usr/bin:/usr/sbin:/bin:$PATH
    # export TERM=linux
    # export HOME=/root
    # export USER=root
    (Note: The above commands shouldn't give you an error even with a stock unrooted phone)
    # mkdir /data/local/ubuntu
    mkdir failed for /data/local/ubuntu, File exists
    # ls $mnt
    (Note: The directory exists but is empty as seen from the ls command)
    # mount -o rw,loop -t ext2 $kit/ubuntu.img $mnt
    # ls $mnt
    lost+found
    bin
    boot
    dev
    etc
    home
    lib
    media
    mnt
    opt
    proc
    root
    sbin
    selinux
    srv
    sys
    tmp
    usr
    var
    init
    (Note: Now that the ubuntu.img is mounted, ls of /data/local/ubuntu shows the root of ubuntu)
    # busybox mount --bind /dev/pts $mnt/dev/pts
    # busybox mount --bind /proc $mnt/proc
    # busybox mount --bind /sys $mnt/sys
    (Note: This allows access to /dev/pts proc and sys from android to the chrooted ubuntu environment. busybox isn't on the stock system and has to be installed. You may be able to use bind -t devpts /dev/pts $mnt/dev/pts)
    # sysctl -w net.ipv4.ip_forward=1
    net.ipv4.ip_forward = 1
    # chroot $mnt /bin/bash
    root@localhost:/# cat /etc/issue
    Ubuntu 9.10 \n \l

    root@localhost:/#



    Good luck, and let me know how it goes.


    Edit: Also I don't think it matters, But I am running Jager chocolate rom 1.7.4 downloaded from http://incredibleroms.com/roms/jager/. I then replaced the kernel with the one included in the zip.
     
  12. jayjay1122

    jayjay1122 Well-Known Member

    Joined:
    Mar 12, 2010
    Messages:
    1,456
    Likes Received:
    338
    There is something about avg and megaupload...We had similar issues on the Eris forum when 2.1 leaks were posted their a few months ago...everyone running avg was getting a virus threat warning.

    Just an FYI! :cool:
     
  13. Bug Splat

    Bug Splat Well-Known Member

    Joined:
    May 28, 2010
    Messages:
    280
    Likes Received:
    34
    I love Ubuntu, I really do, but can I ask you guys a question? Why? IMO Ubuntu makes a bad Mobile OS. Are you just doing this for the sake of impressing friends or are there some real advantages to it? It seems to run very slow.
     
  14. pez252

    pez252 Member This Topic's Starter

    Joined:
    Jul 12, 2010
    Messages:
    17
    Likes Received:
    0
    Once you've chrooted to /bin/bash within the ubuntu image you have access to apt-get and any application out there. lxde and vncserver being an example (though a really slow one).

    Also, why not? :D
     
  15. yojoe600

    yojoe600 Well-Known Member

    Joined:
    Apr 14, 2010
    Messages:
    2,188
    Likes Received:
    207
    bc someone showed a nexus one doing it on Engadget and we want to show we can too... thats my guess?
     
  16. tudmf

    tudmf Well-Known Member

    Joined:
    May 1, 2010
    Messages:
    104
    Likes Received:
    27
    Can your Iphone do this?
     
  17. pez252

    pez252 Member This Topic's Starter

    Joined:
    Jul 12, 2010
    Messages:
    17
    Likes Received:
    0
    I wanted to just reply: For SCIENCE!

    Also,
    Maybe... iClarified - iPhone - How to Install Android on Your iPhone 2G, 3G [iPhoDroid]
    Chrooted Ubuntu on android on an iphone. Now that would be a challenge.


    Also, I made a slightly better video.

    YouTube - Ubuntu on HTC Droid Incredible

    @0:39 - Installing the kernel
    @1:57 - Mount as drive then umount to force sdcard to mounted on the phone
    @3:50 - Running "sh /sdcard/ubuntu/ubuntu.sh"
    @4:23 - chroot ; cat /etc/issue
    @4:40 - apt-get update
    @5:05 - starting vncserver
    @5:30 - mobile network and wifi off
    @5:40 - browser error showing no network connection
    @6:00 - connecting to localhost with androidVNC
    @7:40 - Desktop fully loaded. Yeah X is that slow. Opening firefox...
    @9:20 - firefox fully loaded.
     
  18. ArmlessRifleman

    ArmlessRifleman Well-Known Member

    Joined:
    Jun 23, 2010
    Messages:
    61
    Likes Received:
    8
    Okay so I was able to get it working by typing each command individually in adb shell. I have a Linux console now yay! I am still working on installing software through apt-get though. It is getting stuck at 0% when I try to install the VNC server.
     
  19. pez252

    pez252 Member This Topic's Starter

    Joined:
    Jul 12, 2010
    Messages:
    17
    Likes Received:
    0
    Double check to make sure /etc/hosts and /etc/resolv.conf are ok (within the chroot environment). I may have to add the following commands to the script or update the ubuntu.img.

    echo "127.0.0.1 localhost" > /etc/hosts
    echo "8.8.8.8" > /etc/resolv.conf
    echo "8.8.4.4" >> /etc/resolv.conf

    And congrats on being the first person to confirm they got it working as well :-D

    Did you figure out why running the script didn't work the first time? If you run the script now (after a reboot and making sure /sdcard is mounted) does it work? I've wiped my phone a few times now and each time the script works correctly for me.
     
  20. LinuxFreakD

    LinuxFreakD New Member

    Joined:
    Jul 17, 2010
    Messages:
    2
    Likes Received:
    1
    What would be the hurdles when trying to follow your guide but modify it for Mint linux? I was thinking of trying to install Mint LXDE linux on my android instead of ubuntu.

    For instance, how do I create the img? Do I just take the mint ISO and convert it to an img or what?

    I am going to start trying to modify your guide now for use with Mint and see if I can get it to work. Just wanted to give you a heads up so you could be thinking about it when I run into my first big problem and need your help.

    Thanks.
     
    8andsand likes this.
  21. pez252

    pez252 Member This Topic's Starter

    Joined:
    Jul 12, 2010
    Messages:
    17
    Likes Received:
    0
    The guide above should work for mint with the one issue (as you guessed) of the img file. Looking at the linux mint site I only see downloads for x86 and x64. You would first need to dig around and find an ARM version.

    The rest here is just guessing as there was already an ubuntu.img floating around for ARM that had successfully been run on other android devices..

    I think you'll need to have an arm device to install on, as ext2 and one partition, then dd the ext2 formated disk into a file. If you can get that far, it should be just trouble shooting little issues.


    If you get stuck you could try to fake it... As I understand mint is based on ubuntu, so you could take the ubuntu image above an customize it to look and feel like the mint distribution (which is basically what mint did in the first place).
     
  22. mikmitch

    mikmitch New Member

    Joined:
    Apr 15, 2010
    Messages:
    2
    Likes Received:
    0

    That was my problem... Working now!
     
  23. tremdaniel

    tremdaniel Member

    Joined:
    Apr 29, 2010
    Messages:
    6
    Likes Received:
    0
    I know this thread is a month old, but I'm running into the "Device or resource busy" issue. I have root (busybox also) and I've followed the instructions completely; including installing the kernel provided. I've even tried other kernels, that have loopback. I have to be missing something. Any help/suggestions would be greatly appreciated.

    I've tried entering the commands manually through the terminal and I'm getting stuck here:
    # mount -o rw,loop -t ext2 $kit/ubuntu.img $mnt

    UPDATE: I went to the source of the information, used their files and it worked. ?! If I determine what the issue was/is, I'll post it. Thanks.

    UPDATE: Ok; so the issue was a permissions issue with my SD card (I believe). I was running into the same issue soon after it was working. Remounting the card did not work; so I ejected the card and put it back in and that resolved the issue. It then happened again a few minutes after when I 'exited' to test it; so it may be an issue with my ROM. Will definitely check more into it. Hopefully this information is helpful to someone.
     
  24. mrlanrat

    mrlanrat Member

    Joined:
    May 8, 2010
    Messages:
    24
    Likes Received:
    0
    I am interested in doing this, but I have a quick question.

    How did you make the Ubuntu ARM image? I am interested in making my own, except make a minimalistic Debian install (with no X) Just to be able to apt-get install some cli programs and have a little more Linux power without SSH.

    So, How can I create a minimalistic Debian image to use to chroot into?

    Thanks!
     
  25. miljkovicste

    miljkovicste New Member

    Joined:
    Aug 26, 2010
    Messages:
    1
    Likes Received:
    0
    Hey ArmlessRifleman i am also getting this error and would like to know what did you do to make it work? i have been trying to get this to work but i keep getting that error...i installed busy box through titanium backup and have the ubuntu folder on the root of my sdcard....im confused on what to do :/
    ps...i am running skyraider 2.5.2 with hydras overclocked kernel which according to the changelog supports loopback devices...

    thanks
     

Share This Page

Loading...