Pyatv + home assistant + dietpi on H3 processors

Creating a bug report/issue

Required Information

G_DIETPI_VERSION_CORE=8
G_DIETPI_VERSION_SUB=7
G_DIETPI_VERSION_RC=1
G_GITBRANCH=‘master’
G_GITOWNER=‘MichaIng’

  • DietPi version | cat /boot/dietpi/.version

  • Distro version | echo $G_DISTRO_NAME $G_RASPBIAN
    bullseye

  • Kernel version | uname -a
    Linux MagicCube 5.15.48-sunxi #22.05.3 SMP Wed Jun 22 07:35:10 UTC 2022 armv7l GNU/Linux

  • SBC model | echo $G_HW_MODEL_NAME or (EG: RPi3)
    NanoPi Neo and NanoPi M1

  • Power supply used | (EG: 5V 1A RAVpower)
    5V 3A

  • SD card used | (EG: SanDisk ultra)
    SanDisk Industrial

Additional Information (if applicable)

  • Software title | (EG: Nextcloud)
    home assistant, pyatv
  • Was the software title installed freshly or updated/migrated?
    no, core install
  • Can this issue be replicated on a fresh installation of DietPi?
    yes
    ← If you sent a “dietpi-bugreport”, please paste the ID here →
  • Bug report ID | echo $G_HW_UUID
    c57ae1b3-4ea0-4cb6-98be-cae15a392ca8

Steps to reproduce

  1. stock install home assistant on fresh copy of DietPi on SBC model
  2. install Apple TV integration

Expected behaviour

Home Assistant should auto discover Apple TV’s on the network.

Actual behaviour

Extra details

I Receive this error when trying to discover apple tv on Armv71 (NanoPi Neo with H3). This seems to happen only on the two boards that are running the H3 processor. I have an Odroid C2, C4 and no issues there. Things run from stock install.

There are similar posts out there which led me to the possible solution

https://github.com/home-assistant/core/issues/65837

https://github.com/home-assistant/core/issues/66378

// This is the exact error I receive

DietPi Home Assistant[577]: ImportError: /mnt/dietpi_userdata/homeassistant/deps/lib/python3.9/site-packages/_miniaudio.abi3.so: undefined symbol: __atomic_load_8

Possible Fix
//I took these steps to fix the issue. Once done, the fix survived a home assistant update and dietpi version update.

//stop home assistant

systemctl stop home-assistant.service

//Log in as homeassistant
sudo -u homeassistant bash

//Change to /srv/homeassistant (with “cd”) in this case it’s diepti specific folder
cd /mnt/dietpi_userdata/homeassistant/deps/lib/python3.9/site-packages/

//remove _miniaudio (wihtout removing this, the same issue arises even if the compile is done)
rm _miniaudio.abi3.so
//Activate the virtual environment (“source bin/activate”)
. /home/homeassistant/pyenv-activate.sh
//Recompile miniaudio
pip install --ignore-installed miniaudio --no-binary :all:

//It takes a while for the compile to finish!

//Log back in as root
//Remove .storage folder, database and log files from /mnt/dietpi_userdata/homeassistant/ for a fresh start
rm -rf /mnt/dietpi_userdata/homeassistant/.storage
rm /mnt/dietpi_userdata/homeassistant/db /mnt/dietpi_userdata/homeassistant/log

//start home assistant
systemctl start home-assistant.service

//Initialize Home Assistant from web UI

@MichaIng can you have a look on this

Just to rule it out:

apt install libatomic1

But some threads out there seem to indicate that some Python modules do not load the library correctly for some reason. Preloading or seems to help, but let’s assure first it’s really installed.

I’ll try this suggestion out and report back

Doing this didn’t solve the issue.
I started with a fresh install but I ran into this issue
Home Assistant crashes at startup (sqlalchemy maybe the cause) · Issue #76296 · home-assistant/core · GitHub
Applied the fix you suggested to the env and finally was able to start HA.
Issued the command you suggested, still no love pyatv even after reboot.
I received
“libatomic1 is already the newest version (10.2.1-6).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.”
I applied the fix I suggested in the opening thread and Apple TV discovered.