Snap doesn't work in Ubuntu 20.04

Hello, I accidentally removed snapd when removing appArmor. When snapd was installed again, I can install nothing via snap:

$ sudo snap install snap-store
snap "snap-store" is already installed, see 'snap help refresh'

$ sudo snap list
error: cannot list local snaps! cannot find publisher details: snap-declaration (PMrrV4ml8uWuEUDBT8dSGnKUYbevVhc4; series:16) not found

$ sudo snap refresh snap-store
error: too early for operation, device not yet seeded or device model not acknowledged

Ubuntu 20.04

What is the output of snap changes and snap version on your device?

for reference this is the snapd snap.

The output:
$ sudo snap changes
error: no changes found

$ snap version
snap    2.44.3+20.04
snapd   2.44.3+20.04
series  16
ubuntu  20.04
kernel  5.4.0-37-generic

The problem was solved - I just removed snapd with --purge option:
$ sudo apt remove --purge snapd
and after that installed snapd again.

what is the log output from snapd?

journalctl -e --no-pager -u snapd

there were a lot of errors:

июн 22 22:41:12 e15 snapd[6948]: hotplug.go:131: internal error: cannot get global device context: too early for operation, device model not yet acknowledged
июн 22 22:41:12 e15 snapd[6948]: snapmgr.go:296: cannot read snap info of snap "core" at revision 9289: cannot find installed snap "core" at revision 9289: missing file /snap/core/9289/meta/snap.yaml

But as I wrote above, now it works fine, thanks

Well I’m glad it’s working but it would still be helpful to us and any potential future users that run into this problem if you could post the full log so we can debug what the cause of the problem might have been for you.

1 Like

I’ve been facing the same error when deploying Snaps on 20.04 on AWS.

I’ve been deploying as follows:

Deploy Focal Instance to AWS --> Update Apt Packages --> Install Docker Snap

And face the exact same device not yet seeded error message as the OP.

Deployment is being done with Terraform/Ansible so I’m trying to install Snaps within minutes of the system coming up for the first time.

Reproducing the state of a system like this is difficult since it’s quite time-sensitive but when I added in an extra reboot step the problem disappeared:

Deploy Focal Instance to AWS --> Update Apt Packages --> Reboot --> Install Docker Snap

After this I haven’t seen the problem again.

Can you provide snap list output from one of these machines? Perhaps there is a snap in the seed on the 20.04 images on AWS that is slowing down how long it takes to seed. Also your problem seems to be different, if I understand you correctly, eventually if you waited long enough the problem goes away and you can use/install snaps, but the OP had the issue that they were never able to use/install snaps no matter how long they waited

I will try to get you a clean snap list and snap changes tomorrow on a freshly-deployed image, but it’s worth noting that I only installed the docker snap here manually:

Name              Version    Rev    Tracking         Publisher   Notes
amazon-ssm-agent  2.3.978.0  2012   latest/stable/…  aws✓        classic
core              16-2.45.1  9436   latest/stable    canonical✓  core
core18            20200427   1754   latest/stable    canonical✓  base
docker            19.03.11   471    latest/stable    canonical✓  -
lxd               4.2        15753  latest/stable/…  canonical✓  -

And yes, looking a bit closer, you are right and my issue might be a bit different to OP’s and sounds more like the one @popey was facing in this thread. If I wait a while (or add a reboot before the snap install stage) I am able to install Snaps.

perhaps this discussion is better served on the other thread, but after you have the system booted, you should almost always do snap wait system seed.loaded before any snap command. This will ensure that the system is done setting up any seeded snaps. After that wait command is done, the output of this snippet would be helpful:

for chg in $(snap changes | awk '{print $1}' | grep -Po '[0-9]+'); do
    echo ">>> $chg <<<"
    snap debug timings $chg
done