Download snap core invalid credentials

I cannot refresh my snap on ubuntu 18. I get the following error:

error: cannot perform the following tasks:
- Download snap "core" (8268) from channel "stable" (invalid credentials)
- Download snap "core18" (1668) from channel "stable" (invalid credentials)

The following is the snap logfile:

Jan 23 10:53:56 pc-ici17 dbus-daemon[2821]: apparmor="DENIED" operation="dbus_bind"  bus="session" name="org.keepassxc.KeePassXC.MainWindow" mask="bind" pid=7253 label="snap.keepassxc.keepassxc"
Jan 23 10:53:56 pc-ici17 kernel: [  434.234324] audit: type=1400 audit(1579773236.614:45): apparmor="DENIED" operation="open" profile="snap.keepassxc.keepassxc" name="/sys/bus/usb/devices/" pid=7253 comm=5468726561642028706F6F6C656429 requested_mask="r" denied_mask="r" fsuid=1001 ouid=0
Jan 23 10:53:56 pc-ici17 kernel: [  434.385162] audit: type=1400 audit(1579773236.766:46): apparmor="DENIED" operation="open" profile="snap.keepassxc.keepassxc" name="/sys/bus/usb/devices/" pid=7253 comm=5468726561642028706F6F6C656429 requested_mask="r" denied_mask="r" fsuid=1001 ouid=0
Jan 23 10:54:05 pc-ici17 dbus-daemon[2821]: [session uid=1001 pid=2821] Activating service name='io.snapcraft.Launcher' requested by ':1.105' (uid=1001 pid=7389 comm="snapctl user-open https://github.com/login " label="snap.keepassxc.keepassxc (enforce)")
Jan 23 10:54:05 pc-ici17 dbus-daemon[2821]: [session uid=1001 pid=2821] Successfully activated service 'io.snapcraft.Launcher'
Jan 23 10:54:05 pc-ici17 io.snapcraft.Launcher[2821]: userd.go:98: Starting snap userd
Jan 23 10:54:41 pc-ici17 kernel: [  478.748894] audit: type=1400 audit(1579773281.130:47): apparmor="DENIED" operation="open" profile="snap.keepassxc.keepassxc" name="/sys/bus/usb/devices/" pid=7253 comm=5468726561642028706F6F6C656429 requested_mask="r" denied_mask="r" fsuid=1001 ouid=0
Jan 23 10:54:41 pc-ici17 kernel: [  478.900287] audit: type=1400 audit(1579773281.282:48): apparmor="DENIED" operation="open" profile="snap.keepassxc.keepassxc" name="/sys/bus/usb/devices/" pid=7253 comm=5468726561642028706F6F6C656429 requested_mask="r" denied_mask="r" fsuid=1001 ouid=0
Jan 23 11:38:03 pc-ici17 gnome-software[6422]: tried overwriting io.snapcraft.mockuuups-rnNB01JyovwveX9z2WauV2sG6fzPddmG key GnomeSoftware::FeatureTile-css from border-color: #000000;#012text-shadow: 0 1px 1px rgba(255,255,255,0.5);#012color: #000000;#012outline-offset: 0;#012outline-color: alpha(#ffffff, 0.75);#012outline-style: dashed;#012outline-offset: 2px;#012background: url('/home/kiran/.cache/gnome-software/cssresource/ad233583d7594d0d3ef85e68265b06eb7067ccba-app-512.png') left center / auto 100% no-repeat, #FFFFFF;; to border-color: #000000;#012text-shadow: 0 1px 1px rgba(255,255,255,0.5);#012color: #000000;#012outline-offset: 0;#012outline-color: alpha(#ffffff, 0.75);#012outline-style: dashed;#012outline-offset: 2px;#012background: url('https://dashboard.snapcraft.io/site_media/appmedia/2020/01/app-512.png') left center / auto 100% no-repeat, #FFFFFF;;
Jan 23 11:38:03 pc-ici17 gnome-software[6422]: failed to call gs_plugin_refine_app on snap: Invalid string value converting to GVariant
Jan 23 11:38:03 pc-ici17 gnome-software[6422]: failed to call gs_plugin_refine_app on snap: Invalid string value converting to GVariant
Jan 23 11:55:26 pc-ici17 snapd[1045]: storehelpers.go:436: cannot refresh: snap has no updates available: "gnome-3-28-1804", "spotify"
Jan 23 11:55:26 pc-ici17 snapd[1045]: storehelpers.go:436: cannot refresh snap "odio": snap has no updates available
Jan 23 11:55:27 pc-ici17 snapd[1045]: store.go:1365: Cannot download or apply deltas for core18: invalid credentials
Jan 23 11:55:30 pc-ici17 snapd[1045]: store.go:1365: Cannot download or apply deltas for core: invalid credentials
Jan 23 12:08:50 pc-ici17 snapd[1045]: api.go:952: Installing snap "core" revision unset
Jan 23 12:12:22 pc-ici17 snapd[1045]: main.go:149: Exiting on terminated signal.
Jan 23 12:12:22 pc-ici17 snapd[10088]: AppArmor status: apparmor is enabled and all features are available
Jan 23 12:12:22 pc-ici17 snapd[10088]: daemon.go:346: started snapd/2.42.1+18.04 (series 16; classic) ubuntu/18.04 (amd64) linux/4.15.0-1066-oem.
Jan 23 12:12:22 pc-ici17 snapd[10088]: daemon.go:439: adjusting startup timeout by 1m15s (pessimistic estimate of 30s plus 5s per snap)
Jan 23 12:12:23 pc-ici17 snapd[10088]: storehelpers.go:436: cannot refresh snap "gnome-3-28-1804": snap has no updates available
Jan 23 12:12:23 pc-ici17 snapd[10088]: storehelpers.go:436: cannot refresh: snap has no updates available: "odio", "spotify"
Jan 23 12:12:24 pc-ici17 snapd[10088]: store.go:1365: Cannot download or apply deltas for core: invalid credentials
Jan 23 12:12:24 pc-ici17 snapd[10088]: store.go:1365: Cannot download or apply deltas for core18: invalid credentials
Jan 23 12:12:29 pc-ici17 snapd[10088]: storehelpers.go:436: cannot refresh: snap has no updates available: "gnome-3-28-1804", "spotify"
Jan 23 12:12:29 pc-ici17 snapd[10088]: storehelpers.go:436: cannot refresh snap "odio": snap has no updates available
Jan 23 12:12:30 pc-ici17 snapd[10088]: store.go:1365: Cannot download or apply deltas for core18: invalid credentials
Jan 23 12:12:30 pc-ici17 snapd[10088]: store.go:1365: Cannot download or apply deltas for core: invalid credentials

Hello!

What’s the output of snap whoami?

Hi @chipaca the output is:

email : my_email@gmail.com

can you run snap login again? It looks like your macaroon expired.

Tried to login again, but failed to refresh even after a succesful login

Try this: snap install http, and then http snapd:///v2/users. It should be returning a single user, that matches the output of snap whoami. If not… that’s probably the issue.

Yup, it does not match

HTTP/1.1 401 Unauthorized
Content-Length: 119
Content-Type: application/json
Date: Mon, 03 Feb 2020 15:40:36 GMT

{
“result”: {
“kind”: “login-required”,
“message”: “access denied”
},
“status”: “Unauthorized”,
“status-code”: 401,
“type”: “error”
}

sorry, you need to use sudo for that endpoint.

(also, use “preformatted text” to paste things from the terminal, instead of a blockquote – that is, triple backticks, instead of greater-than)

Now it returns my email:

"result": [
    {
        "email": "my_email@gmail.com",
        "id": 1
    },
    {
        "email": "my_email@gmail.com",
        "id": 2
    }
],
"status": "OK",
"status-code": 200,
"type": "sync"

hmph, that shouldn’t happen. Note it’s there twice.

Easiest way forwards is probably to snap logout – this should remove both of those users, but it might not as there’s clearly a bug

@pedronis, in the context of lp:1860102, this is probably bad news.

Yup, it is not easy. I could remove one entry with snap logout, but not the second one. And now snap whoami doesn’t give out my email

Oh, I see. Many thanks for your help.

In any case the logout should have unstuck the refreshes

Nope. I still have the invalid credentials message

@chipaca so there is no work around for this bug? Maybe somehow “reset” my snapd?

if you don’t have precious data in snaps, you could sudo apt purge snapd and then reinstall, that would certainly work.

Some very careful editing of state.json might be in order otherwise.

reinstallation worked fine. Thank you!