How to install ubuntu on the Droid 4

Search This thread

nb26

Member
Jan 2, 2013
8
0
ubuntu all there but cant edit in vi

have root
running CM 10.2.1 (11 kept crashing)
(no gallery, but cymera works)
love it all would like to fiddle with dual boot android/ubuntu, but anyway....

root@cdma_maserati:/mnt/sdcard-ext/ubuntu # sh ubuntud4.sh
sh ubuntud4.sh
ubuntud4.sh[18]: syntax error: 'if' unmatched

when i get to vi (I'm sorry, i tried out for '300' but i didnt know vi...) i tried motion buttons, i tried :%s/^V^M//g and it just wont find the ^M that's after almost every line. any help would be appreciated.

ty. ttfn
 

zeroktal

Senior Member
Nov 8, 2006
284
42
File has Binary Characters

You can actually delete these manually.


have root
running CM 10.2.1 (11 kept crashing)
(no gallery, but cymera works)
love it all would like to fiddle with dual boot android/ubuntu, but anyway....

root@cdma_maserati:/mnt/sdcard-ext/ubuntu # sh ubuntud4.sh
sh ubuntud4.sh
ubuntud4.sh[18]: syntax error: 'if' unmatched

when i get to vi (I'm sorry, i tried out for '300' but i didnt know vi...) i tried motion buttons, i tried :%s/^V^M//g and it just wont find the ^M that's after almost every line. any help would be appreciated.

ty. ttfn
 
  • Like
Reactions: nb26

Top Liked Posts

  • There are no posts matching your filters.
  • 2
    How to install ubuntu on the Droid 4

    Note to mods: this thread is a branch off of this thread

    Huge thanks to zacthespack for creating the ubuntu installer app and original boot script and to zeroktal for modifying the script to work on the D4 and helping me get it working on my device.

    I decided to take my experience in setting this up and put it into a how-to so that others could enjoy the experience of having ubuntu on the Droid 4. If zackthespac or zeroktal have any problems with me making and putting this guide up, please let me know and I will remove it.

    Knowledge Required:
    • working knowledge of command line
    • working knowledge of vi
    • OR the ability to learn how to use both

    Tools Required:

    Step by Step:
    1. Install BusyBox, Terminal, and Android VNC Viewer
    2. Install and run Ubunutu Installer App
    3. Follow the on-screen instructions and click next
    4. Download either the Small or Large image to your phone, (use zeroktal's ubuntud4.zip file instead of the boot script provided in the guide) after the image downloads (will take a while because the file is HUGE) click next
    5. For this screen, the instructions differ from the app.
      1. With your D4 plugged into your PC in USB Mass Storage, create a directory (folder) called ubuntu in the EXTERNAL sdcard's root*
      2. Extract the image you downloaded to that directory
      3. Download and extract the attached .sh (ununtud4.zip) to that directory
      4. Disconnect your phone from your PC
      5. Open terminal and run the following commands:
      su [ENTER]
      mount -o remount,rw,exec,suid /dev/block/vold/179:1 /mnt/sdcard-ext [ENTER]
      cd /mnt/sdcard-ext/ubuntu [ENTER]
      sh ubuntud4.sh [ENTER]
      960x540 [ENTER]**
      If you get an error message: ubuntud4.sh: 45: syntax error: end of file unexpected (expecting "then") see troubleshooting section below.​
      killall -TERM Xtightvnc [ENTER]
      vncserver :1 -geometry 960x540 [ENTER]**
      6. Open androidVNC app and enter the following settings:
      Nickname: Anything you want
      Password: ubuntu
      Address: localhost
      Port: 5901
      Color Format: 24-bit color (4 bpp)
      7. Hit connect
      8. Hit your menu soft button and then set input mode to touchpad
      9. You have ubuntu on your Droid 4!

    To "shut down" ubuntu:
    • press the menu button, select disconnect in VNC
    • In terminal type this command 3 times (terminal will close itself when you are done):
      exit [ENTER]

    To "start up" ubuntu again:
    • Follow steps 5-8 above

    Troubleshooting:
    If you get the error message: ubuntud4.sh: 45: syntax error: end of file unexpected (expecting "then") you are about to have fun with vi at the command line.

    Do the following from inside terminal:
    su [ENTER]
    cd /mnt/sdcard-ext/ubuntu [ENTER]
    vi ubuntud4.sh [ENTER]
    If you see ^M or ^ at the end of any line (remember to scroll all the way to the right to see the end of long lines) remove it. once you do that, everything should work just fine. (See the Vi Cheat Sheet above for help with Vi)

    Note: Vol Up + E is [ESC] by default in this terminal emulator

    Notes:
    * It does not have to be on the external SD, but if you put it on the internal SD you will have to modify things as needed-- if you dont know what needs to be changed, just put it on the external SD.
    ** Screen size can be whatever you want it to be, but 960x540 is the size of the D4 screen.
    *** This is a fairly involved process... especially when it comes to editing the .sh file in vi things can get very frustrating and hard, but just take your time and you will get it. As always, doing anything with root access on your phone, especially on the command line has risks. I am not responsible if anything goes wrong with your phone... proceed at your own risk!
    1
    Notes:
    * It does not have to be on the external SD, but if you put it on the internal SD you will have to modify things as needed-- if you dont know what needs to be changed, just put it on the external SD.
    ** Screen size can be whatever you want it to be, but 960x540 is the size of the D4 screen.
    *** This is a fairly involved process... especially when it comes to editing the .sh file in vi things can get very frustrating and hard, but just take your time and you will get it. As always, doing anything with root access on your phone, especially on the command line has risks. I am not responsible if anything goes wrong with your phone... proceed at your own risk!

    I actually got it up and running on my internal sdcard partition. Pretty much just have to modify the Mount remount command, and a few lines in the script.
    Here's the original command
    Code:
    mount -o remount,rw,exec,suid /dev/block/vold/179:1 /mnt/sdcard-ext
    And the modified one
    Code:
    mount -o remount,rw,exec,suid /dev/block/vold/179:57 /mnt/sdcard

    Only things you have to change are the device location(179:57) and mount location(drop the -ext after sdcard)
    Now, after that you also have to modify the script a bit. Just go through it, and anywhere that you see sdcard-ext, drop the -ext off the end.
    1
    Also save the follow lines between ### as remount.sh on your system partition. Then chmod 755 /system/remount.sh. Now you can just run run from a terminal /system/remount.sh and voila it remounts correctly and starts ubuntu(with the above fixes). Im still working on the unmounts.

    ####### for the internal sd card
    mount -o remount,rw,exec,suid /dev/block/vold/179:57 /mnt/sdcard
    /mnt/sdcard/ubuntu/ubuntu.sh
    ######

    OR

    ####### for the external sd card
    mount -o remount,rw,exec,suid /dev/block/vold/179:1 /mnt/sdcard-ext
    /mnt/sdcard-ext/ubuntu/ubuntu.sh
    #######
    1
    copy and paste new script

    Copy and paste the new scripts I posted. They will fix your problem. Remember to use the remount script from /system/ the rest will work perfectly if you are root. I'll check back later on your progress.
    1
    Andbuntu will work much better than this method. It works on every single phone with modification to the "environmental variables".

    http://code.google.com/p/andbuntu/

    Follow the directions in the script to make the process much easier than the first post.

    instructions:
    generate an image with rootstock on an ubuntu computer.
    put it on /sdcard/ubuntu/ubuntu.img
    run the script on your phone with "sh /path/to/script"

    Here is the script. http://andbuntu.googlecode.com/svn/trunk/uboot

    Also, run "firstRun" to make things like terminals work properly.