Installing Home Assistant Supervised on a Raspberry Pi with Debian 11

Installing Home Assistant Supervised on a Raspberry Pi with Debian 11

This guide will help you to install Home Assistant Supervised, on a Raspberry Pi with Debian 11. This guide has been tested on a Raspberry Pi 4 4gb model, with USB3 SSD as the boot drive. This installation takes approx 30 mins to complete, but may be faster/slower depending on the boot drive you use and your internet speed. I completed the install in under 20 mins with the above hardware.

:warning: Using Debian 11 and following a strict set of guidelines available HERE will give you an officially supported installation of Home Assistant Supervised. If you choose at anytime to install additional software to the Debian operating system, your installation will become officially unsupported. Community support via the forums is always available however.

While every effort has been made to ensure this guide complies with ADR-0014, no guarantee can be made it does now, or in the future.

In this guide, you will be using Debian 11 as the operating system. This type of installation is what is called “headless” and after the installation is complete, you will not need to have a keyboard, mouse or monitor attached (although you can if you prefer).

What is Home Assistant Supervised?

Home Assistant is a full UI managed home automation ecosystem that runs Home Assistant Core, the Home Assistant Supervisor and add-ons. It comes pre-installed on Home Assistant OS, but can be installed on any Linux system. It leverages Docker, which is managed by the Home Assistant Supervisor plus the added benefit of dozens of add-ons (think app store) that work natively inside the Home Assistant environment.

If you are new to Home Assistant, you can now proceed to Section 1. If you have an existing Home Assistant installation and need to know how to back up your current configuration, please see the document Backing up and Restoring your configuration located HERE

Section 1 – Install Debian 11

1.1) Start by downloading the correct xz-compressed image for your Pi from HERE. For a Pi 4, you will need the image listed as 4 under Family

1.2) While Debian is downloading, you will need to download some software to burn the Debian xz-compressed image to your SD Card / USB SSD. You will use a program called balenaEtcher, available HERE. Once the Debian image has downloaded, insert your SD Card / USB SSD into your PC and launch Etcher.

Click Select Image and navigate to the location you saved the Debian xz-compressed image, Click Select Target and then choose your SD card / USB SSD, and then click Flash. Depending on the speed of your card / drive this process can take between 1 and 20 minutes to complete.

1.3) Once the image has been written to the SD card / USB SSD, you can safely remove the SD card / USB SSD and plug it into your Pi. Before powering on the Pi, you will need to connect a Network Cable, HDMI cable, Monitor and a keyboard. Once you have done this, you can connect the power cable to your Pi. The initial boot will take a few minutes to complete. When the Pi is ready to use, you will see a screen that looks like this (or similar).

Debian GNU/Linux 11 rpi4-20210823 tty1
rpi4-20210823 login:

When you see this, you can now login using the default username of root.

1.4) First, you will make sure the OS is up to date by entering the following commands one at a time.

apt update && apt upgrade -y
apt install sudo -y

1.5) You will now add a username and make that user part of the sudo group. To do this, run the following command

adduser YOUR_USERNAME

You will now be asked to enter a password twice (make note of this for later). You will then be asked to enter your first name, last name, phone number etc. You can skip through all this by pressing Enter. Now you have added your user, you will need to make it part of the sudo group by running the following command.

usermod -aG sudo YOUR_USERNAME

You will now be able to connect to the Pi via SSH using the username and password you have just created to copy and paste the commands needed to install Home Assistant Supervised. Check your router for the IP address of your Pi, or run the following command in the Terminal and look for the entry inet. You don’t need the /24 or /16 on the end, just the IP which will look like 192.168.1.150, or 10.1.1.15

ip addr show eth0
exit

You will now unplug the monitor and keyboard from the Pi as these will no longer be used. You will continue the installation by connecting to your Pi via SSH using a piece of software called PuTTY (use Terminal on a Mac), available HERE. Putty is a free and open-source terminal emulator, serial console and network file transfer application.

1.6) Open Putty and in the HOST NAME (OR IP ADDRESS) box, enter the IP of your Pi, then select OPEN. You will now be prompted to enter your username and password. This will be the username and password you just setup in step 1.5.

Section 2 - Install OS Agent, Docker and Dependencies

You will now install the OS Agent for Home Assistant. It is used for Home Assistant OS and Home Assistant Supervised installation types and it allows the Home Assistant Supervisor to communicate with the host operating system.

2.1) In Putty terminal run the following commands to update the Debian OS, install Docker and the required dependencies for the OS Agent and the Supervised installer. Execute the following commands one at a time.

sudo -i

apt update && sudo apt upgrade -y && sudo apt autoremove -y

apt --fix-broken install

apt-get install jq curl avahi-daemon apparmor-utils udisks2 libglib2.0-bin network-manager dbus wget -y

curl -fsSL get.docker.com | sh

2.2) Visit the OS Agent page and then replace the version number with the latest available, into the commands below. (i.e. replace all references to 1.2.2 with the latest available)

Execute the following commands one at a time.

wget https://github.com/home-assistant/os-agent/releases/download/1.2.2/os-agent_1.2.2_linux_aarch64.deb

dpkg -i os-agent_1.2.2_linux_aarch64.deb

Section 3 – Install Home Assistant Supervised

With the OS Agent and dependencies installed, you can move on to installing Home Assistant Supervised.

3.1) Enter each line of the below commands into the terminal and execute them one at a time.

If you have rebooted since section 2, make sure you are running as root before executing the below commands.

sudo -i

Execute the following commands one at a time.

wget https://github.com/home-assistant/supervised-installer/releases/latest/download/homeassistant-supervised.deb

dpkg -i homeassistant-supervised.deb

3.2) You may be prompted to choose a machine type during the installation process, if so, choose raspberrypi4-64.

The installation time is generally under 5 mins, however it can take longer so be patient. You can check the progress of Home Assistant setup by connecting to the IP address of your machine in Chrome/Firefox on port 8123. (e.g. http://192.168.1.150:8123)

Once you can see the login screen, the setup has been completed and you can set up an account name and password. If you are new to Home Assistant you can now configure any smart devices that Home Assistant has automatically discovered on your network. If you have an existing Home Assistant install and you have a snapshot or YAML files you wish to restore, refer to the document Backing up and Restoring your configuration.

You have completed the installation of Home Assistant Supervised on your Debian machine. It is recommended that you log into your machine at least once a month and use the following command to download security patches and keep the OS up to date. You can do this directly on the machine itself via the terminal.

sudo apt update && sudo apt upgrade -y && sudo apt autoremove –y

If you have an existing Home Assistant install and you have a snapshot or YAML files you wish to restore, refer to Home Assistant website on backing up and restoring your configuration, located HERE

Section 4 - Unhealthy Installation

If you are faced with the HA Supervisor showing you the 'Unhealthy Installation' error, click here to expand and follow this procedure to fix it.

4.1) Install the SSH & Web Terminal add-on from with the HA Supervisor add-on store. It looks like this.
ssh

Configure the add-on so you can connect to the HA container. Here is an example of a simple working configuration you can use, adjust the username and password to suit.

ssh:
  username: USERNAME
  password: PASSWORD
  authorized_keys: []
  sftp: false
  compatibility_mode: false
  allow_agent_forwarding: false
  allow_remote_port_forwarding: false
  allow_tcp_forwarding: false
zsh: true
share_sessions: false
packages: []
init_commands: []

You will need to change the port to 23 (or other unused port number of your choosing) in the Network section of the Configuration tab. Once you have installed and configured the add-on, move on to the next step.

4.2) Using Putty, login to the HA machine using the IP of the machine and port 23. Use the username and password you configured in the previous step.

4.3) Once logged in you can now execute the following command;

ha jobs options --ignore-conditions healthy

Once you have done this, you should see a message saying, Command completed successfully. You can type exit to leave the shell connection. You can now also turn off/stop the SSH & Web Terminal add-on in HA as you will no longer need it. It can be restarted at anytime.

Capture


Thank you to @Tamsy for input and additional information. I welcome feedback on this guide, please feel free to tag me or PM if you have suggestions on how to make improvements, or find an error that needs correcting.

A link to the old installer information using the installer script can be found on my Github, HERE

36 Likes
Installing Home Assistant Supervised on Raspberry Pi OS
Installing Home Assistant Supervised on Debian 11
HASS.IO or not HASS.IO
Install HA on PI 4 - SSD - Nothing happens
Rpi 4 installation
Install homeassistant 2021 in raspberry pi 4 os
Fix unsupported installation in supervisor
Supervisor fails
Why is it so complex and difficult to install and maintain HomeAssistant?
Home Assistant installation
TileBoard - New dashboard for Homeassistant
Getting NetworkManager/HA IP settings to work properly on a supervised 64 bit Raspberry Pi OS install
Raspberry OS or Home Assistant OS
Installing Home Assistant Supervised on Debian 11
Installing HA on a Raspberry Pi
How can i install older versions?
Installing Home Assistant Supervised on Debian 11
Installing Home Assistant Supervised on Debian 11
HA does not boot off new Flashed card
Why is it so complex and difficult to install and maintain HomeAssistant?
No valid repository for https://github.com/home-assistant/addons
Wrong system time&date - HA on Pi4
Installation on Docker
Installing Home Assistant Supervised on Debian 11
Google Nest Intergration Problem
Unable to update core and supervisor
The MAC address changes on every reboot on Raspbian Lite after installing Home Assistant
Installing Home Assistant Supervised on Debian 11
WARNING: latest docker-ce (20.10.0) not compatible with Home Assistant supervised
Installing Home Assistant Supervised on Debian 11
Local realtime person detection for RTSP cameras
HassIO stops responding every so often
Run Hass OS on VM on Raspberry Pi
Home Assistant Installation Methods - What For Who?
Home Assistant installation on Raspberry Pi 4 along side Raspbian
Installation is unhealthy and cannot install plugins
Basic Information Required
Time out waiting for hardware cmd interrupt Deb 11
No valid repository for https://github.com/home-assistant/addons
Why is it so complex and difficult to install and maintain HomeAssistant?
Installing Home Assistant Supervised on Raspberry Pi OS
"Zzh!" (short for "Zig-a-zig-ah!") open-source hardware licensed Zigbee USB-stick based on TI CC2652R
Would it be possible to write an integration to edit configuration.yaml?
Containers being deleted on reboot
Supervisor Logs Extremely Slow to Open
Another 'HomeAssistantCore.update' blocked from execution, system is not healthy issue
Installing Home Assistant Supervised on Raspberry Pi OS
Nginx Reverse Proxy Set Up Guide – Docker
Installing Home Assistant Supervised on Debian 11
Home assistant stopped responding; GUI not reachable
✔️🆒Argon One Active Cooling Addon
Rasberry Pi B+ installation - docker not installing
Database location in usb stick
Newbie Questions regarding initial setup
Static IP address changes by another system dhcp deamon?
Static IP address changes by another system dhcp deamon?
Can't install hass.io
Install socat to new Home Assistant Blue
Raspberry OS or Home Assistant OS

Well timed - I am just preparing to move from a Raspberry Pi OS SSD install to a supported (for the moment) Debian 10 one. This will save me a bit of stress - thanks.

1 Like

Hi, Thank you very much. I’ve just moved my system from Pi3+ to SSD / Pi4 4GB and thanks to your excellent presentation everything went smoothly including restore.
However, when everything seemed to be a success, an unexpected problem arose.
Have I missed something? After the update to the latest 0.118.2 I cannot create any snapshot. I restored a system from the snapshot which I copied via samba to PI4 backup folder. Could I have messed something there?

I am not sure if this is a coincidence, but via SMB I deleted the backup from Pi3 + and going back to HA I see that the new backup has been saved.

Might have just been a browser cache issue not showing the new snapshot. Are you able to successfully make a snapshot now?

Yes. Everything runs smoothly. Thanks again. And now I see that I missed those 3 dots in a right upper corner “Upload snapshot”, easier way to go.

1 Like

That’s only a recent addition to HA, in 0.116.x or 0.115.x, I can’t remember. Certainly makes things easier than needing to set up Samba or SSH config to restore.

Great guide and you could not have timed it better - Like I always tell my HA community pals - Kanga_who? Kanga, the man!
Quick Note: Could you mention someplace that the pi4 image is 64bit (I looked-it up on the screenshot) - it is gravy for those with a pi4 8gb.
Stay blessed!

1 Like

That’s why I made the default 64bit, as it will work on any Pi4. Next update I make to the instructions I’ll make a note of it.

Thanks for the feedback, glad to hear the guides help you :slight_smile:

2 Likes

Just completed this install - in under 15 minutes flat! Went like clockwork!
Points to note (for the readers of this thread):

  • 64bit Debian GNU/Linux 10 (buster), no desktop, CLI only.
  • Tiny 340mgs image size
  • Supported install :slight_smile:
  • No double-dance with SD and SSD or other hacks - I installed directly on an SSD conncted to USB 3 port of a pi4 8gb (with an updated bootloader, of course).

Thanks again, Kanga_who!

3 Likes

Hi. After following to the letter and accessing the host: 8123 and seeing that the page does not load, I decided to do a journalctl -f and it shows me these errors:

-ERROR (MainThread) [supervisor.homeassistant.core] Can’t start Home Assistant!
-INFO (SyncWorker_4) [supervisor.docker.interface] Cleanup images: [‘homeassistant/raspberrypi3-64-homeassistant:landingpage’]
What could I be doing wrong?

Try without the 64

Thanks for the quick reply!
curl -sL “https://raw.githubusercontent.com/Kanga-Who/home-assistant/master/supervised-installer.sh” | bash -s – -m raspberrypi3

**So would it be well written?

Thanks!

Thanks for the guide
I have done the installation on a raspberry pi 3 b and everything is perfect. It works perfectly in a SSD of 64Gb
But when I shutdown - r now or reboot debian, it gets stuck in
sd 0:0:0:0 [sda] Attached SCSI disk
and it does not advance anymore
What can I do for solve?

At a guess, the SSD is not being detected at boot. if you have access to the console, run this.

sudo nano /sys/module/usb_storage/parameters/delay_use

The default value is 1, try changing it to 5, save, exit and reboot.

You may need to start with a fresh install and do this change before doing anything else, and try a reboot and see if it comes back up. If it does, you can move on to OS updates and installing HA.

edit: Actually, that doesn’t seems to work testing it myself, the value defaults back to 1 on reboot. It’s likely the USB adapter you are using is not compatible, and you may need to try another one. I’ve had a similar issue in the past with cheap USB adapters - the boot sometimes and not others.

the adapter is a Ugreen,
What adapter should I buy that is compatible and will work for me?

But the first time in the installation it starts perfectly

I use these Kingspec USB-C SSDs, they works very well with a Pi3 or 4 from my experience, they are an all-in-one and quite cheap.

This page may also be able to help get your existing drive working, or give you some options for adapters that are known to be working, perhaps yours is on the list and needs some config to enable it.

Thank you very much for the help
the ssd disk, which you use, have you tried it on a raspberry pi 3B?
and it works fine?

I have gotten it to boot after reboot with the same adapter
You have to change the /boot/cmdline.txt part of root=LABEL=RASPIROOT
by root = PARTUUID = XXXXXXXX-02
which you get by typing when you first install “blkid”
To make the change, you can do it with the SSD disk placed in a PC

1 Like

Hi,

first of all thanks for the work.

It worked for me but I had a problem with the date on the pi at first. When I did the “apt update && upgrade” it gave me an error about Buster isn’t a valid stable release. I took me a while to figure out that the raspi4 was sitting on an old date (Feb 2019). After I’ve corrected the date with “date -s 2020-11-30” it all went smooth.

Thanks again
Bjoern

1 Like