11-22-2011 10:06 AM
31 12
tools
  1. mmarz's Avatar
    This will not replace or break your Android install. These instructions will get Ubuntu to load parallel to your current system. You'll be able to access Ubuntu through the Android-VNC-Viewer or any network connected computer with a VNC client. I've only tested this on Froyo.

    Things you need:
    LG Optimus V
    2 Gbs free on the SD card FAT partition
    A computer connected to the same network as the phone
    SSH Client
    Android-VNC-Viewer from the market

    Instructions:
    1. Root your phone.
    2. Download the Ubuntu Image here: Download ubuntu.zip for free on uploading.com
    3. Unpack it into your sdcard: /sdcard/ubuntu/
    4. ADB Shell then run these commands while your phone has an internet connection:
      Code:
      su
      cd /sdcard/ubuntu/
      sh ubuntu.sh
      bootubuntu
    5. At this point you'll have Ubuntu running if you get the prompt "root@localhost:/#". But lets load the interface you are familiar with.
    6. Type the following and enter "y" to any prompts: (Don't actually type the text in red)
      Code:
      apt-get update
      apt-get install openssh-server
      /etc/init.d/ssh start
      passwd
      (Enter the password you want to use when connecting.)
      ifconfig
    7. Now look for the IP address of your phone. Connect to your phone using the SSH client from a computer that is on the same network. Username: root
    8. Once you have successfully logged in type:
      Code:
      export LANG=en_US.UTF-8
      apt-get install tightvncserver 
      apt-get install lxde
      cat > /root/.vnc/xstartup
      #!/bin/sh
      xrdb $HOME/.Xresources
      xsetroot -solid grey
      icewm &
      lxsession
      (After that last line, hit Ctrl + D twice.)
      cat > front
      export USER=root
      cd /
      rm -r -f tmp
      mkdir tmp
      cd /
      vncserver -geometry 800x600
      (After this last line, hit Ctrl + D twice.)
      cat front /root/.bashrc > temp
      cp temp /root/.bashrc
      export USER=root
      vncserver -geometry 800x600
      (Enter Password and Enter "no" to the prompt)
    9. While all this has been happening, your phone has been happily sitting there. It should still be fully functional.
    10. Fire up the Android-VNC-Viewer app:
      Nickname: Ubuntu
      Address: 127.0.0.1
      Port: 5901
      Color Format: 24-bit color
    11. Hit connect and be amazed.
    12. Things will run somewhat sluggish. It should run faster if you connect via a desktop using a VNC client.
    13. After a reboot, if you want to run Ubuntu again, run the following command through any script or terminal:
      Code:
      bootubuntu


    Current Bugs:
    • The soft keyboard isn't mapped correctly.
    • It slows down the system when it is running.


    Now you have a full fledged linux server running on your tiny phone.
    Enjoy!

    Here is how you can make your own custom Ubuntu image: How to Build CHROOT ARM Ubuntu Images for Android!

    Credit to this extremely long youtube clip:

    Originator of this: Debian & Android Together on G1 - Jay Freeman (saurik)
    04-28-2011 03:00 PM
  2. LeslieAnn's Avatar
    Wow!,
    Very nice.


    By the way, you have an error here (unless I'm wrong):
    "root@localhoat:/#"
    Should be localhost, no idea how I caught that while glancing at it.
    04-28-2011 03:12 PM
  3. mmarz's Avatar
    Wow!,
    Very nice.


    By the way, you have an error here (unless I'm wrong):
    "root@localhoat:/#"
    Should be localhost, no idea how I caught that while glancing at it.
    good eye!
    04-28-2011 03:18 PM
  4. drezliok's Avatar
    Cool idea, but why do it?
    04-28-2011 04:38 PM
  5. mmarz's Avatar
    Why not?

    Even without the interface loaded, you can run anything you want. Hmmmm, one Idea I just had was to setup your own google voice client, but that might not be practical.
    04-28-2011 04:43 PM
  6. drezliok's Avatar
    I just didn't see any practical application to losing 2gig on your SD card. What can the Ubuntu server do that an app from market can't do better? I have an FTP app to in-pocket sync with.
    04-28-2011 04:58 PM
  7. Takenover83's Avatar
    Why? For geeky awesomeness. That's really the best reason
    04-28-2011 05:03 PM
  8. LeslieAnn's Avatar
    I just didn't see any practical application to losing 2gig on your SD card. What can the Ubuntu server do that an app from market can't do better? I have an FTP app to in-pocket sync with.
    You could run a torrent client, mini-web server, file server... anything you can do with Linux. Yes, I know Android can do most of that, but not all.

    As for losing 2 gigs...
    Many of us have plenty to spare.


    I'm kind of curious why it's 2 gigs when a live/install disk is only 600megs or so.
    04-28-2011 05:21 PM
  9. 00_wrath_00's Avatar
    So this actually puts Ubuntu on our phones as a second os ? I'm a little confused. Sorry for the noob question but how else am I going to learn lol

    Sent from my LG-VM670 using Tapatalk
    04-28-2011 05:28 PM
  10. mmarz's Avatar
    You could run a torrent client, mini-web server, file server... anything you can do with Linux. Yes, I know Android can do most of that, but not all.

    As for losing 2 gigs...
    Many of us have plenty to spare.


    I'm kind of curious why it's 2 gigs when a live/install disk is only 600megs or so.
    The two gigs is a choice. You can actually make it smaller or bigger, but that is space set aside for your Ubuntu system. This is how android and Ubuntu are kept separate from one another.

    @00_wrath_00
    This runs Ubuntu on top of Android. So yes, it is a second OS, but it is running within the Android environment. This is actually perfect, because android provides all the drivers. It can use anything android uses.
    04-28-2011 06:08 PM
  11. 00_wrath_00's Avatar
    Thanks for the info I will have to check this out. Seems interesting.

    Sent from my LG-VM670 using Tapatalk
    04-28-2011 06:13 PM
  12. drezliok's Avatar
    The two gigs is a choice. You can actually make it smaller or bigger, but that is space set aside for your Ubuntu system. This is how android and Ubuntu are kept separate from one another.

    @00_wrath_00
    This runs Ubuntu on top of Android. So yes, it is a second OS, but it is running within the Android environment. This is actually perfect, because android provides all the drivers. It can use anything android uses.
    That's awesome.

    Might do it, for a Linux to Linux mount-able networking. The ftpserver is nice but I have to change my fstab everytime I reboot the router.
    04-28-2011 06:29 PM
  13. Liquidplacidity's Avatar
    I was gonna post a tutorial on this a long time ago, but I had so many problems getting it set up, that I never did. It was giving me all kinds of errors, that took me 3 hours to fix. Definitely not for people new to linux. lol. Oh and as for building your own custom installation, you can ONLY do it with Ubuntu 8. Ubuntu 8 was the first with ARM processor support. Our processors are ARM6, Ubuntu 9 and up only support ARM7 processors. Just thought i'd save ya the time of finding that out yourself.
    mmarz and Lumify like this.
    04-28-2011 11:09 PM
  14. Delphis's Avatar
    Why? For geeky awesomeness. That's really the best reason
    That was my vote too. LOL
    04-29-2011 02:27 PM
  15. lift3d's Avatar
    thx op

    just would like to add that jay freeman (saurik) was the originator for debian on-top of android.

    Debian & Android Together on G1 - Jay Freeman (saurik)
    04-29-2011 04:14 PM
  16. bigsupersquid's Avatar
    Wondered about Ubuntu.
    Been running Debian squeeze for a while on my V. Sid works too.
    My setup is based much on Saurik's work too, but I suspect the loop-mounted filesystem image is slowing things down for you. I'm using an ext4 partition instead (started with ext2 but SD cards are cheap and I'd rather the journaling cause wear than get ext2 corruption in a crash.)
    Since Android mostly lives in flash memory, I bind-mount everything into the root filesystem. Rare crashes don't seem to mess anything up.
    Debian file-managers make a great root explorer in the VNC.
    Main geeky uses are Firefox (actually Iceweasel) for browsing Android can't handle and saving web pages, file compression/decompression without picky semifunctional apps, the compilers, a real bash terminal... I'm sure I forgot something.
    I started with a 2GB card and am now using an 8GB.
    @OP: could you share your boot script seperate from the Ubuntu image?
    and, are you able to successfully use unionfs? I'll share details too if there is interest
    05-03-2011 10:04 PM
  17. mmarz's Avatar
    Wondered about Ubuntu.
    Been running Debian squeeze for a while on my V. Sid works too.
    My setup is based much on Saurik's work too, but I suspect the loop-mounted filesystem image is slowing things down for you. I'm using an ext4 partition instead (started with ext2 but SD cards are cheap and I'd rather the journaling cause wear than get ext2 corruption in a crash.)
    Since Android mostly lives in flash memory, I bind-mount everything into the root filesystem. Rare crashes don't seem to mess anything up.
    Debian file-managers make a great root explorer in the VNC.
    Main geeky uses are Firefox (actually Iceweasel) for browsing Android can't handle and saving web pages, file compression/decompression without picky semifunctional apps, the compilers, a real bash terminal... I'm sure I forgot something.
    I started with a 2GB card and am now using an 8GB.
    @OP: could you share your boot script seperate from the Ubuntu image?
    and, are you able to successfully use unionfs? I'll share details too if there is interest
    You're right, it does slow things down. How much better is your setup?

    Because it does slow things down, I never made a startup script. I would imagine that it would just be that single line "bootubuntu". The rest of it is set to autostart within the image.

    /root/.vnc/xstartup:
    Code:
    #!/bin/sh
    xrdb $HOME/.Xresources
    xsetroot -solid grey
    icewm &
    lxsession
    And

    Code:
    export USER=root
    cd /
    rm -r -f tmp
    mkdir tmp
    cd /
    vncserver -geometry 800x600
    added to /root/.bashrc


    ...But I just realized now why it hasn't been working.

    Code:
    vncserver -geometry 800x600
    prompts for a password. Dang! As you can see, I'm no expert.

    I am very interested in your setup. If it runs faster, we should scrap what I stole from that video and go with yours.
    05-03-2011 10:36 PM
  18. bigsupersquid's Avatar
    You're right, it does slow things down. How much better is your setup?

    Because it does slow things down, I never made a startup script. I would imagine that it would just be that single line "bootubuntu". The rest of it is set to autostart within the image.
    I meant the "bootubuntu" file as the startup script.
    ...But I just realized now why it hasn't been working.

    Code:
    vncserver -geometry 800x600
    prompts for a password. Dang! As you can see, I'm no expert.
    the first time you run vncserver, it wants you to set up the password to access the VNC from the app or another (remote) computer.
    Saurik's page details that process well, after setting the password in linux you need to enter it in the VNCviewer.
    edit:sorry, Saurik uses SSH. The best description I've found for the VNC is here: on xda
    Your setup runs without a VNC password? Interesting.
    I am very interested in your setup. If it runs faster, we should scrap what I stole from that video and go with yours.
    I'd like to compare. Both should be somewhat similar since it's Saurik's pioneering which seems to have driven much of the "linux-on-devicex" work out there. And, both of our systems are Debian based, which should keep other differences to a minimum.
    My current boot script needs reduced with a couple of loops, right now it's overly redundant for debugging and I never bothered to clean it up since it's working.
    I'll post it relatively soon.
    Another detail I forgot to mention, is I leave the root filesystem R/W since my version of this runs there instead of in an image. It also works ok with a chroot in the card partition, but I like the root access to everything from Debian which is trickier to manage running from the card instead of binding subdirectories into the / directory of Android.
    05-04-2011 04:06 PM
  19. bigsupersquid's Avatar
    Standard disclaimer:
    this script may bork your phone, trash your userdata, format system files, and etc., ad nauseum. Use at your own risk.
    This script remounts / and /system both read/write and leaves them that way until you type exit in the bash shell of the chroot. Without r/w mounting, installing Debian packages gives some errors, since it's running in the real root filesystem.
    All that aside, it's never hurt my device since beginning this experiment in early March, and I've had less than 5 crashes which required a reboot; no crashes at all since March.

    Ok, enough suspense.
    I've tested my condensed boot script for a day and can't find any obvious glitches, so here it is attached as boot.txt; the forum wouldn't let me attach it without an extension, so rename as boot with no extension.

    I remount system r/w, copy the file to /system/xbin and chmod 4755 /system/xbin/boot

    Assuming boot.txt is on your phone in /sdcard/download you can type this in a terminal:
    Code:
    su
    mount -o remount /system /system
    cp /sdcard/download/boot.txt /system/xbin/boot
    chmod 4755 /system/xbin/boot
    or with ADB, if boot.txt is in your current working directory
    Code:
    adb remount
    adb push boot.txt /system/xbin/boot
    adb shell
    su
    chmod 4755 /system/xbin/boot
    exit
    my Debian filesystem is on my 2nd sdcard partition. The comments in the script should explain how to use another partition if you have apps2sd running or somesuch (I don't have many Android apps on my phone so don't need/use apps2sd function)

    to use the script as-is, your linux flavor should be in the 2nd card partition.
    open a terminal and type
    Code:
    su
    boot
    don't kill the terminal app... leave it running in the background.
    when you're finished with linux, reopen the same terminal and type
    Code:
    exit
    to cleanly dismount your linux. No reboot required!

    notes:
    after much experimentation, I prefer the shell in SL4A for a terminal (even though the devs say it's old connectbot) because it runs the terminal as a service rather than just a process. It seems to be less likely for Android's oom killer to terminate that way.

    hopefully this helps someone else out. I spent quite a while getting it just how I wanted it, many googlings and picking bits from here and there.
    edit: just FYI, I tested this with Cyanogen and AOSP ROMs, with busybox symlinked to the commands it replaces. Doesn't work with stock ROM or others where you have to type things like 'busybox mount -o /system /system'
    Also, I initially copied all files from overlapping Android directories into their Debian counterparts, with no overwrites, BEFORE running the boot script (this only needs to be done once AFAIK)
    Code:
    yes n | cp -aiv /etc/* /sd-ext/etc
     yes n | cp -aiv /root/* /sd-ext/root
     yes n | cp -aiv /sbin/* /sd-ext/sbin
     yes n | cp -aiv /sys/* /sd-ext/sys
    05-05-2011 08:06 PM
  20. mmarz's Avatar
    Thanks for posting this! I'm going to try this when I have time.

    And here is the bootubuntu script:

    http://www.mediafire.com/?qwc6bwtvk56ab6t
    bigsupersquid likes this.
    05-05-2011 10:48 PM
  21. bigsupersquid's Avatar
    the bootubuntu script is similar in function.
    there is a piece of it I'm going to cannibalize and absorb into mine, the part which checks for the existence of a directory before creating it.
    let me know if my script gives you trouble and I'll try to help with it.

    I forgot to mention, many of the chroot 'boot' methods I've looked at can't be politely shut down and require phone reboot to unmount. Mine (and it looks like your bootubuntu script as well if I'm reading it right,) can be exited and even run again afterwards without rebooting.

    My eventual goal with this is to avoid the VNC viewer (another big slowdown for the chroot) and get access to the framebuffer device from linux. Android configures the fb device differently than X, and trying to use it as-is results in a blank screen. It doesn't lock up the phone, but no display without reboot.

    @mmarz, you said in the first post that there was a problem with the soft keyboard? I haven't noticed any issues with mine except that I can't find a free 'full' keyboard for esc,ctrl,alt and F-keys.
    The android-VNC-viewer I'm using (on google code , also an older version is in the market,) has them in the 'send keys' submenu, but I haven't gotten a soft keyboard with more than a ctrl key to use in the terminal.
    (I added my 2 cents on the swype beta forum about special keys but they don't seem to care.)

    The chroot method I'm using usually only seems to slow Android down if some CPU-intensive work is going on in the chroot, like building a package from source, running debootstrap, or something like that.
    I'll wager the loop-mount is causing most of your system lag.
    05-06-2011 10:26 AM
  22. mmarz's Avatar
    Maybe it is just with my soft keyboard that it is not mapped correctly. I am using the SlideIt keyboard. It may not be free, but it has lots features including the arrow keys. Or maybe it is my Debian image. The tutorial I took that image from also noted the keys being mapped incorrectly. Would you mind sharing how you setup your Debian package?
    05-06-2011 10:45 AM
  23. bigsupersquid's Avatar
    Maybe it is just with my soft keyboard that it is not mapped correctly. I am using the SlideIt keyboard. It may not be free, but it has lots features including the arrow keys. Or maybe it is my Debian image. The tutorial I took that image from also noted the keys being mapped incorrectly. Would you mind sharing how you setup your Debian package?
    swype has arrow keys but they're hidden. I want more programmer keys, though.
    I used debootstrap on my pc first, with the --foreign option since qemu won't run correctly on my old CPU.
    then I ran a chroot on the phone, directly on the sdcard ext partition to complete the debootstrap --second-stage. The script for that chroot is simpler, since no directories get bound, just mounting the sd-ext partition and proc, sysfs, and devpts.
    this was a major pain to get working since Android init doesn't use /dev/initctl but debootstrap expects it to be live. basically it ( debootstrap --second-stage ) locks up consistently at "I: configuring sysvinit"
    (and a few other operations do the same thing.) A workaround is to create /dev/initctl yourself in the sd-ext partition, writing something to it before running debootstrap --second-stage and then when it hangs, reading from the chroot's /dev/initctl in another terminal instance often tricks the installer into thinking the node is live, and it continues.
    Code:
    mknod sd-ext/dev/initctl p
    to create it, and
    Code:
    cat test > sd-ext/dev/initctl
    to write to it (probably will lock up, close terminal or CTRL-C to break), and
    Code:
    cat /sd-ext/dev/initctl
    to read from it to free debootstrap from its wait on init to respond, even though the cat command may lock up itself.

    once debootstrap completes on the phone, exit the chroot. Then Saurik's instructions come back into play, copying /etc/resolv.conf from Android and so on. Then, copy Android's overlapping directories, and use the boot script I posted to run Debian and begin the apt-get marathon for a window manager, tightvncserver, and so on.
    When I've got more time, maybe late tonight, I'll put up a full how-to thread starter, since I don't remember seeing many, if any (except for running linux natively INSTEAD of Android,) examples on the web which use my direct-mounted-partition method for chroot, although Saurik's is close (if only I had unionfs! but I don't want to bug AOSP for a kernel module, and haven't yet compiled my own kernel)
    mmarz likes this.
    05-06-2011 12:30 PM
  24. bigsupersquid's Avatar
    for whomever may be interested, when I began this I couldn't find a small, fresh debian filesystem image for download so I had to learn to use debootstrap.
    to save hassle for the community, I have uploaded a base install, debootstrapped on my V, uploaded from my V with iceweasel in debian. no extra packages. you'll need to apt-get tightvncserver and a window manager unless you just want the bash shell. I like xfce4 it's relatively small but functional; lots of people seem to like matchbox wm, too.
    it's ready to go once you copy over the extra files from Android's /etc /root /sbin and /sys directories.
    (mount the extended partition with debian at /sd-ext first)
    Code:
    yes n | cp -aiv /etc/* /sd-ext/etc
     yes n | cp -aiv /root/* /sd-ext/root
     yes n | cp -aiv /sbin/* /sd-ext/sbin
     yes n | cp -aiv /sys/* /sd-ext/sys
    resolv.conf and sources.list are already configured for 3g access and the main Debian repository, so it's pretty much plug-n-play.
    here is the filesystem image
    careful! use my script here at your own risk.
    you can also chroot into the sd-ext directly, I'll post a script soon for you if you're worried about running in the root filesystem.
    root password is root.
    change it with
    passwd
    if you want.
    JerryScript likes this.
    05-08-2011 05:34 PM
  25. lift3d's Avatar
    for whomever may be interested, when I began this I couldn't find a small, fresh debian filesystem image for download so I had to learn to use debootstrap.
    to save hassle for the community, I have uploaded a base install, debootstrapped on my V, uploaded from my V with iceweasel in debian. no extra packages. you'll need to apt-get tightvncserver and a window manager unless you just want the bash shell. I like xfce4 it's relatively small but functional; lots of people seem to like matchbox wm, too.
    it's ready to go once you copy over the extra files from Android's /etc /root /sbin and /sys directories.
    here
    careful! use my script at your own risk.
    you can also chroot into the sd-ext directly, I'll post a script soon for you if you're worried about running in the root filesystem.
    root password is root.
    change it with
    passwd
    if you want.
    nice work, this based of squeeze or wheezy?

    i prefer xfce4.8 over 4.6 and thats only in testing atm, unless it is pinned
    05-08-2011 07:12 PM
31 12
LINK TO POST COPIED TO CLIPBOARD