I started using Arch some months ago and I really enjoying it. Coming from a released based distro, it feels really nice been able to choose exactly what you want to run in your system and always have the packages up to date. For a while I have been planning on running ubuntu in my transformer but I just don’t feel too comfortable with ubuntu , so decided to run arch in my transformer. I couldn’t find a tutorial so I scavenged the net and found bits and peace that I put together to make this tutorial. What I like about arch is that I am in control of my system and  I can run exactly what I want, thanks awesomely documented Arch!

This is a tutorial that will show you how to run Arch Linux in a chrooted environment within your Asus Tarsnformer. I will not provide a simple script that if you run it will do everything for you, instead I will teach you how to make your own installation by grabbing all necessary elements.

You will need:

Arch Live image: Go to http://archlinuxarm.org/developers/downloads and grab the omap 3/4 package.

Install environment: It can be your internal storage or a sd/micro card. Here I will show how to use the micro sd card.

Script for starting the chroot: I grabbed mine from http://forum.xda-developers.com/showthread.php?t=1517993&highlight=chroot and did some modifications. Thanks-miska-

Rooted Asus Transformer(Prime?) with Terminal: You need root to mount the file system and loop devices. In theory this should work in the Prime too.

Linux Machine

Step 1:

For installing arch in a (micro)sd card (I prefer micro as I don’t need the dock for using it), first you need to format the card and make two partitions. (I used gparted) Make one partition fat and assign a small amount of space(I have a 4gb micro and assigned 128mb to the fat partition), then make the rest ext4. Make sure the fat partition is first and the ext one is second.

Step 2:

Now as root you need to extract the package in the ext partition of your card. REMEMBER to be root, I got stuck thinking there was something wrong with the package I downloaded but it was that I was unpacking as normal user.

# tar -c /path/to/extpartition -xzf  ArchLinuxARM-omap-smp-latest.tar.gz

Now you have a arch environment in your (micro)sd card.

Step 3:

In your asus transformer create a folder called ‘arch’ in the root of your internal storage.

#mkdir /sdcard/arch

Or use a file manager.

Now place this script somewhere in your transformer, I usually keep it in /sdcard/Downloads

#!/bin/sh

# Modify this according to your needs
DEVICE=”/dev/block/mmcblk1p2″
LOOP=”no”

# Maybe this as well
MNT_PATH=”/mnt/sdcard/arch”

# Modify only if you know, what are you doing
BINDS=”dev dev/pts proc sys mnt/sdcard”
ANDROID_BINDS=” /system /data ”
TMPS=”tmp var/tmp var/log var/run”

MY_MOUNTS=”"

unset PS1

# Helper functions

die() {
echo ” $1″
exit 1
}

safe_mount() {
mkdir -p “$MNT_PATH”"$2″
if [ "$3" ]; then
OPTION=” $3 ”
else
OPTION=”"
fi
if [ -z "`mount | grep " $MNT_PATH$2 "`" ]; then
mount $OPTION “$1″ “$MNT_PATH$2″ || die “Can’t mount $2!!!”
fi
MY_MOUNTS=”$MNT_PATH$2 $MY_MOUNTS”
}

# Real work

[ "`whoami || echo root`" = "root" ] || die “You must be root first!”
LOOP_ARG=”"
[ "$LOOP" = "no" ] || LOOP_ARG=” -o loop ”

safe_mount $DEVICE “” “$LOOP_ARG -t ext4 ”

for i in $BINDS; do
safe_mount “/$i” “/$i” ” -o bind ”
done

if [ -d /Removable ]; then
for i in /Removable/*; do
[ -d "$i" ] && safe_mount $i /mnt$i ” -o bind ”
done
fi

for i in $ANDROID_BINDS; do
safe_mount $i /mnt/android$i ” -o bind ”
done

for i in $TMPS; do
safe_mount none /$i ” -t tmpfs ”
done

mount -o remount,ro “$MNT_PATH”
chroot “$MNT_PATH” /sbin/fsck.ext2 -y “$DEVICE”
mount -o remount,rw “$MNT_PATH”

# Tweak configuration of the chroot during first start

#if [ ! -f "$MNT_PATH"/etc/profile.d/tweak.sh ]; then
#mkdir -p “$MNT_PATH”/home/opensuse
echo ‘nameserver 8.8.8.8′ > “$MNT_PATH”/etc/resolv.conf
#echo ‘net:x:3003:root,opensuse’ >> “$MNT_PATH”/etc/group
#echo ‘opensuse:x:1000:100::/home/opensuse:/bin/bash’ >> “$MNT_PATH”/etc/passwd
#echo ‘opensuse:$1$joWqOQdr$YsapocP32UtdiR3PKBXVM1:15395:0:::::’
# >> “$MNT_PATH”/etc/shadow
#sed -i ‘s|^root:.*|root:$1$joWqOQdr$YsapocP32UtdiR3PKBXVM1:15395:0:::::|’
# “$MNT_PATH”/etc/shadow
#echo ‘#!/bin/sh
#export TERM=linux
#export LANG=”en_US.utf-8″
#export EDITOR=”busybox vi”
#alias vi=”busybox vi”
#precmd() { :; }
#if [ "`whoami`" = root ]; then
# export HOME=/root
# export USER=root
# hostname -F /etc/HOSTNAME
#fi
#if [ -z "$CHROOTED" ]; then
# export CHROOTED=yes
# export HOME=”/home/opensuse”
# export USER=”opensuse”
# su opensuse
#fi
#’ > “$MNT_PATH”/etc/profile.d/tweak.sh
#fi

export PATH=”/bin:/sbin:/usr/bin:/usr/sbin:/system/xbin:/system/bin”

# Chroot

chroot “$MNT_PATH” /bin/bash
#chroot “$MNT_PATH” /root/init.sh

# Cleanup

echo “Umount everything”
for i in $MY_MOUNTS; do
umount -l $i
done

 

Step 4:

Chmod +x the script and run it as root.

su
#chmod +x scriptname.sh
sh scriptname.sh

The script will mount the ext partition of your (micro)sd card in /sdcard/arch and will chroot into it. It also does other really nice things, such as mounting your android partitions to /mnt so you can access them from within your arch environment. I have disabled some lines that are used to set up a some environment variables, but you should still be able to get a fully functional command-line environment and you can enable them and modify them as you want.

Step 5:

The rest is completely up to you,  now you have arch running in your transformer. But what!? You need X?! really???? Ok, so lets create a vnc server so we can remote into it.

Your network connection should work, so the first thing to do is an update

#pacman -Syu

Now install xorg

#pacman -S xorg-server xorg-xinit xorg-twm xorg-xclock xterm

Now install a vncserver

#pacman -S tightvnc

And now this is the tricky part(And I spent a lot of time in this).

I grabbed this script from the UbuntuInstaller post. This is the script they use for setting a resolution at each boot. What I did was to remove the resolution prompt and fix the resolution to 1280×752(fullscreen) and remove some ubuntu stuff. I also added an export for HOME and USER that will allow you to run ‘vncserver’ as root.

#!/bin/bash
#############################################
# Asks User to screen size and saves as REZ #
#############################################
#echo “Now enter the screen size you want in pixels (e.g. 800×480), followed by [ENTER]:”

#read REZ

###########################################
# Tidy up previous LXDE and DBUS sessions #
###########################################
#rm /tmp/.X* > /dev/null 2>&1
#rm /tmp/.X11-unix/X* > /dev/null 2>&1
#rm /root/.vnc/localhost* > /dev/null 2>&1
#rm /var/run/dbus/pid > /dev/null 2>&1

############################################################
# enable workaround for upstart dependent installs #
# in chroot’d environment. this allows certain packages #
# that use upstart start/stop to not fail on install. #
# this means they will have to be launched manually though #
############################################################
#dpkg-divert –local –rename –add /sbin/initctl > /dev/null 2>&1
#ln -s /bin/true /sbin/initctl > /dev/null 2>&1
###############################################
# start vnc server with given resolution and #
# DBUS server, (and optionally an SSH server) #
###############################################
export HOME=”/root/”
export USER=”root”
vncserver :0 -geometry 1280×752
dbus-daemon –system –fork > /dev/null 2>&1
/etc/rc.d/sshd start
#echo
#echo “If you see the message ‘New ‘X’ Desktop is localhost:0′ then you are ready to VNC into your ubuntu OS..”
#echo
#echo “If VNC’ing from a different machine on the same network as the android device use the 1st address below:”
##########################################
# Output IP address of android device #
##########################################
ifconfig | grep “inet addr”

#echo
#echo “If using androidVNC, change the ‘Color Format’ setting to 24-bit colour, and once you’ve VNC’d in, change the ‘input mode’ to touchpad (in settings)”

#echo
#echo “To shut down the VNC server and exit the ubuntu environment, just enter ‘exit’ at this terminal – and WAIT for all shutdown routines to finish!”
#echo

###############################################################
# Spawn and interactive shell – this effectively halts script #
# execution until the spawning shell is exited (i.e. you want #
# to shut down vncserver and exit the ubuntu environment) #
###############################################################
/bin/bash -i

#########################################
# Disable upstart workaround and #
# kill VNC server (and optionally SSH) #
# Rename used xstartup to its first file#
#########################################
vncserver -kill :0
/etc/rc.d/sshd stop

 

Place this script in /root/, give it the name ‘init.sh’ and make sure it is executable(chmod +x). Now in the previous script comment the line:

chroot “$MNT_PATH” /bin/bash

and uncomment the line

chroot “$MNT_PATH” /root/init.sh

 

Step 6:

Now you should be able to start a vncserver with twm as your window manager and a xterm.

You can now go to

https://wiki.archlinux.org/index.php/Desktop_Environment

or

https://wiki.archlinux.org/index.php/Window_Manager

and set up the desktop environment that you like the most.

Remember that you need to set up the graphical environment to start manually and not at boot. In a normal environment you would usually use ‘startx’ which will read the .xinitrc file and run the programs from there. In our case put everything that needs to go into .xinitrc into ~/.vnc/xstartup. An example of my ~/.vnc/xstartup

#!/bin/bash

xrdb $HOME/.Xresources
exec startfluxblox

This will start an empty fluxbox window manager.

 

 

 

Share →

17 Responses to Arch Linux Chroot for Asus Transformer

  1. Dalton says:

    I am getting the errors ‘Script.sh[11]: dev/pts: not found’, ‘Script.sh[12]: /system: cannot execute – Is a directory’, ‘ Script.sh[13]: var/tmp: not found’, and ‘Script.sh[28]: syntax error: ‘if’ unmatched’. I am attempting this on the tf300. Any help would be greatly appreciated

    • admin says:

      At which step are you getting this errors?

      • Dalton says:

        Sorry, i should have included that. I get this error with step 4, right after i do sh Script.sh.

        • admin says:

          Its weird you are getting errors in those lines, as those lines are just declarations. I would probably think this error is related to a missing quotation or something similar. Try opening the script in your computer with a text highlighter and make sure the quotation start and end correctly. Also, sometimes the web browsers change quotation and replaces them with “, `, ‘,or ‘, so check carefully. Receiving [‘if’ unmatched] is also supporting my idea of a syntax error. I will check this script one more time in my transformer. I don’t think this error is related with you testing in a TF300. Do you have su?

  2. Dalton says:

    Yes, I have su, and I have put both Ubuntu and Debian on my device at one point or another. The problem with them was that they gave me a very limited amount of memory. Thank you very much for the suggestions. I will try them and get back to you.

    • Dalton says:

      I believe you were right about my browser changing the quotes. Are they all just supposed to be regular quotes, or are they supposed to be all the different kinds?

      • admin says:

        And wordpress is not helping either, I am seeing some atrocities like [=”"] rather [=""]. The script is only supposed to contain double quotes(“) and back quotes(`).

        For example when I copy line 4, I get
        DEVICE=”/dev/block/mmcblk1p2″
        Note the starting and ending quotes are really similar, but this alone will break the entire script. I think I need to fix my code plugin for wordpress.

      • Dalton says:

        What about the single quote looking things? I changed all the others to regular quotes, and then i get the error that im missing an end quote on a line that doesnt exist

        • Dalton says:

          I am going to try downloading the original you have posted at the website at the top and changing it from there, rather than copying and pasting

  3. Dalton says:

    I am getting the error now, whoami: unknown uid 0
    mount: No such file or directory

    • Dalton says:

      Along with Can’t Mount!!!

      • admin says:

        I have uploaded the script to http://pastebin.com/SnaWqWWW

        Most of the quotations should be fixed there. Also remember to reboot your transformer before reapplying the script, maybe the previous runs of the script dealign something, but none of the commands of the script are permanent or dangerous, so if something does not mount, try rebooting.

        • Dalton says:

          Im really sorry, I know this is all probably due to my incompetence, but now when i try this script i get the error as follows
          : not found]
          : not found]
          : not found]
          : not found4]
          : not found6]
          : not found8]
          : not found0]

          : bad number]: 1
          I have no Idea what any of that means…

          • admin says:

            That error means ther is something still wrong with the script, probably I missed a quotation :( . Sorry for all the trouble.

          • admin says:

            There is an error in line 73 from the paste bin,
            echo `nameserver 8.8.8.8` > “$MNT_PATH”/etc/resolv.conf

            the back quotes(`) will execute the nameserver 8.8.8.8. change this for a normal quote or double quotes.

            echo “nameserver 8.8.8.8″ > “$MNT_PATH”/etc/resolv.conf

            This should be better. If you find some echo `nameserver 8.8.8.8` > “$MNT_PATH”/etc/resolv.confproblems, try to run the script only up to a point so you can narrow the line that is causing the problems.

  4. Dalton says:

    I tried that line with both the single and double quotes, but both have yielded the same errors.
    :not foundsh[2]:
    :not foundsh[6]:
    :not foundsh[9]:
    :not foundsh[14]:
    :not foundsh[16]:
    :not foundsh[18]:
    :not foundsh[20]:

    :bad numberh[23]: 1
    I will try going through one line of the script at a time like you suggested and see if i can narrow it down

  5. Dalton says:

    Whenever I attempt to run it without the full code it seems to not do anything. Im not really sure why this is as I dont really know anything about shell scripting. It doesnt continue to the next line, but nor does it come up with any errors. Sorry for the delayed response.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Powered by Sweet Captcha
Verify your real existence,
Drag some popcorn to the box
  • captcha
  • captcha
  • captcha
  • captcha