User Tools

Site Tools


android-debian

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

android-debian [2016-05-02 05:30:17] (current)
Line 1: Line 1:
 +===== Debian in chroot on Android =====
  
 +<note important>​This works with Debian Jessie and does not work with Debian Stretch. APT HTTP method says that it cannot create socket, permission denied. Adding user to the inet/​net_raw group does not help. It might be caused by the old 3.4 kernel.</​note>​
 +
 +Automated tool: [[https://​guardianproject.info/​code/​lildebi/​|Lil'​ Debi]].
 +  * Uses fixed-size loopback device.
 +  * Requires free loopback device - does not work on CyanogenMod 11 on Nexus 4.
 +
 +Manual installation:​
 +  * Install with --foreign on a non-ARM computer
 +<​code>​debootstrap --arch=armhf --foreign jessie armroot/ http://​ftp.de.debian.org/​debian
 +cp /​usr/​bin/​qemu-arm-static armroot/​usr/​bin/​
 +chroot armroot/
 +/​debootstrap/​debootstrap --second-stage</​code>​
 +  * Transfer armroot/ to the device /data/armhf
 +  * First-time usage after reboot:
 +<​code>​su -c "mount -t tmpfs -o context=u:​object_r:​fuse:​s0 none /​storage/​emulated/​legacy/​DCIM/​OpenCamera/​foo"​
 +su -c "mount -o bind /dev /​data/​armhf/​dev;​ mkdir /​data/​armhf/​system;​ mount -o bind /system /​data/​armhf/​system;​ mkdir /​data/​armhf/​aroot;​ mount -o bind / /​data/​armhf/​aroot;​ export LD_PRELOAD=;​ export HOME=/root; export TERM=xterm; mount -o bind /​mnt/​shell/​emulated/​0/​ /​data/​armhf/​storage;​ chroot /data/armhf /​bin/​bash"​
 +</​code>​
 +  * Unexporting LD_PRELOAD from the above example is needed on Android 5 and does not work on Android 6.
 +  * Next shell:
 +<​code>​su -c "​export LD_PRELOAD=;​ export HOME=/root; export TERM=xterm; chroot /data/armhf /​bin/​bash"</​code>​
 +  * Useful .bashrc:
 +<​code>​export PATH="/​usr/​local/​sbin:/​usr/​local/​bin:/​usr/​sbin:/​usr/​bin:/​sbin:/​bin:/​root/​bin"​
 +
 +cd /root
 +
 +/​etc/​init.d/​ssh start >/​dev/​null ​ 2>&1
 +
 +mount | grep -q proc || mount -t proc none /proc
 +mount | grep -q devpts || (mount -t devpts none /dev/pts; mount -t sysfs none /sys)
 +export LANG=cs_cz.UTF-8
 +export LANGUAGE=cs_cz.UTF-8
 +[ -e /​root/​vault/​pin ] || encfs /​root/​.vault /root/vault
 +</​code>​
 +  * My favorite terminal emulator: https://​f-droid.org/​repository/​browse/?​fdid=jackpal.androidterm
android-debian.txt ยท Last modified: 2016-05-02 05:30:17 (external edit)