Docs & Howtos

Jason Kolpin Random Docs and Howto's

Setting up Home Assistant with an RX580 (Debian Trixie)

WARNING!!! I SPENT DAYS ON THIS AND THIS IS JUST A SHOT AT REMEMBER EVERYTHING THAT WAS DONE AS BEST I COULD. NO GUARANTEES HERE

Note! Hardware is important here. I did this using an old i7-4770 CPU, 20GB DDR3, and a Dragon Power RX580. The memory is the most important. I trie this with 6GB o DDR3 and it struggled and choked and errored out constantly.

IMPORTANT! If your BIOS has a setting to set the default video card, be sure it is set to force using the RX580. I had issues with it being set to "auto" in my BIOS.

IMPORTANT! This setup is SPECIFICALLY for the RX580. Using a more modern card would require changes to the debian packages installed, as well as the docker-compose.yml

REQUIRED DIRECTORY STRUCTURE


USER_HOME_DIR
          |
		  -- homeassistant

Install Debian Trixie, upgrade everythign to the latest, install some prerequisite software


:~# sudo apt update
:~# sudo apt dist-upgrade

Install some prerequisite packages


 sudo apt install cmake, curl, ffmpeg, amd firmware, glslc, glslang-dev, git, mesa-vdpau-drivers, mesa-va-drivers, mesa-libgallium, mesa-vulkan-drivers, vulkan-tools

Docker Setup

Create the keyring directory if it doesn't exist


 sudo apt install -m 0755 -d /etc/apt/keyrings

Download Docker's official GPG key


sudo curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc

Add the repository to Apt sources


echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

Update and Install


sudo apt update
sudo apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

Now you can either:

A) Create a new user to run everything from

B) create this in your user home directory and run everything as your user (recommended)

Create a homeassistant directory in the USER home directory


mkdir ~/homeassistant
cd ~/homeassistant

Check for user and group information

Create the ollama user for the docker service


sudo useradd -r -s /bin/false -U -m -d /usr/share/ollama ollama

We need to know if the ollama user (the user the service runs as) is in the render group and what the group number is


getent group render

If you don't see something like "render:x:992:ollama" then you have to add that user to the render group


sudo usermod -aG render,video ollama

Also add your user to the ollama group so you can manage models


sudo usermod -aG ollama $USER

Check again if the ollama user is in the render group.

IMPORTANT! Be sure to get the render and video group ids


getent group render

Output should be something like "render:x:992:ollama". 992 is the render group. Take note of this.


getent group video

Output should be something like "video:x:44:ollama". 44 is the video group. Take note of this as well.

REBOOT YOUR MACHINE

Upload the provided docker-compose.yml into the homeassistant directory

Make sure your terminal is in the ~/homeassistant directory!

Edit the docker-compose.yml

Pay close attention to this part


dns: # You can comment out this and the next two lines if your network isn't using any add blocking DNS hosts like pi-hole
  - 8.8.4.4 # THE GOOGLE DNS SERVER ARE BEING USED HERE BECAUSE MY PI-HOLE WAS BLOCKING WEB REQUESTS FROM DOCKER
  - 8.8.8.8 # THE GOOGLE DNS SERVER ARE BEING USED HERE BECAUSE MY PI-HOLE WAS BLOCKING WEB REQUESTS FROM DOCKER

IMPORTANT! THESE MUST BE CHANGED TO MATCH YOUR MACHINE AND ENVIRONMENT USING THE INFORMATION WE GATHER EARLIER


group_add: # you MUST change this to your specific Debian Trixie setup
  - "YOUR_VIDEO_GROUPID"   # Video group
  - "YOUR_RENDER_GROUPID"  # Your specific render group ID

Save the docker-compose.yml

Install Ollama with composer

This will take a long time!


docker compose up -d

Pull the tinyllama model to get started


docker exec -it ollama ollama pull tinyllama

Make docker start on boot


sudo systemctl enable docker

See if docker is running


sudo systemctl status docker

If it isn't running


sudo systemctl start docker

You should not have a running homeassistant

In a web browser, browse to:

http://yourserveripaddress:8123

Home Assistant Setup