Running Ubuntu/Linux on Android Phones have become very powerful these days. Its easy to find an Android phone under $200 that is capable of powering up a desktop computer with decent performance. I was thinking about setting up a media server in my home network so I can watch movies and TV shows on all devices, I was convinced to use a Raspberry Pie for this but then I thought what if I use my Android phone for the same, its much more capable than a pie and has a lot hardware capabilities that the pie doesn’t offer out of the box. So I set course and took out my old Android phone, did some hacking and got the media server working on it. Its a long process to setup the media server and the first step in getting their is to install Ubuntu or any other Linux distribution on the Android phone. I’ll talk about the media server setup some other day but lets see how to install Ubuntu on Android.
Getting the device ready
Most of the people I know have at least one abandoned Android phone. Though its completely fine to do, I don’t recommend using your primary phone to follow this post as it would end your phone’s warranty. If you are willing to take the risk you can still follow. First, make sure you have the following items checked:
- A phone running Android 7+ with root access
- Basic knowledge of Linux and ssh
- Internet connection
I have tested this approach on the following configurations
- Xiaomi Redmi Note 5 Pro, running Lineage OS 17.1(Android 10), Qualcomm SDM636 Snapdragon 636 arm64 processor
- Xiaomi Redmi 1s, running Lineage OS 14.1(Android 7.1.2) Qualcomm MSM8228 Snapdragon 400 ARM processor
Configuration
Linux Deploy is an app that makes this process easy, go ahead and install the app from Google Play Store. You will need root access enabled on your device to get it working. The app greets you with a screen like in the screenshot below, please not that I am currently using version 2.6.0 it might differ if you use another app version.
The instructions are pretty straight-forward and needs no explanation. Tap on the little settings button at the bottom right and you’ll see a screen as shown below, you can follow the configuration you see here or you can change according to your preference. One important thing to choose is the architecture, in the screenshot you see arm64
which is same as the android phone’s CPU architecture. Its fine to use other architectures as well but I recommend choosing the one which is most compatible with the software you are going to install in the future. The media server I wanted to install works well with the arm64
. Also, if you don’t know the CPU architecture of your phone you can install CPU-Z from the play store.
More about configuration:
- Image Size - Consider this as the partition size for your Linux installation.
- Username & Password - Use anything, we will use it to login with ssh
- Privileged Users - Additional custom permissions for the user
- Mount points - Use it to mount your internal or external sdcard to use in Ubuntu, more on this later
- SSH - Enable this, we want to access this system inside our home network with ssh.
- Audio - We don’t need it for our usecase
- GUI - Since most of the time we will be accessing it through SSH I have skipped the GUI part. If you need GUI then you can setup a VNC viewer and configure it easily.
This is all the configuration that we need for now. Tap on the three dots on the top right and select Install
, the app will be downloading the entire linux image based on our configuration. Depending on your internet speed, if everything went well, you should see a screen as shown below. Now tap on the Start
button on the bottom left. The app will validate the configuration and start all the services of the Linux distribution. The result is a fully functional linux operating system just like we have on a desktop computer.
At this point we can access this system using ssh. The IP is shown at the top, for me its 192.168.0.137
, it might be different for you. From a computer in the same network, you can use the below commands in any shell to login and when it asks for the password just use the password you entered during the configuration, if you forgot your password you can get it by tapping on the settings button on the bottom right.
ssh <username>@<IP>
// if your user name is android and IP is 192.168.0.137, use:
ssh android@192.168.0.137
// Type yes when it asks you to continue connecting to the host
// and enter your password when it asks for it
You are now logged-in to the system and can perform any operations as you want. If you want to avoid entering your password when you login, you can put the public ssh key of your computer in the ~/.ssh/authorized_keys
file. If its not there you’ll have to create it, you can easily find articles on the web if you don’t know how to do it.
Mounting internal and external sdcard
If you are not able to access the phone’s internal storage in the linux file system you will have to map the mount path of the storage in Android file system to a mount point in linux file system. To do this you have to find where is the sdcard mounted in the Android, there are two ways, one with adb
and other by installing any file manager app
. I am going to tell you the adb
way because I don’t want to install any other app for a small usecase. Connect your phone to your computer, make sure USB debugging is enabled, from the terminal execute the following commands
➜ ~ adb devices
List of devices attached
f4936abb device
➜ ~ adb shell
whyred:/ $ df
Filesystem 1K-blocks Used Available Use% Mounted on
tmpfs 2917628 1020 2916608 1% /dev
tmpfs 2917628 0 2917628 0% /mnt
tmpfs 2917628 0 2917628 0% /apex
/dev/block/mmcblk0p61 3096336 1637424 1442528 54% /
/dev/block/mmcblk0p62 806288 414160 375744 53% /vendor
tmpfs 2917628 6432 2911196 1% /sbin
/dev/block/mmcblk0p48 12016 7480 4212 64% /vendor/dsp
/dev/block/mmcblk0p60 237536 212 229464 1% /cache
/sbin/.magisk/block/data 52885008 8501436 44236116 17% /sbin/.magisk/modules
/data/media 52885008 8501436 44236116 17% /storage/emulated
whyred:/ $
As you can guess by the size of the partition, the internal storage in my device is mounted on /storage/emulated
.
Now just create a mount path in linux file system for this path. Open the Linux Deploy app on your phone, stop the container if its running. Go to the mount points settings and tap on the plus button on the top right.
The Android path /storage/emulated
goes in the Source
field and the linux path goes in the Target
. Tap on OK
and start the container again, login to the system and see if you can access the sdcard. You will probably see Permission Denied
error when you try to access the folder, its because the user is not part of the root
or aid_everybody
groups you can check that by the command
$ ls -l
total 8
drwx--x--x. 3 root aid_everybody 4096 Jul 17 21:00 sdcard
$ groups android
android : android aid_graphics aid_sdcard_rw aid_inet
We can fix that by adding the linux user(android in my case) to the aid_everybody
group. Use the command below to do this, you will have to logout and then login again to let this change take effect.
$ sudo usermod -a -G aid_everybody android
$ exit
Connection to 192.168.0.137 closed.
// Login again and check
$ cd sdcard
$ ls
0
$ ls -l 0
total 1623408
drwxrwx---. 2 root aid_everybody 4096 Jun 17 09:02 Alarms
drwxrwx---. 4 root aid_everybody 4096 Jun 17 09:02 Android
drwxrwx---. 3 root aid_everybody 4096 Jun 19 10:33 DCIM
drwxrwx---. 2 root aid_everybody 4096 Jun 17 13:26 Documents
drwxrwx---. 4 root aid_everybody 4096 Jul 18 08:36 Download
-rw-rw----. 1 root aid_everybody 8589934592 Jul 24 19:57 linux.img
drwxrwx---. 3 root aid_everybody 4096 Jun 17 13:25 Movies
drwxrwx---. 2 root aid_everybody 4096 Jun 17 09:02 Music
drwxrwx---. 2 root aid_everybody 4096 Jun 17 09:02 Notifications
drwxrwx---. 5 root aid_everybody 4096 Jul 15 18:14 Pictures
drwxrwx---. 2 root aid_everybody 4096 Jun 17 09:02 Podcasts
drwxrwx---. 2 root aid_everybody 4096 Jun 17 09:02 Ringtones
drwxrwx---. 2 root aid_everybody 4096 Jun 17 09:51 Shows
For external sdcard, just repeat these steps and use the correct mount points to access all the files on it.
Okay, that’s all folks, if you reached here you have a fully functional linux machine. This was a long process, but we are just getting started, there’s a lot more we can achieve with it. In the future posts I will be telling you how you can extend this
- As an ad-block proxy server for your home network with Pi-Hole.
- A media server to stream your favorite movies and TV Shows with Plex.
If you have more ideas in mind please let me know. :)
Phones have become very powerful these days. Its easy to find an Android phone under $200 that is capable of powering up a desktop computer with decent performance. I was thinking about setting up a media server in my home network so I can watch movies and TV shows on all devices, I was convinced to use a Raspberry Pie for this but then I thought what if I use my Android phone for the same, its much more capable than a pie and has a lot hardware capabilities that the pie doesn’t offer out of the box. So I set course and took out my old Android phone, did some hacking and got the media server working on it. Its a long process to setup the media server and the first step in getting their is to install Ubuntu or any other Linux distribution on the Android phone. I’ll talk about the media server setup some other day but lets see how to install Ubuntu on Android.
Getting the device ready
Most of the people I know have at least one abandoned Android phone. Though its completely fine to do, I don’t recommend using your primary phone to follow this post as it would end your phone’s warranty. If you are willing to take the risk you can still follow. First, make sure you have the following items checked:
- A phone running Android 7+ with root access
- Basic knowledge of Linux and ssh
- Internet connection
I have tested this approach on the following configurations
- Xiaomi Redmi Note 5 Pro, running Lineage OS 17.1(Android 10), Qualcomm SDM636 Snapdragon 636 arm64 processor
- Xiaomi Redmi 1s, running Lineage OS 14.1(Android 7.1.2) Qualcomm MSM8228 Snapdragon 400 ARM processor
Configuration
Linux Deploy is an app that makes this process easy, go ahead and install the app from Google Play Store. You will need root access enabled on your device to get it working. The app greets you with a screen like in the screenshot below, please not that I am currently using version 2.6.0 it might differ if you use another app version.

The instructions are pretty straight-forward and needs no explanation. Tap on the little settings button at the bottom right and you’ll see a screen as shown below, you can follow the configuration you see here or you can change according to your preference. One important thing to choose is the architecture, in the screenshot you see arm64
which is same as the android phone’s CPU architecture. Its fine to use other architectures as well but I recommend choosing the one which is most compatible with the software you are going to install in the future. The media server I wanted to install works well with the arm64
. Also, if you don’t know the CPU architecture of your phone you can install CPU-Z from the play store.




More about configuration:
- Image Size - Consider this as the partition size for your Linux installation.
- Username & Password - Use anything, we will use it to login with ssh
- Privileged Users - Additional custom permissions for the user
- Mount points - Use it to mount your internal or external sdcard to use in Ubuntu, more on this later
- SSH - Enable this, we want to access this system inside our home network with ssh.
- Audio - We don’t need it for our usecase
- GUI - Since most of the time we will be accessing it through SSH I have skipped the GUI part. If you need GUI then you can setup a VNC viewer and configure it easily.
This is all the configuration that we need for now. Tap on the three dots on the top right and select Install
, the app will be downloading the entire linux image based on our configuration. Depending on your internet speed, if everything went well, you should see a screen as shown below. Now tap on the Start
button on the bottom left. The app will validate the configuration and start all the services of the Linux distribution. The result is a fully functional linux operating system just like we have on a desktop computer.


At this point we can access this system using ssh. The IP is shown at the top, for me its 192.168.0.137
, it might be different for you. From a computer in the same network, you can use the below commands in any shell to login and when it asks for the password just use the password you entered during the configuration, if you forgot your password you can get it by tapping on the settings button on the bottom right.
ssh <username>@<IP>
// if your user name is android and IP is 192.168.0.137, use:
ssh android@192.168.0.137
// Type yes when it asks you to continue connecting to the host
// and enter your password when it asks for it
You are now logged-in to the system and can perform any operations as you want. If you want to avoid entering your password when you login, you can put the public ssh key of your computer in the ~/.ssh/authorized_keys
file. If its not there you’ll have to create it, you can easily find articles on the web if you don’t know how to do it.

Mounting internal and external sdcard
If you are not able to access the phone’s internal storage in the linux file system you will have to map the mount path of the storage in Android file system to a mount point in linux file system. To do this you have to find where is the sdcard mounted in the Android, there are two ways, one with adb
and other by installing any file manager app
. I am going to tell you the adb
way because I don’t want to install any other app for a small usecase. Connect your phone to your computer, make sure USB debugging is enabled, from the terminal execute the following commands
➜ ~ adb devices
List of devices attached
f4936abb device
➜ ~ adb shell
whyred:/ $ df
Filesystem 1K-blocks Used Available Use% Mounted on
tmpfs 2917628 1020 2916608 1% /dev
tmpfs 2917628 0 2917628 0% /mnt
tmpfs 2917628 0 2917628 0% /apex
/dev/block/mmcblk0p61 3096336 1637424 1442528 54% /
/dev/block/mmcblk0p62 806288 414160 375744 53% /vendor
tmpfs 2917628 6432 2911196 1% /sbin
/dev/block/mmcblk0p48 12016 7480 4212 64% /vendor/dsp
/dev/block/mmcblk0p60 237536 212 229464 1% /cache
/sbin/.magisk/block/data 52885008 8501436 44236116 17% /sbin/.magisk/modules
/data/media 52885008 8501436 44236116 17% /storage/emulated
whyred:/ $
As you can guess by the size of the partition, the internal storage in my device is mounted on /storage/emulated
.
Now just create a mount path in linux file system for this path. Open the Linux Deploy app on your phone, stop the container if its running. Go to the mount points settings and tap on the plus button on the top right.

The Android path /storage/emulated
goes in the Source
field and the linux path goes in the Target
. Tap on OK
and start the container again, login to the system and see if you can access the sdcard. You will probably see Permission Denied
error when you try to access the folder, its because the user is not part of the root
or aid_everybody
groups you can check that by the command
$ ls -l
total 8
drwx--x--x. 3 root aid_everybody 4096 Jul 17 21:00 sdcard
$ groups android
android : android aid_graphics aid_sdcard_rw aid_inet
We can fix that by adding the linux user(android in my case) to the aid_everybody
group. Use the command below to do this, you will have to logout and then login again to let this change take effect.
$ sudo usermod -a -G aid_everybody android
$ exit
Connection to 192.168.0.137 closed.
// Login again and check
$ cd sdcard
$ ls
0
$ ls -l 0
total 1623408
drwxrwx---. 2 root aid_everybody 4096 Jun 17 09:02 Alarms
drwxrwx---. 4 root aid_everybody 4096 Jun 17 09:02 Android
drwxrwx---. 3 root aid_everybody 4096 Jun 19 10:33 DCIM
drwxrwx---. 2 root aid_everybody 4096 Jun 17 13:26 Documents
drwxrwx---. 4 root aid_everybody 4096 Jul 18 08:36 Download
-rw-rw----. 1 root aid_everybody 8589934592 Jul 24 19:57 linux.img
drwxrwx---. 3 root aid_everybody 4096 Jun 17 13:25 Movies
drwxrwx---. 2 root aid_everybody 4096 Jun 17 09:02 Music
drwxrwx---. 2 root aid_everybody 4096 Jun 17 09:02 Notifications
drwxrwx---. 5 root aid_everybody 4096 Jul 15 18:14 Pictures
drwxrwx---. 2 root aid_everybody 4096 Jun 17 09:02 Podcasts
drwxrwx---. 2 root aid_everybody 4096 Jun 17 09:02 Ringtones
drwxrwx---. 2 root aid_everybody 4096 Jun 17 09:51 Shows
For external sdcard, just repeat these steps and use the correct mount points to access all the files on it.
Okay, that’s all folks, if you reached here you have a fully functional linux machine. This was a long process, but we are just getting started, there’s a lot more we can achieve with it. In the future posts I will be telling you how you can extend this
- As an ad-block proxy server for your home network with Pi-Hole.
- A media server to stream your favorite movies and TV Shows with Plex.
If you have more ideas in mind please let me know. :)