I do not know when this started, but my snap packages were all out of date. It turns out that snapd is unable to update. Installing new snaps is the same result.
$ sudo snap install hello-world
error: cannot install "hello-world": cannot query the store for updates: got unexpected HTTP status
code 408 via POST to "https://api.snapcraft.io/v2/snaps/refresh"
I have searched for various solutions but none of them worked. Indeed I have tried so many things I may have forgotten some of them.
- The server pings no problem.
- An
mrttraceroute shows no packet loss. - Disabling IPv6 makes no difference.
curl -s https://api.snapcraft.io/v2/snaps/refreshfails because it expects a POST request.
Basically, there's nothing wrong with the connection.
snap debug connectivity reports failure.
The usual restarts and reboots did nothing, as expected.
I tried snap download node to manually install NodeJS, and the download worked fine, but after installing and attempting to run node I keep getting an exec error: not found. The binary exists in the path so... I gave up on that idea.
Eventually I bit the bullet and decided to purge snapd, remove and reinstall made no difference.
This was particularly difficult as I had to force unmount every Snap mount, and remove BTRFS snapshots created by the LXD snap - apt purge snapd on its own is not capable of doing this.
Once done, and I checked it was cleaned up, I installed again.
Success!
I began reinstalling all the snaps I wanted to use.
And then it stopped working again. Exactly the same error message, absolutely no solution.
$ sudo snap install hello-world
error: cannot install "hello-world": cannot query the store for updates: got unexpected HTTP status
code 408 via POST to "https://api.snapcraft.io/v2/snaps/refresh"
However, it was working for a few minutes!
$ snap changes
ID Status Spawn Ready Summary
1 Done today at 21:37 BST today at 21:38 BST Initialize system state
2 Done today at 21:38 BST today at 21:40 BST Install "openra" snap
3 Doing today at 21:38 BST - Initialise device
4 Done today at 21:41 BST today at 21:42 BST Install "anbox" snap from "edge" channel
5 Done today at 21:44 BST today at 21:44 BST Install "node" snap from "18/stable" channel
6 Done today at 21:45 BST today at 21:46 BST Install "code" snap
Now everything is failing in the same way.
May 22 22:04:01 ken snapd[10080]: api_snaps.go:317: Installing snap "gnome-2048" revision unset
May 22 22:04:11 ken snapd[10080]: api_snaps.go:317: Installing snap "hello-world" revision unset
May 22 22:07:09 ken snapd[10080]: api_snaps.go:317: Installing snap "gnome-2048" revision unset
May 22 22:08:14 ken snapd[10080]: api_snaps.go:317: Installing snap "guiscrcpy" revision unset
May 22 22:09:31 ken snapd[10080]: api_snaps.go:317: Installing snap "vlc" revision unset
This time, however, the debug claims to connect no problem.
$ snap debug connectivity
Connectivity status:
* PASS
I tried sudo snap abort 3 but it just started again. I don't even know which package it is coming from, what is doing.... I'm at a loss. Snaps are a nightmare.
Does anyone know how to fix this issue?