Install Home Assistant (HASS) on ANDROID with LINUX (Linux Deploy Chroot) [ROOT]

Luca Cesarano
5 min readDec 18, 2020


A few months ago I’ve published a Medium in which it was explained how to install Home Assistant on an Android phone with Termux and NO ROOT.

While that is a convenient choice for not buying a Raspberry and reusing old hardware (protect the environment people!), a rooted phone can do even better.

I got this old piece of Android art called OnePlus 3 that is running a rooted Lineage OS (Android 10) version: a completely debloated ROM that I suggest you to install if you want to dedicate a phone for running servers and similar.

Well, this time I’m going to show you how to install Home Assistant on a Rooted Phone that runs a Chrooted Linux with Linux Deploy.



Linux Deploy is one of the best work I’ve seen made in Android. It allows you to run a full Linux (many distros are available) chrooted FS in Android.

Easy to do, but a little tricky to configure (not because it’s hard, but the UI is a little messy).

Click on the settings icon in the lower corner on the right and configure as you wish:

My configuration is:

  • Debian
  • Armhf
  • Buster
  • Image Size = 8000 (MB)
  • MOUNTS: CHECKED, /sdcard/
  • The rest like username and password is up to you…

Then click on INSTALL in the … icon placed on the upper corner at the right. (it takes around 20 minutes)

After this, click START to run your Linux Machine.

Connect to it via VNC inserting the ip-address, the username and the password… and voilà, a fully functioning Linux ready to serve you.

I’ve customized a little the interface, yours should be white and ugly…

Note: if you want terminal shortcut like tab or arrows make sure you run in bash and not sh

My suggestion is to install some basic stuff like a Text Editor and a Simple Browser.

sudo apt-get install epiphany-browsersudo apt-get install gedit

A couple of tips:

Backing up your distro

in /sdcard there’s a file called linux.img which is the whole Debian Distro, back it up so if you mess up you just have to replace that file. Also you can backup before doing something dangeroud or play risky with the terminal.

That image is resizable as well, so if you need more space, you can run the following commands to resize it:

dd if=/dev/zero bs=1048576 count=3000 >> /mnt/sdcard/linux.imge2fsck -f /mnt/sdcard/linux.imgresize2fs /mnt/sdcard/linux.img

Connect via SSH

You can also connect via SSH if you enabled it during the configuration phase with the command:

ssh user@ -p 22

Especially if you’re open outside LAN, using a static public IP, you should protect yourself from malicious bots. Protect your SSH modifying the file sshd_config in /etc/ssh and:

- use a pair of public / private keys to connect to your SSH (and protect the keys with password)
- disable password authentication
- change default port
- enable strict mode
- use Protocol 2

This should improve a little the protection but look on the internet to know how to effectively protect your connection.


Python 3.8 is necessary because an older version will be deprecated in the next HASS release (at least it’s what they say) so, let’s obey the boss and get the latest Python Version for our machine.

sudo apt-get updatesudo apt-get install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libsqlite3-dev libreadline-dev libffi-dev curl libbz2-devcurl -O -xf Python-3.9.1.tar.xzcd Python-3.9.1
./configure --enable-optimizations
#find the number of processors of your machine running
nproc (in my case is 4)
make -j 4sudo make altinstall

Note: These operations require some time


A virtual environment is a isolated Python Environment where you can install packages via pip and keep it local to that environment. That way, you can avoid doing disaster and undo operations easily without messing up with the OS. And you can also avoid interference between incompatible packages that may be across different projects you have.

So, let’s create a venv (shortcut for virtual environment) for our HASS build.

Okay here the official guide asks to create a user dedicated for the venv but in all honesty I’m having some issues doing it so for now, I skip it, since it’s working fine. Eventually, I’ll push an update including the user creation.

Let’s start:

mkdir hass_venvcd hass_venvpython3.9 -m venv .cd hass_venv. bin/activate

Now you’re inside the virtualenv and you can install the required packages:

Install OS dependencies needed issuing:

apt-get install libjpeg62-turbo-dev zlib1g-dev libfreetype6-dev liblcms2-dev libwebp-dev libharfbuzz-dev libfribidi-dev tcl8.6-dev tk8.6-dev python-tk 
#these are necessary for installing Pillow

Note: I don’t know yet how to install apt-get packages in a isolated way in the virtual environment.

pip install wheelpip install pillow==7.2.0 #version may vary, check hass logpip install PyNaCl==1.3.0 #requires some time, version may varypip install homeassistant# if you need it: pip install mosquittohass -v

Check the output to be sure everything is fine. If you notice a missing package that is not being installed, you can install it with the pip command.

Now Open your favorite browser and browser the ip address of the machine at port :8123 and you should be all set. Configure your user and voilà.

You should be all set.

Boot HASS at startup

If you need to boot HASS automatically at startup, do the following:

#create a file
#inside the file type
. /hass_venv/hass_venv/bin/activate
hass -v
#save the file
#make it executable
chmod 777

Now open the app preinstalled in the vnc environment startup applications and add this .sh to the list.

Note: you could use cron or /etc/init.d instead of this method as well

Remote access to HASS

Follow my guide to set up a Dynamic DNS with so you can your machine (and HASS) remotely.