Update SQLite to 3.40.1 or later (can't update)

I get this warning message after installing 2024.8.3.

However when I run

sudo apt install sqlite3

It says

sqlite3 is already the newest version (3.37.2-2ubuntu0.3)

Does anyone know what I should do?

1 Like

Update Ubuntu first?

I have Linux Mint 21.3, which is based on Ubuntu 22.04.

Many users will be on a 22.04 based system, which receives LTS (Long-Term Support) until 2027. One wonders why this wasnā€™t good enough, it includes v3.37.2 of sqlite

Iā€™ve set the ā€œCritical Repair promptā€ to ignored for now.

@bdraco , as you seem to be involved in the upcoming SQLite dependency version bump, could you provide insights?

Iā€™m surprised about this warning in general. The SQLite client is pulled in via pip, not as an OS-provided client, right? (e.g., I donā€™t have any sqlite apt packages installed in my operating system).

If thatā€™s so, then it is out-of-scope for the Home Assistant administrator to take care of updating SQLite. Instead, it will take place via an upcoming Home Assistant update.

We would need someone to make a long term commitment to testing and maintaining older versions until 2027, and dealing with writing any manual migrations that canā€™t be done on all versions to realistically be able to support old versions to make that happen.

SQLite is provided by the operating system in almost all cases. Python is generally linked against the SQLite provided by the operating system unless youā€™ve compiled your own custom python, with its statically linked to a different version

1 Like

I didnā€™t know that. Thank you for this clarification.

My Home Assistant Core installation runs on Ubuntu 22.04.4 LTS jammy (Raspberry Pi 4B).

Because Ubuntu 22.04ā€™s apt package archives only provide Python 3.10, and because previous HA upgrades bumped the minimum Python version requirements to Python 3.12 currently (2024.8.x), I leverage Python3.12 from the deadsnakes PPA.

Assuming I understand the deadsnakes Python3.12 build process correctly, it uses Ubuntu 22.04ā€™s ā€œoriginalā€ libsqlite3-dev, which will probably stay at version 3.37.2.

Confirming command:

$ python3.12 -c 'import sqlite3;print(sqlite3.sqlite_version)'
3.37.2

# learned from https://discuss.python.org/t/will-sqlite3-be-updated-in-the-standard-library-to-address-fixed-cvss-vulnerabilities/48629

So in case the proposed amendment doesnā€™t make it, us Ubuntu 22.04 homelab users will have a long weekend in February 2025, or just shrug it off and peak/sunset at Home Assistant 2025.01.

1 Like

Iā€™ve realized I made a mistake to choose an LTS OS for my Home Assistant. Iā€™m going to be migrating off of Ubuntu LTS personally. HA bumps dependencies way too quickly to work with an LTS OS properly. If you have to make it work with Deadsnakes (as I currently am as well) it defeats the purpose of LTS entirely.

1 Like

Does anyone know which is the ā€œcanonicalā€ linux distro the devs are chasing with these version upgrades?
I have been running Raspbian (on RPi 3B+), but this seems like a futile attempt for past several years.

1 Like

Is there a way to set which sqlite is used? Iā€™ve got sqlite 3.47 installed in /usr/local/bin, and this is the default one on the command line:

>sudo su - homeassistant
$ sqlite3 -version
3.47.2 2024-12-07 20:39:59 2aabe05e2e8cae4847a802ee2daddc1d7413d8fc560254d93ee3e72c14685b6c (64-bit)

However, the Recorder code seems to use the 3.37 version installed at /usr/bin/sqlite3. Iā€™d much rather point HA at the local version than change my system sqlite. I canā€™t see any way to do this in the Recorder docs (Recorder - Home Assistant) - they only allow specifying a DB via the url schema.

Small update on this - Iā€™ve managed to get the installed python to work with sqlite3:

(homeassistant) homeassistant@xxx:/srv/homeassistant$ python3
Python 3.13.1 (main, Dec  4 2024, 08:54:14) [GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import _sqlite3
>>> _sqlite3.sqlite_version
'3.47.2'

However, this isnā€™t picked up by homeassistant - anything I would need to do?

(for anyone else trying to do this, Iā€™ve installed from source (SQLite Download Page) into /usr/local, and then added this to the bin/activate script in /srv/homeassistant:

...
export LD_LIBRARY_PATH=/usr/local/lib

OK, I now have things working!

Procedure:

...
Environment="LD_LIBRARY_PATH=/usr/local/lib"

Now, Iā€™ve got HA running happily on Ubuntu 22.04.5 LTS.