Push and pull fail on a debian11-based installation

Host is Debian 11.

I’ve built LXD 5.21.1 LTS. Everything is working fine (LXD is configured to run with systemd and I can create / operate containers normally), but the push and pull commands fail with error receiving version packet from server

# lxc launch ubuntu:22.04 c1
# lxc exec ubuntu:22.04 touch /tmp/a
# lxc file pull c1/tmp/a
Error: error receiving version packet from server: read unix @->/proc/self/fd/34/forkfile.sock: read: connection reset by peer

Not sure if this is related but:

# lxd --version
lxd: error while loading shared libraries: libdqlite.so.0: cannot open shared object file: No such file or directory
# LD_LIBRARY_PATH=/usr/share/lxd-libs/ lxd --version
5.21.1 LTS
# lxc --version
5.21.1 LTS

Folder /usr/share/lxd-libs/ contains all the libraries created at build time.