Can't install or refresh snaps on Arch Linux


#10

Can you post the output of snap changes?


#11

It’s still:
error: no changes found


#12

Are there any files under /var/lib/snapd?

Can you add SNAPD_DEBUG=1 to /etc/default/snapd, then restart the daemon and post the logs?


#13

Yes, there are files.

➜  ~ ll /var/lib/snapd/
drwxr-xr-x 4 root root 4,0K 25. Nov 22:55 apparmor/
drwxr-xr-x 4 root root 4,0K 27. Aug 23:02 assertions/
drwx------ 2 root root 4,0K 28. Aug 21:39 cache/
drwx------ 2 root root 4,0K  8. Nov 20:40 cookie/
drwxr-xr-x 3 root root 4,0K 27. Aug 22:56 desktop/
drwxr-xr-x 3 root root 4,0K 27. Aug 23:02 device/
drwxr-xr-x 2 root root 4,0K 27. Aug 22:53 hostfs/
drwxr-xr-x 6 root root 4,0K 27. Aug 22:56 lib/
drwxr-xr-x 2 root root 4,0K  8. Nov 20:40 mount/
drwxr-xr-x 3 root root 4,0K 27. Aug 22:56 seccomp/
drwxr-xr-x 2 root root 4,0K 28. Aug 21:39 sequence/
drwxr-xr-x 6 root root 4,0K  8. Nov 20:40 snap/
drwxr-xr-x 2 root root 4,0K  8. Nov 20:40 snaps/
-rw------- 1 root root 3,6K 25. Nov 22:44 state.json
-rw-r--r-- 1 root root  385  2. Dez 13:07 system-key
d--------- 2 root root 4,0K 27. Aug 22:53 void/

Which log file do you want me to post?


#14

Well, you seem to have a bunch of files and a non-empty state data. Let’s see if we can figure out what’s wrong. Can you run this:

sudo cat /var/lib/snapd/state.json | \
     jq '.data.auth.device["brand","model"],.data.seeded,.data["seed-time"]'

Then:

snap known model model=generic-classic

And:

cat /var/lib/snapd/assertions/asserts-v0/model/16/generic/generic-classic/active

#15
➜  ~ sudo cat /var/lib/snapd/state.json | \
      jq '.data.auth.device["brand","model"],.data.seeded,.data["seed-time"]'
"generic"
"generic-classic"
true
"2018-08-23T22:21:24.454919144+02:00"

➜  ~ snap known model model=generic-classic

The file /var/lib/snapd/assertions/asserts-v0/model/16/generic/generic-classic/active does not exist.

 ➜  ~ ll /var/lib/snapd/assertions/asserts-v0/
drwxr-xr-x 4 root root 4,0K 28. Aug 20:49 account/
drwxr-xr-x 3 root root 4,0K 28. Aug 20:36 account-key/
drwxr-xr-x 3 root root 4,0K 28. Aug 20:36 snap-declaration/
drwxr-xr-x 6 root root 4,0K 28. Aug 21:39 snap-revision/

#16

This is something for @pedronis to look at next week once he is back.


#17

One more thing to try:

sudo cat /var/lib/snapd/state.json | jq '.data.auth.device.serial'

#18
➜  ~ sudo cat /var/lib/snapd/state.json | jq '.data.auth.device.serial'
"9f73ba7e-d243-461a-af04-d192ca16a1ed"

#19

This is strange, a device with a set model in the state, but the model assertion is not there…


#20

@mborzecki what could delete the model assertion? there is no code in snapd itself afaik that would delete it, unless I’m missing something, is there something that could in the snapd packaging for arch?


#21

Perhaps that’s a case of buggy package purge in older version of the package. I think there was such a bug at some point, snap-mgmt --purge would remove stuff under /var/lib/snapd/ but state.json was left behind. That was a bunch of releases back though.

Would manually clearing device-serial in state.json unblock it?


#22

@mborzecki I think the easiest workaround would be:

snap ack “the generic model assertion”


#23

@_tim Can you try that?


#24

Yes, I’d like to, but I don’t know what “the generic model assertion” is…


#25

Try:

$ snap known --remote model model=generic-classic series=16 brand-id=generic > assertion
$ sudo snap ack assertion

#26

Ok, did that.
Now I get:

➜  ~ sudo snap refresh 
error: cannot perform the following tasks:
- Download snap "core" (5897) from channel "stable" (no device serial yet)

#27

Seems like there is no easy way out. Please see the output of snap changes to snap changes to check if Initialize device change appears.

If it does not then, try this:

$ systemctl stop snapd
$ sudo cat /var/lib/snapd/state.json | \
    jq 'delpaths([["data", "auth", "device"]])' > state.json-new
$ sudo cp state.json-new /var/lib/snapd/state.json
$ sudo systemctl start snapd

After a while you should see this:

$ snap changes
ID   Status  Spawn               Ready               Summary
19   Done    today at 18:29 CET  today at 18:29 CET  Initialize device

#28

That solved the problem for me! Thanks a lot!


#29

I see this for RPi ubuntu-core core18

{
“type”: “model”,
“authority-id”: “xxx”,
“brand-id”: “xxx”,
“series”: “16”,
“model”: “my-pi3”,
“architecture”: “armhf”,
“base”: “core18”,
“gadget”: “pi=18-pi3”,
“kernel”: “pi-kernel=18-pi3”,
“timestamp”: “2019-01-19T00:32:25+00:00”
}