FORUMS
Remove All Ads from XDA
Honor 7x
Win an Honor 7X!

 View Poll Results: What Kernels did you get Ubuntu to run on?

Silverneedle
 
3 Vote(s)
12.00%
[NOLIGHTS][LEDS]
 
0 Vote(s)
0%
[TEAM XPOSED] [Kernel] modded Stock
 
0 Vote(s)
0%
RCMIX
 
3 Vote(s)
12.00%
Stock 1.13.651.7
 
3 Vote(s)
12.00%
Tiamat
 
2 Vote(s)
8.00%
Bcblend
 
3 Vote(s)
12.00%
mKernel
 
0 Vote(s)
0%
MIUI Kernel
 
1 Vote(s)
4.00%
Other / Not Listed / Custom / My ROM has it's own
 
12 Vote(s)
48.00%

[Guide] How to install Ubuntu Linux on your phone [1.0 Coming Soon]

980 posts
Thanks Meter: 1,683
 
Thread Closed Email Thread
8th August 2011, 07:43 PM |#101  
unCoRrUpTeD's Avatar
Senior Member
Flag Fort Worth, TX
Thanks Meter: 248
 
Donate to Me
More
Quote:
Originally Posted by EarlyMon

Ok - I've been wanting to up the size of the ubuntu.img - and here's what I found on how to built it -

http://androlinux.com/android-ubuntu...s-for-android/

Guess I'm going to pop open a virtual machine on a spare PC, install a sandboxed Ubuntu, see if I can decompose ubuntu.img (so as to retain the changes I have), then simply re-assemble into a larger ubuntu.img file.

If anyone's done this and has any tricks to share, please lay 'em on me!

Otherwise, I'll keep you all posted - sure wish I'd found this yesterday when I had the time to goof off more!

PS - Left questions at the dev's site asking for tips.

Do it from your phone

Code:
adb reboot
adb shell busybox df -h /dev/block/mmcblk1p1 <-----[make sure you have enough free space]
adb shell
cd /sdcard/ubuntu
mv ubuntu.img oldubuntu.img
dd if=/dev/zero of=ubuntu.img bs=1024000 count=XXXX <-----[XXXX is the size in MB you want]
mke2fs ubuntu.img <------[answer "y" if it ask if you want to proceed]
losetup /dev/block/loop1 ubuntu.img
losetup /dev/block/loop2 oldubuntu.img
mkdir ubuntu
mkdir oldubuntu
mount -t ext2 /dev/block/loop1 ubuntu
mount -t ext2 /dev/block/loop2 oldubuntu
cp -a oldubuntu/* ubuntu
umount ubuntu
umount oldubuntu
reboot
Now check and make sure you can access ubuntu
If so then you can delete oldubuntu.img
The Following User Says Thank You to unCoRrUpTeD For This Useful Post: [ View ] Gift unCoRrUpTeD Ad-Free
 
 
8th August 2011, 09:33 PM |#102  
EarlyMon's Avatar
Senior Member
Thanks Meter: 887
 
More
Quote:
Originally Posted by unCoRrUpTeD

Do it from your phone

Code:
adb reboot
adb shell busybox df -h /dev/block/mmcblk1p1 <-----[make sure you have enough free space]

(snipped for brevity)
Now check and make sure you can access ubuntu
If so then you can delete oldubuntu.img

Completely straightforward, obvious and elegant. Very well done, sir!

I see that /dev/block/mmcblk1p1 is correct - but I am most curious how you swam upstream and found that?

Was is just just obvious that all internal was mmcblk0 then the SDcard had to be mmcblk1 and the first partition was up next?
9th August 2011, 07:57 AM |#103  
Senior Member
Flag Conyers GA
Thanks Meter: 546
 
More
I noticed we are using 9.10, would it be better to upgrade to 10.10 at least or maybe getting 11.04? There is a post about 10.10 running on galaxy s and an hd2, and 11.04 for xoom and thunderbolt. Just wondering if it is better to stay with an old version or use a newer one (sometimes newer consumes more space for not a huge benefit)
The Following User Says Thank You to evilvoice For This Useful Post: [ View ] Gift evilvoice Ad-Free
9th August 2011, 07:59 AM |#104  
unCoRrUpTeD's Avatar
Senior Member
Flag Fort Worth, TX
Thanks Meter: 248
 
Donate to Me
More
Quote:
Originally Posted by EarlyMon

Completely straightforward, obvious and elegant. Very well done, sir!

I see that /dev/block/mmcblk1p1 is correct - but I am most curious how you swam upstream and found that?

Was is just just obvious that all internal was mmcblk0 then the SDcard had to be mmcblk1 and the first partition was up next?

In this case yes. I have been working on some things and need the actual block address for the sdcard. Once I knew eMMC was at /dev/block/mmcblk0, the sdcard had to be at /dev/block/mmcblk1. And its easier than typing in /dev/block/vold/179:65.
The Following User Says Thank You to unCoRrUpTeD For This Useful Post: [ View ] Gift unCoRrUpTeD Ad-Free
9th August 2011, 11:10 PM |#105  
EarlyMon's Avatar
Senior Member
Thanks Meter: 887
 
More
Quote:
Originally Posted by unCoRrUpTeD

In this case yes. I have been working on some things and need the actual block address for the sdcard. Once I knew eMMC was at /dev/block/mmcblk0, the sdcard had to be at /dev/block/mmcblk1. And its easier than typing in /dev/block/vold/179:65.


Cool.

OK - so here's the thing - it's my memory. Truth is - it pretty much sucks. Between that and copy and paste, I'm liable to screw up just about anything.

So - I've decided to script all of this.

I just couldn't wrap my head around using the fat32 SDcard for the unix mount points - even if that works, it just made me all ooogly to go that route. So I took your instruction and made the mount points on /data/local/ubuntu (just like bootubuntu) and cleaned my way out when done.

So, here's the deal:
  • Back up your ubuntu.img to your PC before starting (along with anything else)
  • run the script as a bash script, not as shell
  • I put mine in /sdcard/ubuntu
  • You can put yours somewhere in /system in your path and then just execute when you want - be sure that the first line is pointing to your bash and that you chmod the file correctly in the first place

What it does:
  • Asks if you've really just rebooted
  • Checks your free /sdcard space
  • Sets the minimum size at 2150 MB
  • Reduces the available free size by 500 MB (just for safety)
  • Prompts you for the size you want
  • Answer not Y for the boot question, or give it any grief over the size of the new image file, and it bails on you
  • Runs unCoRrUpTeD instructions and automagically answers the mke2fs question for you

Here's the script, I called mine /sdcard/ubuntu/ubuntu_sizer.sh
Code:
#! /system/bin/bash

# bash script to resize the ubuntu.img file used for Ubuntu on Android
#
# Real work on how to do this by unCoRrUpTeD at XDA
#    (http://twitter.com/#!/unCoRrUpT3d) - see:
# http://forum.xda-developers.com/showpost.php?p=16455543&postcount=101
#
# Interactive stuff added by EarlyMon (XDA, Android Forums) 2011 Aug 9

clear
echo "Ubuntu image resizer - Please be root!"
echo
echo "It is imperative that you ONLY run this immediately AFTER rebooting!"
echo -n "Tell the truth - did you just now reboot? [y/N] "
read rebooted

if [[ !( "$rebooted" =~ [Yy] ) ]]; then
   echo "OK, try again after reboot, exiting."
   exit
fi

cd /sdcard/ubuntu

sd_free=`df /sdcard | awk '{print $6}' | sed s/K$//`
# Convert to MB
sd_free=$[$sd_free/1000]
# Reserve 500 MB as a safety measure
sd_free=$[$sd_free-500]

ubuntu_size=`ls -l ubuntu.img | awk '{print $4}'`
ubuntu_size=$[$ubuntu_size/1000000]

# Pick a lower limit here for the image size
minimum=2150

echo  "Existing Ubuntu image size: $ubuntu_size MB"
echo  "Free space on SDcard: $sd_free MB"
echo -n "Target size in MB? (minimum: $minimum) "
read target

if [[ "$minimum" < "$target" && "$target" < "$sd_free" ]]; then

   echo "Resizing ubuntu.img to $target MB"
   echo
   echo "Beginning resize - will reboot when done."
   echo "Test ubuntu.img when complete - discard oldubuntu.img if happy"
   echo
   echo "Please be patient - image creation will take several minutes"
   echo
   echo "mke2fs prompt will be answered automagically"
   echo

   if [ ! -d /data/local/ubuntu ]; then
      mkdir /data/local/ubuntu
   fi
   MOUNT=/data/local/ubuntu

   mv ubuntu.img oldubuntu.img
   dd if=/dev/zero of=ubuntu.img bs=1024000 count=$target

# DO NOT modify the indentation of the following herefile
#   DO NOT allow trailing spaces after either use of the word
#   END_HEREFILE -- be especially cautious of this with copy/paste

   mke2fs ubuntu.img << END_HEREFILE
y
END_HEREFILE

   # Strictly cosmetic
   echo "y"

   losetup /dev/block/loop1 ubuntu.img
   losetup /dev/block/loop2 oldubuntu.img
   mkdir $MOUNT/ubuntu
   mkdir $MOUNT/oldubuntu
   mount -t ext2 /dev/block/loop1 $MOUNT/ubuntu
   mount -t ext2 /dev/block/loop2 $MOUNT/oldubuntu
   cp -a $MOUNT/oldubuntu/* $MOUNT/ubuntu
   umount $MOUNT/ubuntu
   umount $MOUNT/oldubuntu
   rmdir $MOUNT/ubuntu
   rmdir $MOUNT/oldubuntu
   reboot

else
   echo "$target is not a good size"
   cd -
   exit
fi
How to run:
Code:
cd /sdcard/ubuntu
su
bash ubuntu_sizer.sh

How it looks after it's run:
Code:
# cd /sdcard/ubuntu
# bash
bash-4.1# bash ubuntu_sizer.sh

Ubuntu image resizer - Please be root!

It is imperative that you ONLY run this immediately AFTER rebooting!
Tell the truth - did you just now reboot? [y/N] y
Existing Ubuntu image size: 2147 MB
Free space on SDcard: 2964 MB
Target size in MB? (minimum: 2150) 2500
Resizing ubuntu.img to 2500 MB

Beginning resize - will reboot when done.
Test ubuntu.img when complete - discard oldubuntu.img if happy

Please be patient - image creation will take several minutes

mke2fs prompt will be answered automagically

2500+0 records in
2500+0 records out
2560000000 bytes transferred in 614.510 secs (4165920 bytes/sec)
mke2fs 1.41.11 (14-Mar-2010)
ubuntu.img is not a block special device.
Proceed anyway? (y,n) y
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
156480 inodes, 625000 blocks
31250 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=641728512
20 block groups
32768 blocks per group, 32768 fragments per group
7824 inodes per group
Superblock backups stored on blocks: 
	32768, 98304, 163840, 229376, 294912

Writing inode tables: done                            
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 36 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
EarlyMon$ <---this is the kickout to my machine after reboot
Hope this helps!

Tested this all the obvious ways, worked for me.

Your mileage may vary. If in doubt, nandroid and then back up entire SDcard to PC.

This takes a LONG while to run. Just trust it, don't baby it.

Cheers!

PS - I always forget about here-strings, so, oh well.
The Following User Says Thank You to EarlyMon For This Useful Post: [ View ] Gift EarlyMon Ad-Free
10th August 2011, 01:58 AM |#106  
danaff37's Avatar
Senior Member
Flag Saint Petersburg, FL
Thanks Meter: 902
 
More
hey if you want to try this, digging through some old links and found this, with ubuntu 10.10, and who knows, might have a better booting script too. Supposed to be universal... Out of sdcard space to try it myself. (think I'm going to try the backtrack one next anyways)

http://forum.xda-developers.com/showthread.php?t=962023
The Following User Says Thank You to danaff37 For This Useful Post: [ View ] Gift danaff37 Ad-Free
10th August 2011, 07:02 PM |#107  
Senior Member
Flag West Caldwell
Thanks Meter: 32
 
Donate to Me
More
I need help when i type bootubuntu i get this error message

sh-3.2# bootubuntu
/system/bin/bootubuntu: line 13: mknod: command not found
/system/bin/bootubuntu: line 14: losetup: command not found
mount: Invalid argument
mount: No such file or directory
mount: No such file or directory
mount: No such file or directory
/system/bin/bootubuntu: line 20: sysctl: command not found
Setting /etc/resolv.conf to Google Open DNS 8.8.8.8 and 8.8.4.4
/system/bin/bootubuntu: line 22: /data/local/ubuntu/etc/resolv.conf: No such file or directory
/system/bin/bootubuntu: line 23: /data/local/ubuntu/etc/resolv.conf: No such file or directory
Setting localhost on /etc/hosts
/system/bin/bootubuntu: line 25: /data/local/ubuntu/etc/hosts: No such file or directory
READY TO ROCK AND ROLL BABY!
Brought to you by NexusOneHacks.net and the open source community!
/system/bin/bootubuntu: line 29:

chroot: command not found

Shutting down Ubuntu
failed.
failed.
failed.
failed.
losetup: dev/block/loop1: no such device or adress
10th August 2011, 08:25 PM |#108  
unCoRrUpTeD's Avatar
Senior Member
Flag Fort Worth, TX
Thanks Meter: 248
 
Donate to Me
More
Quote:
Originally Posted by donnyevo4g

I need help when i type bootubuntu i get this error message

sh-3.2# bootubuntu
/system/bin/bootubuntu: line 13: mknod: command not found
/system/bin/bootubuntu: line 14: losetup: command not found
mount: Invalid argument
mount: No such file or directory
mount: No such file or directory
mount: No such file or directory
/system/bin/bootubuntu: line 20: sysctl: command not found
Setting /etc/resolv.conf to Google Open DNS 8.8.8.8 and 8.8.4.4
/system/bin/bootubuntu: line 22: /data/local/ubuntu/etc/resolv.conf: No such file or directory
/system/bin/bootubuntu: line 23: /data/local/ubuntu/etc/resolv.conf: No such file or directory
Setting localhost on /etc/hosts
/system/bin/bootubuntu: line 25: /data/local/ubuntu/etc/hosts: No such file or directory
READY TO ROCK AND ROLL BABY!
Brought to you by NexusOneHacks.net and the open source community!
/system/bin/bootubuntu: line 29:

chroot: command not found

Shutting down Ubuntu
failed.
failed.
failed.
failed.
losetup: dev/block/loop1: no such device or adress

Did you run ubuntu.sh first.
Then try installing busybox from the market.

Sent from my PG86100 using XDA App
10th August 2011, 09:16 PM |#109  
Senior Member
Flag West Caldwell
Thanks Meter: 32
 
Donate to Me
More
yes i ran sh ubuntu.sh first and i installed busybox from the market and installed it and then i even installed busybox installer and installed it again im stuck idk whats goin on
10th August 2011, 09:28 PM |#110  
EarlyMon's Avatar
Senior Member
Thanks Meter: 887
 
More
Quote:
Originally Posted by donnyevo4g

yes i ran sh ubuntu.sh first and i installed busybox from the market and installed it and then i even installed busybox installer and installed it again im stuck idk whats goin on

Please feedback the results of the following commands - maybe something will stand out and help resolve this -

Code:
set
ls -l /system/bin/mount
ls -l /system/xbin/mount
10th August 2011, 09:42 PM |#111  
Senior Member
Flag West Caldwell
Thanks Meter: 32
 
Donate to Me
More
THIS IS WHAT I GOT FROM WHAT YOU TOLD ME TO PUT IN

C:\SDK>cd platform-tools

C:\SDK\platform-tools>adb shell
sh-3.2# set
set
ANDROID_ASSETS=/system/app
ANDROID_BOOTLOGO=1
ANDROID_DATA=/data
ANDROID_PROPERTY_WORKSPACE=9,65536
ANDROID_ROOT=/system
ASEC_MOUNTPOINT=/mnt/asec
BASH=/system/bin/sh
BASH_ARGC=()
BASH_ARGV=()
BASH_LINENO=()
BASH_SOURCE=()
BASH_VERSINFO=([0]="3" [1]="2" [2]="0" [3]="7" [4]="release" [5]="arm-none-linux
-gnueabi")
BASH_VERSION='3.2.0(7)-release'
BOOTCLASSPATH=/system/framework/core.jar:/system/framework/bouncycastle.jar:/sys
tem/framework/ext.jar:/system/framework/framework.jar:/system/framework/android.
policy.jar:/system/framework/services.jar:/system/framework/core-junit.jar:/syst
em/framework/com.htc.commonctrl.jar:/system/framework/com.htc.framework.jar:/sys
tem/framework/com.htc.android.pimlib.jar:/system/framework/com.htc.android.easop
en.jar:/system/framework/com.scalado.util.ScaladoUtil.jar:/system/framework/com.
orange.authentication.simcard.jar:/system/framework/android.supl.jar
COLUMNS=80
DIRSTACK=()
EUID=0
EXTERNAL_STORAGE=/mnt/sdcard
GROUPS=()
HISTFILE=//.bash_history
HISTFILESIZE=500
HISTSIZE=500
HOSTNAME=localhost
HOSTTYPE=arm
IFS='
'
LD_LIBRARY_PATH=/vendor/lib:/system/lib
LINES=24
LOOP_MOUNTPOINT=/mnt/obb
MACHTYPE=arm-none-linux-gnueabi
MAILCHECK=60
OPTERR=1
OPTIND=1
OSTYPE=linux-gnueabi
PATH=/sbin:/vendor/bin:/system/sbin:/system/bin:/system/xbin
POSIXLY_CORRECT=y
PPID=153
PS1='\s-\v\$ '
PS2='> '
PS4='+ '
PWD=/
SHELL=/bin/sh
SHELLOPTS=braceexpand:emacs:hashall:histexpand:his tory:interactive-commentsosi
x
SHLVL=1
TERM=dumb
UID=0
_=/system/bin/sh
sh-3.2# ls -l /system/bin/mount
ls -l /system/bin/mount
lrwxrwxrwx root root 2011-08-10 11:58 mount -> toolbox
sh-3.2# ls -l /system/xbin/mount
ls -l /system/xbin/mount
lrwxrwxrwx root root 2011-08-10 11:58 mount -> /system/xbin/bus
ybox
sh-3.2#
Thread Closed Subscribe to Thread

Tags
android, htc evo 3d, htc sensation 4g, htc shooter, ubuntu
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes