Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 18 additions & 15 deletions Documentation/chroot/ubuntu_chroot.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@


1. First you need to have your device <u>rooted</u>.
2. You need to flash [Busybox NDK](https://github.com/Magisk-Modules-Repo/busybox-ndk) with Magisk.
2. You need to flash [Busybox NDK](https://github.com/Magisk-Modules-Repo/busybox-ndk) with Magisk or if you use kernelSU you may use it's bundled busybox binary.
3. Then you need to install the following packages in Termux:

```
pkg update \
&& pkg install x11-repo root-repo \
&& pkg install termux-x11-nightly sudo pulseaudio
&& pkg install termux-x11-nightly sudo pulseaudio wget
```


Expand All @@ -48,35 +48,37 @@ These steps are from Ivon's blog but I've modified some of the lines. These are
su
```

2. Create a directory at `/data/local/tmp` for chroot environment
2. Create a directory at `/data/local` for chroot environment and fix potential permission issues
```
mkdir /data/local/tmp/chrootubuntu
cd /data/local/tmp/chrootubuntu
mkdir -p /data/local/chroot/ubuntu
chmod 755 /data/local/chroot/ubuntu
chown root:root /data/local/chroot/ubuntu
cd /data/local/chroot/ubuntu
```

3. Download [Ubuntu 24.04 LTS](https://cdimage.ubuntu.com/ubuntu-base/releases/24.04/release/) rootfs:
```
curl https://cdimage.ubuntu.com/ubuntu-base/releases/24.04/release/ubuntu-base-24.04.3-base-arm64.tar.gz -o ubuntu.tar.gz
curl https://cdimage.ubuntu.com/ubuntu-base/releases/24.04/release/ubuntu-base-24.04.4-base-arm64.tar.gz -o ubuntu.tar.gz

```

4. Extract the downloaded file and create sdcard folder
```
tar xpvf ubuntu.tar.gz --numeric-owner
mkdir sdcard
mkdir -p sdcard
```

5. Create startup script:
```
cd ..
vi start_ubuntu.sh
busybox vi start_ubuntu.sh
```
Copy and paste the following:
```
#!/bin/sh

# The path of Ubuntu rootfs
UBUNTUPATH="/data/local/tmp/chrootubuntu"
UBUNTUPATH="/data/local/chroot/ubuntu"

# Fix setuid issue
busybox mount -o remount,dev,suid /data
Expand Down Expand Up @@ -106,7 +108,8 @@ sh start_ubuntu.sh
7. The prompt will change to `root@localhost`. If you need to return to Termux just write `exit`. Let's perform some fixes:
```
echo "nameserver 8.8.8.8" > /etc/resolv.conf
echo "127.0.0.1 localhost" > /etc/hosts
echo "127.0.0.1 localhost
::1 localhost" > /etc/hosts

groupadd -g 3003 aid_inet
groupadd -g 3004 aid_net_raw
Expand All @@ -119,7 +122,7 @@ apt update && apt upgrade
apt install nano vim net-tools sudo git
```

8. Set timezone the interactive shell should prompt you to select your timezone if it doesn't run this:
8. Set timezone. The interactive shell should prompt you to select your timezone if it doesn't run this:
```
dpkg-reconfigure tzdata
```
Expand Down Expand Up @@ -177,7 +180,7 @@ EOF

14. Exit chroot and modify the `start_ubuntu.sh` script created on step `5`:
```
vi /data/local/tmp/start_ubuntu.sh
vi /data/local/chroot/start_ubuntu.sh
```
Comment the last line `busybox chroot $UBUNTUPATH /bin/su - root` and write the following line under it:
```
Expand All @@ -187,7 +190,7 @@ If you've installed a different Desktop Environment you need to replace `startxf

15. Let's run the Desktop Environment. Exit chroot environment and download the script with wget and start it on Termux (you can close everything and reopen Termux to be sure you are outside chroot).
```
wget https://raw.githubusercontent.com/LinuxDroidMaster/Termux-Desktops/main/scripts/chroot/ubuntu/startxfce4_chrootubuntu.sh
wget https://raw.githubusercontent.com/LinuxDroidMaster/Termux-Desktops/refs/heads/main/scripts/chroot/ubuntu/startxfce4_chrootubuntu.sh

chmod +x startxfce4_chrootubuntu.sh
./startxfce4_chrootubuntu.sh
Expand All @@ -201,11 +204,11 @@ chmod +x startxfce4_chrootubuntu.sh

* Download Ubuntu 24.04 rootfs:
```
curl https://cdimage.ubuntu.com/ubuntu-base/releases/24.04/release/ubuntu-base-24.04.3-base-arm64.tar.gz -o ubuntu.tar.gz
curl https://cdimage.ubuntu.com/ubuntu-base/releases/24.04/release/ubuntu-base-24.04.4-base-arm64.tar.gz -o ubuntu.tar.gz
```

---
A note if you want to use firefox use the apt repository it's recommended [Firefox](https://support.mozilla.org/en-US/kb/install-firefox-linux).
* Note if you want to use firefox use the apt repository it's recommended [Firefox](https://support.mozilla.org/en-US/kb/install-firefox-linux#w_install-firefox-deb-package-for-debian-based-distributions-recommended).
<br>

## 🎨 Customizations (Nerdfonts, XFCE4 terminal color palettes, etc) <a name=customizations-chroot></a>
Expand Down
143 changes: 101 additions & 42 deletions Documentation/proot/ubuntu_proot.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## PROOT-DISTRO (🟠 UBUNTU)
* 🏁 [First steps](#first-steps-ubuntu-proot)
* ⬇️ [Download scripts to run the desktops](#easy-download-ubuntu-proot)
* ⬇️ [Download scripts to run the desktops](#script-download-ubuntu-proot)
* ⚙️ [Installing Desktops](#installing-desktops-ubuntu-proot)

<br>
Expand All @@ -15,7 +15,7 @@
## 🏁 First steps <a name=first-steps-ubuntu-proot></a>

> [!NOTE]
> All the process is described in more detail in this [video](https://www.youtube.com/watch?v=_vxhzSG2zVQ) (ourdated).
> All the process is described in more detail in this [video](https://www.youtube.com/watch?v=_vxhzSG2zVQ) (outdated).

First you need to install the following packages in Termux:
```
Expand All @@ -33,58 +33,94 @@ proot-distro login ubuntu
Update repositories and install any package you want:
```
apt update && apt upgrade

apt install sudo vim -y
```

---
<br>
---
<br>

## ⬇️ Download launch scripts: <a name=script-download-ubuntu-proot></a>

## ⬇️ Download scripts easily: <a name=easy-download-ubuntu-proot></a>
* startgnome_ubuntu.sh
```
wget https://raw.githubusercontent.com/LinuxDroidMaster/Termux-Desktops/main/scripts/proot_ubuntu/startgnome_ubuntu.sh
```
* startxfce4_ubuntu.sh

```
wget https://raw.githubusercontent.com/LinuxDroidMaster/Termux-Desktops/main/scripts/proot_ubuntu/startxfce4_ubuntu.sh
```

* startplasma_ubuntu.sh

```
wget https://raw.githubusercontent.com/LinuxDroidMaster/Termux-Desktops/main/scripts/proot_ubuntu/startplasma_ubuntu.sh
```

---
<br>

# ⚙️ Installing Desktops <a name=installing-desktops-ubuntu-proot></a>

I have use the following [post](https://ivonblog.com/en-us/posts/termux-proot-distro-ubuntu/) from Ivon's blog as a reference for some steps.
I have use the following [post](https://ivonblog.com/en-us/posts/termux-proot-distro-ubuntu/) from Ivon's blog as a reference for some steps.

<br>
## ️️🖥️ Desktop environments

<details>
<summary><strong> GNOME </strong></summary>
1. Remove PPA:

<br>
```
# install ppa-purge
apt install ppa-purge

> [!NOTE]
> All the process is described in more detail in this [video](https://www.youtube.com/watch?v=_vxhzSG2zVQ).
# remove mozilla team ppa
ppa-purge ppa:mozillateam/ppa
```

<br>
Remove preference files so it doesn't use the ppa:

```
# use ppa-purge
ppa-purge ppa:mozillateam/ppa

# remove ppa-purge
apt autopurge ppa-purge
```
# Commands:
proot-distro login ubuntu --user droidmaster

2. Create a new user and switch to the newly created user:

```
adduser droidmaster
su - droidmaster
```
sudo apt install dbus-x11 ubuntu-desktop -y

3. Install the desktop environment:

* XFCE4

```
Run this command after it finishes:
apt install xubuntu-desktop -y
```
for file in $(find /usr -type f -iname "*login1*"); do rm -rf $file
done

* Remove snap it cannot be used inside termux without a specialized setup.

```
Disable snapd as it doesn't work on Termux
cat <<EOF | tee /etc/apt/preferences.d/nosnap.pref
# To prevent repository packages from triggering the installation of Snap,
# this file forbids snapd from being installed by APT.
# For more information: https://linuxmint-user-guide.readthedocs.io/en/latest/snap.html
Package: snapd
Pin: release a=*
Pin-Priority: -10
EOF
```


* KDE PLASMA

```
cat <<EOF | sudo tee /etc/apt/preferences.d/nosnap.pref
apt install kubuntu-desktop -y
```

* Remove snap it cannot be used inside termux without a specialized setup.

```
cat <<EOF | tee /etc/apt/preferences.d/nosnap.pref
# To prevent repository packages from triggering the installation of Snap,
# this file forbids snapd from being installed by APT.
# For more information: https://linuxmint-user-guide.readthedocs.io/en/latest/snap.html
Expand All @@ -94,30 +130,53 @@ Pin-Priority: -10
EOF
```

Install firefox:
* CINNAMON

```
sudo add-apt-repository ppa:mozillateam/ppa
sudo apt-get update
sudo apt-get install firefox-esr
apt install ubuntucinnamon-desktop
```

Now you can run Ubuntu with GNOME UI from the script I left in the `Download scripts easily` section:
* Remove snap it cannot be used inside termux without a specialized setup.

```
chmod +x startgnome_ubuntu.sh
./startgnome_ubuntu.sh
cat <<EOF | tee /etc/apt/preferences.d/nosnap.pref
# To prevent repository packages from triggering the installation of Snap,
# this file forbids snapd from being installed by APT.
# For more information: https://linuxmint-user-guide.readthedocs.io/en/latest/snap.html
Package: snapd
Pin: release a=*
Pin-Priority: -10
EOF
```
</details>

<br>
## 🦊 Install Firefox
Note I used the official Mozilla [support page](https://support.mozilla.or/g/en-US/kb/install-firefox-linux#w_install-firefox-deb-package-for-debian-based-distributions-recommended) for the content below.

<details>
<summary><strong> Other desktosp (XFCE4, Mate, LXDE, etc) </strong></summary>
<br>
* Import the Mozilla APT repository signing key:

```
wget -q https://packages.mozilla.org/apt/repo-signing-key.gpg -O- | sudo tee /etc/apt/keyrings/packages.mozilla.org.asc > /dev/null
```

Follow the same [installation steps](https://github.com/LinuxDroidMaster/Termux-Desktops/blob/main/Documentation/proot/debian_proot.md#installing-desktops) as for Debian.
* Next, add the Mozilla APT repository to your sources.list:
```
cat <<EOF | sudo tee /etc/apt/sources.list.d/mozilla.sources
Types: deb
URIs: https://packages.mozilla.org/apt
Suites: mozilla
Components: main
Signed-By: /etc/apt/keyrings/packages.mozilla.org.asc
EOF
```

</details>
* Configure APT to prioritize packages from the Mozilla repository:

---

```
echo '
Package: *
Pin: origin packages.mozilla.org
Pin-Priority: 1000
' | sudo tee /etc/apt/preferences.d/mozilla
```

---
4 changes: 2 additions & 2 deletions README_old.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Collection of scripts to launch Desktops with audio in Termux X11. You have also
### PROOT-DISTRO (🟠 UBUNTU)
* 🏁 [First steps](#first-steps-ubuntu-proot)
* ⚙️ [Installing Desktops](#installing-desktops-ubuntu-proot)
* ⬇️ [Download scripts to run the desktops](#easy-download-ubuntu-proot)
* ⬇️ [Download scripts to run the desktops](#script-download-ubuntu-proot)

### PROOT-DISTRO (🔼 ARCH)
* 🏁 [First steps](#first-steps-arch)
Expand Down Expand Up @@ -268,7 +268,7 @@ apt install sudo nano adduser -y
---
<br>

## ⬇️ Download scripts easily: <a name=easy-download-ubuntu-proot></a>
## ⬇️ Download scripts easily: <a name=script-download-ubuntu-proot></a>
* startgnome_ubuntu.sh
```
wget https://raw.githubusercontent.com/LinuxDroidMaster/Termux-Desktops/main/scripts/proot_ubuntu/startgnome_ubuntu.sh
Expand Down
2 changes: 1 addition & 1 deletion scripts/chroot/ubuntu/start_ubunut.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/sh

# Ubuntu rootfs path
UBUNTUPATH="/data/local/tmp/chrootubuntu"
UBUNTUPATH="/data/local/chroot/ubuntu"

# Fix setuid issue
busybox mount -o remount,dev,suid /data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ killall -9 termux-x11 Xwayland pulseaudio virgl_test_server_android termux-wake-
# Start Termux-X11
am start --user 0 -n com.termux.x11/com.termux.x11.MainActivity

sudo mkdir -p /data/local/tmp/chrootubuntu/tmp
sudo busybox mount --bind $PREFIX/tmp /data/local/tmp/chrootubuntu/tmp
sudo mkdir -p /data/local/chroot/ubuntu/tmp
sudo busybox mount --bind $PREFIX/tmp /data/local/chroot/ubuntu/tmp

XDG_RUNTIME_DIR=${TMPDIR} termux-x11 :0 -ac &

Expand All @@ -22,4 +22,4 @@ pacmd load-module module-native-protocol-tcp auth-ip-acl=127.0.0.1 auth-anonymou
#virgl_test_server_android &

# Execute chroot Ubuntu script
su -c "sh /data/local/tmp/start_ubuntu.sh"
su -c "sh /data/local/chroot/start_ubuntu.sh"
27 changes: 27 additions & 0 deletions scripts/proot_ubuntu/startplasma_ubuntu.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/data/data/com.termux/files/usr/bin/bash

# Kill open X11 processes
kill -9 $(pgrep -f "termux.x11") 2>/dev/null

# Enable PulseAudio over Network
pulseaudio --start --load="module-native-protocol-tcp auth-ip-acl=127.0.0.1 auth-anonymous=1" --exit-idle-time=-1

# Prepare termux-x11 session
export XDG_RUNTIME_DIR=${TMPDIR}
termux-x11 :0 >/dev/null &

# Wait a bit until termux-x11 gets started.
sleep 3

# Launch Termux X11 main activity
am start --user 0 -n com.termux.x11/com.termux.x11.MainActivity > /dev/null 2>&1
sleep 1

# Login in PRoot Environment. Do some initialization for PulseAudio, /tmp directory
# and run XFCE4 as user droidmaster.
# See also: https://github.com/termux/proot-distro
# Argument -- acts as terminator of proot-distro login options processing.
# All arguments behind it would not be treated as options of PRoot Distro.
proot-distro login ubuntu --shared-tmp -- /bin/bash -c 'export PULSE_SERVER=127.0.0.1 && export XDG_RUNTIME_DIR=${TMPDIR} && su - droidmaster -c "env DISPLAY=:0 dbus-startup --exit-with-session startplasma-x11"'

exit 0