How to install ubuntu on the Droid 4

Search This thread

huss22us

Member
Oct 30, 2011
7
0
Question

Hey.

Looks like you have a lot of fun here.
just a question, does it work with Galaxy S2 I9100 ??

BR,:cool:
 

Pieter19

Member
Aug 15, 2010
7
1
Zamość
Greetings.

Why don't you make REAL distribution work on android phones? I mean not by VNC and android? My friend have an android tablet and made gentoo work on it.

Sorry for my bad English.
 

greekchampion04

Senior Member
Apr 6, 2011
141
22
this method should work on pretty much every phone.

as for making a real distro work... we would all LOVE it, but its very hard.

if we got one running, it would replace the android OS when running... which means making a way for the phone, sms, ect to work on whatever linux distro you are using, or not having any of that while you are in linux mode.

also for the D4 (and all other moto phones) we have a locked bootloader, making it straight up impossible
 

Pieter19

Member
Aug 15, 2010
7
1
Zamość
My friend told me that he probably make it work on every android device and here is his topic: slatedroid.com/topic/30524-running-a-linux-distribution-on-zenithink-zt280/
 

ndd53

Member
Mar 7, 2012
31
2
Ok, well I started from scratch (deleted both .img and .sh files) and it's still not working.

I have all the apps installed (and yes rooted, SU works just fine)
I used Ubuntu Installer app to download the image zip (tried both the large and small img)
I downloaded the .sh file from the first post
The /sdcard-ext/ubuntu/ folder now has two files: "ubuntu.img" and "ubuntud4.sh"
All ^M characters have been removed from .sh file
Still no joy...

Ideas? What am I missing?

In terminal, I can set SU permissions and the mount/cd commands work just fine...it's the last sh command that spits out a bunch of errors about not being able to create/find the directories.

I'm going to format the sdcard and try again...any help is appreciated.

Update: Even after re-formatting the SD and following the steps exactly, no luck!

check to make sure that the entire path

/data/local/mnt/ubun

exists. the 'mkdir' command will fail if any of the intervening dirs aren't there, so if you have

/data/local

and try

mkdir /data/local/mnt/ubun

it'll fail. you'll have to make

/data/local/mnt

first. 'ubun' is just a name; doesn't matter what you use as long as you're consistent. I changed it to 'ubuntu'; seemed clearer to me, and the 2 extra characters weren't a big deal.
 
  • Like
Reactions: tallelf78

tallelf78

Member
Feb 28, 2012
9
1
check to make sure that the entire path

/data/local/mnt/ubun

exists. the 'mkdir' command will fail if any of the intervening dirs aren't there, so if you have...

that was it...i manually created the directories and then the .sh was able to run without errors.

thanks everyone for feedback! ubuntu on my lapdock is much nicer than the moto webtop.
 
  • Like
Reactions: booda3000

booda3000

Senior Member
Oct 1, 2009
528
26
Oklahoma
that was it...i manually created the directories and then the .sh was able to run without errors.

thanks everyone for feedback! ubuntu on my lapdock is much nicer than the moto webtop.

I had to do this too.
Works now.

Can anyone assist me with using the D4's physical keyboard to type into the ubuntu terminal?

Thanks BTW. This is really cool.

---------- Post added at 05:59 PM ---------- Previous post was at 05:32 PM ----------

@tallelf78

Do u have the 100 or the 500 Lapdock?
 

booda3000

Senior Member
Oct 1, 2009
528
26
Oklahoma
kb

I have the 500, I'm still torn between the two but I guess at this point I'm stuck with it.

Have u used the usb ports much? I'm curious about the functionality of those.

So your hard-keyboard doesn't work in Terminal? I don't know that I can help, mine just worked.

What do have u have for your input settings in vnc? (When your in the Ubuntu desktop)

Also, does your Ubuntu web browser ever just-close on u?

---------- Post added at 09:25 AM ---------- Previous post was at 09:06 AM ----------

I have the 500, I'm still torn between the two but I guess at this point I'm stuck with it.

Your never stuck with a toy on XDA ;>
 

grandkodiak

Member
Apr 5, 2012
7
1
help

hey all, having problem with my droid razr maxx ubuntu. it was working great for awhile, but i didnt use it for a bit, and reset my phone a few times for other lockups.

anywho, i go to go back into it today and when i boot in

su
cd sdcard/ubuntu
sh ubuntu.sh
su
echo USER=root
tightvncserver -geometry 1024x800

I get:
warning localhost:1 is taken because of /tmp/.x1-lock
remove file if no x server on localhost:1
new x desktop is on localhost:2

Ive used:
tightvncserver -kill :1 (2 or 3 or whatever new ones i make kill sucessfully)

But get:
youll have to kill the xtightvnc process manually



How do I get out of this? I cant find the .x1-lock file it mentions to delete, and theres no way to kill :1 (at least that I know about)

I was reading that this happens when ubunutu isnt shut down properly (didnt know just using exit didnt do the trick) so now I cant vnc into my ubuntu anymore and only have the terminal funcuntion!

thanks all!

ps, ive read through all 25 pages of
http://xdaforums.com/showthread.php?t=718952&page=15
which mentions the lock file problem, but i dont understand from the post how to resolve that, and having less then 10 posts to this forum i cant post the question there.



edit. found it reading over my post, it was case sensitive: rm /tmp/.X1-lock and rm /tmp/.X1-unix/X1 for anyone who finds this psot wioth same problems
 
Last edited:

garlick2

Senior Member
Dec 12, 2011
90
52
Hey, I have D4 with an ICS AOKP ROM, I got Ubuntu up and running, super excited about that, but I can't seem to get my lapdock to work with the device.

I didn't know if I needed the webtop.apk, which isn't available yet on ICS, or if there was another app I could download to work for me as the transfer??

Does anyone have any suggestions?? The mousepad works on ICS when I dock it, it just won't show HDMI through the HDMI port, so no mirroring.

Any suggestions would be great, would love to get Ubuntu working on the dock so this becomes a REAL working unit.
 

devilsclaw

Member
Apr 21, 2012
15
11
The reason the vncserver requires being on :1 is because the webtop interface is already running.

I added to the top of the ubuntud4.sh script
/etc/init.d/webtop-shutdown.sh

and at the bottom
/etc/init.d/webtop-restart.sh

with this you don't have to modify anything else besides the ubuntud4.sh

I did edit the init.sh to autofill in my preferences.

What I am really looking to do though is getting the webtop which is the pre-built ubuntu that is already installed on the phone to listen on the tcp port. currently is is ran with -nolisten tcp and I have tried to remove that from the scrip yet it still shows so it must be somewhere else.
 

devilsclaw

Member
Apr 21, 2012
15
11
I unmount the loop245 you have to kill all the processes that are spwaned by ubuntu you can do that like this


Code:
for pid in `lsof | grep "\/data\/local\/mnt\/ubun" | awk '{print $2}'`
do 
  kill $pid
done

or a single line

Code:
for pid in `lsof | grep "\/data\/local\/mnt\/ubun" | awk '{print $2}'` ; do kill $pid ; done


---------- Post added at 09:28 AM ---------- Previous post was at 09:00 AM ----------

Here is the script I use
The REZ=1024x768
wont do anything unless you edit your init.sh to not get that info.

Code:
##########################################
#Ubuntu boot script V5 for Android       #
#Built by Zachary Powell (zacthespack)   #
#Thanks to everyone at XDA!           #
#Modified to work with the D4 by Zeroktal#
##########################################
perm=$(id|cut -b 5)
if [ "$perm" != "0" ];then echo "This script requires root! Type: su"; exit; fi
/etc/init.d/webtop-shutdown.sh
mount -o remount,rw /dev/block/mmcblk0p5 /system
mount -o remount,rw,exec,suid /dev/block/vold/179:1 /mnt/sdcard-ext
export kit=/sdcard-ext/ubuntu
export bin=/system/bin
export mnt=/data/local/mnt/ubun
export USER=root
export REZ=1024x768
mkdir $mnt
export PATH=$bin:/usr/bin:/usr/local/bin:/usr/sbin:/bin:/usr/local/sbin:/usr/games:$PATH
export TERM=linux
export HOME=/root
if [ -b /dev/block/loop254 ]; then
        echo "Loop device exists"
else
        busybox mknod /dev/block/loop254 b 7 254
fi
losetup /dev/block/loop254 $kit/ubuntu.img
mount -t ext2 /dev/block/loop254 $mnt
mount -t devpts devpts $mnt/dev/pts
mount -t proc proc $mnt/proc
mount -t sysfs sysfs $mnt/sys
/system/xbin/busybox mount -o bind /sdcard-ext $mnt/sdcard
/system/xbin/busybox sysctl -w net.ipv4.ip_forward=1
echo "nameserver 8.8.8.8" > $mnt/etc/resolv.conf
echo "nameserver 8.8.4.4" >> $mnt/etc/resolv.conf
echo "127.0.0.1 localhost" > $mnt/etc/hosts
echo "Ubuntu is configured with SSH and VNC servers that can be accessed from the IP:"
ifconfig lo
echo " "
busybox chroot $mnt /root/init.sh

echo "Shutting down Ubuntu ARM"
/etc/init.d/webtop-restart.sh
for pid in `lsof | grep "\/data\/local\/mnt\/ubun" | awk '{print $2}'`
do
        kill $pid
done
export mnt=/data/local/mnt/ubun
umount $mnt/sdcard
umount $mnt/dev/pts
umount $mnt/proc
umount $mnt/sys
umount $mnt
losetup -d /dev/block/loop254

This is my init.sh
Code:
#!/bin/bash
#############################################
# Asks User to screen size and saves as REZ #
#############################################
#echo "Now enter the screen size you want in pixels (e.g. 800x480), followed by [ENTER]:"

#read REZ
#REZ=960x540

##############################################
# Pick which desktop environment to use, this#
# is done by having a xstartup file for each #
# desktop, then renaming the one you want to #
# use to 'xstartup' before boot              #
##############################################
#echo "Please select which Desktop environment you want to use, type the number to select it then press [ENTER]"
#echo "1 - LXDE"
#echo "2 - Gnome"
#echo "Make your Selection:"
#read DESKTOP
DESKTOP=1
if [ $DESKTOP == 1 ]
        then
        mv /root/.vnc/lxstartup /root/.vnc/xstartup
fi
if [ $DESKTOP == 2 ]
        then
        mv /root/.vnc/gxstartup /root/.vnc/xstartup
fi

###########################################
# Tidy up previous LXDE and DBUS sessions #
###########################################
rm /tmp/.X* > /dev/null 2>&1
rm /tmp/.X11-unix/X* > /dev/null 2>&1
rm /root/.vnc/localhost* > /dev/null 2>&1
rm /var/run/dbus/pid > /dev/null 2>&1

############################################################
# enable workaround for upstart dependent installs         #
# in chroot'd environment. this allows certain packages    #
# that use upstart start/stop to not fail on install.      #
# this means they will have to be launched manually though #
############################################################
dpkg-divert --local --rename --add /sbin/initctl > /dev/null 2>&1
ln -s /bin/true /sbin/initctl > /dev/null 2>&1


###############################################
# start vnc server with given resolution and  #
# DBUS server, (and optionally an SSH server) #
###############################################
vncserver :0 -geometry $REZ
dbus-daemon --system --fork > /dev/null 2>&1
/etc/init.d/ssh start


echo
echo "If you see the message 'New 'X' Desktop is localhost:0' then you are ready to VNC into your ubuntu OS.."
echo
echo "If VNC'ing from a different machine on the same network as the android device use the 1st address below:"
##########################################
# Output IP address of android device    #
##########################################
#ifconfig | grep "inet addr"

echo
echo "If using androidVNC, change the 'Color Format' setting to 24-bit colour, and once you've VNC'd in, change the 'input mode' to touchpad (in settings)"

echo
echo "To shut down the VNC server and exit the ubuntu environment, just enter 'exit' at this terminal - and WAIT for all shutdown routines to finish!"
echo

###############################################################
# Spawn and interactive shell - this effectively halts script #
# execution until the spawning shell is exited (i.e. you want #
# to shut down vncserver and exit the ubuntu environment)     #
###############################################################
/bin/bash -i

#########################################
# Disable upstart workaround and        #
# kill VNC server (and optionally SSH)  #
# Rename used xstartup to its first file#
#########################################
vncserver -kill :0
if [ $DESKTOP == 1 ]
        then
        mv /root/.vnc/xstartup /root/.vnc/lxstartup
fi
if [ $DESKTOP == 2 ]
        then
        mv /root/.vnc/xstartup /root/.vnc/gxstartup
fi
/etc/init.d/ssh stop
 

kirschnet

New member
Dec 29, 2008
1
0
fille permissions on ubuntu directory?

For some reason I keep getting "cd: can't cd to ubuntu" whether it was created on the internal sdcard or external sdcard-ext directory. I am assuming the permissions are not right. If I try to look at the permissions with a "ls -l ubuntu" it says no such file or directory. Yet I can connect via windows explorer and can access the directory just fine.

What am I doing wrong?
 

nequeelrey

Member
May 20, 2012
10
0
droid 4 wont boot

I did this, and ubuntu is running correctly through vnc, which is incredible! Thanks! But once I rebooted my droid, it booted to the eye, and then kept rebooting there, in an endless loop, and never booted until the battery died. Anyone know how to fix this, or have any suggestions how to proceed?

Thanks in advance.
 

zeroktal

Senior Member
Nov 8, 2006
283
40
I have modified the d4 script for ICS 4.04.
This also includes a few smaller fixes like directory creation for first time users.
Fixed: Directory creation
Fixed: Busybox in /system/bin OR /system/xbin
Fixed: Edited out /system remount as its not needed
Fixed: Added Remount of /sdcard-ext so that you can run the .sh directly from there.
Fixed: Killing Processes - Thanks to Devils Claw
Fixed: Unmounting filesystems correctly.

#Thanks to everyone at XDA! #
#Modified to work with the D4 by Zeroktal#
##########################################
#Fixed: Directory creation
#Fixed: Busybox in /system/bin OR /system/xbin
#Fixed: Edited out /system remount as its not needed
#Fixed: Added Remount of /sdcard-ext so that you can run the .sh directly from there.
#Fixed: Killing Processes - Thanks to Devils Claw
#Fixed: Unmounting filesystems correctly.
perm=$(id|cut -b 5)
if [ "$perm" != "0" ];then echo "This script requires root! Type: su"; exit; fi
#mount -o remount,rw /dev/block/mmcblk0p5 /system
mount -o remount,rw /dev/block/vold/179:97
export kit=/sdcard-ext/ubuntu
export bin=/system/bin
export mnt=/data/local/mnt/ubun
export mnt2=/data/local/mnt
export mnt3=/data/local/mnt/ubun/sdcard
export USER=root
mkdir $mnt2
mkdir $mnt
mkdir $mnt3
export PATH=$bin:/usr/bin:/usr/local/bin:/usr/sbin:/bin:/usr/local/sbin:/usr/games:$PATH
export TERM=linux
export HOME=/root
if [ -b /dev/block/loop254 ]; then
echo "Loop device exists"
else
busybox mknod /dev/block/loop254 b 7 254
fi
losetup /dev/block/loop254 $kit/ubuntu.img
mount -t ext2 /dev/block/loop254 $mnt
mount -t devpts devpts $mnt/dev/pts
mount -t proc proc $mnt/proc
mount -t sysfs sysfs $mnt/sys
/system/bin/busybox mount -o bind /sdcard-ext $mnt/sdcard
/system/bin/busybox sysctl -w net.ipv4.ip_forward=1
/system/binx/busybox mount -o bind /sdcard-ext $mnt/sdcard
/system/binx/busybox sysctl -w net.ipv4.ip_forward=1
echo "nameserver 8.8.8.8" > $mnt/etc/resolv.conf
echo "nameserver 8.8.4.4" >> $mnt/etc/resolv.conf
echo "127.0.0.1 localhost" > $mnt/etc/hosts
echo "Ubuntu is configured with SSH and VNC servers that can be accessed from the IP:"
ifconfig lo
echo " "
busybox chroot $mnt /root/init.sh

echo "Shutting down Ubuntu ARM"
for pid in `lsof | grep "\/data\/local\/mnt\/ubun" | awk '{print $2}'` ; do kill $pid ; done
sleep 2
umount $mnt/sdcard
umount $mnt/dev/pts
umount $mnt/proc
umount $mnt/sys
umount $mnt
losetup -d /dev/block/loop254
 

Attachments

  • ubuntud4v3.zip
    1 KB · Views: 26
Last edited:

zeroktal

Senior Member
Nov 8, 2006
283
40
Haven't seen this

I did this, and ubuntu is running correctly through vnc, which is incredible! Thanks! But once I rebooted my droid, it booted to the eye, and then kept rebooting there, in an endless loop, and never booted until the battery died. Anyone know how to fix this, or have any suggestions how to proceed?

Thanks in advance.



I haven't seen this, have you made any other mods?
 

louisdk

New member
Jun 27, 2010
4
0
Could somebody please make a video of a Motorola Droid 4 running Ubuntu or maybe just take some pictures? :)
 

zeroktal

Senior Member
Nov 8, 2006
283
40
Sure, I'm a bit pressed for time. I re-did the Ubuntu boot script as well to make things smoother.

Sent from my DROID4 using xda premium
 

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.