Skip to content

Instantly share code, notes, and snippets.

@renatoccosta
Last active November 5, 2024 12:17
Show Gist options
  • Save renatoccosta/c30f0b4216c8caaf1f202b0a0561b5d3 to your computer and use it in GitHub Desktop.
Save renatoccosta/c30f0b4216c8caaf1f202b0a0561b5d3 to your computer and use it in GitHub Desktop.
Install Home Assistant on OrangePi 5

Installing Home Assistant on OrangePi 5 Board

This tutorial will enable the use of Home Assistant on an OrangePi 5 board with the following characteristics:

  • OrangePi Debian OS

  • OS running on a SDCard

  • Home Assistant Supervised Instalation

The steps are a compilation with few modifications from instructions found over the web. Links are at the end.

  1. Download Debian image from http://www.orangepi.org/html/hardWare/computerAndMicrocontrollers/service-and-support/Orange-pi-5.html

  2. Select latest server release. Bullseye on publication of this tutorial

  3. Unzip file and burn it to SDCard.

  4. Stick SDCard into board and start it. It takes just a few seconds to complete startup.

    • SSH is enabled by default, you can use it to access. Username: orangepi, Password: orangepi

  5. Run the following commands as root (sudo su -). Root password orangepi

  6. Update packages

    apt update
    apt upgrade
  7. Install required packages

    apt install \
    apparmor \
    jq \
    wget \
    curl \
    udisks2 \
    libglib2.0-bin \
    network-manager \
    dbus \
    lsb-release \
    systemd-journal-remote -y
  8. Run orangepi-config

    1. System → Bootenv. Add the following lines:

      extraargs=apparmor=1 security=apparmor
      systemd.unified_cgroup_hierarchy=0

      The lines enable AppArmor and CGroupV1 respectively

    2. Save it, then Install

    3. Reboot for changes to take effect

  9. Alternatively you can execute the following commands

    echo "extraargs=apparmor=1 security=apparmor" >> /boot/orangepiEnv.txt
    sed -i -e "1 s/$/ systemd.unified_cgroup_hierarchy=0/" /boot/orangepiEnv.txt
    update-initramfs -u
    reboot
  10. After reboot, check

    • Apparmor

      systemctl status apparmor.service

      You should see a line saying active (excited)

    • Cgroup

      findmnt -lo source,target,fstype,options -t cgroup,cgroup2

      You should see many lines with cgroup in source column

  11. Run as root sudo su -

  12. Install DockerCE

    curl -fsSL get.docker.com | sh
  13. Install Home Assistant OS Agent

    1. Download and install the latest version from https://github.com/home-assistant/os-agent/releases/latest. Look for aarch64.deb file. For instance:

      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
    2. Test instalation by running

      gdbus introspect --system --dest io.hass.os --object-path /io/hass/os

      Some results in JSON format should be returned

  14. Install Home Assistant Supervised

    wget https://github.com/home-assistant/supervised-installer/releases/latest/download/homeassistant-supervised.deb
    apt install ./homeassistant-supervised.deb
    1. When prompted, select qemuarm-64 machine type. I’m not sure that’s the best option, but it works.

  15. Just wait until instalation is completed (it should take a few seconds). Some warnings are excpected, since this OS is a custom Debian build.

    1. Try to access http://orangepi5.local:8123. It should work, if not use host IP. If it still doesn’t work reboot machine and try again. If it still doesn’t work, go back to step 1 and review everything.

@ZenMasta
Copy link

ZenMasta commented Jun 1, 2023

@ZenMasta I might be wrong here, but I don't think there is a Supervisor link on the Settings page there. What do you see when you go into the About option? Mine shows like this: image

I was just going based off of old youtube videos from when there used to be an icon on the sidebar. But I'm generally good now. Just noob misunderstanding of the UI changes. But you can see that I have addons there so all is well.

@kcembrey
Copy link

kcembrey commented Jul 3, 2023

@renatoccosta, thank you so much for putting this together. I bought an Orange Pi 5 Plus and used Debian 12 (bookworm), as that's what HA requires now. I ran into two issues/differences which I thought I'd add here for anyone else who runs into this.

  1. Using this similar article focused on Armbian, I was able to bypass the check requiring stock Debian (not Orange Pi Debian). This just required changing the Pretty Name property of the /etc/os-release file to "Debian GNU/Linux 12 (bookworm)". This is a new check that was recently added, and for now, they just check the Pretty Name property in this file. Orange Pi Debian should work just fine (I think).

  2. During installation, I was receiving an error regarding systemd-resolved not being available or not working (I wish I recorded the errors). At first, I tried skipping this check, but that wasn't the right idea. Instead, I just followed the suggestion from the OS to run the supervised install command with the --fix-broken flag, which ended up replacing another package (I don't remember which :) with systemd-resolved.

Thanks!

KC

@rpanachi
Copy link

I followed the instructions to install Home Assistant on Debian Bullseye and got this error on step 14:

root@orangepi5:~# apt install ./homeassistant-supervised.deb
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Note, selecting 'homeassistant-supervised' instead of './homeassistant-supervised.deb'
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 homeassistant-supervised : Depends: systemd-resolved
E: Unable to correct problems, you have held broken packages.

Any idea?

@rpanachi
Copy link

Update: tried with Debian Bookworm and got this error on step 14:

[error] Orange Pi 1.1.6 Bookworm is not supported!

Then I manage to trick the installer changing my /etc/os-release with the content:

PRETTY_NAME="Debian GNU/Linux 11 (bullseye)"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.2 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=jammy

Tried to install again and this time seems to work.

@kcembrey
Copy link

@rpanachi, it looks like you got it to work, but you ran into the same two issues that I did. I'll simplify my fix instructions for anyone else who runs into this. Workarounds to get this to work in OrangePi Debian 12 (Bookworm):

  1. Before you start, modify the /etc/os-release file and change the first line to:
    PRETTY_NAME="Debian GNU/Linux 12 (bookworm)"

This convinces Home Assistant that you are running a standard copy of Debian 12

  1. (Step 14 in installation instructions) Run the installer with the --fix-broken flag to resolve any issues with systemd-resolved:
    apt install --fix-broken ./homeassistant-supervised.deb

@mplaviak
Copy link

How do I update Home Assistant and Supervisor using Orangepi 5?

@bwcoetzer
Copy link

Unfortunately the --fix-broken did not do the trick for me:

root@orangepi3-lts:~# apt install --fix-broken ./homeassistant-supervised.deb
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Note, selecting 'homeassistant-supervised' instead of './homeassistant-supervised.deb'
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
homeassistant-supervised : Depends: systemd-resolved
E: Unable to correct problems, you have held broken packages.
root@orangepi3-lts:~#

Any other ideas?

@ideal2545
Copy link

ideal2545 commented Jul 30, 2023

@bwcoetzer Make sure youre on bookworm, upgrade your OS or re-install - i had the same issue, moove to bookworm, do the trick noted above to change the name to trick the HA installer. I just did an upgrade of the OS following some random guide. After that, the --fix-broken resolved the issue for me.

@kcembrey
Copy link

@bwcoetzer another thing you can try is to use dpkg and tell it to ignore the required dependency, like this:
sudo dpkg -i --ignore-depends=systemd-resolved ./homeassistant-supervised.deb

I found this on the last comment here: https://community.home-assistant.io/t/os-agent-and-systemd-resolved-are-missing-at-clean-installation-supervised-raspberry-os-64-bit/585914/2

I ended up switching to Ubuntu Jammy to start working on rknn2 with Frigate, so what I ended up doing there is extracting the homeassistant-supervised.deb package and changed the dependency from systemd-resolved to systemd. Then I repackaged it and the install went fine. This is probably the cleanest way to do it, but takes a little more work learning how to extract and repackage a .deb file.

@bwcoetzer
Copy link

@kcembrey Thank you very much for this help. This allowed me to install Debian Bullseye on an OrangePi3 LTS with only one warning ([warn] Could not find /etc/default/grub or /boot/firmware/cmdline.txt failed to switch to cgroup v1) but the instance booted up perfectly and after setting down reported:
Supervisor: | Connected
Supported: | Supported
Healthy: | Healthy

Super excited by this outcome!

@ideal2545
Copy link

ideal2545 commented Aug 8, 2023

Today, i got an 'unhealthy system - not privileged' - has anyone run across this?

edit - I issued a restart of the supervisor and it resolved the issue, pretty strange but it was okay after -

@deep414
Copy link

deep414 commented Nov 25, 2023

Hi, Thanks for your work!.
A few comments though.

  1. add line to u-boot env:
    extraargs=apparmor=1 security=apparmor systemd.unified_cgroup_hierarchy=0
  2. create (if not exist) docker group, and add docker group to user:
    sudo groupadd docker
    sudo usermod -aG docker $USER
  3. logout (or better ) reboot the card

With these additions I installed HA-supervised on orangepi zero 2w card. Thank you once more!

@RotyBR
Copy link

RotyBR commented Mar 1, 2024

OMG it worked! At first I had some a problem with the "System → Bootenv.", but I put both commands at the line and it worked as Vfranchi suggested. Thanks a lot!

@Rooba
Copy link

Rooba commented May 4, 2024

Pretty sure the unhealthy system - not privileged error is due to startup order of the container images upon initial install of homeassistant-supervised

This is startup order post-install, error is being thrown on trying to install add-ons

# docker ps                                                                                                                                                                                                                                                              24-05-04 - 3:58:28
CONTAINER ID   IMAGE                                                       COMMAND               CREATED             STATUS             PORTS                                   NAMES
2db5da337c36   ghcr.io/home-assistant/qemuarm-64-homeassistant:2024.5.1    "/init"               7 minutes ago       Up 7 minutes                                               homeassistant
46ff87b51dd6   ghcr.io/home-assistant/aarch64-hassio-multicast:2024.03.0   "/init"               About an hour ago   Up About an hour                                           hassio_multicast
bd0b8d59ee94   ghcr.io/home-assistant/aarch64-hassio-observer:2023.06.0    "/usr/bin/observer"   About an hour ago   Up About an hour   0.0.0.0:4357->80/tcp, :::4357->80/tcp   hassio_observer
1149626d75dc   ghcr.io/home-assistant/aarch64-hassio-audio:2023.12.0       "/init"               About an hour ago   Up About an hour                                           hassio_audio
93e38e848b0c   ghcr.io/home-assistant/aarch64-hassio-dns:2024.04.0         "/init"               About an hour ago   Up About an hour                                           hassio_dns
abe70c7d9a46   ghcr.io/home-assistant/aarch64-hassio-cli:2024.04.1         "/init"               About an hour ago   Up About an hour                                           hassio_cli
091da0927469   ghcr.io/home-assistant/aarch64-hassio-supervisor:latest     "/init"               About an hour ago   Up About an hour                                           hassio_supervisor

After a restart, add-ons can now be installed, and container startup order now shows supervisor -> observer -> homeassistant, rather than homeassistant being last on the chain

# docker ps                                                                                                                                                                                                                                                              24-05-04 - 4:03:05
CONTAINER ID   IMAGE                                                       COMMAND               CREATED             STATUS          PORTS                                   NAMES
0bfbefdedbcc   ghcr.io/home-assistant/aarch64-hassio-multicast:2024.03.0   "/init"               40 seconds ago      Up 39 seconds                                           hassio_multicast
2f14ace815bb   ghcr.io/home-assistant/aarch64-hassio-audio:2023.12.0       "/init"               41 seconds ago      Up 40 seconds                                           hassio_audio
438f35d0ea1d   ghcr.io/home-assistant/aarch64-hassio-dns:2024.04.0         "/init"               41 seconds ago      Up 40 seconds                                           hassio_dns
e9247c068080   ghcr.io/home-assistant/aarch64-hassio-cli:2024.04.1         "/init"               42 seconds ago      Up 41 seconds                                           hassio_cli
2db5da337c36   ghcr.io/home-assistant/qemuarm-64-homeassistant:2024.5.1    "/init"               11 minutes ago      Up 45 seconds                                           homeassistant
bd0b8d59ee94   ghcr.io/home-assistant/aarch64-hassio-observer:2023.06.0    "/usr/bin/observer"   About an hour ago   Up 45 seconds   0.0.0.0:4357->80/tcp, :::4357->80/tcp   hassio_observer
091da0927469   ghcr.io/home-assistant/aarch64-hassio-supervisor:latest     "/init"               About an hour ago   Up 45 seconds                                           hassio_supervisor

However, i might be wrong, but it does work

@zhekch
Copy link

zhekch commented Jul 12, 2024

I had an issue while trying to install:

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Note, selecting 'homeassistant-supervised' instead of './homeassistant-supervised.deb'
The following NEW packages will be installed:
  homeassistant-supervised
0 upgraded, 1 newly installed, 0 to remove and 61 not upgraded.
Need to get 0 B/7,440 B of archives.
After this operation, 0 B of additional disk space will be used.
Get:1 /tmp/homeassistant-supervised.deb homeassistant-supervised all 1.8.0 [7,440 B]
Preconfiguring packages ...
Selecting previously unselected package homeassistant-supervised.
(Reading database ... 219022 files and directories currently installed.)
Preparing to unpack .../homeassistant-supervised.deb ...
[warn]
[warn] If you want more control over your own system, run
[warn] Home Assistant as a VM or run Home Assistant Core
[warn] via a Docker container.
[warn]
Adding 'diversion of /etc/NetworkManager/NetworkManager.conf to /etc/NetworkManager/NetworkManager.conf.real by homeassistant-supervised'
Adding 'diversion of /etc/NetworkManager/system-connections/default to /etc/NetworkManager/system-connections/default.real by homeassistant-supervised'
Adding 'diversion of /etc/docker/daemon.json to /etc/docker/daemon.json.real by homeassistant-supervised'
Adding 'diversion of /etc/network/interfaces to /etc/network/interfaces.real by homeassistant-supervised'
Leaving 'diversion of /etc/systemd/resolved.conf to /etc/systemd/resolved.conf.real by homeassistant-supervised'
Unpacking homeassistant-supervised (1.8.0) ...
Setting up homeassistant-supervised (1.8.0) ...
[info] Reload systemd
[info] Restarting NetworkManager
[info] Enable systemd-resolved
dpkg: error processing package homeassistant-supervised (--configure):
 installed homeassistant-supervised package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
 homeassistant-supervised
E: Sub-process /usr/bin/dpkg returned an error code (1)

Managed to fix this by first removing the package sudo dpkg --remove homeassistant-supervised and then running sudo apt reinstall systemd-resolved

@Rooba
Copy link

Rooba commented Jul 12, 2024

I had an issue while trying to install:

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Note, selecting 'homeassistant-supervised' instead of './homeassistant-supervised.deb'
The following NEW packages will be installed:
  homeassistant-supervised
0 upgraded, 1 newly installed, 0 to remove and 61 not upgraded.
Need to get 0 B/7,440 B of archives.
After this operation, 0 B of additional disk space will be used.
Get:1 /tmp/homeassistant-supervised.deb homeassistant-supervised all 1.8.0 [7,440 B]
Preconfiguring packages ...
Selecting previously unselected package homeassistant-supervised.
(Reading database ... 219022 files and directories currently installed.)
Preparing to unpack .../homeassistant-supervised.deb ...
[warn]
[warn] If you want more control over your own system, run
[warn] Home Assistant as a VM or run Home Assistant Core
[warn] via a Docker container.
[warn]
Adding 'diversion of /etc/NetworkManager/NetworkManager.conf to /etc/NetworkManager/NetworkManager.conf.real by homeassistant-supervised'
Adding 'diversion of /etc/NetworkManager/system-connections/default to /etc/NetworkManager/system-connections/default.real by homeassistant-supervised'
Adding 'diversion of /etc/docker/daemon.json to /etc/docker/daemon.json.real by homeassistant-supervised'
Adding 'diversion of /etc/network/interfaces to /etc/network/interfaces.real by homeassistant-supervised'
Leaving 'diversion of /etc/systemd/resolved.conf to /etc/systemd/resolved.conf.real by homeassistant-supervised'
Unpacking homeassistant-supervised (1.8.0) ...
Setting up homeassistant-supervised (1.8.0) ...
[info] Reload systemd
[info] Restarting NetworkManager
[info] Enable systemd-resolved
dpkg: error processing package homeassistant-supervised (--configure):
 installed homeassistant-supervised package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
 homeassistant-supervised
E: Sub-process /usr/bin/dpkg returned an error code (1)

Managed to fix this by first removing the package sudo dpkg --remove homeassistant-supervised and then running sudo apt reinstall systemd-resolved

@zhekch You could try running /var/lib/dpkg/info/homeassistant-supervised.postinst directly and it should tell you what the error output is since dpkg consumes it

@PeterGamma
Copy link

Since Corona we don t trust Raspberry Pi anymore. It is highly desirable to have Home Assistant on the Orange Pi 5 as an alternative.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment