Bug in snap refresh with private snap

I’m running into the following bug:

root@here:/home/me# snap refresh foo
error: snap "foo" not found
root@here:/home/me# snap install foo
snap "foo" is already installed, see 'snap help refresh'

I’ve tried adding --amend to the refresh command, but that doesn’t help. I don’t have a reproducer, but this issue showed up at the same time my snap login broke. This is a private snap. I logged out and logged back in again but now the refresh command is broken.

My snapd and core packages are up-to-date.

There’s very little information for anyone to try to figure out what the issue could be. Have you looked at snapd logs? Can you attach the output of snap list?

If you’re worried about leaking the name of the private snap, but are a customer you should file a support ticket.

Hi @mborzecki1, thanks for getting back to me.

The “foo” snap is registered as sponge-controller:

root@here:~$ snap list
Name                  Version                 Rev    Tracking       Publisher        Notes
core20                20250213                2503   latest/stable  canonical✓       base
core22                20250315                1912   latest/stable  canonical✓       base
core24                20250318                892    latest/stable  canonical✓       base
mesa-core20           21.2.6                  169    latest/stable  canonical✓       -
mesa-core22           23.2.1                  369    latest/stable  canonical✓       -
nmap                  7.95                    3887   latest/stable  maxiberta✪       -
snapd                 2.68.4                  24509  latest/stable  canonical✓       snapd
sponge-controller     0+git.d67eb1a-dirty     320    latest/beta    ******          private
ubuntu-frame          147-mir2.17.2           12367  22/stable      canonical✓       -
ubuntu-frame-osk      75-squeekboard-v1.17.1  1062   22/stable      canonical✓       -

The snapd logs don’t have a lot to say. I mainly see:

May 01 06:23:04 10002 snapd[473144]: storehelpers.go:916: cannot refresh:
May 01 06:23:04 10002 snapd[473144]: snap has no updates available: "core20", "core22", "core24", "mesa-core20", "mesa-core22", "nmap", "snapd", "ubuntu-fra>
May 01 06:23:04 10002 snapd[473144]: snap not found: "sponge-controller"
May 01 14:08:45 10002 snapd[473144]: api_snaps.go:467: Installing snap "sponge-controller" revision unset

This is from the output of journalctl -u snapd. Is there a better place to view snapd logs?

I would have assumed that the “install” and “refresh” commands use the same piece of code to verify if a snap exists, but maybe the account verification scripts differ between the two?

Yes, snap changes (note though that these are not persistent and get flushed regularly, so the relevant logs might be gone already)

root@here:~$ snap changes
ID     Status  Spawn                   Ready                   Summary
27194  Done    yesterday at 14:51 EDT  yesterday at 14:53 EDT  Auto-refresh snap "snapd"

snap changes doesn’t give more info. The last snap refresh on this system for the snap in question was the 10th of February, I just noticed the other day that it was out of date.

Yes, as I said, the changes get flushed regularly… (BTW with snap change <ID> you can see the actual details of such a log)

I think it may be really a store error that the snap wasn’t found. This is in line with what you mentioned about the snap being private.

Have you tried querying the store about the snap, by running snap info <snapname> ? Are you logged in? i.e. have you run snap login before? Does snap whoami show that you are logged in?

snap info is able to find the snap as expected:

root@here:~$ snap info sponge-controller
name:      sponge-controller
(...)
tracking:     latest/beta
refresh-date: 2025-02-10
channels:
  latest/stable:    0+git.0142686       2025-04-22 (413) 203MB -
  latest/candidate: 0+git.0142686       2025-04-22 (413) 203MB -
  latest/beta:      0+git.b0f17d6       2025-05-02 (433) 221MB -
  latest/edge:      0+git.b0f17d6       2025-05-03 (434) 301MB -
installed:          0+git.d67eb1a-dirty            (320) 199MB private

snap whoami shows that I am indeed logged in. When this issue first popped up I tried to logout and log back in again, but that didn’t help.

I tried some other snap commands too: snap install, snap switch, snap info, snap enable all recognize that the snap is installed. snap refresh seems to think that the snap is not installed.

Ordinarily I would try to uninstall and reinstall the snap, but this machine is a remote iot machine for which the remote access is handled by the snap in question. I can’t risk uninstalling the existing version and loosing access.

I suppose I could install a different means of remote access and reinstall the snap after, but if this is indeed a bug in snapd then fixing it there would be a better solution.

It could be that the snap store is returning not found error which snapd relays back to the user. Can you add the following:

SNAPD_DEBUG_HTTP=7
SNAPD_DEBUG=1

to the snapd service environment, restart snapd, run snap refresh and collect the logs?

Make sure to edit the logs and erase authentication Macaroon before pasting them to the forum.

Other snap versions seem to be listed properly, is it possible that the private revision was removed? Can you paste the output of snap list sponge-controller?

If the snap is unasserted you may need to run snap refresh --amend sponge-controller for snapd to start tacking the version available from the store again.