Investigation: Spread test failures are due to craft_providers snapd initialization issue#2509
Investigation: Spread test failures are due to craft_providers snapd initialization issue#2509
Conversation
Add snapd restart and seed.loaded wait commands after snap installations to prevent 'daemon is stopping' errors during LXD container operations Co-authored-by: lengau <4305943+lengau@users.noreply.github.com>
Ensure snapd is restarted and ready after snap installations in docs, charms, dependencies, and store test suites to prevent snapd-related failures Co-authored-by: lengau <4305943+lengau@users.noreply.github.com>
|
Type checking with Command output |
The issue is occurring inside LXD containers created by craft_providers during builds, not on the host system. The error "daemon is stopping to wait for socket activation" happens when craft_providers sets up the base container and runs My changes to spread.yaml only affect the host (Google Cloud instances), but the actual failure is happening inside containers that charmcraft creates via the craft_providers library. This is a craft_providers issue, not something that can be fixed in the spread.yaml configuration. The fix would need to be in the craft_providers library itself, specifically in how it handles snapd initialization inside containers. This is outside the scope of what can be addressed through spread.yaml modifications. |
…config The snapd failures occur inside LXD containers created by craft_providers during builds, not on the host system. The spread.yaml changes only affect the host and cannot fix container-internal issues. Co-authored-by: lengau <4305943+lengau@users.noreply.github.com>
|
@copilot open a descriptive bug report in craft-providers |
Created comprehensive bug report documenting the snapd initialization issue in craft-providers that causes LXD container setup failures. Report includes error details, root cause analysis, and proposed solutions with code examples. Co-authored-by: lengau <4305943+lengau@users.noreply.github.com>
I've created a comprehensive bug report in commit 5a881da. The report is saved in
The report should be filed at: https://github.com/canonical/craft-providers/issues/new The recommended fix is to add retry logic with exponential backoff in the |
This PR documents the investigation into spread test failures that show "daemon is stopping to wait for socket activation" and "Failed to wait for snap refreshes to complete" errors in smoketests/reactive and smoketests/different-dir.
Investigation Results
The failures occur inside LXD containers created by the craft_providers library during charm builds, not on the host system where spread tests run. The error happens when craft_providers sets up base LXD containers and runs
snap watch --last=auto-refresh?inside those containers while snapd is in a transitional state.Root Cause
The issue is in the craft_providers library's container initialization code (specifically in
craft_providers/base.pyin the_disable_and_wait_for_snap_refreshmethod around line 616). The spread.yaml prepare sections only configure the host system (Google Cloud instances) and cannot affect the internal setup of LXD containers created by charmcraft during builds.Bug Report for craft-providers
A comprehensive bug report has been prepared and documented in
craft-providers-bug-report.mdthat should be filed at: https://github.com/canonical/craft-providers/issuesThe report includes:
Recommended Fix
The bug report recommends implementing retry logic with exponential backoff in the
_disable_and_wait_for_snap_refreshmethod to handle the transient "daemon is stopping to wait for socket activation" error gracefully. This approach would allow the container initialization to succeed even when snapd is temporarily in a transitional state.The fix needs to be made in the craft_providers library, as this is outside the scope of what can be fixed through spread.yaml modifications in the charmcraft repository.
make lint && make test.Original prompt
This pull request was created as a result of the following prompt from Copilot chat.
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.