Virtual Debian Environment¶
You can create a complete Debian environment usable within Android through the FIRERPA add-on module, similar to the functionality provided by Termux or androdeb. You can use apt to install software and compile code in this environment, and likewise, you can compile and use BPF-related programs within it. It is a near-complete Linux environment running on Android devices.
Hint
The Debian environment only contains basic software packages. You need to use apt to install common commands such as git and python3 yourself.
Installing the Environment¶
Hint
Starting from version 10.5, you no longer need to manually download the Debian mod in this step. Simply execute the debian command directly in the remote desktop terminal, and it will automatically download and install the rootfs from GitHub. Of course, if your network environment causes slow downloads or prevents downloads, you can still manually perform the following installation steps.
You can find lamda-mod-debian-arm64-v8a.tar.gz on the project's release page (please download the corresponding installation package based on your machine architecture). After downloading, open the remote desktop and drag the downloaded file to upload it to the device (we assume you have not modified the remote desktop's file upload directory), then perform the following installation operations. This installation operation does not need to be repeated.
Hint
Files you upload via the remote desktop will be in the ~/uploads directory by default.
tar -C ~/modules -xzf ~/uploads/lamda-mod-debian-arm64-v8a.tar.gz
After executing the command, the installation is complete. The following explains how to enter the system.
Entering the Environment¶
After installing the relevant environment's file system, we can execute commands to enter the virtual Debian environment. The Debian environment has been installed to ~/modules/debian, and you can execute the following command to enter the Debian interactive terminal.
debian /bin/bash
If you only need to execute a command once, such as executing the id command, you can use it like this:
debian /bin/bash -c id
Attention
Only one instance can enter the virtual environment at a time. If you keep the session open after executing debian /bin/bash, executing this command again in another terminal will return an error. Please exit the previous debian session before trying again.
Advanced Usage¶
We will introduce a simple advanced usage. Once completed, you can run SSH services or Python scripts in the environment without being limited by the number of sessions. First, execute the following command to enter the virtual environment.
debian /bin/bash
You should now be inside the virtual environment. Follow along and execute the commands below.
apt update
apt install -y openssh-server procps python3 python3-pip python3-dev
echo 'PermitRootLogin yes' >> /etc/ssh/sshd_config
echo 'StrictModes no' >> /etc/ssh/sshd_config
mkdir -p /run/sshd
# Change the root password
echo root:lamda|chpasswd
# Exit the debian environment
exit
Now execute the command to start our SSH server.
debian /usr/sbin/sshd -D -e
The above command will occupy the current terminal (freeze it). To avoid this, you can also use the built-in scheduled tasks to make the SSH service start automatically with the FIRERPA service. Next, execute crontab -e and write the following rule in it, then restart the FIRERPA service or device. For documentation on using scheduled tasks, you can also refer to the Scheduled Tasks chapter.
@reboot debian /usr/sbin/sshd -D -e >~/sshd.log 2>&1
Now obtain the device's IP address, then execute the following command on your computer and enter the password lamda to log in.
ssh root@192.168.x.x
You can continue to explore all kinds of creative ideas and create infinite possibilities. It is a small Linux server.