core refresh in container build breaks build
Metadata
Current evaluation
Fixed by merged PR canonical/snapcraft#2098 (commit 7666a74a7), which waits for active snap refreshes before injecting build snaps into reusable LXD containers.
Resolution: closed resolved
Reason: PR #2098 was merged and explicitly fixed LP bug #1722049. It added a snap watch wait before injecting core and snapcraft snaps, preventing installation while a core refresh is still in progress.
Evaluated by: mr-cal-bot
No scores available.
Issue body
I'm using "export SNAPCRAFT_CONTAINER_BUILDS=1" to build in a re-usable lxc container. I had a build fail for some reason, and needed to fix my yaml and re-run snapcraft. However on multiple occasions I have had this happen:-
"Installing /run/core_3070.snap
error: cannot install snap file: snap "core" has changes in progress"
At this point snapcraft crashes out and dumps a traceback.
alan@deep-thought:~$ lxc list
+-----------------+---------+------+------+------------+-----------+
| NAME | STATE | IPV4 | IPV6 | TYPE | SNAPSHOTS |
+-----------------+---------+------+------+------------+-----------+
| snapcraft-xxxxx | STOPPED | | | PERSISTENT | 0 |
+-----------------+---------+------+------+------------+-----------+
alan@deep-thought:~$ lxc start snapcraft-xxxxx
alan@deep-thought:~$ lxc shell snapcraft-xxxxx
run-parts: /etc/update-motd.d/98-fsck-at-reboot exited with return code 1
The programs included with the Ubuntu system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by
applicable law.
mesg: ttyname failed: Success
root@snapcraft-godot:~# snap changes
ID Status Spawn Ready Summary
1 Done 2017-10-08T10:49:14Z 2017-10-08T10:49:14Z Initialize system state
2 Done 2017-10-08T10:49:26Z 2017-10-08T10:49:33Z Install "core" snap from file "/run/core_3070.snap"
3 Done 2017-10-08T10:49:31Z 2017-10-08T10:49:33Z Initialize device
4 Done 2017-10-08T10:49:38Z 2017-10-08T10:49:38Z Install "snapcraft" snap from file "/run/snapcraft_601.snap"
5 Doing 2017-10-08T11:44:01Z - Auto-refresh snap "core"
Time passes............
root@snapcraft-godot:~# snap changes
ID Status Spawn Ready Summary
1 Done 2017-10-08T10:49:14Z 2017-10-08T10:49:14Z Initialize system state
2 Done 2017-10-08T10:49:26Z 2017-10-08T10:49:33Z Install "core" snap from file "/run/core_3070.snap"
3 Done 2017-10-08T10:49:31Z 2017-10-08T10:49:33Z Initialize device
4 Done 2017-10-08T10:49:38Z 2017-10-08T10:49:38Z Install "snapcraft" snap from file "/run/snapcraft_601.snap"
5 Done 2017-10-08T11:44:01Z 2017-10-08T11:46:29Z Auto-refresh snap "core"
I resolved this by starting the container, and waiting for the core change to finish.
lxc list
lxc start snapcraft-appname
lxc shell snapcraft-appname
Then inside the container:-
snap changes
I noted core was "Doing" changes.
I waited until it had finished.
Perhaps snapcraft needs to check the status of core update before trying to install it in the lxc container? (I expect this to still be potential failure if snapd tries to refresh underneath you? Perhaps you need to turn off auto refresh in the lxc container?
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| stealth/space-bunny-alpha | — | closed resolved | Fixed by merged PR canonical/snapcraft#2098 (commit 7666a74a7), which waits for active snap refreshes before injecting build snaps into reusable LXD containers. | |
| stealth/space-bunny-alpha | — | closed resolved | Fixed by merged PR canonical/snapcraft#2098 (commit 7666a74a7), which waits for active snap refreshes before injecting build snaps into reusable LXD containers. | |
| stealth/space-bunny-alpha | — | closed resolved | Fixed concurrent core-refresh failures in LXC container builds by waiting for ongoing refreshes before injecting snaps. PR #2098 merged as commit 7666a74a7. | |
| qwen/qwen3.6-35b-a3b | — | — | Closed without resolution. Container builds failed when snapd auto-refreshed core concurrently. The author worked around it by waiting for the refresh to finish and suggested disabling auto-refresh or checking status before installation. | |
| qwen/qwen3.6-35b-a3b | — | — | Closed without a code fix. The reporter worked around the concurrent core snap refresh conflict by manually waiting for the change to complete or disabling auto-refresh in the container. | |
| qwen/qwen3.6-35b-a3b | — | — | Closed without a fix. Concurrent core snap auto-refresh in persistent LXC containers caused build failures. The issue was likely abandoned or superseded by updated container build handling. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Closed without a formal fix. The author resolved the container build failure by manually waiting for the core snap auto-refresh to complete. Suggested snapcraft should disable auto-refresh or verify update status before installation. |
Update history
| Date | Change |
|---|---|
| created |
Related work
-
Likely Fixed By:
canonical/snapcraft#2098
(confidence 100%)
Merged fix that waits for ongoing LXD container snap refreshes to finish.
-
Duplicate Of:
canonical/snapcraft#2037
(confidence 96%)
The same failure was tracked on GitHub and closed by PR #2098.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #2037 core refresh in container build breaks build | snapcraft | closed | Fixed concurrent core-refresh failures in container builds by waiting for in-progress refreshes; merged via snapcraft#2098 (commit 7666a74a7). | |
| #1739 lxd: refresh remote container | snapcraft | merged | Merged #1739 as 2f9265f23, fixing snapcraft refresh to honor the LXD remote named by SNAPCRAFT_CONTAINER_BUILDS instead of using a local container. | |
| #1412 lxd: snapcraft refresh in containers | snapcraft | merged | Merged PR #1412 as 3d511c5eb, making LXD container refresh install Snapcraft once while allowing packages and snaps to be updated in reusable containers. | |
| #2098 lxd: wait for on-going refreshes to finish | snapcraft | merged | PR #2098 by kalikiana merged (commit 7666a74a7), adding a `snap watch` call before injecting core/snapcraft snaps into LXD containers so in-progress refreshes finish. Fixes #2037 and LP bug #1722049. | |
| #1780997 Persistent container builds are broken | snapcraft (launchpad) | closed | Persistent LXD builds were fixed by canonical/snapcraft#1847 (commit e7d73a365), correcting user handling for remote SSHFS-mounted containers. | |
| #1716923 Installing core snap in container often fails | snapcraft (launchpad) | closed | Fixed by merged PR #1568 (commit 1bd531772), which stopped LXD container builds from re-injecting identical snaps. | |
| #1364 lxd: Inject snapcraft and core snaps into the container | snapcraft | merged | Merged PR #1364 as 99f5598ac, injecting the host's Snapcraft and core snaps into LXD containers so builds no longer use a mismatched Xenial archive version. | |
| #1666735 snapcraft cleanbuild does not work with lxd installed via snap | snapcraft (launchpad) | closed | Fixed by merged canonical/snapcraft#1199 (commit 417989880), making cleanbuild LXD detection packaging-independent instead of relying on apt package metadata. | |
| #1546 cli: update parts cache in the container | snapcraft | merged | Merged as 0dde02398: snapcraft update now refreshes the parts cache in the LXD container as well as the host. Complementary container refresh work landed in #1412. | |
| #1624075 cleanbuild - Don't try to stop a non-existent container | snapcraft (launchpad) | closed | Fixed by merged PR canonical/snapcraft#1403, adding an LXD existence check so cleanbuild no longer tries to stop or remove a container that was never created. |