Ubuntu: ‘Connection to the Snap Store failed’ during upgrade from Ubuntu 20 to 22

If you are upgrading from Ubuntu 20 to Ubuntu 22 using ‘do-release-upgrade’ and get a fatal error ‘Connection to the the Snap Store failed’, this may be resolved by removing the ‘lxd’ package which is a lightweight container supervisor.

sudo /etc/init.d/lxd stop
sudo rm -fr /var/lib/lxd
sudo dpkg --force depends -P lxd; sudo dpkg --force depends -P lxd-client
sudo apt upgrade -f -y

After making this change, run ‘do-release-upgrade ‘again.

REFERENCES

askubuntu.com, Your system is unable to reach the snap store

ubuntu.forumming.com, Your system is unable to reach the snap store

ubuntu.com, LXD containers overview