Caution
READ CAREFULLY! When using Chroot environments to exit completely close the Termux application even from the background apps or if necessary force close it. Otherwise, in case you do some command like "rm -rf chrootFolder" the device will go crazy and you will have to force reboot it.
- 🏁 First steps
- 💻🍥 Setting Debian chroot - automatic installer
- 🤚🍥 Setting Debian chroot - Manual install
- ⬇️ Download scripts to run desktops
- ⬇️ Download Debian chroot
- 🎨 Customizations (Nerdfonts, XFCE4 terminal color palettes, etc)
Note
All the process is described in this video
- First you need to have your device rooted.
- You need to flash Busybox with Magisk.
- Then you need to install the following packages in Termux:
pkg update
pkg install x11-repo
pkg install root-repo
pkg install termux-x11-nightly
pkg update
pkg install tsu
pkg install pulseaudio
Please read first #First Steps section
- Download the installer with this command:
wget https://raw.githubusercontent.com/LinuxDroidMaster/Termux-Desktops/main/scripts/chroot/debian/chroot_debian_installer.sh
- Run it with sudo privileges from Termux:
su
chmod +x chroot_debian_installer.sh
sh chroot_debian_installer.sh
- startxfce4_chrootDebian.sh
wget https://raw.githubusercontent.com/LinuxDroidMaster/Termux-Desktops/main/scripts/chroot/debian/startxfce4_chrootDebian.sh
- Download Debian 12 rootfs:
wget https://github.com/LinuxDroidMaster/Termux-Desktops/releases/download/Debian/debian12-arm64.tar.gz
-
XFCE4 color palettes:
-
Installing NerdFonts on chroot env (Debian, Ubuntu) from this post:
sudo apt install wget unzip -y
wget -P ~/.local/share/fonts https://github.com/ryanoasis/nerd-fonts/releases/download/v3.0.2/JetBrainsMono.zip \
&& cd ~/.local/share/fonts \
&& unzip JetBrainsMono.zip \
&& rm JetBrainsMono.zip \
&& fc-cache -fv
- Enter Android shell with root privileges:
su
- Create a directory at
/data/local/tmp
for chroot environment
mkdir /data/local/tmp/chrootDebian
cd /data/local/tmp/chrootDebian
- Download Debian 12 rootfs:
wget https://github.com/LinuxDroidMaster/Termux-Desktops/releases/download/Debian/debian12-arm64.tar.gz
- Unzip the downloaded file and create some folders to mount the sdcard
tar xpvf debian12-arm64.tar.gz --numeric-owner
mkdir sdcard
mkdir dev/shm
- Create a start script:
cd ../
vi start_debian.sh
Copy and paste the following:
#!/bin/sh
#Path of DEBIAN rootfs
DEBIANPATH="/data/local/tmp/chrootDebian"
# Fix setuid issue
busybox mount -o remount,dev,suid /data
busybox mount --bind /dev $DEBIANPATH/dev
busybox mount --bind /sys $DEBIANPATH/sys
busybox mount --bind /proc $DEBIANPATH/proc
busybox mount -t devpts devpts $DEBIANPATH/dev/pts
# /dev/shm for Electron apps
mkdir $DEBIANPATH/dev/shm
busybox mount -t tmpfs -o size=256M tmpfs $DEBIANPATH/dev/shm
# Mount sdcard
mkdir $DEBIANPATH/sdcard
busybox mount --bind /sdcard $DEBIANPATH/sdcard
# chroot into DEBIAN
busybox chroot $DEBIANPATH /bin/su - root
- Make the script executable and run it:
chmod +x start_debian.sh
sh start_debian.sh
- The prompt will change to
root@localhost
. If you need to return to Termux just writeexit
. Let's execute some fixes:
echo "nameserver 8.8.8.8" > /etc/resolv.conf
echo "127.0.0.1 localhost" > /etc/hosts
groupadd -g 3003 aid_inet
groupadd -g 3004 aid_net_raw
groupadd -g 1003 aid_graphics
usermod -g 3003 -G 3003,3004 -a _apt
usermod -G 3003 -a root
apt update
apt upgrade
apt install nano vim net-tools sudo git
- Create a new user called
droidmaster
(or the name you prefer)
groupadd storage
groupadd wheel
useradd -m -g users -G wheel,audio,video,storage,aid_inet -s /bin/bash droidmaster
passwd droidmaster
- Add the created user to sudoers file to have superuser privileges:
nano /etc/sudoers
Add this line:
droidmaster ALL=(ALL:ALL) ALL
- Install Desktop Environment:
- XFCE4
sudo apt install xfce4
- Exit chroot and modify the
start_debian.sh
script created on step5
:
vi /data/local/tmp/start_debian.sh
Change the last line busybox chroot $DEBIANPATH /bin/su - root
to this line:
busybox chroot $DEBIANPATH /bin/su - droidmaster -c 'export DISPLAY=:0 && export PULSE_SERVER=127.0.0.1 && dbus-launch --exit-with-session startxfce4'
- Let's run the Desktop Environment. Exit chroot environment and copy the following commands on Termux (you can close everything an reopen Termux to be sure you are outside chroot).
wget https://raw.githubusercontent.com/LinuxDroidMaster/Termux-Desktops/main/scripts/chroot/debian/startxfce4_chrootDebian.sh
chmod +x startxfce4_chrootDebian.sh
./startxfce4_chrootDebian.sh