Guide: Installing HA Supervised on Debian (Official) Distro

Hi all,

There were changes to the HA OS Agent preventing Supervised installs on Raspberry Pi OS. Would like to share a quick community guide for Debian installs, coupled with some extra add-ons.

I clobbered this from multiple resources, not all info was created by me. This guide was tested on a rPi 4.

EDIT: I found the community guide where I extracted the info from - appending full credit here!

As a precursor, flash the official Debian image for Raspberry Pi onto your SD card. Connect the Pi to a monitor, with keyboard and LAN connection (not WiFi).

Step 0 - preinstallation
Once itā€™s fully booted, youā€™ll see a prompt like this

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

Login into the terminal using root.
Update timezone. You can print a list using this command timedatectl list-timezones

sudo timedatectl set-timezone <INSERT_TIMEZONE>

Step 1 - creating username for SSH

Then create a custom username <YOUR_USERNAME>, create a password. You will then be asked to enter your first name, last name, phone number etc - you can skip all these by pressing Enter.

adduser YOUR_USERNAME
usermod -aG sudo YOUR_USERNAME

Post this, you can login into your installation via SSH, which will make things easier.

Step 2 - Installing OS Agent, Docker & Dependencies

Connect via SSH and run these commands:

sudo -i
sudo apt update && sudo apt upgrade -y && sudo apt autoremove ā€“y
apt --fix-broken install

apt-get install jq wget curl udisks2 libglib2.0-bin network-manager dbus apparmor systemd-journal-remote lsb-release bluetooth -y

curl -fsSL get.docker.com | sh

Then install latest version of OS Agent. Change the URL to point to the latest version (1.5.1 at time of writing)

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

dpkg -i os-agent_1.5.1_linux_aarch64.deb

Reboot the Pi using sudo reboot

Step 3 - Installing HA Supervised
Install as follows, and choose RaspberryPi4-64 as the option.

sudo -i

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

dpkg -i homeassistant-supervised.deb

Once you get the completion prompt, go into your ip_address:8123 page and proceed from here!

OTHER RESOURCES:

Bluetooth drivers (guide here: Getting Bluetooth Working with Raspberry Pi Zero W and Debian Buster | newspaint)

wget \ -O /lib/firmware/brcm/BCM43430A1.hcd \ https://github.com/RPi-Distro/bluez-firmware/blob/9556b08ace2a1735127894642cc8ea6529c04c90/broadcom/BCM43430A1.hcd?raw=true

Enabling PWR/ACT LEDs
Both LEDs are turned off by default. You can create a service script (see below) ,but test if these commands work for you. PWR refers to the Power LED, ACT refers to the activity LED.

For the ACT command line, mmc1 points to my SD card. But if it doesnā€™t work, use mmc0 instead.

echo 1 | sudo tee /sys/class/leds/PWR/brightness
echo mmc1 | sudo tee /sys/class/leds/ACT/trigger

Once you confirm the commands work for you, create a script as follows:
sudo nano /etc/systemd/system/rpi-led-pwr.service

Copy the entire contents into the editor, Ctrl-X to exit and enter Y to save.

[Unit]
Description=Control Raspberry Pi LEDs

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=sh -c "echo mmc1 | sudo tee /sys/class/leds/ACT/trigger"
ExecStart=sh -c "echo 1 | sudo tee /sys/class/leds/PWR/brightness"
ExecStop=sh -c "echo 0 | sudo tee /sys/class/leds/ACT/trigger"
ExecStop=sh -c "echo 0 | sudo tee /sys/class/leds/PWR/brightness"

[Install]
WantedBy=multi-user.target

Then run these commands to start the service
systemctl daemon-reload
systemctl enable rpi-led-pwr.service
systemctl start rpi-led-pwr.service

Enable sudo for user without password
Enter into the config page using sudo visudo

Append the following line, replace with your username. Ctrl-X to save, and click on Y.
<USER> ALL=(ALL) NOPASSWD: ALL

I have HA Supervised installed as well, using almost the exact same steps you have, but had not yet gotten to the ability of getting the old LEDs on the RPI board to function, so thatā€™s fantastic, Iā€™ll give it a shot. I would suggest you also add the steps for allowing your UserID to issue sudo commands without having to retype the password every single time you issue the sudo command.

One issue I ran into was that for some reason when I installed apparmor-utils, it does not on my RPI 4b 8Gig also install apparmor. So instead of apparmor-utils, my scripp used apparmor (it is apparmor that is required, not actually apparmor-utils, as you can see from the Baby Casa documentation.) Maybe Iā€™ve been changing something in the environment on my RPI that the underlying apparmor did not actually get installed? I am sure that apparmor-utils is a terrific set of utilities but I donā€™t use them.

Question - before I get a chance to go try this on my RPI - and one you might want to consider - run your whole setup on an SSD rather than the MicroSD slot, it will run MUCH faster and the SSD lasts much longer than a MicroSD Card. I donā€™t even have any MicroSD Card in the slot, it reboots right from the SSD. So, asking you this - instead of mmc etc. what should I use so the traffic on the SSD is used for the led instead of the traffic on the MicroSD?

Thanks for the comments! Have appended the commands to use sudo without password.

Also noted on apparmor-utils, have replaced it with apparmor - hopefully this doesnā€™t break anything.

Iā€™m using a MSATA SSD via USB but kept the instructions to refer to a SD card.

For those interested, you can configure your Pi4 firmware to boot USB first (using this guide How to Boot Raspberry Pi from USB?). Thereā€™s a good resource here: Best Working SSD / Storage Adapters - Raspberry Pi 4 / 400

On your question - mmc1 still works for me - havenā€™t rebooted to see if this is correct!

@borez , this s terrific, note:

My SSD card which is very low power (Samsung T7 - which even comes with itā€™s own USB cable to plug right into the RPI) - is terrific to use as it does not tax the RPI power supply at all. The reason I mention this is, the SSD also has an led on it which always flickers for any activity - so this would allow me to compare that against the green led on the RPI ( :slight_smile: )ā€¦

I noticed the mmc0 does nothing for me and mmc1 only flashes every 500 milliseconds no matter what is going on, so on my case it appears to be a call by the OS to check to see if there is a MicroSD Card card there to automatically mount it (and there is not). (I also tried mmc2 which resulted in an error message.) I am a noob to linux and python so bear with me. Also, doing some digging I learned that ā€œMMCā€ stands for MultiMediaCard, which is any onboard card on the RPI - so that would not be the SSD.

So, this command:

cat /sys/class/leds/ACT/trigger
  • will give you all the possible values that can trigger (or not in the case of ā€˜noneā€™) the activity led, which each person implementing this should run, and this gave me:
none kbd-scrolllock kbd-numlock kbd-capslock kbd-kanalock kbd-shiftlock kbd-altgrlock kbd-ctrllock kbd-altlock kbd-shiftllock kbd-shiftrlock kbd-ctrlllock kbd-ctrlrlock disk-activity disk-read disk-write ide-disk mtd nand-disk cpu cpu0 cpu1 cpu2 cpu3 panic usb-gadget [usb-host] mmc0 mmc1 rfkill-any rfkill-none rfkill0 bluetooth-power hci0-power rfkill1 unimac-mdio--19:01:link unimac-mdio--19:01:1Gbps unimac-mdio--19:01:100Mbps unimac-mdio--19:01:10Mbps

So, in trying a variety of those with the command:

echo SOMETHINGFROMTHEABOVELIST | sudo tee /sys/class/leds/ACT/trigger

I was surprised in my case that disk-activity, disk-read and disk-write all did nothing and usb-gadget did nothing as well, but usb-host caused the led to flicker when my SSD flickered.

However, the flickering with one did not match exactly the flickering pattern with the other (the SSD flickers more, but when it does flicker, the onboard RPI does always flicker at least once, and sometimes but not often alot, especially when restarting HA). Note, my SSD firmware does alot of other stuff internally such as caching reads and writes etc. for more efficiency - so I believe that the specific SSD activity cannot be shown by the onboard RPI led, but rather, the SSD in my case shows all the activity but the onboard RPI led only is showing the actual USB traffic - which is good enough for me (hence ā€œUSB-hostā€ - duh - see told you I was a noob)!

I am very careful as Iā€™ve trashed everything several times and I am a noob, so I will back up my ssd and then try to make the changes, including your script, and let you know! (Donā€™t ask about how to PROPERLY back up one of these goofy 1TB SSDā€™s - that was a very painful journey for another time lol - which I forced myself to go through early in my RPI/HA journey after a couple of blowups. My journey was especially painful as I lost weeks banging my head against a stone wall as my first SSD actually had bad sectors which stopped my dozens of unsuccessful backup attempts.)

Iā€™ll let you know how it goes on my end -

1 Like

@borez this works like a charm, thank you.

Community Guides operate as a wiki. As explained in the category description, anyone can edit the first post in the topic. Closing this. Please update the original topic.

1 Like