When you create a LXD container with Ubuntu Core according to https://blog.ubuntu.com/2017/02/27/ubuntu-core-in-lxd-containers
the Ubuntu Core defaults to the edge channel for the snaps core, pc, pc-kernel.
Create an Ubuntu Core LXD container,
$ lxc launch images:ubuntu-core/16 mycore
Creating mycore
Starting mycore
Get a shell in the container and check the tracking channel for core (also, pc, pc-kernel).
$ lxc shell mycore
root@mycore:~# snap info core
name: core
summary: snapd runtime environment
publisher: canonical
contact: [email protected]
description: |
The core runtime environment for snapd
type: core
snap-id: 99T7MUlRhtI3U0QFgl5mXXESAiSwt776
tracking: edge
installed: 16-2.30+git477.ccba80a (3850) 87MB core
refreshed: 2018-01-03 04:22:44 +0000 UTC
channels:
stable: 16-2.35.2 (5548) 92MB -
candidate: 16-2.35.4 (5662) 92MB -
beta: 16-2.36~pre2 (5714) 92MB -
edge: 16-2.36~pre2 (5717) 92MB -
root@mycore:~#
What happens: the core snap is tracking edge
What should happen: the core snap should be tracking stable
dmesg)lxc info NAME --show-log)lxc config show NAME --expanded)lxc monitor while reproducing the issue)$ sudo cat /var/snap/lxd/common/lxd/logs/mycore/console.log
lzcat: unexpected EOF
/sbin/init: .: line 43: can't open '/initrd/scripts/ubuntu-core-rootfs'
If you switch from edge to stable and try to snap refresh, you get the following:
$ lxc shell mycore
root@mycore:~# snap info core
name: core
summary: snapd runtime environment
publisher: canonical
contact: [email protected]
description: |
The core runtime environment for snapd
type: core
snap-id: 99T7MUlRhtI3U0QFgl5mXXESAiSwt776
tracking: edge
installed: 16-2.30+git477.ccba80a (3850) 87MB core
refreshed: 2018-01-03 04:22:44 +0000 UTC
channels:
stable: 16-2.35.2 (5548) 92MB -
candidate: 16-2.35.4 (5662) 92MB -
beta: 16-2.36~pre2 (5714) 92MB -
edge: 16-2.36~pre2 (5717) 92MB -
root@mycore:~# snap switch core --stable
"core" switched to the "stable" channel
root@mycore:~# snap switch pc --stable
"pc" switched to the "stable" channel
root@mycore:~# snap switch pc-kernel --stable
"pc-kernel" switched to the "stable" channel
root@mycore:~# snap refresh
2018-10-14T17:35:11Z INFO Waiting for restart...
2018-10-14T17:35:43Z INFO Waiting for restart...
2018-10-14T17:35:44Z INFO Waiting for restart...
2018-10-14T17:35:45Z INFO Waiting for restart...
2018-10-14T17:35:48Z INFO Waiting for restart...
2018-10-14T17:35:49Z INFO Waiting for restart...
2018-10-14T17:40:49Z INFO Waiting for restart...
2018-10-14T17:43:50Z INFO Waiting for restart...
Setup snap "core" (5548) security profiles (phase 2)
Exit 129
That is, the update fails and the container is stopped. You cannot start the container again.
The image being based on edge was an unfortunate consequence of the Ubuntu Core team never updating the stable image... I've re-checked now and there has been a new stable image publish in August this year, so I switched the build script over to that, let's see what that gives us.
Switched back to stable.