Home Assistant Core Install

Been using HA for a couple of years, and finally got sick of the system falling over EVERY time I do a core or OS upgrade (as happened this morning when moving from 6.1 to 6.2, trashed the system to a hard stop and unable to reboot)

So, I thought I would give Home Assistant Core a go.

Installed Rasbian on a Pi3+, followed the install instructions ( Raspberry Pi - Home Assistant ), but get all these errors on startup…

2021-09-05 15:53:47 WARNING (MainThread) [homeassistant.setup] Setup of recorder is taking over 10 seconds.
2021-09-05 16:01:45 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
File "/srv/homeassistant/lib/python3.7/site-packages/aiohttp/web_protocol.py", line 314, in data_received
messages, upgraded, tail = self._request_parser.feed_data(data)
File "aiohttp/_http_parser.pyx", line 546, in aiohttp._http_parser.HttpParser.feed_data
aiohttp.http_exceptions.BadStatusLine: 400, message="Bad status line 'invalid HTTP method'"
2021-09-05 16:02:22 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
File "/srv/homeassistant/lib/python3.7/site-packages/aiohttp/web_protocol.py", line 314, in data_received
messages, upgraded, tail = self._request_parser.feed_data(data)
File "aiohttp/_http_parser.pyx", line 546, in aiohttp._http_parser.HttpParser.feed_data
aiohttp.http_exceptions.BadStatusLine: 400, message="Bad status line 'invalid HTTP method'"
2021-09-05 16:03:23 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
File "/srv/homeassistant/lib/python3.7/site-packages/aiohttp/web_protocol.py", line 314, in data_received
messages, upgraded, tail = self._request_parser.feed_data(data)
File "aiohttp/_http_parser.pyx", line 546, in aiohttp._http_parser.HttpParser.feed_data
aiohttp.http_exceptions.BadStatusLine: 400, message="Bad status line 'invalid HTTP method'"
2021-09-05 16:04:03 WARNING (MainThread) [homeassistant.bootstrap] Support for the running Python version 3.7.3 is deprecated and will be removed in the first release after December 7, 2020. Please upgrade Python to 3.8.0 or higher.

Ideas / Suggestions ?

What core version you are trying to install?

Maybe you need to update your Python?

Got no idea, the point is I followed the published instructions to the letter an it does not work.

Clearly python needs to be upgraded, but why and how ? (type ‘Upgrade python version on Pi’ into google, and EVERY page says something different)

What is wrong with the current install instructions ?

Nothing is wrong with them, and they clearly state you need python 3.8+, you are running python 3.7


OK, not helpful, no instructions on how to install 3.8 anywhere I can find…, and the first step in the install is this:

sudo apt-get install -y python3 python3-dev python3-venv python3-pip libffi-dev libssl-dev libjpeg-dev zlib1g-dev autoconf build-essential libopenjp2-7 libtiff5 tzdata

Why does this not install the correct version of Python ? And if I had somehow managed to install 3.8 beforehand, this would overwrite it ?

If you follow them, and they don’t work, they are either wrong, or steps are missing…, in this case how do you install Python 3.8 on Rasbian is missing. The instructions may as well say ‘To install home assistant core, simply install home assistant core’

You have obviously installed buster, and not bullseye. Bullseye contains 3.9

There is a clear note at the beginning that a prerequisite for this install method is that you have an operating system and at least python 3.8.
You can’t expect to find instructions to install python 3.8 in the Home Assistant installation guide.
Let’s say you want to install AutoCAD on your computer and the install instructions say you need to at least Windows 10, but you are running Windows 8, would you expect the install instructions to include how to install Windows 10???

Also I’d highly suggest you to not run Home Assistant Core, it’s for advanced users, which honestly doesn’t seem to be the case…

1 Like

I don’t think you can cop out with that excuse. Install the latest version of Rasbian, OK, lots of guides on how to do this, but then install python 3.8 which is not included in the apt distro for the latest Rasbian is a pain. I could not find one definitive guide on how to do this, and then what happens when you run the first install command in the instructions which includes sudo apt-get install -y python3 which will just write over the top of any 3.8 install with the apt approved 3.7 version (as far as I can make out)

Nothing in the instructions implies ‘Advanced Users’.

That’s no excuse, it is written that it is a prerequisite to have python 3.8, I don’t know what you don’t underatand about this…

If you had installed the latest Raspbian version, Python 3.9 would already be included.

Right here before the second two install methods are listed:

Again don’t use it if you already have issues updating the python version. There are many guides even here on the forum on how to update python. And towards the end of the year you’ll need to upgrade again and you’ll get headaches again.

1 Like

Going round in circles here, bottom line, the instructions are duff…, I’ve been using HA for 2 years now, and this stuff has always been lacking. The supervised ‘recommended’ version has become too bloated and over complicated…, a separate docker container just for DNS FFS…

Every time I do a ha core update or ha os update its 50/50 whether is does it, or just hangs, or totally trashed the install.

On a Pi3+ the CPU load average is 0.5 with everything running. Initiating a core update pushes this to 10+ to the point where I cannot even SSH onto the machine. It’s hands down the most unstable software distro I’ve ever used.

PS. To install the latest version of Rasbian, the Pi Foundation recommends using their raspberry Pi imager software which contains no version of Rasbian that contains Python 3.8, and Experienced does not mean the same thing as Advanced)

Maybe you should try Docker instead, since in December you’ll need to upgrade to Python 3.9 and rebuild the venv. Then next December you’ll need to upgrade to Python 3.10 and rebuild the venv. Then the following December…

1 Like

Thanks for the suggestion, but tomato, tomato…, the docker install also looks unnecessarily complex, to many prerequisites…, any instructions that start ‘This guide assumes’ is a very bad sign…

I really like using HA, and I absolutely hate it. Too many assumptions that swing wildly from basic user knowledge to off the chart geek, etc. Its the unreliable upgrades that are the most irritating. Even moving a simple x.x.1 to x.x.2 can cause catastrophic failures. I’m sure I recall in the early days such upgrades took only a few minutes, but now they take hours, and most of the time (at least for me) fail in some way the requires a hard reboot, or a complete rebuild. Load averages go off the chart, the system becomes unresponsive, which cause more errors / timeouts. I just don’t get why fundamental functionality like this is still so poor after so many years…

The problem is, you have HAOS at one end - and the problems you’re facing are not typical - Container in the middle, and Core at the other end.

With both Docker (Container) and Core some manual setup is required by you, that’s unavoidable. Core requires the most because the developers aren’t going to hold things back just because it’s inconvenient for those not using the Docker images.


I started using Home Assistant somewhere around 0.4x (4 years ago) and did an update on every version and not even one time did I experience a catastrophic failure. And even if I did, I take a backup before updating and then it’s a matter of minutes to restore to the previous version. Also most of the time I read here about users having “catastrophic failures”, it is because they didn’t read the release notes and breaking changes and it would have been avoidable if the person had adjusted the config accordingly.


So, today’s example:

Upgrade available for Home Assistant OS from 6.2 to 6.3. Pressed the upgrade button on the supervisor UI and left it for 5 hours or so. After 5 hours, nothing had happened (apparently), system still running, and returning to the supervisor page showed the same ‘upgrade available message’.

At this point I hit the ‘Host restart button’, system went down, never came back. Powercycled after a couple of hours, nothing. Rebuild time.

Flashed the latest version fof Home Assistant OS, rebooted and got the ‘Preparing this should take up to 20 mins’ web page, took over 2 hours to get to the login prompt.

Didn’t login, instead hit the restore from snapshot action, selected the file, and full restore. After 20 seconds or so, page became unresponsive, so I left it for another 5 hours, came back, nothing.

Powercycled again, and the system came back up, however with these issues.

  1. The static IP set for the system was not restored (is this part of the snapshot ?)
  2. The File Editor add-on was not restored
  3. The Google Drive Snapshot backup was restored, but would not run and the repository was missing from the supervisor add-on page
  4. Lots of errors in the supervisor logs, things not being strings, timeouts, unavailable transports etc.

So, took me about 14 hours to get the system back up, and this is what I get most of the time. Similar things happen with core update. If I do this via the command line, then it generally just returns an timeout error after an hour or so. Doing it via the UI is hit and miss, sometimes after several hours it will restart and be upgraded, other times it either does nothing at all, or trashes the system to a hard stop.

No traffic is blocked to/from the instance, I can see all DNS requests being fulfilled (not blocked for any reason). I have what I think is a relatively simple install with only DuckDNS, File Editor, Google Drive Backup and Terminal & SSH add-ons. 17 integrations, couple of hundred entities. Database is in memory with a 2 day retention (memory usage hovers around 70%) CPU load average stays around 0.5 (unless doing a core or OS update when it jumps to 10+).

The only problems I ever get are during the upgrade process.

Ideas ?

PS. How come I get errors like this in a brand new install ?

[supervisor.addons.addon] Building backup for add-on core_ssh
21-09-05 23:23:28 ERROR (MainThread) [asyncio] Task exception was never retrieved
future: <Task finished name='Task-2231' coro=<HomeAssistantWebSocket.async_supervisor_update_event() done, defined at /usr/src/supervisor/supervisor/homeassistant/websocket.py:138> exception=TypeError('Received message 257:None is not str')>
Traceback (most recent call last):
  File "/usr/src/supervisor/supervisor/homeassistant/websocket.py", line 143, in async_supervisor_update_event
    await self.async_send_command(
  File "/usr/src/supervisor/supervisor/homeassistant/websocket.py", line 134, in async_send_command
    return await self._client.async_send_command(message)
  File "/usr/src/supervisor/supervisor/homeassistant/websocket.py", line 46, in async_send_command
    response = await self.client.receive_json()
  File "/usr/local/lib/python3.9/site-packages/aiohttp/client_ws.py", line 291, in receive_json
    data = await self.receive_str(timeout=timeout)
  File "/usr/local/lib/python3.9/site-packages/aiohttp/client_ws.py", line 276, in receive_str
    raise TypeError(f"Received message {msg.type}:{msg.data!r} is not str")
TypeError: Received message 257:None is not str

All this timeout errors etc. sound like network issues to me. Is the Pi connected over LAN? Fo you have a complex network setup? Slow internet connection?
Just as a comparison, on my system it takes less than 5 minutes to download the latest image, install it and restart Home Assistant. Maybe it’s also time to update to a Pi 4 or something else that is more powerful.


Hardwired connection, no issues. Takes 25s to download the full build image from git. (been running computer networks for over 30 years)

As for power, with a 0.5 CPU load average the system is running at 1/10th its capacity day to day, so its pointless throwing away more money on more unused CPU cycles

(A Pi 3B+ can perform 5,300,000,000 floating point operations per second. The computer that put man on the moon peaked at 3,600. All I want to do is turn my lights on and off)

The main bottleneck on the Pi3 (and to a lesser extent on the Pi4) is the really slow I/O of the SD card controller. So SD card I/O needs to be minimized, especially writes, and the Pi3 can become really snappy even without an SSD. The problem is that HAOS is absolutely not optimized for this. AFAIK, there are no measures to limit I/O (read only filesystem, logging to ramdisk, suppressing logging, etc). Add to that the Supervisor which is well known for doing all kinds of things that spam the local network with insane amounts of requests, which again generate logging and SD card I/O. The database, if not mapped to an NFS drive or similar, will then kill the rest of the remaining performance.

Install Raspberry Pi OS, which has a default configuration that is much better suited for I/O limiting and can be configured to become an almost entirely RO filesystem in the extreme case. Move the database to somewhere else (external NAS or something) and run HA Core. You’d be surprised how fast and responsive an RPi3B can be if you cut out all the bloat.

So, to limit IO on the Pi I use the recorder settings to turn off history logging for the majority of devices, and I also run a full in memory database :

  purge_keep_days: 2
  db_url: 'sqlite:///:memory:'

I also turn off all but critical logging

  default: critical

This effectively means that is virtually no IO to the SD card, so my disk usage graph looks like this:

And the network activity is relatively low:

Screenshot from 2021-09-06 10-07-32
Screenshot from 2021-09-06 10-07-13

Its fast in day to day use, history and log pages loads instantly…, like I said, the problem is just with upgrades.