Arch linux chroot - Eee Pad Transformer General

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.
Code:
# 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.
Code:
#mkdir /sdcard/arch
Or use a file manager.
Now place this script somewhere in your transformer, I usually keep it in /sdcard/Downloads
Code:
#!/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.
Code:
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
Code:
#pacman -Syu
Now install xorg
Code:
#pacman -S xorg-server xorg-xinit xorg-twm xorg-xclock xterm
Now install a vncserver
Code:
#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 1280x752(fullscreen) and remove some ubuntu stuff. I also added an export for HOME and USER that will allow you to run 'vncserver' as root.
Code:
#!/bin/bash
#############################################
# Asks User to screen size and saves as REZ #
#############################################
#echo "Now enter the screen size you want in pixels (e.g. 800x480), 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 1280x752
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:
Code:
chroot "$MNT_PATH" /bin/bash
and uncomment the line
Code:
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
Code:
#!/bin/bash
xrdb $HOME/.Xresources
exec startfluxblox
This will start an empty fluxbox window manager.

Related

Installing BackTrack5 onto the Motorola Atrix 4G

As I am not allowed to post this where it should be, this seems to be the next best place.
Hardware Needed:
* The Motorola Atrix 4G (without this you wont be going very far)
* Atleast a 4 Gb SD card
* a way of transfering data from your computer onto the SD card (The supplied USB cable or an SD adaptor)
Apps Needed:
* SuperUser (If your on this site, you most likely already have this)
* Just about any Terminal Emulator will work (I used Better Terminal Emulator Pro)
* Any VNC Viewing Client (I used androidVNC)
* A Busybox installer (I used Stericson's BusyBox installer)
Software used:
* I used the BackTrack5 version posted by msullivan, found **HERE**:
I used a slightly edited version of the bt file from the bundle
just copy and paste over the original bt file:
Code:
perm=$(id|cut -b 5)
if [ "$perm" != "0" ];then echo "This script requires root! Type: su"; exit; fi
busybox mount -o remount,rw /dev/block/mmcblk0p5 /system
export kit=/sdcard-ext/BT5
export bin=/system/bin
export mnt=/data/local/bt5
mkdir $mnt
export PATH=$bin:/usr/bin:/usr/local/bin:/usr/sbin:/bin:/usr/local/sbin:/usr/games:$PATH
export TERM=linux
export HOME=/root
if [ -b /dev/loop7 ]; then
echo "Loop device exists"
else
busybox mknod /dev/loop7 b 7 0
fi
#mount -o loop,noatime -t ext2 $kit/bt5.img $mnt
losetup /dev/block/loop7 $kit/bt5.img
mount -t ext2 /dev/block/loop7 $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 "nameserver 8.8.8.8" > $mnt/etc/resolv.conf
echo "nameserver 8.8.4.4" >> $mnt/etc/resolv.conf
echo "127.0.0.1 localhost bt5" > $mnt/etc/hosts
echo "Ubuntu is configured with SSH and VNC servers that can be accessed from the IP:"
ifconfig eth0
echo " "
busybox chroot $mnt /bin/bash
echo "Shutting down BackTrack ARM"
umount $mnt/dev/pts
umount $mnt/proc
umount $mnt/sys
umount $mnt
losetup -d /dev/loop7
Installation Steps:
1. Make sure you have enough space to work with (atleast 4Gb).
2. Edit the bt file with the above coding.
3. Copy over the BT5 folder onto your SD card however you see fit, I just used a SD to USB adaptor that I got with my SD card.
4. Disconnect the USB cable if you have it connected.
5. open your Terminal emulator and type:
Code:
su <ENTER>
6. Type:
Code:
cd /sdcard-ext/BT5 <ENTER>
7. Type:
Code:
sh bt <ENTER>
8. The bt file should run, and leave you with a red command prompt.
Hit the home button.
9. Open your VNC Viewer and enter the login information.
Code:
Nickname: BackTrack5
Password: root
Address: 127.0.0.1
Port: 5901
The screen size still needs adjusting however as I believe it is set at 800×480 currently.
Sick. Just sick.
Cant wait to crack some Wifi with this. Anyone test this out and get a successful crack?
I haven't looked too far into it, however I do believe that this is almost useless as a "cracking" distro on ARM hardware. AFAIK many things don't/can't work. for instance injecting is a no go (real turn off for me, but that is what a netbook is for).
Until we get better drivers for the wifi, we don't have injection, or monitor mode. I've also found editing scripts can be a ***** because the on screen keyboard is either in the way, or the enter doesn't work as enter if using nano, running vi really hoses things up. My external bluetooth keyboard helps with this, but a bluetooth mouse while it works, is waaaaaaaaaaaaaaay (no really) too sensitive on the Atrix. Hooked up to an external monitor in webtop mode it works much better, but I've not tried running backtrack from there.
Yeah I did not even consider the ARM architecture. Very good point.
Do they make a Rosetta type app for Linux? Anyone know? That could at least help use get past the Architectural limits.
*edit*
Still not thinking straight, that app is for PPC users.
In the beginning where the script says "sdcard-ext/bt5" could I edit that to say "sdcard/bt5" in order to boot it from my internal phone memory?
Sent from my MB860 using XDA App
BravoMotorola said:
In the beginning where the script says "sdcard-ext/bt5" could I edit that to say "sdcard/bt5" in order to boot it from my internal phone memory?
Sent from my MB860 using XDA App
Click to expand...
Click to collapse
Yep.
stupid 10 character limit...
Exthero said:
As I am not allowed to post this where it should be, this seems to be the next best place.
Hardware Needed:
* The Motorola Atrix 4G (without this you wont be going very far)
* Atleast a 4 Gb SD card
* a way of transfering data from your computer onto the SD card (The supplied USB cable or an SD adaptor)
Apps Needed:
* SuperUser (If your on this site, you most likely already have this)
* Just about any Terminal Emulator will work (I used Better Terminal Emulator Pro)
* Any VNC Viewing Client (I used androidVNC)
* A Busybox installer (I used Stericson's BusyBox installer)
Software used:
* I used the BackTrack5 version posted by msullivan, found **HERE**:
I used a slightly edited version of the bt file from the bundle
just copy and paste over the original bt file:
Code:
perm=$(id|cut -b 5)
if [ "$perm" != "0" ];then echo "This script requires root! Type: su"; exit; fi
busybox mount -o remount,rw /dev/block/mmcblk0p5 /system
export kit=/sdcard-ext/BT5
export bin=/system/bin
export mnt=/data/local/bt5
mkdir $mnt
export PATH=$bin:/usr/bin:/usr/local/bin:/usr/sbin:/bin:/usr/local/sbin:/usr/games:$PATH
export TERM=linux
export HOME=/root
if [ -b /dev/loop7 ]; then
echo "Loop device exists"
else
busybox mknod /dev/loop7 b 7 0
fi
#mount -o loop,noatime -t ext2 $kit/bt5.img $mnt
losetup /dev/block/loop7 $kit/bt5.img
mount -t ext2 /dev/block/loop7 $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 "nameserver 8.8.8.8" > $mnt/etc/resolv.conf
echo "nameserver 8.8.4.4" >> $mnt/etc/resolv.conf
echo "127.0.0.1 localhost bt5" > $mnt/etc/hosts
echo "Ubuntu is configured with SSH and VNC servers that can be accessed from the IP:"
ifconfig eth0
echo " "
busybox chroot $mnt /bin/bash
echo "Shutting down BackTrack ARM"
umount $mnt/dev/pts
umount $mnt/proc
umount $mnt/sys
umount $mnt
losetup -d /dev/loop7
Installation Steps:
1. Make sure you have enough space to work with (atleast 4Gb).
2. Edit the bt file with the above coding.
3. Copy over the BT5 folder onto your SD card however you see fit, I just used a SD to USB adaptor that I got with my SD card.
4. Disconnect the USB cable if you have it connected.
5. open your Terminal emulator and type:
Code:
su <ENTER>
6. Type:
Code:
cd /sdcard-ext/BT5 <ENTER>
7. Type:
Code:
sh bt <ENTER>
8. The bt file should run, and leave you with a red command prompt.
Hit the home button.
9. Open your VNC Viewer and enter the login information.
Code:
Nickname: BackTrack5
Password: root
Address: 127.0.0.1
Port: 5901
The screen size still needs adjusting however as I believe it is set at 800×480 currently.
Click to expand...
Click to collapse
I get an error when doing "sh bt".
I get "bt: 36: Syntax error: end of file unexpected (expecting "then")"
BravoMotorola said:
I get an error when doing "sh bt".
I get "bt: 36: Syntax error: end of file unexpected (expecting "then")"
Click to expand...
Click to collapse
Is your bt folder on your "internal" or external sd card? If it's the sdcard-ext, you'll need to edit the bt script to point to the correct location.
barry99705 said:
Is your bt folder on your "internal" or external sd card? If it's the sdcard-ext, you'll need to edit the bt script to point to the correct location.
Click to expand...
Click to collapse
Hmm, tried a lot of things, ended up going to the OP of the original Backtrack on Android thread and use his original file instead, working now. But now I have a new problem, (lol) how can I change the screen resolution of the BT5 GUI to match the Atrix's screen? I've looked all over for this. I just can't find out how...
BravoMotorola said:
Hmm, tried a lot of things, ended up going to the OP of the original Backtrack on Android thread and use his original file instead, working now. But now I have a new problem, (lol) how can I change the screen resolution of the BT5 GUI to match the Atrix's screen? I've looked all over for this. I just can't find out how...
Click to expand...
Click to collapse
once you start up backtrack, you need to edit /usr/bin/startvnc . Change that last line to
Code:
vncserver -geometry 940x520
barry99705 said:
once you start up backtrack, you need to edit /usr/bin/startvnc . Change that last line to
Code:
vncserver -geometry 940x520
Click to expand...
Click to collapse
Thanks and yes I did see that somewhere, I just had no clue what file to edit. So is it possible to install things like Flash on Firefox on here or is the no package installer for this? Gosh, sorry I'm asking so much...thanks for the help so far
BravoMotorola said:
Thanks and yes I did see that somewhere, I just had no clue what file to edit. So is it possible to install things like Flash on Firefox on here or is the no package installer for this? Gosh, sorry I'm asking so much...thanks for the help so far
Click to expand...
Click to collapse
Firefox is already installed. Not sure if flash is there since it's so insecure.
Laptop dock
After installing BT5 to Atrix 4G, can the laptop dock be used to run BT5?
I just wanted to throw a thanks out there to Exthero (since you only have 2!) for the start up script. Couldn't get it working until i used yours.
I'm having a blast with this
NISVermeer said:
After installing BT5 to Atrix 4G, can the laptop dock be used to run BT5?
Click to expand...
Click to collapse
easiest way is on wifi:
see what your ip is
Code:
$ ifconfig
example:
eth0: 192.168.1.3
use a vnc server on your computer connect to ip address in ifconfig (port 5901 default for this chroot)
anyone know if or where the atrix wireless drivers are for this?

Tizen

As tizen source is available now I wondered if anyone has taken a look at it yet.
I prepared my machine to start building it and test it.
Will publish updates in this thread.
Sent from my GT-I9300 using xda premium
Another mobile OS. Like there isnt enough already.
Subscribe
Tapatalk 2-vel küldve az én GT-I9300-ről
As far as I have read the new phone with Tizen which Samsung will release (i9500) uses the i9300 modem.
Looking at the structure, used kernel etc now.
For building a kickstart file is used, it is looking like this:
Code:
# -*-mic2-options-*- -f loop [email protected]@-rs.tar.gz -*-mic2-options-*-
#
# Do not Edit! Generated by:
# kickstarter.py
#
lang en_US.UTF-8
keyboard us
timezone --utc America/Los_Angeles
# ROOT fs partition
#part / --size=800 --ondisk mmcblk0p --fstype=ext4 --label=platform
# Use larger partition for creation, and will be shrinked at last, workaround of libzypp bug
#part / --size=2000 --ondisk mmcblk0p --fstype=ext4 --label=platform
# DATA partition
#part /opt/ --size=1800 --ondisk mmcblk0p --fstype=ext4 --label=data
# ROOT fs partition
part / --size=1700 --ondisk mmcblk0p --fstype=ext4 --label=platform
# DATA partition
part /opt/ --size=3000 --ondisk mmcblk0p --fstype=ext4 --label=data
# UMS partition
part /opt/media/ --size=300 --ondisk mmcblk0p --fstype=vfat --label=ums
rootpw tizen
bootloader --timeout=0 --append="rootdelay=5"
desktop --autologinuser=root
user --name root --groups audio,video --password ''
repo --name=Tizen-main --baseurl=https://download.tizen.org/snapshots/trunk/common/@[email protected]/repos/main/armv7l/packages/ --save --ssl_verify=no
repo --name=Tizen-base --baseurl=https://download.tizen.org/snapshots/trunk/common/@[email protected]/repos/base/armv7l/packages/ --save --ssl_verify=no
%packages
@tizen-c210
@tizen-bootstrap
-glib2-static
-gettext-tools
-eglibc-utils
-imake
-giflib-utils
-brcm-gps-daemon
-insserv
%end
%prepackages
libgcc
eglibc
sqlite
zlib
libpython
libdlog
libcap
libattr
default-files-slp
busybox
python-base
libacl
glib2
tzdata-slp
vconf
libxml2
heynoti
openssl
shared-mime-info
libudev
security-server
dbus-libs
cert-svc
libsecurity-server-client
%end
%post
echo 'kickstart post script start'
if [ -d /etc/init.d ]; then
cp /etc/init.d/* /etc/rc.d/init.d/ -rdf
fi
rm -rf /etc/init.d*
ln -sf /etc/rc.d/init.d /etc/init.d
# Without this line the rpm don't get the architecture right.
echo -n 'armv7l-meego-linux' > /etc/rpm/platform
ssh-keygen -t rsa1 -f /etc/ssh/ssh_host_key -N ""
ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key -N ""
ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key -N ""
ail_initdb
/opt/apps/com.samsung.menu-screen/bin/menuscreen_initdb
cat > /usr/bin/press << EOF
#!/bin/sh
JUNK="SLP"
[ "\$1" ] && TIMEOUT="\$1" || TIMEOUT="1"
echo "Press return key to stop scripts"
read -t \$TIMEOUT JUNK
exit \$?
EOF
chmod +x /usr/bin/press
ln -s /opt/etc/X11/xkb /usr/share/X11
echo "UDEV_PERSISTENT_STORAGE=no" >> /etc/sysconfig/udev
rm -rf /usr/include
rm -rf /usr/share/man
rm -rf /usr/share/doc
MAJOR="2"
MINOR="0"
cat >/etc/info.ini <<EOF
[Version]
Major=$MAJOR;
Minor=$MINOR;
Build=TIZEN_`date +%Y%m%d`_1;
Order=;
[Build]
Date=`date +%Y.%m.%d`;
Time=`date +%H:%M:%S`;
EOF
ln -sf /etc/info.ini /opt/etc/info.ini
ln -sf /etc/info.ini /usr/etc/info.ini
mkdir -p /home/app
cp -a /etc/skel/.e /home/app/
chown -R 5000:5000 /home/app
chmod 0755 /home/app
chown -R 5000:5000 /opt/home/app
chmod 0755 /opt/home/app
cat > /usr/lib/systemd/system/usb-debug.service << EOF
[Unit]
Description=Start usb networking for debugging
ConditionPathExists=/sys/devices/platform/usb_mode/UsbMenuSel
[Service]
Type=oneshot
RemainAfterExit=yes
Environment=PATH=/bin:/sbin
ExecStart=/bin/bash -c 'echo 4 > /sys/devices/platform/usb_mode/UsbMenuSel'
ExecStart=/sbin/ifconfig usb0 192.168.129.3 netmask 255.255.255.0
ExecStop=/bin/bash -c 'echo 0 > /sys/devices/platform/usb_mode/UsbMenuSel'
#
# We now don't launch this USB mode hack by default. If you need that, run this:
# systemctl enable usb-debug.service
# or create a link manually like below:
# ln -s ../usb-debug.service /usr/lib/systemd/system/basic.target.wants/usb-debug.service
#
[Install]
WantedBy=basic.target
EOF
# required for the connman systemd service
cat > /etc/sysconfig/connman << EOF
OPTIONS="-W wext"
EOF
# required for the wpa_supplicant systemd service
cat > /etc/sysconfig/wpa_supplicant << EOF
OPTIONS="-Dwext"
EOF
ldconfig
rpm --rebuilddb
echo 'kickstart post script end'
%end
%post --nochroot
%end
News ?
It is nice Android to have competition but from what I saw on youtube Tizen is just android stuck at version 2.3. Is there anything new except that there will be no native apps?
gud to here that
now wating for ur good work

Android 4.2.2 (PAC, CM10.1, etc): Mount CIFS share on /sdcard (incl. nls_utf8)

With Android 4.2's multi-user stuff and the dreaded "0" folder, Google broke mounting of CIFS shares for good. (They basically implemented something utterly useless for my needs, and broke something I need on a daily basis.) Cyanogenmod fixed that for mounts outside the /storage hierarchy, but many apps can't go there. And with 4.2.2, Google made using adb on the device very annoying as well, which adds to problems for a workaround for mounting shares in a useful place.
So I looked around for various fixes for that issue and compiled those into one method that works perfectly well for me on a P6810 running the current PAC ROM 20130629. It should probably work for any other CM10.1 or PA3.6x-based ROM as well. A nls_utf8.ko module compiled for the Nexus 10 is included as well, which can be loaded via punchmod (at least in PAC), so you can access shares with Ümläüts in them.
Prerequisites: SManager, SMWidgets, and a working Busybox install (I use Stericson's Busybox Installer).
1.) Extract nls_utf8.ko and punchmod from the attached .zip file and put them in /system/lib/modules. You can put them in some other place as well, but my scripts need to be adjusted then. Next, give the files sufficient permissions:
Code:
chmod 644 /system/lib/modules/nls_utf8.ko
chmod 755 /system/lib/modules/punchmod
2.) Optional: if you want the module to auto-start, create a file called 00punch-nls_utf8 (or whatever you like) with the content below, put it in /etc/init.d and chmod it to 755. To check if nls-utf8 is loaded after a reboot, type lsmod in a terminal window or adb shell - it should display the module name. If punchmod auto-detection fails, read here how to get the right vermagic string for your device: http://forum.xda-developers.com/showthread.php?p=41920265#post41920265
Code:
#!/system/bin/sh
sleep 10
/system/lib/modules/punchmod /system/lib/modules/nls_utf8.ko ""
3.) Here's the script that mounts a CIFS share. Edit the settings on top and either put your correct vermagic string as well, or delete the "$VERMAGIC" part in line 22 and try your luck with auto-detection. I put some sanity checks in the script, but it might not work for all directories in /sdcard (or, /data/media/0, to call it by its 'real' name/location). If you don't want to use the nls-utf8 module, just delete lines 18-23, and iocharset=utf8 in line 67.
Name the script mount-music.sh or something, put the script wherever you like, open SManager and navigate to the script. Run the script with SU permissions. If everything goes well, it will ask you to accept an adb RSA key, and then adb mounts the share. You can also add a desktop widget for quick access to the script with SMWidgets.
Code:
#!/system/bin/sh
# Your settings here
IP="192.168.1.123"
SHARE="Music"
USER="yourusername"
PASS="yourpassword"
MOUNTPOINT="/data/media/0/cifs"
VERMAGIC="3.0.31-CM-ga034655-dirty SMP preempt mod_unload ARMv7 p2v8 "
# Load cifs (if it isn't already loaded)
if [ `lsmod | grep -o cifs` ] ; then
:
else
insmod /system/lib/modules/cifs.ko
fi
# Load nls_utf8 brute-force style (if it isn't already loaded)
if [ `lsmod | grep -o nls_utf8` ] ; then
:
else
/system/lib/modules/punchmod /system/lib/modules/nls_utf8.ko "" "$VERMAGIC"
fi
# Check if cifs $MOUNTPOINT dir exists, create it if not, give sufficient permissions
if [ -d $MOUNTPOINT ] ; then
:
else
mkdir $MOUNTPOINT
fi
chmod 755 $MOUNTPOINT
# Check if $SHARE directory is empty - if not, unmount the share
if [ "$(su root -c busybox ls -A $MOUNTPOINT/$SHARE 2> /dev/null)" == "" ] ; then
:
else
/system/xbin/busybox umount -l $MOUNTPOINT/$SHARE
fi
# Create $SHARE directory if necessary, give sufficient permissions
if [ -d $MOUNTPOINT/$SHARE ] ; then
:
else
mkdir $MOUNTPOINT/$SHARE
fi
chmod 755 $MOUNTPOINT/$SHARE
# Starting adb
adb kill-server
export HOME=/sdcard
# PORT=`getprop service.adb.tcp.port`
setprop service.adb.tcp.port 5555
adb start-server
cat /sdcard/.android/adbkey.pub >> /data/misc/adb/adb_keys
stop adbd
start adbd
adb connect localhost
# Make sure we only use the first device (sometimes there is more than one)
SERIAL=`adb devices | head -n2 | tail -n1 | cut -f1`
if [ "$SERIAL" = "" ] ; then
echo "ERROR: Could not find ADB device.";
fi
# Mounting share via adb
echo Mounting share via adb...
adb -s $SERIAL shell su root -c /system/xbin/busybox mount -t cifs //$IP/$SHARE $MOUNTPOINT/$SHARE -o user=$USER,pass=$PASS,iocharset=utf8,cache=none,directio,CIFSMaxBufSize=130048,rw,file_mode=0777,dir_mode=0777,uid=1015,gid=1015
# If you started adb, then stop it here for security
adb disconnect localhost
stop adbd
PORT=`getprop service.adb.tcp.port`
setprop service.adb.tcp.port $PORT
start adbd
# Show some results
RESULT=`mount | grep $MOUNTPOINT/$SHARE`
if [ "$RESULT" = "" ] ; then
echo "FAILED! //$IP/$SHARE could not be mounted."
else
echo "SUCCESS! //$IP/$SHARE has been mounted on $MOUNTPOINT/$SHARE."
fi
echo
echo All done. You may close this script window now.
4.) This is the script to unmount the share. Name it unmount-music.sh or similar, and edit your settings at the beginning of the script. Again, run it in SManager with SU permissions, and add a desktop widget with SMWidgets if you like.
Code:
#!/system/bin/sh
# Your settings here
SHARE="Music"
MOUNTPOINT="/data/media/0/cifs"
# Check if $SHARE directory exists
if [ -d $MOUNTPOINT/$SHARE ] ; then
# Check if $SHARE directory is empty - if not, unmount the share
if [ "$(su root -c busybox ls -A $MOUNTPOINT/$SHARE 2> /dev/null)" == "" ] ; then
echo "$MOUNTPOINT/$SHARE is empty."
else
su root -c busybox umount -l $MOUNTPOINT/$SHARE
fi
fi
# Show some results
RESULT=`mount | grep $MOUNTPOINT/$SHARE`
if [ "$RESULT" = "" ] ; then
echo "SUCCESS! $MOUNTPOINT/$SHARE has been unmounted."
else
echo "FAILED! $MOUNTPOINT/$SHARE could not be unmounted."
fi
echo
echo All done. You may close this script window now.
Hope this helps some of you. It sure stumped me how incredibly convoluted this simple and much needed procedure has become on Android 4.2.2... just because of that multi-account stuff and new restrictions on adb.
Credits:
Script bits and nls_utf8.ko by H3g3m0n
More script bits by dafunk60 and jmtw000
Punchmod by Jann Horn
Punchmod info by idcrisis
Thanks man, looks awesome, I am going to try it on my 6800.
Do you know how to mount ext4 or ntfs sdcard on CM10.1 based roms?
Removed the original post, still trying to make it work!
I checked vermagic in some existing ko files and found that it is exactly the same as yours.
Sent from my GT-p6800 using Tapatalk HD
m0bster said:
Removed the original post, still trying to make it work!
I checked vermagic in some existing ko files and found that it is exactly the same as yours.
Sent from my GT-p6800 using Tapatalk HD
Click to expand...
Click to collapse
You can try loading the UTF8 module without vermagic string as well, it should work on PAC. Or, make sure you have a blank space at the end of the vermagic string, it is required. Maybe read the short tutorial here: http://forum.xda-developers.com/showthread.php?p=41920265#post41920265
dfkt_ said:
You can try loading the UTF8 module without vermagic string as well, it should work on PAC. Or, make sure you have a blank space at the end of the vermagic string, it is required. Maybe read the short tutorial here: http://forum.xda-developers.com/showthread.php?p=41920265#post41920265
Click to expand...
Click to collapse
I finally managed to mount cifs shares, after loading original cifs and punmode load of nls_utf8.ko.
But I mounted it with cifsmanager. The script always shows "failure to mount" !

[Guide] Debian on Android (rooted)

Hi, this is a guide to install a Linux image on your rooted Android phone with the debootstrap + chroot method.
In this guide, we'll install a Debian image, but the steps are practically the same, with a few tweaks.
If you need help to install a Linux image, feel free to ask on this thread.
For this guide, all credit goes to them:
http://linux-expert.net/?Trucs_et_astuces___Android___Tutoriel_%3A_Chroot_Debian (in french)
http://forum.xda-developers.com/showthread.php?p=45457799
http://forum.xda-developers.com/showthread.php?t=2312013
http://forum.xda-developers.com/showthread.php?t=631389
http://forum.xda-developers.com/showthread.php?t=1418546
http://forum.xda-developers.com/showpost.php?p=5671794&postcount=124
VNC
________________
I. On your PC
So first, you have to create the .img file that will contain the OS.
In a GNU/Linux environment (PC) and with the root permissions, type these commands:
Code:
# mkdir debian
# dd if=/dev/zero of=wheezy-armhf.img bs=1M count=0 seek=2048
[COLOR="Red"](NOTE: "of=" will be the name of our .img file and "seek=" the size of the file (MB). Here, we create a file named "wheezy-armhf.img" of 2 GB)[/COLOR]
# mkfs.ext4 -F wheezy-armhf.img
# mount -o loop wheezy-armhf.img /debian
Then we have to fill up the filesystem.
Code:
# debootstrap --foreign --arch=armhf wheezy debian/
# umount debian
Finally, move it to your SD Card. In my case, I moved it on /data/local/
II. On your phone
On your phone, in a terminal emulator and with the root permissions, type the following commands:
Code:
# mount -o rw,remount rootfs /
# export LINUXROOT=/linux
(NOTE: here we'll install Debian on the root of the internal memory, in "/", but we can also install Debian on the SD Card or in /data/loca/linux by changing the path after "LINUXROOT=")
# mkdir $LINUXROOT
# busybox mknod /dev/block/loop100 b 7 100
# losetup /dev/block/loop100 /sdcard/wheezy-armhf.img
# mount -t ext4 /dev/block/loop100 $LINUXROOT
# chroot $LINUXROOT /bin/sh
# export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
# /debootstrap/debootstrap --second-stage
The debootstrap's second part should start. Grab a cup of coffee while it's working!
When it's finish, leave the chroot by typing
Code:
# exit
# su
Let's mount the filesystem. We're close!
Code:
# mount -t proc none /proc
# mount -t sysfs none /sys
# mount -o bind /dev /dev
# mount -t devpts none /dev/pts
Now, we have to set the environment variable. Ensure that you have set the correct path of LINUXROOT in case you've chosen another path than /linux.
Code:
# export LINUXROOT=/linux
# export TMPDIR=/tmp
# export USER=root
# export HOME=/root
# export SHELL=/bin/bash
# export TERM=linux
# export LC_ALL=C
# export LANGUAGE=C
# export LANG=C
And finally, chroot.
Code:
# chroot $LINUXROOT /bin/bash
su
Welcome on Debian!
III. DNS and Mirrors
Set a DNS. We'll set the free Google DNS but you can set yours if you want.
Code:
echo -e "domain local\nsearch local\n" >> /etc/resolv.conf
echo -e "# DNS Google\nnameserver 8.8.8.8\nnameserver 8.8.4.4\n" >> /etc/resolv.conf
You can add mirrors to your sources.list if you want. I'm french so I added french mirrors:
Code:
# echo -e "## Debian Wheezy sources.list\n\n" > /etc/apt/sources.list
# echo -e "## Debian.org FR mirror\ndeb http://ftp.fr.debian.org/debian/ wheezy main contrib non-free\ndeb-src http://ftp.fr.debian.org/debian/ wheezy main contrib non-free\n\n" >> /etc/apt/sources.list
# echo -e "## Debian security updates\ndeb http://security.debian.org/ wheezy/updates main contrib non-free\ndeb-src http://security.debian.org/ wheezy/updates main contrib non-free\n >> /etc/apt/sources.list
IV. VNC
To access your Debian in a graphical environment from your PC or your phone, you have to set up a VNC Server and install a Desktop Environment. Let's install VNC and LXDE.
We'll follow the steps described on the LXDE wiki:
Code:
su
# apt-get update
# apt-get install lxde
# apt-get install tightvncserver
Set up the VNC server by typing the following command, which will ask you to set two passwords (let the second password if you want):
Code:
# vncserver
Kill the session:
Code:
# vncserver -kill :1
Go to /root/.vnc/ and edit the xstartup file: comment out #/etc/X11/xsession and add these two lines:
icewm
lxsession
Click to expand...
Click to collapse
To start a VNC session, type "vncserver -geometry x". For the Nexus 4, we would type "vncserver -geometry 1184x768"
To access your Desktop Environment from your phone, download android-vnc-viewer and launch it.
In the password field, type your password. In the address field, type "127.0.0.1", in port type "5901" and select 24-bit color (4bpp).
V. Script
I've made three scripts to mount, launch and unmount Debian. Whenever you reboot your phone, you'll have to mount Debian, set the environment variables and chroot.
VI. Credit
All credit goes to them:
http://linux-expert.net/?Trucs_et_astuces___Android___Tutoriel_%3A_Chroot_Debian (in french)
http://forum.xda-developers.com/showthread.php?t=2312013
http://forum.xda-developers.com/showthread.php?t=631389
http://forum.xda-developers.com/showthread.php?t=1418546
http://forum.xda-developers.com/showpost.php?p=5671794&postcount=124
VNC
Sorry for my bad english, I hope this will help
EDIT: Feel free to correct me!
Hi, I have 2021 updates, if someone interested. Tested with rooted LineageOS 17 (selinux permissive - not sure if required, my ROM is permissive, didn't set it explicitly):
for 32-bit ARM, ext4 created by 64-bit Linux didn't work, obviously there is some 64-bit feature that was not supported at least with my kernel (3.14). I've in the end created the FS on the Android, but using "-O '^64bit'" could be sufficient in the Linux. UPDATE: I've in the end used F2FS instead of EXT4.
above mknod+losetup+mount didn't work for me (neither 'mount -o loop -t ext4 <img>'), I've used 'mount -t ext4 $(losetup -sf /sdcard/stable-armhf.img) $LINUXROOT' in the end (obviously the device name needs to be saved somewhere if one wants to cleanly umount)
there was issue with network access denied even if you are root, see here. I've fixed it by creating the group 'inet/3003' in the chroot and issuing 'newgrp inet' inside it (more details in the link).
Anyways, thanks a lot for the above instructions, it helped me much!

Install full Linux OS on note 10.1 2014 using Linux deploy.

If we can install full Linux OS on note 10.1 2014, then it will become the truly laptop replacement.
It seems that Linux deploy is very promising, but it require a truly working root
Someone used Linux deploy to install full Linux OS on note 10.1 2012 and turned note into a full Linux laptop when needed.
https://play.google.com/store/apps/details?id=ru.meefik.linuxdeploy
Can someone savvy give it a try?
I've played around with a few installers and in the terminal by hand for a few hours. I am not able to grant permission to chroot. Even with root. I will look into this in the future.
dasmoover said:
I've played around with a few installers and in the terminal by hand for a few hours. I am not able to grant permission to chroot. Even with root. I will look into this in the future.
Click to expand...
Click to collapse
someone managed to install Linux on note3
https://github.com/meefik/linuxdeploy/issues/77
Since note 10.1 2014 is essentially an enlarged note3, above information maybe helpful for you
Got Linux deploy (linuxonandroid) app working with work
Hello, Sorry meant to say Complete Linux Installer in the topic, not Linux Deploy!
I tried the Linux Deploy project with no luck. The post that was in this thread got me to the point that you need to apply a patch in the source code ShellEnv.java and then recompile. It sets it up so it prefaces all commands in the script with su when run. I was not able to recompile the code nor anyone that could give it to me. So I moved on to the Complete Linux Installer linuxonandroid app http://linuxonandroid.org/ I ran into the same problems but I was able to get around it because the script that is used to starts the Linux distribution is editable it is bootscript.sh placed in /data/data/com/zpwebsites.linuxonandroid/files this script is automatically created when you walk through the setup/install process while you are downloading an image file going through the setup process you can edit this file as it will be created at that point, where ever you see "$bbox and a xxxxx" in the script you change it to "su $bbox and xxxxxxx" so basically you have to preface all these points which there are a lot of with su. This is part of the situation. Second part is that you will need to setup the mount point for the loop directory by hand and you can see this in the script, then you will need to mount the loop directory and then create each directory inside to what is specified in the script.Then unmount the loop directory, or reboot and then you can finish the setup and launch the distribution.
You may run into errors along the way and you will need to correct them as needed. This is no easy task to setup unless you are familiar with linux and what the script is doing. Sorry I have no easy way but I was able to get it running with the Ubuntu small images to even include the display, still having so issues getting the xwindow to display correctly in the other large images which are close to a full distribution.
All my work was done with a terminal emulator, root explorer, a text editor, Complete Linux Installer(linuxonandroid from ZPWebSites), and a VNC client. Oh and using the spen and Bluetooth keyboard helps as it takes more time with just the touch interface and keyboard for what needs to be done.
It is possible to get running but you have to work at it, took me 3 hours to work through all the issues and I am familiar with Linux and its tools.
Hope this gets you in the direction you need because it was important to me to get this working for what I do. I have sent updates to the developer to hope he can automate this in the future. With Samsung's Android implementation with multiple user config it messes with the security context of scripts because each command can be run through an interactive terminal session. But the script needs to pass SU with the commands to get it to work.
I have a Samsung Galaxy Note 10.1 2014 WIFI P600 and should work with the other models too because not specific to a model. Seems this work with a Galaxy S4 as well since they are setup the same in the OS from what I have found.
quser1 said:
Hello, Sorry meant to say Complete Linux Installer in the topic, not Linux Deploy!
I tried the Linux Deploy project with no luck. The post that was in this thread got me to the point that you need to apply a patch in the source code ShellEnv.java and then recompile. It sets it up so it prefaces all commands in the script with su when run. I was not able to recompile the code nor anyone that could give it to me. So I moved on to the Complete Linux Installer linuxonandroid app http://linuxonandroid.org/ I ran into the same problems but I was able to get around it because the script that is used to starts the Linux distribution is editable it is bootscript.sh placed in /data/data/com/zpwebsites.linuxonandroid/files this script is automatically created when you walk through the setup/install process while you are downloading an image file going through the setup process you can edit this file as it will be created at that point, where ever you see "$bbox and a xxxxx" in the script you change it to "su $bbox and xxxxxxx" so basically you have to preface all these points which there are a lot of with su. This is part of the situation. Second part is that you will need to setup the mount point for the loop directory by hand and you can see this in the script, then you will need to mount the loop directory and then create each directory inside to what is specified in the script.Then unmount the loop directory, or reboot and then you can finish the setup and launch the distribution.
You may run into errors along the way and you will need to correct them as needed. This is no easy task to setup unless you are familiar with linux and what the script is doing. Sorry I have no easy way but I was able to get it running with the Ubuntu small images to even include the display, still having so issues getting the xwindow to display correctly in the other large images which are close to a full distribution.
All my work was done with a terminal emulator, root explorer, a text editor, Complete Linux Installer(linuxonandroid from ZPWebSites), and a VNC client. Oh and using the spen and Bluetooth keyboard helps as it takes more time with just the touch interface and keyboard for what needs to be done.
It is possible to get running but you have to work at it, took me 3 hours to work through all the issues and I am familiar with Linux and its tools.
Hope this gets you in the direction you need because it was important to me to get this working for what I do. I have sent updates to the developer to hope he can automate this in the future. With Samsung's Android implementation with multiple user config it messes with the security context of scripts because each command can be run through an interactive terminal session. But the script needs to pass SU with the commands to get it to work.
I have a Samsung Galaxy Note 10.1 2014 WIFI P600 and should work with the other models too because not specific to a model. Seems this work with a Galaxy S4 as well since they are setup the same in the OS from what I have found.
Click to expand...
Click to collapse
Can you upload the edited script?
dasmoover said:
Can you upload the edited script?
Click to expand...
Click to collapse
Yes, I will try. One thing is that the script is producing errors when you try to Exit the running distro with syntax errors on a couple of commands and I have not been able to fix them, they looks like script issues from the generated script, still need investigation and I have contacted the developer. Only way I have been able to get the system to unmount the loop device after an exit is to restart the tablet because of the script errors. Also you will need to create all the file system in the loop directory as the script is not doing it automatically.
---------- Post added at 09:43 AM ---------- Previous post was at 09:26 AM ----------
Tried to attach file so keep getting error so pasting the script here. Just so you know this is an auto created script on setup so not sure if it is different for each install.
###########################################
# Linux boot script V8 for Android v4.3 #
# Built by Zachary Powell (zacthespack) #
# and Martin Møller (Tuxling) #
# Thanks to: #
# Johan Vromans #
# Marshall Levin #
# Vaykadji #
# and to everyone at XDA! #
# Feel free to edit/use this script as you#
# like but credit Linuxonandroid.org #
###########################################
# $ver: V8 #
###########################################
###########################################
# This is a function we use to stop the #
# script in case of errors #
###########################################
error_exit() {
echo "Error: $1"
exit 1
}
###########################################
# Set up variables #
###########################################
if [ -f /data/data/com.zpwebsites.linuxonandroid/files/busybox ]; then
export bbox=/data/data/com.zpwebsites.linuxonandroid/files/busybox
elif [ -f /data/data/com.zpwebsites.linuxonandroid.opensource/files/busybox ]; then
export bbox=/data/data/com.zpwebsites.linuxonandroid.opensource/files/busybox
else
export bbox=/system/xbin/busybox
fi
export usermounts=android # Base folder all user mounts are done in, should be moved to app later
export imgfile=$(dirname $0)/ubuntu.img # Default image file, another can be set by using an argument
export bin=/system/bin
export mnt=/data/local/mnt
export USER=root
if [[ ! -d $mnt ]]; then mkdir $mnt; fi
export PATH=$bin:/usr/bin:/usr/local/bin:/usr/sbin:/bin:/usr/local/sbin:/usr/games:$PATH
export TERM=linux
export HOME=/root
###########################################
# Handle arguments if present #
###########################################
if [ $# -ne 0 ]; then
if [ -f $1 ]; then # Is full path present?
imgfile=$1
elif [ -f $(dirname $0)/$1 ]; then # Is only a filename present?
imgfile=$(dirname $0)/$1
else
error_exit "Image file not found!($1)"
fi
fi
###########################################
# If a md5 file is found we check it here #
###########################################
if [ -f $imgfile.md5 ]; then
echo "MD5 file found, use to check .img file? (y/n)"
read answer
if [ $answer == y ]; then
echo -n "Validating image checksum... "
$bbox md5sum -c -s $imgfile.md5
if [ $? -ne 0 ];then
echo "FAILED!"
error_exit "Checksum failed! The image is corrupted!"
else
echo "OK"
rm $imgfile.md5
fi
fi
fi
################################
# Find and read config file #
# or use defaults if not found #
################################
use_swap=no
cfgfile=$imgfile.config # Default config file if not specified
if [ -f $imgfile.config ]; then
source $imgfile.config
fi
###########################################
# Set Swap up if wanted #
# #
###########################################
if [ $use_swap == yes ]; then
if [ -f $imgfile.swap ]; then
echo "Swap file found, using file"
echo "Turning on swap (if it errors here you do not have swap support"
swapon $imgfile.swap
else
echo "Creating Swap file"
dd if=/dev/zero of=$imgfile.swap bs=1048576 count=1024
mkswap $imgfile.swap
echo "Turning on swap (if it errors here you do not have swap support"
swapon $imgfile.swap
fi
fi
###########################################
# Set up loop device and mount image #
###########################################
echo -n "Checking loop device... "
if [ -b /dev/block/loop255 ]; then
echo "FOUND"
else
echo "MISSING"
# Loop device not found so we create it and verify it was actually created
echo -n "Creating loop device... "
su $bbox mknod /dev/block/loop255 b 7 255
if [ -b /dev/block/loop255 ]; then
echo "OK"
else
echo "FAILED"
error_exit "Unable to create loop device!"
fi
fi
su $bbox losetup /dev/block/loop255 $imgfile
if [ $? -ne 0 ];then error_exit "Unable to attach image to loop device! (Image = $imgfile)"; fi
su $bbox mount -t ext4 /dev/block/loop255 $mnt
if [ $? -ne 0 ];then error_exit "Unable to mount the loop device!"; fi
###########################################
# Mount all required partitions #
###########################################
su $bbox mount -t devpts devpts $mnt/dev/pts
if [ $? -ne 0 ];then error_exit "Unable to mount $mnt/dev/pts!"; fi
su $bbox mount -t proc proc $mnt/proc
if [ $? -ne 0 ];then error_exit "Unable to mount $mnt/proc!"; fi
su $bbox mount -t sysfs sysfs $mnt/sys
if [ $? -ne 0 ];then error_exit "Unable to mount $mnt/sys!"; fi
su $bbox mount -o bind /sdcard $mnt/sdcard
if [ $? -ne 0 ];then error_exit "Unable to bind $mnt/sdcard!"; fi
if [[ ! -d $mnt/root/cfg ]]; then mkdir $mnt/root/cfg; fi
su $bbox mount -o bind $(dirname $imgfile) $mnt/root/cfg
su $bbox mount -o bind /sys/fs/selinux $mnt/selinux
###########################################
# Checks if you have a external sdcard #
# and mounts it if you do #
###########################################
if [ -d /sdcard/external_sd ]; then
su $bbox mount -o bind /sdcard/external_sd $mnt/external_sd
fi
if [ -d /Removable/MicroSD ]; then
su $bbox mount -o bind /Removable/MicroSD $mnt/external_sd
fi
# This is for the HD version of the Archos 70 internet tablet, may be the same for the SD card edition but i dont know.
if [ -d /storage ]; then
su $bbox mount -o bind /storage $mnt/external_sd
fi
###########################################
# Mount all user defined mounts if any #
###########################################
if [ -f $imgfile.mounts ]; then
olddir=$(pwd)
echo "Mounting user mounts"
cd $mnt
if [[ ! -d $mnt/$usermounts ]]; then su $bbox mkdir -p $usermounts; fi
echo "# Script to unmount user defined mounts, do not delete or edit!" > $imgfile.shutdown
echo "cd $mnt/$usermounts" > $imgfile.shutdown
cd $mnt/$usermounts
for entry in $(cat "$imgfile.mounts"); do
ANDROID=${entry%;*}
LINUX=${entry#*;}
if [[ -d $ANDROID ]]; then
echo -n "Mounting $ANDROID to $usermounts/$LINUX... "
if [[ ! -d $mnt/$usermounts/$LINUX ]]; then su $bbox mkdir -p $LINUX; fi
su $bbox mount -o bind $ANDROID $mnt/$usermounts/$LINUX &> /dev/null
if [ $? -ne 0 ];then
echo FAIL
if [[ -d $mnt/$usermounts/$LINUX ]]; then su $bbox rmdir -p $LINUX; fi
else
echo OK
echo "su $bbox umount $mnt/$usermounts/$LINUX" >> $imgfile.shutdown
echo "su $bbox rmdir -p $LINUX" >> $imgfile.shutdown
fi
else
echo "Android folder not found: $ANDROID"
fi
done
echo "cd $mnt" >> $imgfile.shutdown
echo "su $bbox rmdir -p $usermounts" >> $imgfile.shutdown
cd $olddir
else
echo "No user defined mount points"
fi
###########################################
# Sets up network forwarding #
###########################################
su $bbox sysctl -w net.ipv4.ip_forward=1
if [ $? -ne 0 ];then error_exit "Unable to forward network!"; fi
# If NOT $mnt/root/DONOTDELETE.txt exists we setup hosts and resolv.conf now
if [ ! -f $mnt/root/DONOTDELETE.txt ]; then
echo "nameserver 8.8.8.8" > $mnt/etc/resolv.conf
if [ $? -ne 0 ];then error_exit "Unable to write resolv.conf file!"; fi
echo "nameserver 8.8.4.4" >> $mnt/etc/resolv.conf
echo "127.0.0.1 localhost" > $mnt/etc/hosts
if [ $? -ne 0 ];then error_exit "Unable to write hosts file!"; fi
fi
###########################################
# Chroot into ubuntu #
###########################################
su $bbox chroot $mnt /root/init.sh $(basename $imgfile)
###########################################
# Shut down ubuntu #
###########################################
echo "Shutting down Linux ARM"
#for pid in `lsof | grep $mnt | sed -e's/ / /g' | cut -d' ' -f2`; do kill -9 $pid >/dev/null 2>&1; done
for pid in `su $bbox lsof | su $bbox grep $mnt | su $bbox sed -e's/ / /g' | su $bbox cut -d' ' -f2`; do su $bbox kill -9 $pid >/dev/null 2>&1; done
sleep 5
###########################################
# Unmount all user defined mounts if any #
###########################################
if [ -f $imgfile.shutdown ]; then
echo "Unmounting user defined mounts"
sh $imgfile.shutdown
rm $imgfile.shutdown
fi
su $bbox umount $mnt/root/cfg
su $bbox umount $mnt/sdcard
su $bbox umount $mnt/external_sd
su $bbox umount $mnt/dev/pts
su $bbox umount $mnt/dev
su $bbox umount $mnt/proc
su $bbox umount $mnt/sys
su $bbox umount $mnt/selinux
su $bbox umount $mnt
su $bbox losetup -d /dev/block/loop255 &> /dev/null
for those brave enough ,try SELinux Permissive Kernel,maybe all problems will be solved.
http://forum.xda-developers.com/showthread.php?t=2590311
robertchow said:
for those brave enough ,try SELinux Permissive Kernel,maybe all problems will be solved.
http://forum.xda-developers.com/showthread.php?t=2590311
Click to expand...
Click to collapse
Yes the kernel in the thread you posted allows for Linux function in Complete Linux Installer. After the kernel is installed either use Wanam Xposed and disabling SELinux to set as always Permissive, or using "setenforce 0" in terminal(this is only for the session and once the system reboots will go back to Enforcing or if "setenforce 1")
At that point if you use getenforce at a terminal will show as Permissive and Linux will boot normally with full function.
My hat goes off to the developer of the kernel because now I have everything on the tablet I need.
FYI on my Ubuntu large installs I am running into a new SELinux issue, even with it in Permissive doing an apt-get upgrade, causes issues with an error related to invalid security context selinux, cant remember the full error. I am not seeing this with the Fedora large image. When this happens with the Ubuntu ones it breaks the KDE GUI and the Application menu ends up blank. The error occurs when install packages try to address the Ubuntu Group security, packages like colord is just an example which do a security group change. Still plowing through how to fix. Till then using Fedora which I haven't used in years
Hi,
I tried with the large Ubuntu image and get an error as well with apt-get update...not being too conversant on Linux on Android, I would like to find out if you had a fix or a resolution from the developers? Might have to stay with the Xperia Z Tablet for Linux in the meantime...
Fedora 19 via Complete Linux Installer. Have Selinux Permissive Kernel, Selinux Mode Changer, and root of course. Otherwise FW is stock MJ6.
Just a few remarks:
The Fedora image is a bit small for a full blown Linux desktop. I copied the contents to a larger 8 GB image. Had to reformat the SD card with exFAT in order to store the image there. Copying was done on a desktop computer because MTP connection just stops at 4 GB.
Changes to scripts include changing the mount command for external_sd to /storage/extSdCard in boot script. Once Linux is up and running, change /root/init.sh, find the line that starts vncserver and append -dpi 300, otherwise fonts in Linux are barely readable. Wigdets are still kind of small but at least the fonts are readable now.
If you get a connection refused in AndroidVNC, you may have to set a password on the Linux terminal for user, that is su - fedora, then vncpasswd.
Todo: find out why second start of Linux fails on loop mount busy and why shutdown complains about umount of dev.
So, my note happily runs KDE desktop, LibreOffice, and kile for LaTeX. The latter was the main reason for putting Linux on the note.
caferick said:
Fedora 19 via Complete Linux Installer. Have Selinux Permissive Kernel, Selinux Mode Changer, and root of course. Otherwise FW is stock MJ6.
Just a few remarks:
The Fedora image is a bit small for a full blown Linux desktop. I copied the contents to a larger 8 GB image. Had to reformat the SD card with exFAT in order to store the image there. Copying was done on a desktop computer because MTP connection just stops at 4 GB.
Changes to scripts include changing the mount command for external_sd to /storage/extSdCard in boot script. Once Linux is up and running, change /root/init.sh, find the line that starts vncserver and append -dpi 300, otherwise fonts in Linux are barely readable. Wigdets are still kind of small but at least the fonts are readable now.
If you get a connection refused in AndroidVNC, you may have to set a password on the Linux terminal for user, that is su - fedora, then vncpasswd.
Todo: find out why second start of Linux fails on loop mount busy and why shutdown complains about umount of dev.
So, my note happily runs KDE desktop, LibreOffice, and kile for LaTeX. The latter was the main reason for putting Linux on the note.
Click to expand...
Click to collapse
Thanks for the post. I played around with linux on my note 2 and have been waiting to get it running on my 2014. How well does it handle linux?
Sent from my SM-P600 using XDA Premium 4 mobile app
Duly.noted said:
How well does it handle linux?
Click to expand...
Click to collapse
It runs reasonably well. I guess the limiting factor is disk I/O, or SD I/O in this case. I run KDE 4 in desktop mode with graphical desktop effects disabled and most of the KDE services like indexing disabled. It takes about 15-20 seconds from finished boot to desktop. Once the desktop is up and running, opening apps like LibreOffice is fast enough. Feels like with the first generation Atom netbooks. KDE is a resource hog, it would probably make sense to go for something that is lighter on resources but I chose KDE for girlfriend compatibility. She only knows KDE and I won't force her to learn the XFCE way or something even more obscure like Gnome3 http://forum.xda-developers.com/images/smilies/tongue.gif .
Vncserver runs at native full screen, ie 2560x1600 at 300 dpi. There was a noticable screen redraw lag when closing windows. That was easily fixed by disabling the desktop background image. I have not yet done any high load tasks. Only opened LibreOffice and kile for a quick check.
I have a cheapo foldable bluetooth keyboard. Need to get a small bluetooth mouse. Any recommendations? Or a small keyboard/touchpad combo I can take with me when traveling.
To Caferick - Fedora 19 step by step
Hi can you explain step by step how u got the Fedora 19 to wor pleasek? where i can find the bootscript?
Amadyl said:
Hi can you explain step by step how u got the Fedora 19 to wor pleasek? where i can find the bootscript?
Click to expand...
Click to collapse
Hum, a step by step guide would be rather longish. To answer the question: Complete Linux Installer scripts are located in /data/data/com.zpwebsites.linuxonandroid/files. There is the bootscript.sh. However, editing it is not strictly necessary. It should work as is. Alright, let's see
Preliminaries:
* need root on your device along with the usual suspects like busybox and terminal emulator (both on Google Play)
* need selinux set to permissive -> flash selinux permissive kernel (to be found in xda forums) and install something like SELinuxModeChanger (Play) set to always change SELinux mode to permissive, check by rebooting and then Configuration > General > Device Info, it should say Permissive
* useful apps include a decent file manager (I like TotalCommander), ZIP extractor (ZArchiver), text editor (Jota), these make things somewhat easier
* required app: AndroidVNC (Play)
1. Install Complete Linux Installer from Play
* start the app and open the menu by touching the < sign at the top left
* choose installation guides (or the like, my interface is not English)
* choose Fedora 19, there are four tabs, work through them in sequence, second tab presents a download button, if you have not yet installed Terminal and AndroidVNC you can use the two other buttons to do it now
* third tab asks you to unzip the downloaded image, the ZIP will probably be in /storage/emulated/0/download, move it to the root of your external SD card, unzip with Zarchiver
* there should now be a new folder fedoraXXXXX with two files in it, the fedora-*.img and an md5 file, you can safely delete the md5 file and maybe rename the image to something like fedora.img, likewise for the enclosing folder
* read the rest of tab 3 and 4
2. Start Linux
* go back to CompLinInstaller menu and push the second entry labeled Start
* a page will open and probably say Ubuntu in the drop down combo box above the Start button, change it to Fedora and type in the path to the image, like /storage/extSdCard/fedora/fedora.img
* push the Start button
* a terminal will open and a few lines will fly by. If everything goes well, you will be asked to set passwords two times, just use a trivial one like 12345678, you can change it later if you are paranoid about passwords
* you will be asked to set the resolution for VNC, type 2560x1600 which is the native resolution of the tab
* you will be asked whether you want to autostart VNC, type y
* you will be asked whether you want to start SSH server, type n
* your choice will be saved right beside the image file, in my case the file is called fedora.img.config, you can change it with any text editor
3. In the chroot terminal
* still in the terminal, the prompt should now say [email protected]
* while you are there, type su - fedora , the prompt should change to [email protected]
* type vncpasswd to set a password for VNC access, just use the same password as above, then type exit
* you are back at [email protected] If you have a keyboard (bluetooth or USB), you can edit the file init.sh with vi and append -dpi 300 to vncserver startup line. This setting will take effect at next start because vncserver. If you do not have a keyboard or do not know vi editor, you can skip this for now.
4. VNC
* start AndroidVNC, Nick: fedora, Password: 12345678, Address: localhost, Port: 5900, Color Format: 24-bit color (4bpp), Connect
* you should now see a linux desktop with tiny fonts
* hit the tabs config button to bring up AndroidVNC options, change input mode to touchpad
* you can now move the linux pointer with your finger on the display
5. Shutdown
* in VNC Linux logout just as you would log out of any other Linux desktop
* terminate VNC session by choosing Disconnect from AndroidVNC config menu
* switch to the still running terminal and type exit
* Linux now stops, wait a few seconds and close the terminal
There are still some minor problems with shutdown which I am trying to trace. A subsequent start of Linux will not work because of busy devices. So best reboot the tab and try again.
That's it for the base setup. Uh, the text is long indeed. Has it worked for you so far? Next comes customization
Corrections welcome, I typed this down from memory...
script
So we need to create script ourselves, when i've done it, i was set resolution to my tablet's resolution, then all is poor to see, that words and windows is too small to work, so it's horrible at the moment, but else works good enough. Is anyone know how to get normal UI on that big resolution? Sorry for my bad english.
Hey guys is there a walk through on how to increase the IMG size for fedora in a windowc pc ? i al ready have the SD partitioned just need to encrease the size to 10 GB
sits at boot up
My device is rooted, chroot installed, vnc installed, and busybox installed.
I install SELinux Permissive and systems sits at bootup screen. never boots to OS at any point. Just sits and the Samsung screen.
I have the Galaxy Note 10.1 SM-P600 (2014 Edition).
How long does it sit at the Samsung Boot screen before finally booting the rest of the way?
I installed using Odin 3.09.
I have running Ubuntu (xfce) on my Note 3 with Linux Deploy. VNC is not the way, it is slow. You should use framebuffer mode and you will be astonished how nice its running. Also, I modified xorg.conf for the phone to only react to stylus input and the stylus button to be right click. This setup is also working on my Note 10.1 old edition.
mdalacu said:
I have running Ubuntu (xfce) on my Note 3 with Linux Deploy. VNC is not the way, it is slow. You should use framebuffer mode and you will be astonished how nice its running. Also, I modified xorg.conf for the phone to only react to stylus input and the stylus button to be right click. This setup is also working on my Note 10.1 old edition.
Click to expand...
Click to collapse
Can we use it without linux deploy, because it doesn't work on sm-p605? Can you point us to some guide or documentation? Thanks.

Categories

Resources