I’m running an old Home Assistant 0.92 system that I would like to try updating to the latest version before getting even more out of date. It’s running off an SD card with Armbian Ubuntu 18.04, plugged into an Amlogic S805 chip media player. Since this box is dedicated to running Home Assistant, I originally installed HA directly in Linux, no container or VM required to complicate things.
So I can easily copy this installation to a new SD card and experiment with updating it. But after hours of effort, I’m defeated at every turn. All the suggested upgrade or fresh installation methods I’ve tried end with error messages without accomplishing anything. Usually it’s something unhelpful like “No module named apt_pkg”.
Any suggestions as to the simplest possible installation method for me to try with this setup? I willing to start fresh and throw out the current working HA installation to rebuild it later. If I could try working through the simplest install method one step at a time, maybe I would have a chance of debugging what’s going wrong step by step.
Ideally, if it’s an option, I’d suggest using the Docker install method. That won’t impact your current install at all, and you can get it set up and tested before migrating.
Thanks, let’s give it a try…
First test, can we run Docker?
# Docker
Traceback (most recent call last):
File "/usr/lib/command-not-found", line 28, in <module>
from CommandNotFound import CommandNotFound
File "/usr/lib/python3/dist-packages/CommandNotFound/CommandNotFound.py", line 19, in <module>
from CommandNotFound.db.db import SqliteDatabase
File "/usr/lib/python3/dist-packages/CommandNotFound/db/db.py", line 5, in <module>
import apt_pkg
ModuleNotFoundError: No module named 'apt_pkg'
#
Apparently not.
Followed the official instructions to install Docker on Ubuntu 18.04 here: https://docs.docker.com/engine/install/ubuntu/
When it gets to
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs)
stable"
It errors out with:
Traceback (most recent call last):
File "/usr/bin/add-apt-repository", line 12, in <module>
from softwareproperties.SoftwareProperties import SoftwareProperties, shortcut_handler
File "/usr/lib/python3/dist-packages/softwareproperties/SoftwareProperties.py", line 28, in <module>
import apt_pkg
ModuleNotFoundError: No module named 'apt_pkg'
I’ve tried various general suggestions for fixing “No module named ‘apt_pkg’”, such as https://stackoverflow.com/questions/56218562/how-to-fix-modulenotfounderror-no-module-named-apt-pkg, but none of them seem to help so far. I have a feeling that this problem is due to me upgrading Python from version 3.6 to version 3.7, which I thought I had to do to install the current version of Home Assistant. Currently if I enter “python3 --version”, I get back “3.7.5”.
I could always revert to before the Python update to version 3.7.
You’ll need to find an official guide for Armbian, since Ubuntu will be generally assumed to be AMD64 (64 bit Intel).
Python needs to be at least 3.7.1, but really you should be aiming at 3.8.6 since when 3.9 is released support for 3.7 will be dropped. You can just manually install Python, I’ve done that, but it takes a long time on low powered systems.
Installing a Python update is quick, and the new version runs fine. But clearly something went wrong with the system configuration as a result of the Python 3 update that is screwing up the installation of any new package, and I don’t know what it was.
sigh
I used this method, which came up first when I googled updating Python to version 3.7 on Ubuntu 18.04: https://tech.serhatteker.com/post/2019-09/upgrade-python37-on-ubuntu18/
Only now do I see the fine print: “Update: method may cause system error : probably [break apt]”
Another few hours wasted: went back and started again from a fresh copy, installed Python 3.8, went through the Docker install procedure again from https://docs.docker.com/engine/install/ubuntu/
Result: FAIL on the command: apt-get install docker-ce docker-ce-cli containerd.io
no sources found for docker-ce or docker-ce-cli
Double-checked that I had the recommended repositories installed, the right ones for Ubuntu 18.04 (Bionic) and arm64 architecture.
Finally succeeded in finding docker-ce-arm64 and docker-ce-cli-arm64, but then next FAIL: “Unable to locate package containerd.io”
No solution found. Docker is not installed.
By the time you throw in multiple versions of Linux, multiple versions of Ubuntu, multiple hardware architectures, multiple repository sources, multiple versions of stable and test releases, it’s like throwing darts at a giant dartboard to locate the right information!
Your choice of Armbian is almost certainly at the heart of your problems, though with obscure hardware there’s likely little other choice.
Maybe it’s time to do a manual Python 3.8.6 install and a fresh venv. Maybe it’s time to buy some more common hardware
Python is not the problem. Python 3.8 is successfully installed. The problem yesterday was the defective Python install instructions that broke apt-get, now fixed.
But I think you may be right that adding anything else on top of Home Assistant may be making things too complicated to solve with my specific Armbian Ubuntu.
Today’s problem is the Docker installation. There’s a lot of different sources of different versions of Docker for different versions of Linux and different hardware architectures, and the standard instructions are apparently not adequate to cover all of the cases.
But finally a clue: I tried the manual Docker install from the .deb package and it warned me that the amd64 package is not correct for my armhf architecture. Doh! Why couldn’t that have been mentioned earlier by the auto install? Apparently the old S805 chip system I am installing on is not Arm64, but rather Armhf in Docker’s terminology. I’m too accustomed to seeing “Arm64” on the boot screen of the newer box that replaced it, and forgot that the old S805 chip might not have been Arm64. With that corrected, Docker installs correctly… and then fails to start for reason of “Failed”.
Delving into log files, Docker seems to be failing with “error msg=”[graphdriver] prior storage driver devicemapper failed: devicemapper: Error running deviceCreate (CreatePool) dm_task_run failed". This appears to be a very complex error that many people have had over the years, not easily resolved.
And in the end it turns out that there was a much easier way to install Docker that was staring me in the face on every SSH connection: “armbian-config”, mentioned in the login header. All you have to do is run armbian-config, select Third-Party Software and then Docker and then Install. The install is successful, but unfortunately just comes back to the same problem I encountered of my manual install.
I think it’s time to pull the plug on Docker - it’s just adding to the problems by imposing too many requirements on my simple Armbian Ubuntu 18.04. Looks like container install is out! Thanks anyway.