[DEV] Reworked process for running Ubuntu on Nexus One (Device busy error eliminated) - Nexus One Android Development

Few months ago, there was a post on XDA:
http://forum.xda-developers.com/showthread.php?t=718952
and a link to:
http://nexusonehacks.net/nexus-one-hacks/how-to-install-ubuntu-on-your-nexus-oneandroid/
They explain how to install and run Ubuntu on Nexus One.
But a lot of people got problems when running script bootubuntu and ubuntu.sh, and I was one of them.
After Cyanogen Mod 6.0 was released, I could successfully run Ubuntu according to given instructions, but later I discovered the two scripts (ubuntu.sh and bootubuntu) don't always work, and I found them very complex and unnecessary statements can be removed.
Since few months ago I've been refining the two scripts to make them able to boot Ubuntu with less likelihood to get error. I thought I would like to share my findings to everyone interested.
Here are some reasons why it's useful to have Ubuntu on Nexus One
1. Fully functional web browser Firefox
2. Fully functional office suite OpenOffice
3. Fully functional Linux terminal with lots of ultilities
4. Fully functional image manipulation tool Gimp
5. Ability to run lots of useful native Linux programs
6. Python, gcc, g++..
I'll talk about my findings in next few posts.
Post #2: simplify ubuntu.sh, remove unnecessary script files
Post #3: simplify bootubuntu, forcibly umount
Post #4: how to shutdown Ubuntu properly if terminal application was closed by Android
Post #5: a little script which should be run before exiting from Ubuntu
Post #6: how to start GNOME desktop (instead of LXDE) and get correct keyboard mapping
Post #7: a possible solution to loop device's "resource or device busy" error
About my Nexus One:
bought on 2nd March
Cyanogen Mod 6.0
IntersectRaven HAVS CM CFS 1020 kernel
Busybox 1.17
Radio 5.0.8
Gapps hdpi 20101020.1
Please don't hesitate to tell me if I made any mistake, I'm a Linux beginner because I taught myself Linux, my University will teach Unix next semester.
Attachment: ubuntu_scripts.zip
contains all modified scripts.

Finding #1:
In original Zip package, there are five scripts, but only two of them are actually used to install and boot up Ubuntu.
fsrw, mountonly, unionfs are not necessary to install and boot ubuntu, thus their reference can be removed from ubuntu.sh
Here is my simplified version of ubuntu.sh
#-------------------------------
mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system
rm -f /system/bin/bootubuntu
rm -r -f /data/local/ubuntu
cp -f bootubuntu /system/bin
cd /
echo "Type 'bootubuntu' to boot Ubuntu"
#-------------------------------
Simplified ubuntu.sh removed unnecessary statements to reduce risk of error.
Also I discovered:
Files in /sdcard/ubuntu can not be chmod, and it's unnecessary to chmod 4777 to them.
chmod 4777 /system/bin/* will cause some Android softwares to malfunction (e.g. Orbot), also it *possibly* cause some roms to fail to boot up next time (CM6.0)

Finding #2:
Here's my simplified bootubuntu script, there are minor changes to script flow and removed all unnecessary statements:
#-------------------------------
mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system
echo "SETTING VARIABLES"
export bin=/system/bin
export mnt=/data/local/ubuntu
export PATH=$bin:/usr/bin:/usr/sbin:/bin:$PATH
export TERM=linux
export HOME=/root
if [ ! -d /data/local/ubuntu ]
then
mkdir /data/local/ubuntu
fi
echo "SETTING UP LOOP DEVICE"
losetup /dev/block/loop1 /sdcard/ubuntu/ubuntu.img
echo "MOUNTING"
mount -t ext2 /dev/block/loop1 /data/local/ubuntu
mount -t devpts devpts $mnt/dev/pts
mount -t proc proc $mnt/proc
mount -t sysfs sysfs $mnt/sys
echo "SETTING UP NETWORK"
sysctl -w net.ipv4.ip_forward=1
echo "nameserver 208.67.222.222" > $mnt/etc/resolv.conf
echo "nameserver 208.67.220.220" >> $mnt/etc/resolv.conf
echo "127.0.0.1 localhost" > $mnt/etc/hosts
echo "Brought to you by NexusOneHacks.net and the open source community! "
chroot $mnt /bin/bash
echo "UMOUNTING"
umount -lfr $mnt/dev/pts
umount -lfr $mnt/proc
umount -lfr $mnt/sys
umount -lfr $mnt
losetup -d /dev/block/loop1
#-------------------------------
and it forcibly,lazily,read-only-if-failed umount $mnt, thus losetup -d will less likely to fail and eliminate the problem when booting ubuntu second time.

Finding #3:
If terminal application is terminated automatically by Android system, in this situation, the Ubuntu is not properly umounted.
Thus we change ubuntu.sh into:
#------------------------------
mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system
rm -f /system/bin/bootubuntu
rm -f /system/bin/exitu
rm -r -f /data/local/ubuntu
cp -f bootubuntu /system/bin
cp -f exitu /system/bin
cd /
echo "Type 'bootubuntu' to boot Ubuntu"
#------------------------------
and we create a new script named "exitu" in sdcard/ubuntu directory:
#------------------------------
export mnt=/data/local/ubuntu
echo "UMOUNTING"
umount -lfr $mnt/dev/pts
umount -lfr $mnt/proc
umount -lfr $mnt/sys
umount -lfr $mnt
losetup -d /dev/block/loop1
#------------------------------
remember to run "sh ./ubuntu.sh" to copy new exitu script into /system/bin.
Then whenever you went back to terminal, found Ubuntu terminal is gone, simply type exitu (remember to be su first) to exit ubuntu, then bootubuntu again to enter ubuntu terminal. It's harmless to execute exitu multiple times to ensure $mnt is umounted successfully.
Sometimes exitu still can not successfully remove loop1 assignment with /sdcard/ubuntu/ubuntu.img, but seems like it doesn't really matter, ubuntu still can boot up successful even loop1 was not unassigned successfully

Finding #4:
To reduce likelihood of getting "device or resource busy" error when removing loop device assignment, it's good to have this script in your Ubuntu, and run the script before exiting from Ubuntu:
#-------------------
export USER=root
vncserver -kill :1
vncserver -kill :2
sudo reboot
sudo halt
#-------------------
(remember, the script should be in your Ubuntu's file system, not your android's file system!)
run the script before you exiting from Ubuntu, this will greatly reduce likelihood of getting device or resource busy error when exiting.

Finding #5:
For those of you who prefer to enter GNOME desktop manually (no automatically start-up), this script may help, also this script should be able to fix androidVNC keyboard mapping problem:
(this script should be in Ubuntu)
#--------------------
cd /
rm -r -f tmp
mkdir tmp
cd /
export USER=root
export XKL_XMODMAP_DISABLE=1
vncserver -geometry 800x600
#--------------------
regarding the guide:
http://nexusonehacks.net/nexus-one-hacks/how-to-install-ubuntu-on-your-nexus-oneandroid/
if you would like to enter gnome and not to autostart desktop environment, please don't follow its instruction on making change to /root/.vnc/xstartup and /root/.bashrc
instead, create a script as I mentioned above, and run the script to bring up VNC server, and you will get GNOME desktop in VNC with correct keyboard mapping

Finding #6
If you're constantly getting "device or resource busy" error when mounting loop1 to /data/local/ubuntu, the reason might be caused by Android App2SD (Froyo version), if you have any software installed on SD card, it may cause all loop devices to be busy all the time (even newly created loop device!) And busy loop device can not be mounted, thus generates "device or resource busy" error message.
Most people had the same problem few months ago, when they execute bootubuntu, they get an error saying loop device is busy, and even changing loop device wouldn't help.
Now I think the reason is determined. After uninstalled all applications which are on SD card (or move all of them from SD card to internal storage), the Ubuntu can boot successfully without getting "device or resource busy" error when mounting loop device.
Edit 2010-11-04:
If bootubuntu gets executed before Android loads all app2sd applications, it is possible solves the loop device busy error even with App2SD applications installed. It requires a very perfect timing, today after few experiments on my phone, I worked out a process which can always boot up Ubuntu on my phone:
1. Reboot phone
2. as soon as you enter lock screen, unlock screen
3. quickly go to terminal emulator
4. become su by typing su and enter
5. type bootubuntu and wait (type it fast... practice )
-------------
1-5 must be done before SD "Checking for errors" notification disappears, if you fail to do so.. reboot and try again
------------
6. as soon as SD "Checking for errors" notification disappears, hit enter IMMEDIATELY
Now you should be able to enter Ubuntu terminal.
Do NOT exit from your Android terminal (don't press back or home button), wait 1-2 minutes for Android to load applications on SD card.
Once you reboot your phone, you'll need to repeat the above procedure again to enter Ubuntu successfully.

Also chmod 4777 is horrible from a security point of view. It makes all the system bin files writable by anyone and run with root privileges (setuid root).
Sent from my Nexus One using XDA App

houzuoguo said:
Finding #6
If you're constantly getting "device or resource busy" error when mounting loop1 to /data/local/ubuntu, the reason might be caused by Android App2SD (Froyo version), if you have any software installed on SD card, it may cause all loop devices to be busy all the time, thus loop device can not be mounted to /data/local/ubuntu anymore.
Most people had the same problem few months ago, when they execute bootubuntu, they get an error saying loop device is busy, and even changing loop device wouldn't help.
Now I think the reason is determined. After uninstalled all applications which are on SD card (or move all of them from SD card to internal storage), the Ubuntu can boot successfully without getting "device or resource busy" error when mounting loop device.
Click to expand...
Click to collapse
This is because with Froyo apps to SD android creates an encrypted loopback device for each app on the SD card, so depending on the number of apps on your SD card loop0-7 may be in use. I solve this by using a high loop number with losetup - loop99.
Sent from my Nexus One using XDA App

Use a higher loop device, the best option
It worked for me on loop7, but to be on the safe side, decided to use a higher loop number as suggested, but it requires to create the loop device as it doesn't exists, use mknod:
Code:
echo "SETTING UP LOOP DEVICE"
mknod /dev/block/loop99 b 7 99
losetup /dev/block/loop99 /sdcard/ubuntu/ubuntu.img
Now is working on loop99 too!. The clean up section for both bootubuntu and exitu scripts:
Code:
echo "UMOUNTING"
umount -f $mnt/dev/pts
umount -f $mnt/proc
umount -f $mnt/sys
umount -f $mnt
losetup -d /dev/block/loop99
rm /dev/block/loop99
I'm not sure about how I am cleaning up the new node, rm erases it... but is this the best method? rebooting the phone will erase the node anyway so maybe an if clause to test for the node loop99 before creating it will be better.

fralacos said:
It worked for me on loop7, but to be on the safe side, decided to use a higher loop number as suggested, but it requires to create the loop device as it doesn't exists, use mknod:
Code:
echo "SETTING UP LOOP DEVICE"
mknod /dev/block/loop99 b 7 99
losetup /dev/block/loop99 /sdcard/ubuntu/ubuntu.img
Now is working on loop99 too!. The clean up section for both bootubuntu and exitu scripts:
Code:
echo "UMOUNTING"
umount -f $mnt/dev/pts
umount -f $mnt/proc
umount -f $mnt/sys
umount -f $mnt
losetup -d /dev/block/loop99
rm /dev/block/loop99
I'm not sure about how I am cleaning up the new node, rm erases it... but is this the best method? rebooting the phone will erase the node anyway so maybe an if clause to test for the node loop99 before creating it will be better.
Click to expand...
Click to collapse
thanks a lot
I tried this idea already but it seems doesn't work under CM6.0...
and the problem was, every newly created loop device will always be busy, if app2sd is used. (Don't know why)
I'm going to try a different approach, I try to mount loop device to /data/local/ubuntu before Android mounts all app2sd applications

mathrock said:
This is because with Froyo apps to SD android creates an encrypted loopback device for each app on the SD card, so depending on the number of apps on your SD card loop0-7 may be in use. I solve this by using a high loop number with losetup - loop99.
Sent from my Nexus One using XDA App
Click to expand...
Click to collapse
thanks.
my finding is, Android froyo app2sd uses dm-xx loop devices for sd applications, for example, now I have three games on sd card, by entering mount in terminal, i read that
/dev/block/dm-0,dm-1,dm-2 are used.
After I removed all SD applications and reboot system, all of those dm-xxx devices are not mounted anymore.
Also the only difference between mount result with app2sd and mount result without app2sd is usage of dm-xx devices.

Finally I've found solution to the "device or resource busy" error
but it seems like people are now less interested in running Ubuntu on Nexus One
the original post got more than 35k hits and more than 200 replies

Hi houzuoguo!!
I'm trying to type bootubuntu when enter in system, but i think i'm not fast enough or that not work for me. Everytime i get:
# bootubuntu
SETTING VARIABLES
SETTING UP LOOP DEVICE
losetup: /dev/block/loop1
MOUNTING
mount: mounting /dev/block/loop1 on /data/local/ubuntu failed: Device or resource busy
mount: mounting devpts on /data/local/ubuntu/dev/pts failed: No such file or directory
mount: mounting proc on /data/local/ubuntu/proc failed: No such file or directory
mount: mounting sysfs on /data/local/ubuntu/sys failed: No such file or directory
SETTING UP NETWORK
net.ipv4.ip_forward = 1
bootubuntu: cannot create /data/local/ubuntu/etc/resolv.conf: directory nonexistent
bootubuntu: cannot create /data/local/ubuntu/etc/resolv.conf: directory nonexistent
bootubuntu: cannot create /data/local/ubuntu/etc/hosts: directory nonexistent
Brought to you by NexusOneHacks.net and the open source community!
chroot: can't execute '/bin/bash': No such file or directory
UMOUNTING
umount: can't forcibly umount /data/local/ubuntu/dev/pts: No such file or directory
umount: can't forcibly umount /data/local/ubuntu/proc: No such file or directory
umount: can't forcibly umount /data/local/ubuntu/sys: No such file or directory
umount: can't forcibly umount /data/local/ubuntu: Invalid argument
losetup: /dev/block/loop1: Device or resource busy
#
Whats the problem then?¿?
Thanks in advance.

devex said:
Hi houzuoguo!!
I'm trying to type bootubuntu when enter in system, but i think i'm not fast enough or that not work for me. Everytime i get:
# bootubuntu
SETTING VARIABLES
SETTING UP LOOP DEVICE
losetup: /dev/block/loop1
MOUNTING
mount: mounting /dev/block/loop1 on /data/local/ubuntu failed: Device or resource busy
mount: mounting devpts on /data/local/ubuntu/dev/pts failed: No such file or directory
mount: mounting proc on /data/local/ubuntu/proc failed: No such file or directory
mount: mounting sysfs on /data/local/ubuntu/sys failed: No such file or directory
SETTING UP NETWORK
net.ipv4.ip_forward = 1
bootubuntu: cannot create /data/local/ubuntu/etc/resolv.conf: directory nonexistent
bootubuntu: cannot create /data/local/ubuntu/etc/resolv.conf: directory nonexistent
bootubuntu: cannot create /data/local/ubuntu/etc/hosts: directory nonexistent
Brought to you by NexusOneHacks.net and the open source community!
chroot: can't execute '/bin/bash': No such file or directory
UMOUNTING
umount: can't forcibly umount /data/local/ubuntu/dev/pts: No such file or directory
umount: can't forcibly umount /data/local/ubuntu/proc: No such file or directory
umount: can't forcibly umount /data/local/ubuntu/sys: No such file or directory
umount: can't forcibly umount /data/local/ubuntu: Invalid argument
losetup: /dev/block/loop1: Device or resource busy
#
Whats the problem then?¿?
Thanks in advance.
Click to expand...
Click to collapse
I worked on that problem for few weeks and finally I discovered, once I moved all SD applications back to Internal storage, loop1 no longer be busy.
Are you using Froyo app2sd?

houzuoguo said:
thanks a lot
I tried this idea already but it seems doesn't work under CM6.0...
and the problem was, every newly created loop device will always be busy, if app2sd is used. (Don't know why)
I'm going to try a different approach, I try to mount loop device to /data/local/ubuntu before Android mounts all app2sd applications
Click to expand...
Click to collapse
Some of us are still interested in this info but ubuntu runs pretty slow on the nexus. I say it would be nice to have the newest ubuntu (10.10) installed on the nexus one. Possibly the netbook remix version.

Lou2serious said:
Some of us are still interested in this info but ubuntu runs pretty slow on the nexus. I say it would be nice to have the newest ubuntu (10.10) installed on the nexus one. Possibly the netbook remix version.
Click to expand...
Click to collapse
thanks haha, good to hear that I'm not the only one still interested in running Ubuntu on Nexus One.
I'm thinking, if Nexus Two can be overclocked to 1.4Ghz, together with top class SD card, the speed will be enough to run Ubuntu fluently.

Hi! Thanx for ur work! It helped me.....
Now i´m having another issue....i´m triying either to resize the ubuntu.img to make it bigger so i can install the stuff i want ( clean install has 100 mb left) or (preffered option) mounting my sdcard so i can install the native programs from there...any ideas?¿

I think the simple way is just to create another file bigger.

funkatiko said:
Hi! Thanx for ur work! It helped me.....
Now i´m having another issue....i´m triying either to resize the ubuntu.img to make it bigger so i can install the stuff i want ( clean install has 100 mb left) or (preffered option) mounting my sdcard so i can install the native programs from there...any ideas?¿
Click to expand...
Click to collapse
You might want to build your own rootfs - check this site out - it worked great for me.
https://wiki.ubuntu.com/ARM/RootfsFromScratch

Related

Debian on the X10

[MESSAGE TO MODS, I could not include urls so have added spaces to pass spam filter.. please change?]
Well now we finally have root on our shiny devices I decided to crack open
the beers and get to work getting debian running on the X10..
the process is actually pretty straight-forward.
(as it turns out the x10's kernel already has support for most things needed
such as the ext2 filesystem)
-- step 1--
firstly we need to create a debian image for the phone, there are a few already out there but you can use the following to create your own
Code:
apt-get install debootstrap
dd if=/dev/zero of=debian.img seek=749999999 bs=1 count=1
mke2fs -F debian.img
mkdir debian
mount -o loop debian.img debian
debootstrap --verbose --arch armel --foreign lenny debian [ht]tp:[//]ftp. de. debian. org/debian
umount debian
how ever if you would prefer to use a ready built one (recomended for less techies ) you can get one from: rapidshare. com/files/161776007/debian-armel-750.img.bz2
(had to include spaces in the url to pass spam filter, could a mod please change this?)
now copy this too the root of your sdcard and make sure its called debian.img
-- step 2 --
I have created a script to do most of the other work for you:
Code:
alias b=busybox
export PATH=/data/local/bin:/usr/bin:/usr/sbin:/bin:$PATH
b mknod /dev/loop0 b 7 0
b mount -o loop,noatime /sdcard/debian.img /data/local/mnt
echo 'nameserver 4.2.2.2' >data/local/mnt/etc/resolv.conf
b chroot /data/local/mnt
mount -t devpts devpts /dev/pts
mount -t proc proc /proc
mount -t sysfs sysfs /sys
rm -f /etc/mtab
ln -s /proc/mounts /etc/mtab
put this in your sdcard to.
-- step 3 --
Finally in any terminal emulator cd to the location of the startdeb.sh file
and do the following:
Code:
chmod 777 ./startdeb.sh
./startdeb.sh
!! and your done !!
you should now be within the debian system.. i suggest running
Code:
apt-get update
and installing what ever apps you want
(my first choices were gcc, python and tightvncserver)
[ EXTRA ]
now your on debian you can use
Code:
apt-get install tightvncserver
to get the xwindow system and the vnc server
now set both your HOME and USER variables
Code:
export HOME=/root
export USER=root
(or what ever user you choose)
and run
Code:
tightvncserver
(your also gonna have to download lxde and do a few other bits of setup
have a look around for X11 "Ported" to android post on these forums)
you could also change the config so that the desktop is displayed
at the right size for the screen
just use a vnc client from the market to connect to your GUI
Kool. I had ubuntu running on my htc touch pro once but wasnt really worth having apart from the cool factor. This looks promising.............. ill wait a while till I play around, the rooting factor is still new and I dont see the major gain to root yet.
Way awesome, thanks for the guide.
Nice work, will give this a try after I get the R2B rooted on my phone.
Next step for me would be to get the arm cross compilation toolchain and start porting goodies for the android....
wow this looks sooooo awesome!! any screen shots? don't make me google
when i try mounting debian.img using ur cmd i got following error
Code:
Usage: mount [-r] [-w] [-o options] [-t type] device directory
seems my mount requires -t parameters, so i try again, but still having error
Code:
mount -o loop,noatime -t ext2 /sdcard/debian.img /data/local/mnt
ioctl LOOP_SET_FD failed: Device or resource busy
please help thanks!
aget1 said:
when i try mounting debian.img using ur cmd i got following error
Code:
Usage: mount [-r] [-w] [-o options] [-t type] device directory
seems my mount requires -t parameters, so i try again, but still having error
Code:
mount -o loop,noatime -t ext2 /sdcard/debian.img /data/local/mnt
ioctl LOOP_SET_FD failed: Device or resource busy
please help thanks!
Click to expand...
Click to collapse
Are you running the script as root? If you not you might wanna try that.
This may sound kind of noobish, but would this be a dual-boot (I.e. running both android and debian on different boots of the phone, or would this be debian, until you reset the phone to be android again.
Sent from my X10a using XDA App
ddewbofh said:
Are you running the script as root? If you not you might wanna try that.
Click to expand...
Click to collapse
Still the same
Code:
whoami
whoami: unknown uid 0
mount -o loop,noatime -t ext2 /sdcard/debian.img /data/local/mnt
ioctl LOOP_SET_FD failed: Device or resource busy
aget1 said:
Still the same
Code:
whoami
whoami: unknown uid 0
mount -o loop,noatime -t ext2 /sdcard/debian.img /data/local/mnt
ioctl LOOP_SET_FD failed: Device or resource busy
Click to expand...
Click to collapse
And I assume you're either running the script or doing those commands manually? Including the mknod part?
ddewbofh said:
And I assume you're either running the script or doing those commands manually? Including the mknod part?
Click to expand...
Click to collapse
i run the script and found no luck, so i type in both adb and console, of coz mknod is done, either mkdir /data/local/mnt is done or not gives the same result, tried also mounting without loop,noatime and gives
Code:
mount: Block device required
would it be rooting problem or mount problem?
also tried losetup -d /dev/loop0, no luck
Code:
losetup: /dev/loop0: Device or resource busy
Keegan_P said:
This may sound kind of noobish, but would this be a dual-boot (I.e. running both android and debian on different boots of the phone, or would this be debian, until you reset the phone to be android again.
Sent from my X10a using XDA App
Click to expand...
Click to collapse
i see this to be a remounting of debian system on your phone, no modification on your phone so no, no dual boot
anybody can post a video tutorial please?
and the debian and android works together or just debian?
thx
A video tutorial would be amazing.
Sent from my X10a using XDA App
I will upload a video tutorial asap but at the moment I am having to use a 3G dongle for my internet (just moved out, am poor.. all donations to [email protected] on paypal ;-)) also this runs along side (or on top of) android so you'll still be able to get your texts and calls.. finally there are already a lot of debian apps compiled for ARM systems so have a look to see if the app you want is on apt (make sure you've run apt-get update first) please pm me if you have any problems
Thanks,
Sam Aldis
I tried to run it on the latest firmware and it seems loop device kernel module is not available in it.
Also the script is not fully functional :
you need to 'mkdir /data/local/mnt/'
also it's '/data/local' instead of 'data/local'
I haven't spend much time on this, so it's not working for now on my phone.
So help is welcome
Quick question:
Has anyone at all gotten this to work?
nope. I doubt it.
mod edit:..
sorry for stupid me, i don't know i can create loop device more than loop 0
i create loop0,loop1,loop2,loop7 and try mounting again, it success this time
so here is my script:
Code:
#!/system/bin/bash
export PATH=/data/local/bin:/usr/bin:/usr/sbin:/bin:$PATH
if [ ! -d /data/local/mnt ]
then
mkdir /data/local/mnt
fi
if [ ! -b /dev/loop2 ]
then
mknod /dev/loop0 b 7 0
mknod /dev/loop1 b 7 0
mknod /dev/loop2 b 7 0
mknod /dev/loop7 b 7 0
fi
if [ ! -d /data/local/mnt/bin ]
then
mount -o loop,noatime /sdcard/debian.img /data/local/mnt
fi
echo "nameserver 4.2.2.2" >data/local/mnt/etc/resolv.conf
chroot /data/local/mnt
mount -t devpts devpts /dev/pts
mount -t proc proc /proc
mount -t sysfs sysfs /sys
rm -f /etc/mtab
ln -s /proc/mounts /etc/mtab
Edited:
I just brick my device after some more work, every command even ls do no output, reboot machine freezes at sony ericsson logo, now i am re rooting the device......
Edited 2:
Should be not the problem of debian, seems working fine.

[WIP] [DEV] [HOWTO] Ubuntu on Nook Color! UPDATE 1/5/11

DISCLAIMER: You know the risks, bricking, breaking etc. I'm not, nor is anyone else responsible if something goes wrong with your device, especially should it turn into a cave troll and bludgeon someone to death.
You will have to be rooted for this to work.
Update 1/5/11
Changed the install and loader scripts re-compressed and uploaded, new download link. Stream lined the installation process (removed 5 steps)
Update 1/4/11
reflect changes to ubuntu.sh and bootubuntu scripts and streamlining the process. Added screenshots
_________________________
I was over at nexusonehacks.net and looking at the ubuntu on nexus one hack and was thinking that this could be ported to the nook color. The idea is to run ubuntu from an img on the sd card.
The following is a modified version of the "how to" orginally posted here
http://nexusonehacks.net/nexus-one-hacks/how-to-install-ubuntu-on-your-nexus-oneandroid/
Credits
The guys at NexusOneHacks
xda user munday who has modified the scripts to work for the nook color
Devs at XDA Developer for the Ubuntu ARM image for HTC HD2
Saurik (Jay Freeman) for the Debian G1 script, which was hacked for Ubuntu on Nexus One! and then re-hacked for the Nook Color by munday
Here we go:
1) Go download the ubuntu file here: http://www.megaupload.com/?d=67BU4Y3T
2) Extract the contents using 7zip http://www.7-zip.org/download.html
3) Copy the extracted folder "ubuntu" to the root of your SD card
4) Unmount the nook from your pc, go into the app NookColor Tools (if you don't have it download it here courtesy of Ben 74 and click All Settings->Development then uncheck Auto Mount. This will prevent the SD card from being mounted automatically when plugged into the PC
5) Plug the Nook back into your pc and open a command line then navigate to your android sdk folder ie C:\android-sdk or wherever you have it and type
Code:
adb devices
Hit enter and make sure that the nook color comes up (should be the SN of your Nook)
Note: This can also be done from terminal emulator instead of adb...but it is kind of a pain
6) Now we want to go into the command line on the nook so type
Code:
adb shell
Hit enter and this should bring up a "#" sign.
7) Type
Code:
su
hit enter (I do this just as a force of habit)
8) Now we navigate to the ubuntu folder we just copied to our sd card by entering
Code:
cd /sdcard/ubuntu
hit enter. To confirm you are where you want to be you can type
Code:
ls
and it should list the contents of the ubuntu folder.
9) Run the setup script ubuntu.sh by entering the following:
Code:
sh ./ubuntu.sh
hit enter
10) Now type
Code:
bootubuntu
and hit enter
11) So now we have ubuntu command line up and running which should look like:
Code:
[email protected]:/#
We will need to get some packages to run a gui and then connect to it via VNC client. So we need to update a few things first. Type:
Code:
apt-get update
then
Code:
apt-get install tightvncserver
now we need the gui elements so enter this:
Code:
apt-get install lxde
12) Type the following:
Code:
export USER=root
vncserver -geometry 1024×600
this sets the resolution...you can change it to play around, but the native resolution for the nook is 1024x600. This is also where you will set the password for your vnc server...make sure to remember it
13) Next, we are going to add the following to /root/.vnc/xstartup file using cat command: (hit enter after each line and ignore the fact that it looks like it does it twice)
Code:
cat > /root/.vnc/xstartup
#!/bin/sh
xrdb $HOME/.Xresources
xsetroot -solid grey
icewm &
lxsession
After hitting enter after the last line press "Ctrl+D" twice then press enter
14) We need the vnc server to start every time we start ubuntu, type this:
Code:
cat > front
export USER=root
cd /
rm -r -f tmp
mkdir tmp
cd /
vncserver -geometry 1024×600
Same as before, hit enter after each line then after hitting enter for the last line press "Ctrl+D" twice then press enter.
15) Enter this
Code:
cat front /root/.bashrc > temp
Then
Code:
cp temp /root/.bashrc
16) Now on the nook open up your vnc viewer app (android vnc viewer or PocketCloud...or whatever you use)
Use the following settings:
Host Address: 127.0.0.1 (some don't require this)
Password: the password you set up in step 16
Port: 5901
Save and then click connect and you should be up and running on ubuntu! To leave ubuntu type exit from adb. This should kill ubuntu. Exit adb and then you can disconnect the nook from your pc.
To start ubuntu from the nook open up a terminal emulater and type:
Code:
bootubuntu
Hit enter, this should bring up the [email protected], hhen press "Home" key and open up your vnc app. Now you are ready to rock your Linux tablet!
You could also use gscript lite to automate the process of starting ubuntu so you don't have to type it in the terminal everytime. You can get gscript lite from the market or download the file I have attached.
It does seem a little laggy..just a little...for now anyway
To exit ubuntu: Disconnect the vnc client then hold the "Home" key (I use button savior which brings up a nice little task manager) and click the Terminal emulator when it pops up under running tasks. Once you are back in the terminal you can type:
Code:
exit
to shut down ubuntu.
Enjoy and make sure you thank munday and the guys at nexusonehacks and all the devs who helped make it possible.
-devastator
EDIT:
I noticed that after rebooting the nook would hang at the "Future of reading" screen....if this happens turn the device off remove the sd card the turn the nook back on. It should boot fine. After it's finished you can return the sd card and mount it. This is strange and I'm looking into it. I'm not sure if this is limited to me or if it is universal to all nooks. It also still fails at shutting ubuntu down for some reason. I'm still looking into this.g into this.
I got it going, just needed a few "busybox"-es here and there . It needs some work, right now to get X you have to use VNC.
It's sluggish but a bit more work might just yield something a bit more usable. I'll play more tomorrow night.
Here's my scripts:
ubuntu.sh
Code:
mount -o remount,rw /dev/block/mmcblk0p5 /system
busybox modprobe ext2
rm -f /data/local/bin/fsrw
rm -f /data/local/bin/bootubuntu
rm -f /data/local/bin/unionfs
rm -f /data/local/bin/installer.sh
rm -f /data/local/bin/mountonly
mkdir /data/local/mnt
#busybox clear
rm /system/bin/fsrw
rm /system/bin/bootubuntu
rm /system/bin/unionfs
rm -/system/bin/mountonly
busybox cp -f fsrw /system/bin
busybox cp -f bootubuntu /system/bin
busybox cp -f unionfs /system/bin
busybox cp -f mountonly /system/bin
cd /sdcard/ubuntu
busybox chmod 4777 *
cd /system/bin/
busybox chmod 4777 *
cd /
#busybox clear
echo " "
echo "Ubuntu Chroot Bootloader v0.1"
echo "Ubuntu Bootloader is now installed!"
echo "This process does NOT damage Android OS!"
echo " "
echo "Original Installer by Charan Singh"
echo "Modified for Ubuntu Chroot by Max Lee at NexusOneHacks.net"
echo " "
echo "To enter the Debian Linux console just type 'bootubuntu'"
bootubuntu
Code:
mount -o remount,rw /dev/block/mmcblk0p5 /system
export kit=/sdcard/ubuntu
export bin=/system/bin
export mnt=/data/local/mnt
export PATH=$bin:/usr/bin:/usr/sbin:/bin:$PATH
export TERM=linux
export HOME=/root
busybox mknod /dev/loop2 b 7 0
mount -o loop,noatime -t ext2 $kit/ubuntu.img $mnt
mount -t devpts devpts $mnt/dev/pts
mount -t proc proc $mnt/proc
mount -t sysfs sysfs $mnt/sys
busybox sysctl -w net.ipv4.ip_forward=1
echo "Setting /etc/resolv.conf to Google Open DNS 8.8.8.8 and 8.8.4.4"
echo "nameserver 8.8.8.8" > $mnt/etc/resolv.conf
echo "nameserver 8.8.4.4" >> $mnt/etc/resolv.conf
echo "Setting localhost on /etc/hosts "
echo "127.0.0.1 localhost" > $mnt/etc/hosts
echo "READY TO ROCK AND ROLL BABY! "
echo "Brought to you by NexusOneHacks.net and the open source community! "
echo " "
busybox chroot $mnt /bin/bash
#After exit command is executed clear it all up
echo " "
echo "Shutting down Ubuntu"
umount $mnt/dev/pts
umount $mnt/proc
umount $mnt/sys
umount $mnt
Then just followed the instructions at nexusonehacks.
note: to run bootubuntu i had to use sh and the use the full path:
Code:
# sh /system/bin/bootubuntu
other note: I was using adb not a term app on the nook.
Obligatory video
I can't post links yet so check: youtube.com/watch?v=TnXfZ6aagn8 for a really boring video
EDIT: switched the names, DOH!
I also had to use sh and the full path also. Thanks for the update on the script...gonna try it in the morning (it's 2am here) will also see if I can help to get it running smoother. What class SD card are you using? I imagine a class 4 or higher would yeild better results as far as responsiveness goes.
The sd is a class 2 that came in one of my dev phones. I'll pick up a faster one tomorrow after work and test it out.
It's just about 3am here now, we must be in the same time zone.
I'm going to bed now, but first here's a modded version of the script you had originally posted that also works now.
bootubuntu
Code:
#!/bin/sh
mount -o remount,rw /dev/block/mmcblk0p5 /system
export kit=/sdcard/ubuntu
export bin=/system/bin
busybox [ ! -d /data/local/ubuntu ] && mkdir /data/local/ubuntu
export mnt=/data/local/ubuntu
export PATH=$bin:/usr/bin:/usr/sbin:/bin:$PATH
export TERM=linux
export HOME=/root
busybox mknod /dev/loop1 b 7 0
busybox losetup /dev/block/loop1 /sdcard/ubuntu/ubuntu.img
mount -t ext2 /dev/block/loop1 /data/local/ubuntu
#mount -o loop,noatime -t ext2 $kit/ubuntu.img $mnt
mount -t devpts devpts $mnt/dev/pts
mount -t proc proc $mnt/proc
mount -t sysfs sysfs $mnt/sys
busybox sysctl -w net.ipv4.ip_forward=1
echo "Setting /etc/resolv.conf to Google Open DNS 8.8.8.8 and 8.8.4.4"
echo "nameserver 8.8.8.8" > $mnt/etc/resolv.conf
echo "nameserver 8.8.4.4" >> $mnt/etc/resolv.conf
echo "Setting localhost on /etc/hosts "
echo "127.0.0.1 localhost" > $mnt/etc/hosts
echo "READY TO ROCK AND ROLL BABY! "
echo "Brought to you by NexusOneHacks.net and the open source community! "
echo " "
busybox chroot $mnt /bin/bash
#After exit command is executed clear it all up
echo " "
echo "Shutting down Ubuntu"
umount $mnt/dev/pts
umount $mnt/proc
umount $mnt/sys
umount $mnt
busybox losetup -d /dev/loop1
#unregistering the loopback device just seems to die. need to fix or remove.
I'll look at the N1 formus tomorrow too and see if they have made progress in getting X to run fast or without need for VNC.
Nice work, I am addicted in seeing the crazy crap people are doing everyday.
Couldn't sleep so I'm messing around with it now...I'm using a class 4 and have it up and running. It does seem to be a little laggy, but I don't have a class 2 to compare it to. Let me know what you find out, I'll keep playing with it also to see if I can get it to be more responsive...but we are definately on our way to having a great little linux tablet in addition to android. You should also be able to use this for other builds of linux also by just changing out the .img file to a flavor of your choosing. I'm excited
I have also updated the OP with the how to and credits. Really appreciate your help munday.
I noticed that after rebooting the nook would hang at the "Future of reading" screen....if this happens turn the device off remove the sd card the turn the nook back on. It should boot fine. After it's finished you can return the sd card and mount it. This is strange and I'm looking into it. I'm not sure if this is limited to me or if it is universal to all nooks.
Edit:
Running into some strange occurrences...it appears that when you type exit from the terminal to kill ubuntu, I believe ubuntu stays running...anyway, I'm going to bed and will work on it more tomorrow.
devastatorx said:
You should also be able to use this for other builds of linux also by just changing out the .img file to a flavor of your choosing. I'm excited
Click to expand...
Click to collapse
Are there any increased risks with changing the version you use?
Well, you will want to make sure that the build supports ARM based devices.
munday said:
Then just followed the instructions at nexusonehacks.
note: to run bootubuntu i had to use sh and the use the full path:
Code:
# sh /system/bin/bootubuntu
Click to expand...
Click to collapse
I fixed this, the scripts were backwards, I have updated the OP to reflect the changes and bootubuntu now works
devastatorx said:
I fixed this, the scripts were backwards, I have updated the OP to reflect the changes and bootubuntu now works
Click to expand...
Click to collapse
sweet, i can't wait to get home to play more!!!
I've tried running ubuntu.sh from the terminal emulator (With su) and from ADB, and have not had success with either.
The readout is:
Code:
': File existste '/system/bin
': File existste '/system/bin
': File existste '/system/bin
: not found
: not found
cd: can't cd to /sdcard/ubuntu
: not found
: No such file or directory
: not found
cd: can't cd to /system/bin
: not found
: No such file or directory
: not found
cd: can't cd to /
: not found
: not found
Ubuntu Chroot Bootloader v0.1
Ubuntu Bootloader is now installed!
etc., etc.
Is there a problem with how I copied the script? I assume the first part about the file existing is due to this being the third or fourth time I've tried running the script (Unsuccessfully), but I've no idea how to interpret the rest.
Thanks
munday said:
sweet, i can't wait to get home to play more!!!
Click to expand...
Click to collapse
I sent you a message
Link3737 said:
I've tried running ubuntu.sh from the terminal emulator (With su) and from ADB, and have not had success with either.
The readout is:
Code:
': File existste '/system/bin
': File existste '/system/bin
': File existste '/system/bin
: not found
: not found
cd: can't cd to /sdcard/ubuntu
: not found
: No such file or directory
: not found
cd: can't cd to /system/bin
: not found
: No such file or directory
: not found
cd: can't cd to /
: not found
: not found
Ubuntu Chroot Bootloader v0.1
Ubuntu Bootloader is now installed!
etc., etc.
Is there a problem with how I copied the script? I assume the first part about the file existing is due to this being the third or fourth time I've tried running the script (Unsuccessfully), but I've no idea how to interpret the rest.
Thanks
Click to expand...
Click to collapse
Try using these, just unrar and then copy them in your ubuntu folder, if it asks to overwrite just click yes...also you have autmounting of the sd card turnned off in nook color tools settings right?
Yeah, it must have been an error on my end. Using the updated scripts you posted worked like a charm.
Thanks!
Link3737 said:
Yeah, it must have been an error on my end. Using the updated scripts you posted worked like a charm.
Thanks!
Click to expand...
Click to collapse
Good to hear!
I'm currently working on making this a port to the SD card so that with the sd card in it boots into ubuntu from power off, and with the sd card out it boots to android then you replace the sd and use it for storage like normal. It will also run a lot snappier....well that's the idea anyway.
devastatorx said:
Good to hear!
I'm currently working on making this a port to the SD card so that with the sd card in it boots into android from power off, and with the sd card out it boots to android then you replace the sd and use it for storage like normal. It will also run a lot snappier....well that's the idea anyway.
Click to expand...
Click to collapse
Booting from SD in the same fashion as Nookie Froyo? That sounds like it would give a huge performance boost over the current method, I can't wait to see what you come up with.
This should be acheivable using the method mentioned in this topic:
http://forum.xda-developers.com/showthread.php?t=873243 thanks to clockworx.
Currently looking into this
devastatorx said:
This should be acheivable using the method mentioned in this topic:
http://forum.xda-developers.com/showthread.php?t=873243 thanks to clockworx.
Currently looking into this
Click to expand...
Click to collapse
I was thinking the exact same thing, the nook seems to like booting from sd, so we should be able to set up the partitions like the foryo sd and edit the init.rc and env.txt to boot ubuntu instead of android. Just a theory though. It's my plan for tonight anyway.
munday said:
I was thinking the exact same thing, the nook seems to like booting from sd, so we should be able to set up the partitions like the foryo sd and edit the init.rc and env.txt to boot ubuntu instead of android. Just a theory though. It's my plan for tonight anyway.
Click to expand...
Click to collapse
I also stumbled across this: http://androix.org/ Which talks about a native android xserver which does a way with the vnc aspect altogether. I downloaded and attempted to install but I get the error "There is a problem parsing the package" and I haven't had any luck plus there isn't much documentation.
Let me know how it goes munday, I'll be working on the same thing later (have to take the fiance out for dinner)
question
I was just curious, after installing ubuntu can we install flash as we would had we booted linux from netbook?

Need help with Chroot Ubuntu

I need some help with running chroot ubuntu on my TFP. I had the chroot BT5 ( http://forum.xda-developers.com/showthread.php?t=1428475 ) image running a week ago then I decided to try out my own image of ubuntu 11. I got it to run once using this process but now I get this:
Code:
# su
[email protected]:/ # cd sdcard/ubuntu/
[email protected]:/sdcard/ubuntu # sh bootubuntu.txt
mknod: /dev/loop5: File exists
mount: Invalid argument
mount: No such file or directory
mount: No such file or directory
mount: No such file or directory
net.ipv4.ip_forward = 1
Setting /etc/resolv.conf to Google Open DNS 8.8.8.8 and 8.8.4.4
bootubuntu.txt[23]: cannot create /data/local/ubuntu/etc/resolv.conf: No such file or directory
bootubuntu.txt[24]: cannot create /data/local/ubuntu/etc/resolv.conf: No such file or directory
Setting localhost on /etc/hosts
bootubuntu.txt[26]: cannot create /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!
chroot: can't execute '/bin/bash': No such file or directory
Shutting down Ubuntu
failed: No such file or directory
failed: No such file or directory
failed: No such file or directory
failed: Invalid argument
losetup: /dev/block/loop5: No such device or address
1|[email protected]:/sdcard/ubuntu #
This is the bootubuntu script I am running:
Code:
#modprobe ext2
mount -o remount,rw -t yaffs2 /dev/block/mmcblk0p1 /system
export kit=/sdcard/ubuntu
export bin=/system/bin
if [ ! -d /data/local/ubuntu ]
then
mkdir /data/local/ubuntu
fi
export mnt=/data/local/ubuntu
export PATH=$bin:/usr/bin:/usr/sbin:/bin:$PATH
export TERM=linux
export HOME=/root
export USER=root
mknod /dev/loop5 b 7 0
losetup /dev/block/loop7 /sdcard/ubuntu/ubuntu.img
mount -t ext2 /dev/block/loop5 /data/local/ubuntu
#mount -o loop,noatime -t ext2 $kit/ubuntu.img $mnt
mount -t devpts devpts $mnt/dev/pts
mount -t proc proc $mnt/proc
mount -t sysfs sysfs $mnt/sys
sysctl -w net.ipv4.ip_forward=1
echo "Setting /etc/resolv.conf to Google Open DNS 8.8.8.8 and 8.8.4.4"
echo "nameserver 8.8.8.8" > $mnt/etc/resolv.conf
echo "nameserver 8.8.4.4" >> $mnt/etc/resolv.conf
echo "Setting localhost on /etc/hosts "
echo "127.0.0.1 localhost" > $mnt/etc/hosts
echo "READY TO ROCK AND ROLL BABY! "
echo "Brought to you by NexusOneHacks.net and the open source community! "
echo " "
chroot $mnt /bin/bash
#After exit command is executed clear it all up
echo " "
echo "Shutting down Ubuntu"
umount $mnt/dev/pts
umount $mnt/proc
umount $mnt/sys
umount $mnt
losetup -d /dev/block/loop5
Help! I feel like I'm going crazy because this worked a week ago but now it doesn't.
Okay, I changed busybox from 1.19.3 to 1.19.2 and now I get this:
Code:
# su
[email protected]:/ # cd sdcard/ubuntu/
[email protected]:/sdcard/ubuntu # sh bootubuntu.txt
mknod: /dev/loop5: File exists
net.ipv4.ip_forward = 1
Setting /etc/resolv.conf to Google Open DNS 8.8.8.8 and 8.8.4.4
bootubuntu.txt[23]: cannot create /data/local/ubuntu/etc/resolv.conf: No such file or directory
bootubuntu.txt[24]: cannot create /data/local/ubuntu/etc/resolv.conf: No such file or directory
Setting localhost on /etc/hosts
bootubuntu.txt[26]: cannot create /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!
chroot: can't execute '/bin/bash': No such file or directory
Shutting down Ubuntu
losetup: /dev/block/loop5: No such device or address
1|[email protected]:/sdcard/ubuntu #
Hmmm, is the Bash command line executable located in a different folder with ubuntu 11? Edit that bootubuntu sh file. Or maybe try removing the loop file under the /dev/ dir.
Thanks philleonard for responding. I checked and bash is definitely in /bin/ and I also tried deleting the loop5 file in /dev/ but that didn't help. Is it a bad image file? The weird thing is that I can't even get the BT5 image to run with the bt.sh script either. This is killing me.
I'm thinking that it's an issue with the loop device not mounting the ubuntu.img but not sure how to fix it.
Try changing: losetup /dev/block/loop7 /sdcard/ubuntu/ubuntu.img
to: losetup /dev/block/loop5 /sdcard/ubuntu/ubuntu.img
Hmmm, maybe try reinstalling busybox. Im running BT5 and Ubuntu 9.10 (I think it is) on my Transformer Prime. BT5 i installed through the script provided in this tutorial; http://forum.xda-developers.com/archive/index.php/t-1074723.html Its for the Xoom but seems to work just fine.
Cannot connect to VNC
Ive got [email protected] but when I try to connect to vnc i get this. Anyone care to elaborate? I cant apt-get install openssh-server it says failed to fetch. I try apt-get install tightvncserver and it says it cannot fetch. It says it cannot update when I run it. There is no sh run.sh command. I try to run export USER=root
vncserever -geometry 1200x800 and get command not found.
I type le or whatever and it pulls up my connections and I have the 127.0.0.1 port 5901 found but when I put it in the vncviewer it says connection rejected. Please can someone help me I am frustrated with ubuntu ever since trying to run it on my phone.

How to auto mount cleanly a partiton on boot

I have a second partition on my SDCARD at /dev/block/mmcblk1p2, all I want to do is ensure that it is always mounted as /storage/sdcard0/mount seems simple I can do it in 5 second on Linux, on Android, it seems impossible I can try to add a hack, but that is lost every-time I update the ROM. There has to be some simple way to do it, that I'm missing. The best I have is to load up a terminal emulated su to root and run: mount -t ext4 /dev/block/mmcblk1p2 /storage/sdcard0/mount
Now in theory, the following would work but for 2 things:
mkdir /storage/sdcard0/mount
su - root -c 'mount -t ext4 /dev/block/mmcblk1p2 /storage/sdcard0/mount'
But for the fact the Android's su does not understand -c so that is out. as well as the fact that non-root users (u0_a216 in my case) can not access /storage/sdcard0.
All I want is a simple way to ensure that this is always mounted where I want it when I need it, yet this simple task is nearly impossible it appears on Android, so why is that?
The issue here is that the fat32 partition does not support large files so I need a separate partition that does such as ext4, in reality if the external sdcard could just be ext4 there would be no issues, and it would be faster, but that is Android for you.
Any suggestions?
Thanks,
ERIC
Insert mount script to init.d folder...
via XDA Premium
Ok, I have this mostly working with juicessh and tasker now for now
I have 2 shell scripts:
mountDev.sh:
Code:
mkdir /storage/sdcard2
chmod 777 /storage/sdcard2
mount -t ext4 /dev/block/mmcblk1p2 /storage/sdcard2
umountDev.sh
Code:
umount /storage/sdcard2
rmdir /storage/sdcard2
In Tasker I have 2 tasks defined:
I'm using the JuiceSSH plugin to open a terminal to localhost I then execute:
To Mount:
Code:
su -l --shell=/system/bin/sh --command='cd /storage/sdcard0 ; sh ./mountDSev.sh ; exit' ; exit
To umount:
Code:
su -l --shell=/system/bin/sh --command='cd /storage/sdcard0 ; sh ./mountDSev.sh ; exit' ; exit
I then created 2 icons, 1 for each operation on the home screen. I also created a Device Boot event to automatically execute and mount the task.
This works, mostly, however even though it is root, sometimes I get errors such as /storage/ is readonly, which makes no sense since it could create the directory at boot, but can not remove the directory later on, since it is readonly. Its a minor thing currently, but annoying.
The benefit of this is it is easy to transfer between ROM images and devices without worrying about it being wiped out every-time I update. In theory it also works without init.d support being enabled. Down side is it you need Tasker and the JuiceSSH plug-in so it costs money.
Hope this helps others.
ERIC

[HOWTO] Run Gentoo Linux on the X+ (chroot)

Hi,
Can't really find a tutorial for our phone, so I'll be, well, making a tutorial
Some notes:
- Compiling is really slow, VERY. Probably RasPi speed.
- Putting the chroot in a specific location helps, due to our phone having weird mountpoints (try typing `mount` and see what happens)
- You can ADB shell into the phone, type "stop" so Zygote is stopped (less RAM usage, less CPU usage, basically pure Linux is running)
- ^ Remember to type "start" after finished playing with the chroot, or you get a frozen phone until forced reboot!
You may be able to adapt this guide to other distros too (although unlikely)
REQUIREMENTS
- Enough juice for playing games for a long time
- A WORKING busybox with "tar xvjpf" available
- You are rooted
1. First of all, su and mount root read/write.
Code:
su; mount -o remount,rw /
2. cd into /data/local
Code:
cd /data/local
3. mkdir linux (or other names if you prefer)
Code:
mkdir linux
4. cd into it
Code:
cd linux
5. Download a stage3 tarball USE ARMv7l, our phone isn't hard-floated and put it in current directory.
- If you use an external browser, make sure the permissions isn't set to r--------, chmod 755 to be sure
- If you use wget, you probably don't have to worry about permissions
6. Extract it. Replace blahblahblah with your file name
Code:
tar xvjpf blahblahblah.tar.bz2
7. Make a chroot script which contains all the necessary bind mounts and commands. Make sure it is in the same dir as your chroot!
Code:
#!/system/bin/sh
# Enable network forwarding to the chroot
sysctl -w net.ipv4.ip_forward=1
# Mount proc to "current directory"/proc
mount -t proc proc proc/
# Mount sys, bind
mount -o bind /sys sys/
# Mount dev, bind
mount -o bind /dev dev/
# Symlink proc/self/fd to dev/fd, or portage will fail
ln -s proc/self/fd dev/
# Write resolvconf
echo "8.8.8.8" > etc/resolv.conf
# Make sure the permissions are correct
chmod 755 etc/resolv.conf
# Chroot using /bin/bash as shell
chroot . /bin/bash
Then chmod 755 the script
Code:
chmod 755 chroot.sh
8. All Gentoo users should know this...
Code:
source /etc/profile
9. Edit /etc/portage/make.conf
Code:
nano /etc/portage/make.conf
10. Add these lines to it
Code:
# This will disable userfetch, making name resolution work.
FEATURES="-userfetch"
11. Adjust USE flags and other configs as necessary... save it
12. Enjoy Gentoo on your phone! :laugh::laugh:
13. Just Ctrl+D to exit chroot

Categories

Resources