I've run into an issue that I don't know how to fix: (lxc can't connect to the socket)

This is likely caused by the same issue as the error others have seen: “Duplicate config row found for key …”

And the original reported issue here:

https://github.com/lxc/lxd/issues/8260

In your case, you’ve likely just upgraded and jumped several releases such as to miss the interim release that just detected these issues and gave the error seen in those other reports, and instead got caught out by the schema change we added to prevent the issue happening in the future.

Please could you provide the output of:

sudo sqlite3 /var/snap/lxd/common/lxd/database/global/db.bin
sqlite> SELECT * FROM networks;
sqlite> SELECT * FROM networks_config;