LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Mobile (https://www.linuxquestions.org/questions/linux-mobile-81/)
-   -   ubuntu on android (https://www.linuxquestions.org/questions/linux-mobile-81/ubuntu-on-android-938878/)

danchristoffersen 04-09-2012 08:02 AM

ubuntu on android
 
is it possible to implement an ubuntu userspace on your android phone, i have some problems using android and ubuntu together

jayboe 04-10-2012 03:24 PM

I believe so...
 
I actually have Ubuntu 12.04 and another Linux distro both with a gui that I can start up and run on top of my Razr android kernel at any given time without service interruption and they work perfect.

justboo2u 04-21-2012 08:34 PM

Sooooo???

How did you do that?
Is the RAZR ARM-based or something else?

Inquiring Android tablets want to know! :p

:D

jayboe 04-21-2012 09:48 PM

Quote:

Originally Posted by justboo2u (Post 4659524)
Sooooo???

How did you do that?
Is the RAZR ARM-based or something else?

Inquiring Android tablets want to know! :p

:D

Here is a link to my youtube video showing it working
http://youtu.be/ZaJo_zx5Td0

Here is a README file that i put together. You can accumulate the files yourself. I have not got around to uploading and seeding due to some seeding issues in Precise final beta, but the BT5 website has an arm download that has many files in it once you extract it but they need to be tweaked. The BT5 arm img is too large for VFAT filesystems but the link provided below will help you take care of that.

This has been tested on Atrix and my Droid Razr and they work perfectly.

I had to resize the original bt5.img to less than 4GB so that it would fit
onto the VFAT filesystem of the android device.
Cedit here http://www.backtrack-linux.org/forum...ad.php?t=46709

From the BackTrack website you can download the original arm image
which comes with some boot files that need tweaking to get it to work
but I have done that for you.

*************************************bootbt********************************************************* ****
perm=$(id|cut -b 5)

if [ "$perm" != "0" ];then echo "This Script Needs Root! Type : su";exit;fi

busybox sysctl -w net.ipv4.ip_forward=1
export kit=/sdcard/BT5
export bin=/system/bin
export mnt=/data/local/mnt
export PATH=$bin:/usr/bin:/usr/local/bin:/usr/sbin:/bin:/usr/local/sbin:/usr/games:$PATH
export TERM=linux
export HOME=/root
losetup /dev/block/loop2 $kit/bt5.img
mount -o noatime -t ext2 /dev/block/loop2 $mnt
mount -t devpts devpts $mnt/dev/pts
mount -t proc proc $mnt/proc
mount -t sysfs sysfs $mnt/sys
echo "nameserver 8.8.8.8" > $mnt/etc/resolv.conf
echo "127.0.0.1 localhost bt5" > $mnt/etc/hosts
busybox chroot $mnt /bin/bash

echo "Stopping Backtrack on Razr"
umount $mnt/dev/pts
umount $mnt/proc
umount $mnt/sys
umount $mnt/root/.gvfs
sleep 2
umount $mnt
losetup -d /dev/block/loop2

*****************************************bootubu is basically the same**********************************
perm=$(id|cut -b 5)

if [ "$perm" != "0" ];then echo "This Script Needs Root! Type : su";exit;fi

busybox sysctl -w net.ipv4.ip_forward=1
export kit=/sdcard/ubuntu
export bin=/system/bin
export mnt=/data/local/mnt
export PATH=$bin:/usr/bin:/usr/local/bin:/usr/sbin:/bin:/usr/local/sbin:/usr/games:$PATH
export TERM=linux
export HOME=/root
losetup /dev/block/loop2 $kit/ubuntu.img
mount -o noatime -t ext2 /dev/block/loop2 $mnt
mount -t devpts devpts $mnt/dev/pts
mount -t proc proc $mnt/proc
mount -t sysfs sysfs $mnt/sys
echo "nameserver 8.8.8.8" > $mnt/etc/resolv.conf
echo "127.0.0.1 localhost bt5" > $mnt/etc/hosts
busybox chroot $mnt /bin/bash

echo "Stopping Ubuntu on Razr"
umount $mnt/dev/pts
umount $mnt/proc
umount $mnt/sys
umount $mnt/root/.gvfs
sleep 2
umount $mnt
losetup -d /dev/block/loop2
**************************************************************************************************** ****
I assume that you can figure out how to extract these files. If not,
then you should abort now.
I am not responsible for any damage that you may cause to your device
through neglegent behaviour.
With that being said let's move on to the goods.

There are a number of ways to move the files that you need to your phone.
I like to use adb myself, but this can be as simple as plugging in your phone
and selecting mass storage and dragging and dropping if you are indeed
that lazy.

Oh yeah, your device will need to be rooted.

##you just need to be sure that you have these files which most came with the BT5arm download
1. After extraction you will find these files;
BUSYBOX = busybox installbusybox.sh
BT5 = bootbt fsrw mountonly bt5.img unionfs
UBUNTU = bootubu fsrw mountonly ubuntu.img unionfs

2. There is no need to go to the Play Store (Market) and install the busybox
that you find there. Just copy or push busybox and busyboxinstaller.sh to
the /sdcard directory, start a shell (adb shell) or a trusty old emulator
on your phone and execute # sh busyboxinstaller.sh
**Be sure that all the files have the right permissions before the transfer
because once they are on your sdcard you may not be able to change the
perms from there #chmod +x -R BT5/*
#chmod +x -R UBUNTU/*

3. Now take and copy over the BT5/UBUNTU directory/s to your /sdcard and go
to the Play Store and download android vnc viewer if you plan on using
the GUI if you have not already

4. You are ready to rock and roll! Fire up a terminal from your phone and
#su
#cd /sdcard/BT5 or UBUNTU
#sh boobt or bootubu #and you should see the following lines
net.ipv4.ip_forward = 1
root@localhost:/#
**you can type in ls pentest/ in bt5 for a look at what's in there**

5. Now that you are in there let's change some passwords to get your GUI ready
BT5 = root@localhost:/#passwd (same command for UBUNTU)
BT5 = root@localhost:/#vncpasswd (same command for UBUNTU)

6. Now we need to add "export USER=root", but without the quotes to a couple
of files using the editor of your choice (vi, nano, etc...) if you prefer
nano you may have to download it "apt-get install nano"
root@localhost:/#nano /usr/bin/startvnc (ubuntu does not have the startvnc
or stopvnc scripts but you can make your own with the following script)
** #!/bin/bash
rm -rf /tmp/.X1*
export USER=root #looks like a good spot to me
vncserver -geometry 1024x600 **
and now do the same thing to the stopvnc file and save

7. Start the vnc server
root@localhost:/#startvnc
and you should see this;
New 'X' Desktop is localhost:1
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/localhost:1.log
***************In UBUNTU we gotta add the startvnc and stopvnc scripts to the
/usr/bin directory and give them chmod +x permissions**********************************

8. Now you are ready for the GUI. Simply hit your home button, leaving the
terminal running of course and start your android-vnc-viewer
Use the vnc passwd that you set
Set the address to 5901
Set the color to 24bit
Press connect and there you have it.
Press the menu button and set your input mode to touchpad
Press menu button and select disconnect to, uh, well, disconnect
Return to your terminal and enter stopvnc before entering exit
to leave BT5 or UBUNTU

BlackHawk 05-02-2012 08:07 PM

jayboe,

i myself was running both ubuntu 12.04 ARM and backtrack 5 on my android bionic phone.

While ubuntu was running great, i found backtrack 5 to be a bit unstable...als

I tried installing things like "xchat" and "irssi" with apt-get on backtrack but it couldn't find those
apps in the repo's and those are major apps...

also i was hoping maybe you could take a look at my post about "how can i add more space to ubuntu on my
android phone"

I am having a bit of trouble trying to add more space so i can install more apps on my ubuntu arm distro
on my android phone...

my sdcard is 16gigs but i ran into a weird error...


also have you ran into a weird thing when connecting with androidvnc to either ubuntu or bt5 that androidvnc
would say "connected to localhost" but only show you a grey screen with an x that acts like a mouse?

anyways thanks for the video...

-BlackHawk

jayboe 05-02-2012 08:58 PM

Hey Blackhawk.
More than likely if you cant get the app from the repo with apt-get it is probably not avaiable in armel yet. Maybe it sais that is is available in another source meaning deb or rpm. It is a work in progress.

As far as adding more space to your Ubuntu arm that may prove to be a little more difficult. For me anyways... Im not sure but I think that if you maximize the size of the img before moving it to your sdcard that may be the answer. Problem is that the android phones only support a max of 4GB. Here is a good place to get started on learning the dd command (be careful) to create a new image of a different size.
http://www.linuxquestions.org/questi...ommand-362506/
Here is the link I posted for the method I used to shrink BT5 for my Razr as an example.
http://www.backtrack-linux.org/forum...ad.php?t=46709

And for the grey screen be sure that your /usr/bin/vnc start/stop scripts has the rm and export commands in them i.e.
#!/bin/bash
rm -rf /tmp/.X1*
export USER=root
vncserver -geometry 1024x600

and now do the same thing to the stopvnc file and save and the geomtry can be different too.
I recreated the same scripts from the BT5 vnc onto Ubuntu and it works fine.
I did notice that if I run BT5 before Ubuntu (not at the same time) that there was no problem running Ubuntu, but if I run Ubuntu first the I would have to restart my phone for it to unmount the loop0 to get the BT5 to run.
Eyes squinting red with sleep...... hope this helps. I havent messed with it much since I got it going but its fun trying to figure some of this stuff out ;)

jago25_98 05-19-2012 06:46 PM

can't mount an additional 4gb partition?

justboo2u 06-01-2012 06:02 PM

I built a 7168k image that seems to be working fine, except that I cannot find tightvncserver when I 'apt-get install' under the ubuntu image...
Is it called something else?
Or is it already there and I dont realize it?

EDIT:
Ok... I lied. it is on a 4gb and is the original 2gb size. Harrumph.
That will have to change in the immediate future! :D

Still ??? about the vnc?

BlackHawk 06-04-2012 09:18 PM

that is really weird that you can't find the 'tightvncserver' for your ubuntu arm distro. I looked under my ubuntu ARM distro
and the name of the package is "tightvncserver" so i am not sure why you don't have it? When i installed my ubuntu 12 ARM distro
i am almost positive that the tightvncserver was already installed. What i do know is that I had to manually run the tightvncserver
app to get the vncserver running, it doesn't start on its own like it suggested in most "install linux on your phone tutorials".

What i did was I ran the command "netstat -ntl" and saw that the vncserver was not running. So i ran it manually with the command
"vncserver" and after that when i did "netstat -ntl" again i saw that the vncserver was running on port "5091" not port "5090".
Every tutorial i have seen says that the vncserver runs on port "5090" but mine is on "5091".

After that i was able to connect to the vncserver with the android app "androidvnc" using these settings:

host: localhost

port: 5091

password: ubuntu

and boom i connected right away.


Maybe you can find the tightvncserver app with google and install it manually with wget? Make sure you find the ARM version of
tightvncserver or it will not work!


I hope this has helped...

And thank you so much for your assistance on my "giving more space to ubuntu on android" forum, i still have some questions
on that forum that i will be asking you later so if you can please take a look at it again.

Thank you again for all of your help, and i hope you get your linux arm distro working on your phone...I know how much fun I have
with linux on mine.

-BlackHawk


All times are GMT -5. The time now is 08:32 AM.