Installing Home Assistant Supervised on a Raspberry Pi using Debian 12

This worked great! thanks

Apologies… I had gotten frustrated and restored a backup. I just went back to this and still get the same issues on a new try.

deb http://deb.debian.org/debian/ bookworm main non-free
deb-src http://deb.debian.org/debian/ bookworm main

deb http://security.debian.org/debian-security bookworm-security main non-free
deb-src http://security.debian.org/debian-security bookworm-security main

# bullseye-updates, to get updates before a point release is made;
# see https://www.debian.org/doc/manuals/debian-reference/ch02.en.html#_updates_                                         and_backports
deb http://deb.debian.org/debian/ bookworm-updates main non-free
deb-src http://deb.debian.org/debian/ bookworm-updates main
Python 3.11.2

apt.conf is not available.
Edit: The issue seems to stem specifically from py3clean:

Preparing to unpack .../python3-debian_0.1.49_all.deb ...
Traceback (most recent call last):
  File "/usr/bin/py3clean", line 210, in <module>
    main()
  File "/usr/bin/py3clean", line 196, in main
    pfiles = set(dpf.from_package(options.package))
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/share/python3/debpython/files.py", line 54, in from_package
    stdout = str(stdout, 'utf-8')
             ^^^^^^^^^^^^^^^^^^^^
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x82 in position 6: invalid start byte
dpkg: warning: old python3-debian package pre-removal script subprocess returned error exit status 1
dpkg: trying script from the new package instead ...
Traceback (most recent call last):
  File "/usr/bin/py3clean", line 210, in <module>
    main()
  File "/usr/bin/py3clean", line 196, in main
    pfiles = set(dpf.from_package(options.package))
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/share/python3/debpython/files.py", line 54, in from_package
    stdout = str(stdout, 'utf-8')
             ^^^^^^^^^^^^^^^^^^^^
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x82 in position 6: invalid start byte
dpkg: error processing archive /var/cache/apt/archives/python3-debian_0.1.49_all.deb (--unpack):
 new python3-debian package pre-removal script subprocess returned error exit status 1
Traceback (most recent call last):
  File "/usr/bin/py3compile", line 323, in <module>
    main()
  File "/usr/bin/py3compile", line 302, in main
    compile(files, versions,
  File "/usr/bin/py3compile", line 185, in compile
    for fn, versions_to_compile in filter_files(files, e_patterns, versions):
  File "/usr/bin/py3compile", line 128, in filter_files
    for fpath in files:
  File "/usr/share/python3/debpython/files.py", line 71, in filter_public
    for fn in files:
  File "/usr/share/python3/debpython/files.py", line 54, in from_package
    stdout = str(stdout, 'utf-8')
             ^^^^^^^^^^^^^^^^^^^^
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x82 in position 6: invalid start byte
dpkg: error while cleaning up:
 installed python3-debian package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
 /var/cache/apt/archives/python3-debian_0.1.49_all.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

Note that the error also occurs when directly connected (local terminal), not just via SSH.

Okay, I seem to have figured it out. This is actually caused by an issue in Ubuntu with different locales, but also affects my system for some reason.
I ended up manually applying the changes listed here and it fixed it. The file to edit is /usr/share/python3/debpython/files.py - just note that it differs slightly from the linked one, but the same additions/changes will work.

So you installed HA Supervised on Ubuntu? :thinking:

No, I installed it on Debian. But the only mention of a similar issue I found was for Ubuntu, and the same fix transferred successfully to Debian.

1 Like