yashsingh1/xdaforums huggingface dataset:
[Android Software Development] userdelroot:
I figured that was gonna be an issue.

There are so many variants when it comes to device / busybox, I tried to get around that by including my own binary but fail on my part i guess...

Anyways.

Fix this line

LINE: 310 handle_error mke2fs -qF -t $fs_type $IMGLOC/$IMGNAME

to

handle_error mk2fs.ext2 $IMGLOC/$IMGNAME
[Android Software Development] ONDR4SH3K:
I rewrite with mke2fs -F $IMGLOC/$IMGNAME this working well.

But another problem with debootstrap. See attachment. So it's end of testing, isn't it?
[Android Software Development] userdelroot:
hmm...

I had that error initially also and I corrected it, probably should of documented what I fixed...

in the terminal type

uname

Is that a valid command?

change install-or-mount

LINE :333 handle_error debootstrap --no-check-gpg --extractor=ar --arch=armhf --foreign $DIST $MOUNT $MIRROR

to

handle_error debootstrap --no-check-gpg --extractor=ar --arch armhf --foreign $DIST $MOUNT $MIRROR
[Android Software Development] ONDR4SH3K:
Yes, it print Linux. I try another deboostrap. You use VERSION='1.0.40~ubuntu0.4'. So I find new one.

EDIT: New debootstrap with the same error.
[Android Software Development] userdelroot:
Yea, it has to do with the line above I believe.
[Android Software Development] ONDR4SH3K:
Sry, not working, but I deleted line with checking architecture and I got new error. See attachment.

EDIT:

I use:

sh install-or-mount -i -n linux.img -m /data/local/chroot -l /data/local -o precise -0

Rewrited mk2fs line in install-or-mount file to: mke2fs -F $IMGLOC/$IMGNAME

Deleted if [ -z "$ARCH" ] || [ -z "$HOST_OS" ]; then error 1 WHATARCH "Couldn't work out current architecture" fi line in deboostrap file

I think if I deleted this line, chroot not mounted correctly and bootstrap can't continue. So we need figure out, how fix architecture error.

I found this: http://uyirpodiru.blogspot.cz/2012/08/debootstrap-error-e-couldnt-work-out.html
[Android Software Development] userdelroot:
All the errors you are getting I did get at one point, I forgot how I fixed them, cause I was working on another project..

Ill do some testing, as I am working on the code right now.

Ill post when I find a solution to those..

Also before continuing I wanted to just let you know.

the debootstrap requires 'ar' archiver which I do not believe comes with CM.

busybox ar

That is why I included my own version.

I may have some work arounds tho so give me a few..
[Android Software Development] ONDR4SH3K:
New vesion 0.2 in attachment. Is on the way.

EDIT: I put busybox from /sbin to /system/xbin and it looks like deboostrap working, but you have error with Release. Attachment no.3.

Thanks for helping.
[Android Software Development] lozohcum:
is it normall ubuntu for desktop or Ubuntu phone version?
[Android Software Development] JFizDaWiz:
desktop
[Android Software Development] milestoneman:
I'm confused

Does touch work? Or do we need OTG cables
[Android Software Development] userdelroot:
You need root, and an android device.

No OTG cables..

It build's a chroot image on the device, with android running in the background.

You can run X windows (only LXDE currently because it is lightwieght) on the device and then vnc into it from anywhere, even a desktop...

There are other tools out there for this however, they require you to download the images. Which are usually between 1gig - 4gigs.

Instead of downloading the images, this creates the image and only downloads approximately 200megs for the packages.
[Android Software Development] milestoneman:
Thanks for the explanation, sounds great
[Android Software Development] userdelroot:
Yea, crap, that was my bad, I should check where the system busybox is installed. It should default to /system/xbin

But some roms I guess put it in /system/sbin ? Possibly a typo on the rom developers part? LOL

Anyways, I will add code to correct this.

EDIT: How did you fix image 2?, as it should stop at the error in image type every time.

At any rate, image 2 error is because it can't find sh. in the install-or-mount/bin directory type this..

ls -l bin/

Make sure sh is symlinked to /system/bin/sh or /system/xbin/busybox if not that is causing the error in picture 2

it should look like this...

ls -l bin/

sh sh -> /system/xbin/busybox

If you don't see that do the following:

cd /data/local/install-or-mount

busybox touch bin-configs/sh

rm -rf .bin-configs-done

if you have something like that it should be ok, however to be safe since you moved you your busybox

from inside install-or-mount

rm -rf .bin-configs-done

Yes there is a DOT in front of bin-configs-done
[Android Software Development] cliff p:
I receive a permission denied error with debootstrap as wellView attachment 2543234

Edit: crap I didn't see all the replies up there :)
[Android Software Development] Devarishi:
Will it works on my armv7 single core tablet?
[Android Software Development] ONDR4SH3K:
I fix it other way:

mount -o remount,rw /system

cp busybox /sbin /system/xbin

mount -o remount,ro /system

I hope that commands are fine.

I has no solution for fetch Release error, yet. I tried rewrite URL, but unsussesful.

Its in scripts folder line mirror_styles Release

---------- Post added at 01:06 AM ---------- Previous post was at 01:00 AM ----------

Already testing on armv7 device dual core. OP must fix a few errors but you can try it.
[Android Software Development] MartiniGM:
cal/chroot -l /data/local -o precise -1 <

Install options:

Distro: precise

image: linux.img size: 2048 img location: /data/local

setting up enviroment: [OK]

checking root: [OK]

Creating image: [OK]

Formating ext2

Filesystem label=

OS type: Linux

Block size=4096 (log=2)

Fragment size=4096 (log=2)

65536 inodes, 262144 blocks

13107 blocks (5%) reserved for the super user

First data block=0

Maximum filesystem blocks=4194304

8 block groups

32768 blocks per group, 32768 fragments per group

8192 inodes per group

Superblock backups stored on blocks:

32768, 98304, 163840, 229376

[OK]

checking mount point: [OK]

Mount location: /data/local/chroot

rootfs: [OK]

starting debootstrap

debootstrap --no-check-gpg --extractor=ar --arch=armhf --foreign precise /data/local/chroot

I: Retrieving Release

I: Validating Packages

I: Resolving dependencies of required packages...

I: Resolving dependencies of base packages...

I: Chosen extractor for .deb packages: ar

[fail]

Failure bailing out

1|root@manta:/data/local/install-or-mount #

So.. What's wrong? debootstrap is almost working. :(
[Android Software Development] 'Murica:
I do not have anything in my /data folder. I'm on cm11 s4 m919
[Android Software Development] userdelroot:
Yes, I use it on my nexus 7
[Android Software Development] userdelroot:
If you are using a nexus 7 it should install fine, as that is what I used to create this. Stock 4.4.2 + ElementalX kernal
[Android Software Development] userdelroot:
Few things with the fetch error.

My device is Wifi only, I have not tried a 3g / 4G type connection.

If you could please try wifi and see if that corrects the problem.

Also getting packages error could also mean your busybox is broken..

Try this from terminal

cd to /data/local

busybox wget http://www.google.com

if it downloads your busybox is good to go.

if it fails you have a screwed up busybox and you need to replace it. Or I could possibly build one for your device?
[Android Software Development] userdelroot:
You are missing AR archiver.

Type the following commands to verify.

Open a terminal or adb shell

su

busybox --list | busybox grep '^ar$'

if the above is blank you need a busybox with 'AR' archiver support.
[Android Software Development] userdelroot:
It seems not many if any busybox's include the ar archiver.

I may build a generic busybox which should work on all devices but it will be very stripped down so you all will have the ar archiver.

Or just compile the ar archiver itself ?

What is cool about this process if you all don't know, is you can compile arm right on the device itself :)

More on that later, need to get you all chrooted :)
[Android Software Development] sharingan:
so through this can i install ubuntu on my galaxy ace ??
[Android Software Development] userdelroot:
Please read the initial thread.

This was built on a Nexus 7 2013 running stock 4.4.2 with a different kernel.

In theory YES this should work on all devices for the most part.

As it does not modify the actual "android" system. It creates a "LINUX IMAGE" on the device. once the image is created you can chroot into the linux image, and it is like you are running linux once you chroot.

You will be able to apt-get install packages etc

But those will only be available in the chroot. Once you exit the chroot you will be back to android....

Hopefully I explained that correctly... Sorry tired...
[Android Software Development] yaomink:
My Ask....This can use on my samsung galaxy S4???
[Android Software Development] sridharrn:
Trying on nexus 5

I: Extracting sed...

I: Extracting sensible-utils...

I: Extracting sysv-rc...

I: Extracting sysvinit-utils...

I: Extracting tar...

I: Extracting tzdata...

I: Extracting udev...

I: Extracting upstart...

I: Extracting util-linux...

I: Extracting xz-utils...

I: Extracting zlib1g...

[fail]

Failure bailing out

what to do next?
[Android Software Development] userdelroot:
EDIT: 3

Delete LINE 399

Delete LINE 400

in the install-or-mount script

395 echo "starting debootstrap"
396 echo " debootstrap --no-check-gpg --extractor=ar --arch=armhf --foreign $DIST $mnt $MIRROR"
397 handle_error debootstrap --no-check-gpg --extractor=ar --arch=armhf --foreign $DIST $mnt $MIRROR
398 echo "[finished]"
399 handle_cleanup
400 exit

In vi type

400

shift + G

it will take you to that line
[Android Software Development] usatf1290:
Make sure you have "root explorer" enabled in your file manager. I use ES File Explorer, and had to enable the "Root Explorer" before anything showed up in /data.
[Android Software Development] userdelroot:
Download the newest release.

Also, you really do not need 3.5 gigs it will run at 850 megs just fine.

KEEP IN MIND.

If you create a 3.5 GIG image you have to have 3.5 GIGS + or - of storage space on device. As it makes an IMAGE which will take up 3.5 gigs.

I would try 1GIG to start
[Android Software Development] userdelroot:
Yes thank you. I don't use those, so I can not say how to move about the system... I use adb shell for development and debugging along with connectbot or android terminal

Thanks for the tip!..
[Android Software Development] userdelroot:
Updated version uploaded Along with a screen shot :)

newest version 0.2.2-alpha
[Android Software Development] usatf1290:
root@flo:/data/local # cd install-or-mount/

local -o precise -1 <

Install options:

Distro: precise

image: linux.img size: 2048 img location: /data/local

setting up enviroment:	[OK]

checking root:	[OK]

Creating image:	[OK]

Formating	ext2

Filesystem label=

OS type: Linux

Block size=4096 (log=2)

Fragment size=4096 (log=2)

65536 inodes, 262144 blocks

13107 blocks (5%) reserved for the super user

First data block=0

Maximum filesystem blocks=4194304

8 block groups

32768 blocks per group, 32768 fragments per group

8192 inodes per group

Superblock backups stored on blocks:

32768, 98304, 163840, 229376

[OK]

checking mount point:	[OK]

Mount location: /data/local/chroot

rootfs:	[OK]

starting debootstrap

debootstrap --no-check-gpg --extractor=ar --arch=armhf --foreign precise /data/local/chroot

[fail]

>>CMD: [debootstrap --no-check-gpg] ARGS: [--extractor=ar --arch=armhf --foreign precise]

>>>ERROR: [sh: applet not found]

1|root@flo:/data/local/install-or-mount #

Nexus 7 (2013) flo here.

I've checked the symlinks, I have "sh -> /system/xbin/busybox". Do I need "sh sh -> /system/xbin/busybox" as you stated, or is the extra "sh" in your post a typo?

I've also deleted .bin-configs-done.

My busybox is in /system/xbin. I've tried using the version 0.2.2-alpha.
[Android Software Development] LexReznichenko:
Nexus 5. install-or-mount-v0.2.2-alpha
[Android Software Development] userdelroot:
In a terminal or adb shell type the following commands:

su

cd /data/local

busybox mount -o loop linux.img chroot

ls -l chroot/

Does the mount give you an error?

Do you see files in chroot ?

That is the issue I had also when I did the next update within like 2 minutes of the other update lol...
[Android Software Development] userdelroot:
sh sh -> etc.... yes typo sorry that was supposed to be 'ls bin/sh'

If you are running nexus flo this should work for you as I just did a full install and a mount, as that is where the screen shot came from...

are you running stock or a ROM ?

type the following in a terminal or adb shell

su

cd /data/local/install-or-mount

sh

does the above 'sh' give you an error ?

if not try this

busybox sh

does that give you an error?

if so type this...

from within the install-or-mount directory

cd bin
rm -rf sh

command -v sh
## The above more then likely should show
/system/bin/sh

ln -s /system/bin/sh sh

cd ..

then try install again
[Android Software Development] usatf1290:
That did it! I did get the error when executing "busybox sh" , then executed your supplied code. I then reran the install, and got pretty far along, through the debootstrap and retrieval of packages and dependencies. Now i have this after running the install with the same options:

.....(Lots of Retrievals and Validations).....

I: Retrieving vim-tiny

I: Validating vim-tiny

I: Retrieving whiptail

I: Validating whiptail

I: Retrieving xkb-data

I: Validating xkb-data

I: Retrieving xz-utils

I: Validating xz-utils

I: Retrieving zlib1g

I: Validating zlib1g

I: Chosen extractor for .deb packages: ar

I: Extracting adduser...

E: Unknown compression type for in .//var/cache/apt/archives/adduser_3.113ubuntu2_all.deb

[fail]

Failure bailing out

1|root@flo:/data/local/install-or-mount #

UPDATE: Looking back above, looks like my busybox doesn't have "ar" in it.
[Android Software Development] LexReznichenko:
busybox mount -o loop linux.img chroot

there are no errors. may be i should change anything in the script?
[Android Software Development] sharingan:
wow what a mouthful of you

thanks for explaining everything

also will my phone look like android after installing this
[Android Software Development] cliff p:
Decided to give it another go with a fresh ROM on the phone. No extra apps installed, dev mode enabled, no busybox install (I always install bbpro but omitted it for testing).

Everything runs smooth up to here:

Edit: device is galaxy note2 (ATT)

ROM is temesek cm11

Edit 2:

Just got to work and downloaded the latest alpha release, will give it another go and report back with my findings.

Edit 3:

That did the trick for the most part. The system hangs when you get to the installation screen and it asks for your location information. Screen becomes unresponsive, in that you can select a country location, and then the next screen for time zone selection freezes. I cannot select anything.
[Android Software Development] cliff p:
After the hang at the regional selection stuff, I decided to delete the chroot folder that was created along with the image that was created. Rebooted the phone, re-ran the script, and when the regional selection stuff populates, I just bypass the selections by pressing enter. Install completed successfully. Ran the VNC script per recommendation in term, and now installing vnc viewer to test.
[Android Software Development] userdelroot:
This will not change your android OS.

The OS is not affected by this.

You can receive calls text etc while in the chroot
[Android Software Development] 'Murica:
Should I just make a folder in /data?
[Android Software Development] cliff p:
You need to enable root view for whatever file explorer you're using in order to see /data/local. It's hidden from non-root view.
[Android Software Development] Knake:
Can anyone who installed share some screenshots or a short video?
[Android Software Development] userdelroot:
try to find one that includes everything in bin-configs

if you can ill try to get ar standalone or a stripped busybox with it
[Android Software Development] usatf1290:
I ended up using the app "BusyBox X", whatever busybox that installed, had ar in it.

UPDATE: Now I'm getting problems with retrieving the release:

t -i -n linux.img -m /data/local/chroot -l /data/local -o precise -1 <

Install options:

Distro: precise

image: linux.img size: 2048 img location: /data/local

setting up enviroment:	[OK]

checking root:	[OK]

Creating image:	[OK]

Formating	ext2

Filesystem label=

OS type: Linux

Block size=4096 (log=2)

Fragment size=4096 (log=2)

65536 inodes, 262144 blocks

13107 blocks (5%) reserved for the super user

First data block=0

Maximum filesystem blocks=4194304

8 block groups

32768 blocks per group, 32768 fragments per group

8192 inodes per group

Superblock backups stored on blocks:

32768, 98304, 163840, 229376

[OK]

checking mount point:	[OK]

Mount location: /data/local/chroot

rootfs:	[OK]

starting debootstrap

debootstrap --no-check-gpg --extractor=ar --arch=armhf --foreign precise /data/local/chroot

I: Retrieving Release

E: Failed getting release file http://ports.ubuntu.com/ubuntu-ports/dists/precise/Release

[fail]

Failure bailing out
[Android Software Development] 'Murica:
Got this error if someone wants to help me with it. N
[Android Software Development] TheEdgeOfRage:
Im trying to run frotz - a zmachine interpreter for text based games. after installing it with apt-get install frotz it tells me that i need to update the alternatives. I Googled it and tried a few commands like

# update-alternatives -- install /usr/games/frotz frotz /usr/games/frotz 1

but it returned an error. I thought this might be a problem with frotz but soon I found out that this is the problem with any package that add commands to the terminal. How do I use the update-alternatives command on this distro?
[Android Software Development] userdelroot:
You have a space

-- install

Should be --install
[Android Software Development] TheEdgeOfRage:
No that's not the problem I didn't copy the command I retyped it. Im sure I didn't make a typo :p
[Android Software Development] Knake:
Trying on N7100. It says there is no such file or directory for linux.img...
[Android Software Development] dave7802:
Have you checked permissions? As the Linux .img is created by the script an it's crated in /data/local
[Android Software Development] Knake:
Same in here...
[Android Software Development] noahthedominator:
Please Help.

Could someone please help me with this.

I downloaded the zip and extracted it to data/local.

Then i typed this in terminal emulator

su root

sh install-or-mount -z -n linux.img -m /data/local/chroot -l /data/local

I get an error every time saying no such file or directory.

If someone could walk me through the entire process of this that would be great!
[Android Software Development] usatf1290:
Did you change to the directory? do the following:

su root

cd data/local/install-or-mount

sh install-or-mount -z -n linux.img -m /data/local/chroot -l /data/local
[Android Software Development] userdelroot:
What is the actual command you are using to install?
[Android Software Development] userdelroot:
If you get that far it worked just reboot and use the mount option

I'll check the setup.sh script then for that error and fix it tonight
[Android Software Development] Knake:
It is not a problem anymore. however i got this

E: Failed getting release file http://ports.ubuntu.com/ubuntu-ports...recise/Release

[fail]

Failure bailing out
[Android Software Development] noahthedominator:
OK that helped. But I still got an error.
[Android Software Development] ONDR4SH3K:
Anybody, who get Fetch Release error.

Type: busybox wget google.com

If you get error, you haven't right busybox. I fix it copying busybox from bin directory install-or-mount to /system/xbin to my android filesystem.

It needs RW to system:

mount -o remount,rw /system

cd /data/local/install-or-mount/bin

cp busybox /system/xbin

mount -o remount,ro /system
[Android Software Development] noahthedominator:
I got this far now what do I do?
[Android Software Development] ONDR4SH3K:
sh install-or-mount -i -n etc...

start with sh command
[Android Software Development] noahthedominator:
Can you type it out exactly? I tried the install One in the original in the first post but it didn't work.
[Android Software Development] usatf1290:
you're missing the "-l /data/local" option.

Use what it says in the Discussion OP: "sh install-or-mount -i -n linux.img -m /data/local/chroot -l /data/local -o precise -0"

---------- Post added at 10:33 PM ---------- Previous post was at 10:29 PM ----------

This did indeed solve the problem. "busybox wget http://www.google.com" resulted in an error before running your suggestions.

Ran all of your above commands, and now it's well on its way. Thanks a lot!

EDIT: Rerunning my install with 0.2.4-alpha
[Android Software Development] userdelroot:
updated version posted 0.2.4-alpha
[Android Software Development] usatf1290:
Call me dumb, but would this require an unlocked bootloader? From what I see, just root, right?

ADDED: Almost there!! Getting this:

Mount location: /data/local/chroot

rootfs:	[OK]

/sys:	[OK]

/proc:	[OK]

/dev:	[OK]

/dev/pts:	[OK]

/dev/shm:	[OK]

mount internal_sd:	[OK]

creating mtab entries:	[OK]

Setting up nameservers:	[OK]

Entering chroot enviroment:	[init]

To shut down the Linux environment, just enter 'exit' at this terminal

WAIT for all shutdown routines to finish!

To launch LXDE enter sh lxdestart.sh, then connect via vnc

cat: /home/nexus/.motd: Permission denied

cat: /home/nexus/.motd: Permission denied

nexus@localhost:~$ sh lxdestart.sh

sh: 0: Can't open lxdestart.sh

nexus@localhost:~$

EDIT AGAIN: Worked running "sudo ./lxdestart"
[Android Software Development] userdelroot:
PLEASE DO NOT RUN AS ROOT!!!!

As it is a security risk...

However this is an easy fix

While in the chroot enviroment type the following...

sudo chown nexus.nexus /home/nexus/.motd

sudo chown nexus.nexus /home/nexus/lxdestart

chmod 644 lxdestart

exit from the chroot...

You may get an error if you do reboot device and enter chroot

type

sh lxdestart

should launch now..
[Android Software Development] usatf1290:
I'm getting "chown: cannot access `/home/nexus/lxdestart': No such file or directory" after running the second command you gave, while in chroot and everything .

Looking above, I noticed this in my install before all the Get statements:

I: Base system installed successfully.

[finished]

Setting up nameservers:	[OK]

finishing setup

Generating apt sources.list

[OK]

Entering chroot enviroment:	[setup]

cp: can't create '/data/local/chroot/home/nexus/lxdestart': No such file or directory

Finalizing setup

__________

Then later on this:

Setting up x11vnx

Error opening file for reading: No such file or directory

stored passwd in file: /home/nexus/.x11vnc/passwd

chown: cannot access `/home/nexus/lxdestart.sh*': No such file or directory

default password: nexus
[Android Software Development] userdelroot:
Hmm oops

do the command again without lxdestart.sh remove the .sh from the end of it

There is an actual lxdestart file inside the chroot right?

EDIT::

Thank you for pointing this out. I found an error in the setup.sh script that has been fixed.

That will correct you chmod error during install.

also it will correct some vnc issues
[Android Software Development] usatf1290:
I really appreciate all the work you're doing on this! I'm sure others do as well, judging by the number of downloads of the builds!
[Android Software Development] userdelroot:
Thanks bro.

Greatly appreciated, if you have not thanked please do :)
[Android Software Development] userdelroot:
Ill be posting another updated version here shortly..

Also found a bug which is kind of out of my control right now 1.5GIG seems to be the max at least on my device.

So disk image size will depend on which busybox box you are using.

I will be posting a lil how to or something on how to compile in your knew chroot and run your compiled code on your device ;)