RaspberryPI - HA Core - Version 3.27.2 of SQLite is not supported

When upgrading to HA 2021.11.0 I get the message:

Logger: homeassistant.components.recorder.util
Source: components/recorder/util.py:304
Integration: Recorder (documentation, issues)
First occurred: 16:52:42 (1 occurrences)
Last logged: 16:52:42

Version 3.27.2 of SQLite is not supported; minimum supported version is 3.32.1. Starting with Home Assistant 2022.2 this will prevent the recorder from starting. Please upgrade your database software before then

I am running HA Core on a Raspberry PI…

$ cat /etc/rpi-issue
Raspberry Pi reference 2019-09-26
Generated using pi-gen, https://github.com/RPi-Distro/pi-gen, 80d486687ea77d31fc3fc13cf3a2f8b464e129be, stage2

When I try to upgrade sqlite3 I get…

$ sudo apt install sqlite3 --upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
sqlite3 is already the newest version (3.27.2-3+deb10u1).

Any suggestions on how I move forward?

3 Likes

I found a solution, documenting for others…

wget https://sqlite.org/2021/sqlite-autoconf-3360000.tar.gz
tar -xvf sqlite-autoconf-3360000.tar.gz
cd sqlite-autoconf-3360000
./configure
make
sudo make install

hass still complained. It turned out to be where the libraries were installed.
The old libraries were in /usr/lib/arm-linux-gnueabihf/, whereas the new ones were in /usr/local/lib.
At that point I took the easy option (hass is the only application running, so no risk to other apps)…

sudo cp /usr/local/lib/*sql* /usr/lib/arm-linux-gnueabihf/
sudo chmod a+x /usr/lib/arm-linux-gnueabihf/*sql*

hass then restated without the warning.

21 Likes

thanks, i wanted to do this over a few weeks, but now i did it today.
cause i dont have to search anymore for the best way of doing this. :+1:

1 Like

Hello,
is there any option more clean than the copy command above ?
thank You

I tried a lot of different things to get this working, I didn’t want to overwrite the system sqlite.

Annoyingly there is no clean way to point a freshly compiled python at a freshly compiled sqlite (eg a --with-sqlite configure flag).

In the end I stood up a local mariadb instance.

What would be nice would be if HA supported using the pysqlite3 module, which offers compatibility with the stdlib sqlite3 but allows a custom sqlite build.

I found an alternative solution by updating Raspberry Pi package list:

sudo nano /etc/apt/sources.list

then I added this line:

deb http://raspbian.raspberrypi.org/raspbian/ bullseye main contrib non-free rpi

Save & exit the file, then type:

sudo apt update
sudo apt install sqlite3 -t bullseye

Once it’s done installing/updating you can check the sqlite3 version by typing:

sqlite3 --version

It should output something like this:

3.34.1 2021-01-20 14:10:07 10e20c0b43500cfb9bbc0eaa061c57514f715d87238f4d835880cd846b9ealt1

FYI, my RaspberryPi3 is running

PRETTY_NAME="Raspbian GNU/Linux 9 (stretch)"
NAME="Raspbian GNU/Linux"
VERSION_ID="9"
VERSION="9 (stretch)"
VERSION_CODENAME=stretch
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"
4 Likes

Don´t work for me:

sudo apt install sqlite3 -t bullseye
Leyendo lista de paquetes... Hecho
Creando árbol de dependencias
Leyendo la informaciĂłn de estado... Hecho
No se pudieron instalar algunos paquetes. Esto puede significar que
usted pidió una situación imposible o, si está usando la distribución
inestable, que algunos paquetes necesarios aĂşn no se han creado o se
han sacado de «Incoming».
La siguiente informaciĂłn puede ayudar a resolver la situaciĂłn:

Los siguientes paquetes tienen dependencias incumplidas:
 libc6-dev : Rompe: libgcc-8-dev (< 8.4.0-2~) pero 8.3.0-6+rpi1 va a ser instalado
E: Error, pkgProblemResolver::Resolve generĂł cortes, esto puede deberse a paquetes retenidos.

Doesn’t work for me either:

sudo apt install sqlite3 -t bullseye
Reading package lists… Done
Building dependency tree
Reading state information… Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
libc6-dev : Breaks: libgcc-8-dev (< 8.4.0-2~) but 8.3.0-6+rpi1 is to be installed
E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.

This is on Raspberry PI 4 …

The solution from ColinRobbins worked fine for me!
Thanks a lot ColinRobbins!

I did this today, and it seemed to work as it should. Then I tried to reboot, and I now have two Pi’s that throws an error message saying “No session for pid xxx”, and the menu line in Buster doesn’t show. :scream: I have not yet found a fix for it.

Edit: And after an hour it’s worse, now I can’t even see the desktop with VNC on one of the Pi’s.

What happened is that it became a bastard version of Buster and Bullseye (latest Raspbian version), which made all sorts of probles. I’m glad I have backups…

You could set the LD_LIBRARY_PATH environment variable for Home Assistant. How you do that depends on how you installed it.

Trying to pull in the bullseye version pulled in lots of other things, and ended up making the system unusable. I was forced to revert to a backup. But the solution from ColinRobbins worked fine for me!

The answer is as written by @ColinRobbins.
For WSL the path would be /usr/lib/x86_64-linux-gnu/

If you’re unsure - run
find /usr -name libsqlite3*so* -exec ls -l {} \;

Really thanks

Thanks for this answer. It helped me
I think if you use:
./configure --libdir= /usr/lib/arm-linux-gnueabihf/
You do not have to copy. I didn’t test this yet

1 Like

Many thanks for the solution! As an alternative to overwriting existing sqlite library files, you can export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib before starting hass. This way you can keep both versions of the library and not affect any other current or future apps.

1 Like

I compiled sqlite3 as @ColinRobbins suggested, but adding a different prefix. Just change the
./configure
to
./configure --prefix=/opt/sqlite

Then, I edited the systemctl script (/etc/systemd/system/[email protected]) to point at the new libs:

[Unit]
Description=Home Assistant
After=network-online.target

[Service]
Type=simple
User=%i
Environment=“GPIOZERO_PIN_FACTORY=pigpio”
Environment=“PIGPIO_ADDR=127.0.0.1”
Environment=“LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/sqlite//lib”
ExecStart=/opt/homeassistant/bin/hass -c “/home/%i/.homeassistant”

[Install]
WantedBy=multi-user.target

Pretty clean.

2 Likes

https://www.msly.cn/boards/topic/57/installing-home-assistant-core-on-raspberry-pi-3b-step-by-step/page/2#1304