Installation in an Android Chroot

Install Arch Linux ARM on other devices.

Re: Installation in an Android Chroot

Postby einstein » Thu Mar 15, 2012 10:10 am

Is this thread dead or something?

Come on guys, help me out!
einstein
 
Posts: 5
Joined: Thu Mar 08, 2012 5:16 pm

Re: Installation in an Android Chroot

Postby Gary13579 » Fri Mar 23, 2012 6:31 am

The trimslice build runs fine on my Tegra 2 device (Eee Pad Transformer). Perhaps someone would help if you posted errors instead of just saying "it doesn't work", it's hard to diagnose something with such a generic description ;).
Gary13579
 
Posts: 30
Joined: Tue Feb 28, 2012 9:21 am

Re: Installation in an Android Chroot

Postby einstein » Wed Mar 28, 2012 8:24 am

I downlaoded the trimslice build and chrooted into the mounted image.
However, whenever I ran a command it told me that the executable was not compatible or something.
I remembering trying different Tegra2 builds, but non of which worked for me. But I have to admit I only tried if they work out of the box as I am not familiar with fixing stuff in a foreign ArchLinux build.
einstein
 
Posts: 5
Joined: Thu Mar 08, 2012 5:16 pm

Re: Installation in an Android Chroot

Postby WarheadsSE » Wed Mar 28, 2012 12:22 pm

@einstein - what is the kernel version on your phone ?
Core Developer
Remember: Arch Linux ARM is entirely community donation supported!
WarheadsSE
Developer
 
Posts: 6807
Joined: Mon Oct 18, 2010 2:12 pm

Re: Installation in an Android Chroot

Postby einstein » Thu Mar 29, 2012 9:27 am

I am running Linux Version 2.6.59.
einstein
 
Posts: 5
Joined: Thu Mar 08, 2012 5:16 pm

Re: Installation in an Android Chroot

Postby WarheadsSE » Thu Mar 29, 2012 11:34 am

2.6.29?
Core Developer
Remember: Arch Linux ARM is entirely community donation supported!
WarheadsSE
Developer
 
Posts: 6807
Joined: Mon Oct 18, 2010 2:12 pm

Re: Installation in an Android Chroot

Postby einstein » Thu Mar 29, 2012 7:40 pm

Sorry it was 2.6.32.59 ( this time I tripple checked)
einstein
 
Posts: 5
Joined: Thu Mar 08, 2012 5:16 pm

Re: Installation in an Android Chroot

Postby weaponseventeen » Fri Mar 30, 2012 10:35 am

As a long time user of Arch on the desktop, I have recently installed a chroot Arch linux ARM on my Transformer Prime. I used the trim-slice build and all mostly went without troubles. I have a couple of questions I hope someone knows the answer to.

Prior to chrooting, I do the following mounts ($mnt is my archarm location):
mount -o bind /dev $mnt/dev
mount -t proc proc $mnt/proc
mount -t sysfs sysfs $mnt/sys

Consequently my /proc/mounts and /etc/mtab show not only the mount points of the archarm chroot, but also the android host. I have an ubuntu chroot on the same machine, and it has its own /proc so does not encounted this problem.

This produces obvious errors such as when running pacman, after "checking for file conflicts", I get a series of warnings like:
"warning: could not get filesystem information for /acct: No such file or directory"
and for all other android mount points not present in the archarm chroot.

A possibly similar problem is found in the /dev folder, which because it is mounted from android does not contain a tty0 and other entries needed to establish an x-server.

It is possible I have missed a very simple step in setting up this chroot, and would be very grateful for any suggestions. Thanks
weaponseventeen
 
Posts: 1
Joined: Fri Mar 30, 2012 10:21 am

Re: Installation in an Android Chroot

Postby fackamato » Tue Apr 17, 2012 9:01 am

Thanks for the guide!

I'm setting up Archlinux on my old Galasy S phone (gen1). I wrote a shell script to to the mount/umount/chroot stuff so I don't have to type this manually. I use sshdroid on the phone as the SSH server, so you might want to adjust the script etc.

Code: Select all
#!/data/data/berserker.android.apps.sshdroid/home/bin/ash
export PATH=$PATH:/data/data/berserker.android.apps.sshdroid/home/bin:/data/data/berserker.android.apps.sshdroid/dropbear
unset _chroot
_chroot="/mnt/emmc/chroot"
unset _tmp
_tmp="/mnt/sdcard/losetup.txt"
unset _rootfsimage
_rootfsimage="/mnt/emmc/alarm.img"


if [ ! -e "$_rootfsimage" ]; then
   echo "$_rootfsimage not found, exiting"
   exit 1
#else
   #echo "$_rootfsimage found, continuing"
fi

# Checking if losetup is done
busybox [ -e "$_tmp" ] && rm -f $_tmp
busybox losetup > $_tmp
unset _line

echo >> "$_tmp"
while read _line; do
   case "$_line" in
      *"alarm.img"* )
         echo "Loop found."
         break
      ;;
      * )
         echo "Setting up loop"...
         busybox losetup /dev/loop1 "$_rootfsimage" || exit 1
      ;;
   esac
done < $_tmp


echo "Mounting file systems..."
mount -t ext2 -o rw,noatime /dev/loop1 $_chroot || exit 1
mount -o bind /dev/ $_chroot/dev || exit 1
mount -t devpts devpts $_chroot/dev/pts || exit 1
mount -t proc proc $_chroot/proc || exit 1
mount -t sysfs sysfs $_chroot/sys || exit 1
echo "Entering chroot..."
busybox chroot $_chroot /usr/bin/env HOME=/root TERM="$TERM" PS1='\u:\w\$ ' \
   PATH=/bin:/usr/bin:/sbin:/usr/sbin /bin/bash --login +h
echo "chroot exited. umount..."
umount $_chroot/dev/pts || exit 1
umount $_chroot/dev || exit 1
umount $_chroot/proc || exit 1
umount $_chroot/sys || exit 1
umount $_chroot || exit 1
echo "Deactivating loop..."
busybox losetup -d /dev/loop1
echo "Done. Bye!"
busybox [ -e "$_tmp" ] && rm -f $_tmp
exit 0


What I want to do:
* Get X up and running (VNC first)
* Find out of I can (maybe with help of Clockwork Mod Recovery?) boot straight into Archlinux instead of Android ICS
* Get X to run on a framebuffer (needs the previous done first)

Problems:
* The chroot environment seems to inherit all environment variables by the Android host, so you have to (re)set path, home etc. Annoying
*
Code: Select all
[root@galaxys ~]# df -h
df: ‘/acct’: No such file or directory
df: ‘/mnt/asec’: No such file or directory
df: ‘/mnt/obb’: No such file or directory
df: ‘/system’: No such file or directory
df: ‘/cache’: No such file or directory
df: ‘/radio’: No such file or directory
df: ‘/data’: No such file or directory
df: ‘/datadata’: No such file or directory
df: ‘/efs’: No such file or directory
df: ‘/mnt/emmc’: No such file or directory
df: ‘/mnt/secure/asec’: No such file or directory
df: ‘/mnt/emmc/.android_secure’: No such file or directory
df: ‘/mnt/secure/asec’: No such file or directory
df: ‘/mnt/emmc/.android_secure’: No such file or directory
df: ‘/mnt/sdcard’: No such file or directory
df: ‘/mnt/secure/asec’: No such file or directory
df: ‘/mnt/sdcard/.android_secure’: No such file or directory
Filesystem      Size  Used Avail Use% Mounted on
rootfs          756M  464M  285M  62% /
/dev/loop1      756M  464M  285M  62% /


Perhaps this can be solved if proc is mounted after the chroot has been entered.
fackamato
 
Posts: 2
Joined: Tue Apr 17, 2012 8:57 am

Re: Installation in an Android Chroot

Postby workdowg » Tue Apr 17, 2012 11:01 pm

So I've managed to get Archlinux running in a chroot environment on my A200.

THIS IS ONLY FOR ROOTED DEVICES - MUST HAVE BUSYBOX AND SUPERUSER


credits: crimsonredmk @ archlinuxarm.org forum, JoshAshby » Arch-droid, and some miscellaneous others...

The following gets you command line only Arch Linux installation only.
There are several errors that come up and I would apreciate any help with them. (from the scripts)
I'll edit this later with getting LXDE running via vnc.

The following works on the Acer Iconia A200:

1) download and start a SSH server app (I use SSHdroid)
2) get SSH client for your PC
3) connect to tablet using SSH client

or open terminal emulator

Code: Select all
#these commands get typed in to create your arch install - run first time only
su
cd /sdcard
dd if=/dev/zero of=archarm.img seek=1750000000 bs=1 count=1 #create empty 1.6gb image file
mke2fs -F archarm.img
mknod /dev/loop256 b 7 256
losetup /dev/loop256 archarm.img
mount -t ext2 /dev/loop256 arch/
cd arch
wget http://archlinuxarm.org/os/ArchLinuxARM-trimslice-latest.tar.gz #this is for our A200, it is Tegra2 Arm7
tar xzf ArchLinuxARM*.tar.gz
rm ArchLinuxARM*.tar.gz
mount -o bind /dev/ /sdcard/arch/dev
mkdir media/sdcard #for mounting sdcard
mkdir media/external_sd #for mounting external_sd
mount -o /sdcard/ /sdcard/arch/media/sdcard #mount the sdcard
mount -o /mnt/external_sd/ /sdcard/arch/media/external_sd #mount the internal storage
chroot . /bin/bash #enter the chroot, your now in the Arch install.
#next we need to set some stuff up to make sure everything works well:
echo "nameserver 8.8.8.8" > /etc/resolv.conf
echo "export TERM=xterm" >> /etc/profile
echo "export HOME=/root" >> /etc/profile
mount -t proc proc /proc
mount -t sysfs sysfs /sys
source /etc/profile
mount /dev/pts
pacman -Syu


Before you leave the chroot for the first time, create this file called "start" in "/" of the chroot:



Code: Select all
#http://joshashby.com/2011/08/arch-droid/
#quick hack to start up everything for the chrooted Arch
if [ "mount | grep proc" ]; then
        echo "Proc already mounted, skipping..."
else
        mount -t proc proc /proc
fi
if [ "mount | grep sysfs" ]; then
        echo "Sysfs already mounted, skipping..."
else
        mount -t sysfs sysfs /sys
fi
if [ "mount | grep devpts" ]; then
        echo "Sysfs already mounted, skipping..."
else
        mount /dev/pts
fi


Then

Code: Select all
chmod 755 start


When you are done, type exit to exit the chroot.

(Unfortunately this leaves the processes open, I'm not really sure how to stop them.)

Next is a script called "startarch" you can create in /sdcard to start the chroot next time.

Code: Select all
#http://joshashby.com/2011/08/arch-droid/
#quick hack to mount and start the chroot...
if [ "mount | grep arch" ]; then
        cd /sdcard/arch/
        chroot . /bin/bash
else
        mknod /dev/loop256 b 7 256
        losetup /dev/loop256 /sdcard/archarm.img
        mount -t ext2 /dev/block/loop256 /sdcard/arch/
        cd /sdcard/arch/
        mount -o bind /dev/ /sdcard/arch/dev
        chroot . /bin/bash
fi


Then

Code: Select all
chmod 755 startarch


So here is the final result:

Connect to the tablet with SSH (or terminal emulator)

Code: Select all
su #at command prompt
cd /sdcard
sh startarch #enters arch chroot
source /etc/profile
./start



I have been rebooting the tablet after exiting to clear things up...

Any and all suggestions are welcome!
workdowg
 
Posts: 16
Joined: Tue Apr 17, 2012 10:57 pm

PreviousNext

Return to [Please read announcement] Community-Supported Devices

Who is online

Users browsing this forum: No registered users and 2 guests