Before Installing Debian
table of contents
To install Debian on an Android device, we will work with different shells as different users on different systems, so (before we begin) we must define a few shortcuts that tell the reader which commands should be run as which user on which system. For that purpose, we'll define:
a$ == Android user prompt
a# == Android root prompt
d$ == Debian user prompt
d# == Debian root prompt
c$ == desktop computer user prompt
c# == desktop computer root prompt
Assuming that you already have Debian installed on your desktop computer, you can install other necessary tools with:
c# apt-get install android-tools-adb gparted xtightvncviewer
The android-tools-adb package provides Android Debug Bridge (ADB), a command line tool for communicating with an Android device. In our case, it provides a convenient alternative to typing commands directly into your phone. Instead, you simply connect your phone to your desktop computer (via USB) and run the commands over ADB. For example, the command:
c$ adb shell
will drop you into an Android shell with the prompt: "shell@android:/ $ ".
partitioning your SD card
If you will be installing Debian onto an SD card, then you will have to divide space on the card according to your own personal needs. If your needs are similar to mine, then you may want one VFAT partition for your music and photos, one EXT2 partition for your Debian installation and a second EXT2 partition for the files that your Debian user will work with (documents, spreadsheets, etc.).
I have a 32 GB card, so I used GParted to create three partitions. The first partition must be a VFAT partition. (It's the location that the Android system uses for music and photos). I shrank it down to 8 GB. For my files, I created an EXT2 partition in the next 16 GB of space. And at the end, I created a 6 GB partition to hold the Debian system.
To reduce the number of writes to your SD card, you should either use the EXT2 file system or turn off journaling in EXT3/4. For this project, I am using EXT2.
Here's a table that summarizes my layout (as seen by the Android system):
Note that in complete violation of all UNIX conventions, the Android system assigns each application to a unique user and runs the application as that user. The purpose of this strange arrangement is to enhance Android security by "sandboxing" each application into its own space. (Sandboxing isolates each application's data and code execution from other applications).
This does not create any file permissions problems when Android applications save their data to a FAT file system (which has no concept of file permissions). It creates all sorts of problems on an EXT2 partition however, so you should not let Android applications save to the EXT2 partition.
A simple method of preventing Android applications from saving to the EXT2 partition is presented in the page about access to an external SD card.
Copyright © 2014-2022 Eryk Wdowiak