Installing Home Assistant on a RPi 4b with SSD boot

How much of a speed increase is there for rebooting HA when you go from SD Card to an SSD?

Hi there,

Do we need to place a wpa.conf file on the root of the ssd before first boot, or can the first boot work ok with a direct LAN Ethernet cable connection?

I have ordered all the kit recommended and just waiting for delivery before embarking on this new hardware journey…

First boot will work with a direct LAN cable. After login to HA, you can change to wifi connection if you want under Supervisor tab.

1 Like

… but remember that for a reliable and responsive system it might be better to stay on LAN. :wink:

2 Likes

Soooo, I don’t know what has gone wrong. :frowning: Everything was working great using the above and then out of nowhere errors galore.

Such fun things as

Logger: homeassistant.components.recorder
Source: components/recorder/__init__.py:693
Integration: Recorder (documentation, issues)
First occurred: 7:49:30 (3488 occurrences)
Last logged: 20:35:31

Error in database connectivity during commit: Error executing query: (sqlite3.OperationalError) disk I/O error (Background on this error at: http://sqlalche.me/e/14/e3q8). (retrying in 3 seconds)

And

Logger: homeassistant.components.recorder
Source: components/recorder/__init__.py:716
Integration: Recorder (documentation, issues)
First occurred: 7:49:33 (3487 occurrences)
Last logged: 20:35:26

SQLAlchemyError error processing event <Event time_changed[L]: now=2021-05-25T20:35:01.002058+01:00>: This connection is on an inactive transaction. Please rollback() fully before proceeding. (Background on this error at: http://sqlalche.me/e/14/8s2a)
SQLAlchemyError error processing event <Event time_changed[L]: now=2021-05-25T20:35:03.001640+01:00>: This connection is on an inactive transaction. Please rollback() fully before proceeding. (Background on this error at: http://sqlalche.me/e/14/8s2a)
SQLAlchemyError error processing event <Event time_changed[L]: now=2021-05-25T20:35:11.001779+01:00>: This connection is on an inactive transaction. Please rollback() fully before proceeding. (Background on this error at: http://sqlalche.me/e/14/8s2a)
SQLAlchemyError error processing event <Event time_changed[L]: now=2021-05-25T20:35:13.002060+01:00>: This connection is on an inactive transaction. Please rollback() fully before proceeding. (Background on this error at: http://sqlalche.me/e/14/8s2a)
SQLAlchemyError error processing event <Event time_changed[L]: now=2021-05-25T20:35:23.001712+01:00>: This connection is on an inactive transaction. Please rollback() fully before proceeding. (Background on this error at: http://sqlalche.me/e/14/8s2a)
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/recorder/__init__.py", line 534, in _process_one_event_or_recover
  File "/usr/src/homeassistant/homeassistant/components/recorder/__init__.py", line 627, in _process_one_event
  File "/usr/src/homeassistant/homeassistant/components/recorder/__init__.py", line 690, in _commit_event_session_or_retry
  File "/usr/src/homeassistant/homeassistant/components/recorder/__init__.py", line 716, in _commit_event_session
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/session.py", line 1428, in commit
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/session.py", line 833, in commit
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 2323, in commit
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 2523, in _do_commit
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 540, in _invalid_transaction
sqlalchemy.exc.PendingRollbackError: This connection is on an inactive transaction.  Please rollback() fully before proceeding. (Background on this error at: http://sqlalche.me/e/14/8s2a)

And

Logger: aiohttp.server
Source: components/http/static.py:39
First occurred: 20:35:00 (1 occurrences)
Last logged: 20:35:00

Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/aiohttp/web_protocol.py", line 422, in _handle_request
    resp = await self._request_handler(request)
  File "/usr/local/lib/python3.8/site-packages/aiohttp/web_app.py", line 499, in _handle
  File "/usr/local/lib/python3.8/site-packages/aiohttp/web_middlewares.py", line 119, in impl
  File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 56, in security_filter_middleware
  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 18, in request_context_middleware
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 74, in ban_middleware
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 135, in auth_middleware
  File "/usr/src/homeassistant/homeassistant/components/http/static.py", line 39, in _handle
  File "/usr/local/lib/python3.8/pathlib.py", line 1415, in is_dir
  File "/usr/local/lib/python3.8/pathlib.py", line 1197, in stat
OSError: [Errno 5] I/O error: '/usr/local/lib/python3.8/site-packages/hass_frontend/frontend_latest/chunk.f1d56069bdfcd4228e40.js'

This has happened following fresh installs and I have no idea what to do. Back to SD Card for me it seems.

My first guess would be that your database file is corrupt. Try to delete /config/home-assistant_v2.db and restart HA.

By deleting that file you will lose your history. This data is deleted anyway after 10 days. A new, empty file will be created on restart and your history will fill up again over the next days.

This being said such corruption should not happen out of nowhere. Did you have an unexpected power outage? Or did you “shut down” your system by pulling the plug?

1 Like

And if the proposed solution from Jpsy is not working I suggest to switch to MariaDB.

You just need to install the addon, define a password in configuration

databases:
  - homeassistant
logins:
  - username: homeassistant
    password: your_password
rights:
  - username: homeassistant
    database: homeassistant

And add this line to your configuration.yaml

recorder:
  db_url: mysql://homeassistant:your_password@core-mariadb/homeassistant?charset=utf8mb4

It’s faster and way more stable and reliable.

I had often times problems with the sqlite files. Also in other context.

1 Like

Does anyone know when / if HA OS will update the firmware of the Raspberry?

I helped a friend switch from SD to USB SSD yesterday, but still ended up having to do the rpi-eeprom update manually before it would boot from the USB.

——-Update——-
Looks like this answers my question, although I now see this as well in the OS 5.13 to 6.0 changes, which sounds like it will now be disabled again.

Any way though to see the current version from HA OS?

Do we still need to set up a base-level version of HA on the SSD before we restore from snapshot?

How should an empty SSD restore your snapshot?

Is either of Core v2021.6.4 or OS 6.0 safe to update to at this time or should we be holding off and staying on 2021.6.3 & 5.13?

1 Like

I am running OS 6.0 and core 2021.6.4 without any issues.

2 Likes

I’m on Argon M.2 case with SSD. Just updated everything to latest, i.e OS 6.0, Core 2021.6.4 and Supervisor 2021.6.0.

Everything is working fine.

2 Likes

I’m new to HA and have never restored from a snapshot so I’m unfamiliar with how that works. Does it give you an option to restore from local or remote files (I save a daily snapshot to my Google Drive).

It is really easy:
Flash a device with Home Assistant Operating System.
Plug it in your Pi.
Switch on the Pi.
Wait until you see something at http://homeassistant.local (maybe :8123, I don‘t know it anymore)
There you can upload a snapshot from you local computer.
Then you have to wait.
Ready!

Thanks! I’m in the middle of this process and I have the SSD plugged into the Pi and displayed on my TV. I see the black screen that says Welcome to Home Assistant and homeassistant login.

Strangely, I cannot connect to the Pi with IP:Port, homeassistant.local, homeassistant:8123 or anything combination thereof.

Wow, that took way longer than expected, but it’s finally working.

slightly off topic, but please let me ask if you had to issue the special command Argon is talking about, for activating the fan in that case? Or can you use the on/off button for it alright in HA?

No issue with the Argon Active Fan Cooling addon. Still working though I didn’t use the on/off button at te Argon case.

and is the fan always on (steady speed) or does it only kick in on certain temp levels?

If you are using the Argon active cooling addon…You can set the temp levels and the fan will kick in at different % depends on the temp. You can check the documentation.