Installing Home Assistant Supervised on a Raspberry Pi using Debian 12

I’d just go with Debian 11 and then when you need to go to 12 - backup - then upgrade in place - and backup again. It’s still supported for 3+ more months

What’s the rush to get on Deb 12? Is your system working? I’d assume it is therefore you have no need to update this very second.

I’ll get the guide updated when my work allows me some downtime, in the meantime Deb 11 is still supported so you don’t need to upgrade.

2 Likes

“When a new major version of Debian is released, the previous major version is dropped, with a deprecation time of 4 months”

Debian 11 will still be treated as supported for another 2-3 months.

1 Like

No rush, just asking :wink:

That’s very correct, still as this is a tutorial for a new installation it’s rather not smart (future proof) to install an old OS which will be unsupported in HA within less than 10 weeks from now :man_shrugging:

Better just directly install HA supervisor on Debian 12 as it is available and stable - it is not more work/time consuming but will allow the HA installation to be supported probably till somewhere middle/end 2025 :confetti_ball:

2 Likes

For those who want to upgrade from Debian 11 (bullseye) to Debian 12 (bookworm) without starting from scratch, here comes how it can be done (successfully tested on RPI4 and amd64).

:information_source: This upgrade guide works also on the amd64-architecture. It is not exclusive to the RPI.


:warning: This upgrade guide is exclusively for upgrading Debian 11 (bullseye) to Debian 12 (bookworm).
If you have a Debian derivative such as Raspberry Pi OS or Ubuntu installed the upgrade will fail and you will get an Unsupported and “Unhealthy” system. DO NOT post in this thread about your OS not being supported, you must run Debian, not a derivative.

:information_source: “A Debian derivative is a distribution that is based on the work done in Debian but has its own identity, goals and audience and is created by an entity that is independent from Debian. Derivatives modify Debian to achieve the goals they set for themselves.” (Source: Debian -- Debian derivatives).


:stop_sign: Before proceeding, please read the following information :stop_sign:

Make sure you have a recent full backup of your Home Assistant ready just in case something goes wrong. Since this guide is about upgrading the operating system itself it is wise to keep a copy of that backup not only on the HA device you are going to upgrade. I am not responsible for any data loss which might occur. Please do some research if you have any concerns about upgrading the OS before following this guide!

This upgrade guide is considered advanced and should only be used if one is an expert in managing a Linux operating system, Docker and networking!


:warning: Do yourself (and the supporting community here) a favor and refrain from executing the following commands as the system’s root user. Doing so can lead to all kinds of hard to find errors and the upgrade will eventually fail.

Run the commands to upgrade your system as the unprivileged user you created when initially building your system. Prepend sudo to all of the selected commands instead as shown within this upgrade guide to get temporary root-access when needed only.


Make sure all packages on your Debian 11 OS have the latest versions installed.
Execute from the CLI:

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

:exclamation: In case the kernel has been upgraded with the above command or you see the recommendation to reboot the host you should reboot the system before continuing with this guide.

Also make sure you have the latest HA-Version, Supervisor-Version and OS Agent installed.
At the time of this writing/latest edit this is:

  • HA-Version: core-2024.10.3
  • Supervisor-Version: supervisor-2024.10.2
  • Agent-Version: 1.6.0

Now do from the console as an unprivileged user (not root) :

sudo sed -i 's/bullseye/bookworm/' /etc/apt/sources.list
sudo sed -i 's/bullseye/bookworm/' /etc/apt/sources.list.d/*.list
sudo sed -i 's|bookworm/updates|bookworm-security|' /etc/apt/sources.list

Continue with the OS upgrade:

sudo apt update

Only if you see the following error message after “sudo apt update”:

The value 'bullseye' is invalid for APT::Default-Release as such a release is not available in the sources

Run:

sudo sed -i 's/bullseye/bookworm/' /etc/apt/apt.conf

and again:

sudo apt update

Now upgrade your existing packages without adding any new packages to the upgrade process:

sudo apt upgrade --without-new-pkgs -y

:exclamation: The above command will take some time. Be patient.

:exclamation: If asked whether the installer should automatically restart certain services during the upgrade choose “yes”.

Now do the final upgrade to Debian 12 (bookworm) by executing the following command:

sudo apt full-upgrade -y

:exclamation: The above command will take even longer and sometimes feels like the process has stalled, especially when it has reached:

Checking for services that may need to be restarted...
Checking init scripts...

Just be patient and don’t interrupt the upgrade process but let it work in the background. As mentioned above this will take quite a while.

When the process has finally finished it is time to reboot your RPI:

sudo reboot

or (depending on the system architecture):

sudo systemctl reboot

After the system has rebooted go back to the CLI and check the version number of the OS by executing the lsb_release and cat commands:

sudo lsb_release -a
sudo cat /etc/debian_version

It should show:

No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 12 (bookworm)
Release:        12
Codename:       bookworm

and

12.7

With the Debian 12 upgrade finally complete, remove any unwanted packages that might have carried over from the previous OS installation. Run:

sudo apt --purge autoremove -y

Make sure all installed packages are up-to-date:

sudo apt list --upgradable

If there are upgradable packages available execute:

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

to upgrade those packages.

:exclamation: If asked about whether to keep locally modified configuration files always choose:

"Keep the local version currently installed"

Most probably also the kernel got upgraded. Thus you have to reboot the system:

sudo systemctl reboot

After the system is up and running again execute:

sudo apt-get install udisks2 wget

Check whether systemd-journal-remote is installed:

sudo dpkg -s systemd-journal-remote

The output should contain:

Version: 252.30-1~deb12u2
Depends: libc6 (>= 2.34), libcurl4 (>= 7.16.2), libmicrohttpd12 (>= 0.9.50), libsystemd-shared (= 252.30-1~deb12u2), systemd

If systemd-journal-remote is not installed run:

sudo apt install systemd-journal-remote -y

In case the version on your RPI shows < Version: 252.17-1 run:

sudo apt-get install --reinstall systemd-journal-remote

:warning: About systemd-resolved which is needed by HA Supervised:

The new systemd-resolved package will not be installed automatically on upgrades. You need to install the new package manually!

Note that until systemd-resolved has been (re-)installed, DNS resolution might no longer work since the service will not be present on the system.

Installing this package will automatically give systemd-resolved control over /etc/resolv.conf. If you don’t want this, follow this post to regain control over /etc/resolv.conf after you have completed the following steps:

Check whether systemd-resolved is correctly installed:

dpkg -s  systemd-resolved

The output should contain:

Version: 252.30-1~deb12u2
Replaces: resolvconf, systemd (<< 251.3-2~)
Provides: resolvconf

In case systemd-resolved is not installed run:

sudo apt-get install systemd-resolved

:exclamation: If the system complains about certain unfulfilled dependencies while installing systemd-resolved just hit “y

It is time now to restart the host system once again:

sudo systemctl reboot

All done. Your HA Supervised should now run on Debian 12 (bookworm) and shows similar to:

:exclamation: In case you are still seeing the status “Unsupported” and/or “Unhealthy” at this point, re-run the “supervised-installer”:

cd /usr/local/src
sudo rm -f homeassistant-supervised.deb
sudo wget https://github.com/home-assistant/supervised-installer/releases/latest/download/homeassistant-supervised.deb
sudo dpkg -i homeassistant-supervised.deb

:information_source: You may be prompted to choose a machine type during the installation process. If so, choose raspberrypi4-64 if you do the upgrade on a RPI4 64bit.

Now reboot the host once again.

:exclamation: If you are you are presented with the following message after the host reboot:

Unsupported system - CGroup version

Execute the following command through CLI:

sudo sed -i.bak 's/$/ systemd.unified_cgroup_hierarchy=0/' /boot/firmware/cmdline.txt

and reboot.

The above command will also take care of writing a backup of the original file (/boot/firmware/cmdline.txt.bak) just in case something goes wrong.


Addendum (12 Oct. 2024):

Since some users have run into DNS issues (i.e. “lookup ghcr.io: no such host”) here come the steps on how to resolve those issues:

Find your active interface using the CLI:

sudo nmcli con show --active

The output shows something similar to:

NAME             UUID                                  TYPE      DEVICE 
Supervisor eno1  e874k675-44d4-31a4-8cf8-3b8cc5f3b7cb  ethernet  eno1   
lo               1e5bf4e3-e5c6-40d4-a193-0ffaa1l4fd2b  loopback  lo

where

e874k675-44d4-31a4-8cf8-3b8cc5f3b7cb

is the active interface of my RPI4 used by Supervisor.

Now run the following command but use the UUID of your active interface:

sudo nmcli con mod "e874k675-44d4-31a4-8cf8-3b8cc5f3b7cb" ipv4.dns "8.8.8.8, 8.8.4.4"

With the above command you configure the RPI to resolve TLD’s using Google’s DNS servers (8.8.8.8 and 8.8.4.4). Of course you can change this to whatever valid DNS-servers of your choice.

Restart the NetworkManager service:

sudo systemctl restart NetworkManager

OR (if the above does not lead to working DNS services):

Open/edit file /etc/gai.conf

Find line:
#precedence ::ffff:0:0/96 100

and uncomment it:
precedence ::ffff:0:0/96 100

to prioritise IPv4 over IPv6.

Save /etc/gai.conf and reboot the host:

sudo systemctl reboot


(Upgrade guide last updated/revised: 25 Oct. 2024)

21 Likes

My apologies for not rushing to the forums and updating the guide before now. I should have taken time away from running my business to do so.

Fortunately, @tamsy has helped out and made the necessary changes.

3 Likes

No worries - no need to pause your business. The community is here to assist :wink:

As a side note there are also other programs which respect users privacy doesn’t include tracking/analytics and doesn’t come in a bundle as adware. :arrow_backward:

When omitting the code for tracking/analytics/ads and other unnecessary code a program that writes images to flash and validates it can be as small as 300 kb (with gui) instead of the balenaMonster which by now probably grown over half a gigabyte (500 mb) with dependences and therfor is around 99% bigger than needed. Also etcher is build on EOL sofware which doesn’t even receives critical fixes anymore. :boom:

Last thought: Why download ~500mb of software to write a ~250mb HaOS image? What a waste of resources! :man_facepalming:

Out of curiosity:

Wondering where the other ~350mb’s have gone to :thinking:

1 Like

emphasis on “with dependencies:point_down:

a detail look :eyes:

Comparison

Description balenaEtcher WIN32 Disk Imager USBImager
Multiplatform :heavy_check_mark: :heavy_check_mark:
Minimum Windows Win 7 Win XP Win XP
Minimum MacOSX (1) 10.15 10.10
Available on Raspbian :heavy_check_mark:
Program size (2) 130 Mb 300 Kb
Dependencies lots, ~300 Mb Qt, ~8 Mb ✗ none

You need to sum-up the program size (now 148MB from your screenshot) together with the dependencies (typically downloaded in the background for your convenience)

But the size shouldn’t be a big problem for many, rather the ads/trackers which are included as well building on a obsolete/eol software stack are the big red marks :stop_sign:

I wrote the guide, I like using Etcher so I linked it.

If you or anyone else wishes to use an alternative, feel free to do so.

Well, then one should not use Windows either, nor Android nor Apple and many other software.

But I think we are getting off-topic here.

2 Likes

As HA focuses on privacy:

Open source home automation that puts local control and privacy first.

I would hope people also try to in-cooperate this when publishing guides around HA and prefer privacy respecting FOSS software which is more efficient (and faster) than other solutions which track/spy on the users without consent (and probably violates EU GDPR laws) and only works with ads.

Some decades ago spy- and adware were quite common but luckily this times are almost over.

Not sure about the windows and the apples (don’t use that) but my androids are free from ads/trackers (and google ware). Difference between win/apple to android is that you get a black box closed source OS which does whatever the manufactures wants - the later on the other hand is open source which allows privacy respecting interaction without tracking or ads. :raised_hands:

Feel free to move along when you’re ready.

This is a Community Guide not an excuse for you to be overly verbose.

4 Likes

I’m very much aware of that :wink:

Just wanted to point out the facts as many people aren’t aware of it or know the implications of the software they are using :bulb:

Regarding etcher many people actually recommending it without knowing they are promoting adware with tracking :man_shrugging:

So as a suggestion for your guide you might add the information that etcher includes ads and tracking (so everyone is aware before taking the decision using it) and maybe even give some alternatives like usbimager or rpi-imager (the later does include analytics) so people have a choice :+1:

Hello, triyng to install on Debian 12 and getting an error on step:

dpkg -i homeassistant-supervised.deb
root@rpi4-20230612:/usr/local/src# dpkg -i homeassistant-supervised.deb
(Reading database ... 30664 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]
[warn] ModemManager service is enabled. This might cause issue when using serial devices.
Leaving 'diversion of /etc/NetworkManager/NetworkManager.conf to /etc/NetworkManager/NetworkManager.conf.real by homeassistant-supervised'
Leaving 'diversion of /etc/NetworkManager/system-connections/default to /etc/NetworkManager/system-connections/default.real by homeassistant-supervised'
Leaving 'diversion of /etc/docker/daemon.json to /etc/docker/daemon.json.real by homeassistant-supervised'
Leaving 'diversion of /etc/network/interfaces to /etc/network/interfaces.real by homeassistant-supervised'
Unpacking homeassistant-supervised (1.5.0) over (1.5.0) ...
Setting up homeassistant-supervised (1.5.0) ...
parse error: Invalid numeric literal at line 1, column 10
dpkg: error processing package homeassistant-supervised (--install):
 installed homeassistant-supervised package post-installation script subprocess returned error exit status 4
Errors were encountered while processing:
 homeassistant-supervised
root@rpi4-20230612:/usr/local/src#

What can be wrong?

PRETTY_NAME="Debian GNU/Linux 12 (bookworm)"
NAME="Debian GNU/Linux"
VERSION_ID="12"
VERSION="12 (bookworm)"
VERSION_CODENAME=bookworm
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

Welcome to the forum, DabbyAI :wave:t3:

Problems like this usually arise if one does not strictly follow the guide.

Note paragraph 1.5 and paragraph 1.6 (first section)! There is a reason behind the instruction to continue all after the OS installation as an unpriviledged user (but not as root) by prepending “sudo” (or “sudo -i”) to commands.

Furthermore disable ModemManager from starting after reboots:

sudo systemctl status ModemManager

If modem manager is running stop and disable it:

sudo systemctl stop ModemManager
sudo systemctl disable ModemManager

Now make sure the latest NetworkManager is installed:

sudo dpkg -s network-manager

The output should show:

Package: network-manager
Status: install ok installed

If not, install NetworkManager:

sudo apt install network-manager

Just to make sure reboot the host:

sudo systemctl reboot

Now continue with:

cd /usr/local/src
sudo dpkg -i homeassistant-supervised.deb
1 Like

just solved this problem by enabling vpn on my router for this step

sudo dpkg -i homeassistant-supervised.deb

some resources seems to be blocked by my ISP :slightly_smiling_face:

Having problems with my DNS after installing network manager.

so when I get to this part

root@rpi4-20230612:~# curl -fsSL get.docker.com | sh

I receive this error

curl: (6) Could not resolve host: get.docker.com

Any ideas?

Probably NetworkManager messing with your settings. I’m betting your resolv.conf is overwritten by it and now it’s empty. This is a recurring problem to which I, besides a dirty hack, have no solution.
For now, put some dns entry in it, but count on it that NM will overwrite it again at some time.
Adding a DNS entry in HA’s network settings didn’t solve it for me.

/etc/resolv.conf
nameserver 1.1.1.1

1 Like